From wb at freebie.xs4all.nl Sat Nov 1 00:12:01 2008 From: wb at freebie.xs4all.nl (Wilko Bulte) Date: Sat Nov 1 00:12:13 2008 Subject: svn commit: r184515 - in head/sys: conf modules/rl pci In-Reply-To: <490B9486.60204@FreeBSD.org> References: <200810312324.m9VNOE88093395@svn.freebsd.org> <490B9486.60204@FreeBSD.org> Message-ID: <20081101065350.GA1270@freebie.xs4all.nl> Quoting Bruce M. Simpson, who wrote on Fri, Oct 31, 2008 at 11:28:06PM +0000 .. > This stuff is absolutely crazy, but I'm glad you checked it in. /* you are not expected to understand this */ From ed at FreeBSD.org Sat Nov 1 01:07:03 2008 From: ed at FreeBSD.org (Ed Schouten) Date: Sat Nov 1 01:07:13 2008 Subject: svn commit: r184520 - head/sys/dev/adb Message-ID: <200811010807.mA18725C002941@svn.freebsd.org> Author: ed Date: Sat Nov 1 08:07:02 2008 New Revision: 184520 URL: http://svn.freebsd.org/changeset/base/184520 Log: Allow a read() on /dev/ams[0-9] to be interrupted. Right now ams_read() uses cv_wait() to wait for new data to arrive on the mouse device. This means that when you run `cat /dev/ams0', it cannot be interrupted directly. After you press ^C, you first need to move the mouse before cat will quit. Make this function use cv_wait_sig(), which allows it to be interrupted directly. Reviewed by: nwhitehorn Modified: head/sys/dev/adb/adb_mouse.c Modified: head/sys/dev/adb/adb_mouse.c ============================================================================== --- head/sys/dev/adb/adb_mouse.c Sat Nov 1 06:57:59 2008 (r184519) +++ head/sys/dev/adb/adb_mouse.c Sat Nov 1 08:07:02 2008 (r184520) @@ -382,6 +382,7 @@ ams_read(struct cdev *dev, struct uio *u struct adb_mouse_softc *sc; size_t len; int8_t outpacket[8]; + int error; sc = CDEV_GET_SOFTC(dev); if (sc == NULL) @@ -403,7 +404,11 @@ ams_read(struct cdev *dev, struct uio *u /* Otherwise, block on new data */ - cv_wait(&sc->sc_cv,&sc->sc_mtx); + error = cv_wait_sig(&sc->sc_cv, &sc->sc_mtx); + if (error) { + mtx_unlock(&sc->sc_mtx); + return (error); + } } sc->packet[0] = 1 << 7; From ed at FreeBSD.org Sat Nov 1 01:35:29 2008 From: ed at FreeBSD.org (Ed Schouten) Date: Sat Nov 1 01:35:41 2008 Subject: svn commit: r184521 - in head/sys: conf kern sys Message-ID: <200811010835.mA18ZSrZ003531@svn.freebsd.org> Author: ed Date: Sat Nov 1 08:35:28 2008 New Revision: 184521 URL: http://svn.freebsd.org/changeset/base/184521 Log: Reimplement the /dev/console device node. One of the pieces of code that I had left alone during the development of the MPSAFE TTY layer, was tty_cons.c. This file actually has two different functions: - It contains low-level console input/output routines (cnputc(), etc). - It creates /dev/console and wraps all its cdevsw calls to the appropriate TTY. This commit reimplements the second set of functions by moving it directly into the TTY layer. /dev/console is now a character device node that's basically a regular TTY, but does a lookup of `si_drv1' each time you open it. d_write has also been changed to call log_console(). d_close() is not present, because we must make sure we don't revoke the TTY after writing a log message to it. Even though I'm not convinced this is in line with the future directions of our console code, it is a good move for now. It removes recursive locking from the top half of the TTY layer. The previous implementation called into the TTY layer with Giant held. I'm renaming tty_cons.c to kern_cons.c now. The code hardly contains any TTY related bits, so we'd better give it a less misleading name. Tested by: Andrzej Tobola , Carlos A.M. dos Santos , Eygene Ryabinkin Added: head/sys/kern/kern_cons.c (contents, props changed) - copied, changed from r184520, head/sys/kern/tty_cons.c Deleted: head/sys/kern/tty_cons.c Modified: head/sys/conf/files head/sys/kern/tty.c head/sys/sys/tty.h Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Sat Nov 1 08:07:02 2008 (r184520) +++ head/sys/conf/files Sat Nov 1 08:35:28 2008 (r184521) @@ -1596,6 +1596,7 @@ kern/kern_alq.c optional alq kern/kern_clock.c standard kern/kern_condvar.c standard kern/kern_conf.c standard +kern/kern_cons.c standard kern/kern_cpu.c standard kern/kern_cpuset.c standard kern/kern_context.c standard @@ -1708,7 +1709,6 @@ kern/sysv_sem.c optional sysvsem kern/sysv_shm.c optional sysvshm kern/tty.c standard kern/tty_compat.c optional compat_43tty -kern/tty_cons.c standard kern/tty_info.c standard kern/tty_inq.c standard kern/tty_outq.c standard Copied and modified: head/sys/kern/kern_cons.c (from r184520, head/sys/kern/tty_cons.c) ============================================================================== --- head/sys/kern/tty_cons.c Sat Nov 1 08:07:02 2008 (r184520, copy source) +++ head/sys/kern/kern_cons.c Sat Nov 1 08:35:28 2008 (r184521) @@ -68,30 +68,8 @@ __FBSDID("$FreeBSD$"); static MALLOC_DEFINE(M_TTYCONS, "tty console", "tty console handling"); -static d_open_t cnopen; -static d_close_t cnclose; -static d_read_t cnread; -static d_write_t cnwrite; -static d_ioctl_t cnioctl; -static d_poll_t cnpoll; -static d_kqfilter_t cnkqfilter; - -static struct cdevsw cn_cdevsw = { - .d_version = D_VERSION, - .d_open = cnopen, - .d_close = cnclose, - .d_read = cnread, - .d_write = cnwrite, - .d_ioctl = cnioctl, - .d_poll = cnpoll, - .d_name = "console", - .d_flags = D_TTY | D_NEEDGIANT, - .d_kqfilter = cnkqfilter, -}; - struct cn_device { STAILQ_ENTRY(cn_device) cnd_next; - struct vnode *cnd_vp; struct consdev *cnd_cn; }; @@ -101,22 +79,12 @@ static struct cn_device cn_devtab[CNDEVT static STAILQ_HEAD(, cn_device) cn_devlist = STAILQ_HEAD_INITIALIZER(cn_devlist); -#define CND_INVALID(cnd, td) \ - (cnd == NULL || cnd->cnd_vp == NULL || \ - (cnd->cnd_vp->v_type == VBAD && !cn_devopen(cnd, td, 1))) - -static dev_t cn_udev_t; -SYSCTL_OPAQUE(_machdep, OID_AUTO, consdev, CTLFLAG_RD, - &cn_udev_t, sizeof cn_udev_t, "T,struct cdev *", ""); - int cons_avail_mask = 0; /* Bit mask. Each registered low level console * which is currently unavailable for inpit * (i.e., if it is in graphics mode) will have * this bit cleared. */ static int cn_mute; -static int openflag; /* how /dev/console was opened */ -static int cn_is_open; static char *consbuf; /* buffer used by `consmsgbuf' */ static struct callout conscallout; /* callout for outputting to constty */ struct msgbuf consmsgbuf; /* message buffer for console tty */ @@ -214,6 +182,8 @@ cnadd(struct consdev *cn) printf("WARNING: console at %p has no name\n", cn); } STAILQ_INSERT_TAIL(&cn_devlist, cnd, cnd_next); + if (STAILQ_FIRST(&cn_devlist) == cnd) + ttyconsdev_select(cnd->cnd_cn->cn_name); /* Add device to the active mask. */ cnavailable(cn, (cn->cn_flags & CN_FLAG_NOAVAIL) == 0); @@ -230,10 +200,9 @@ cnremove(struct consdev *cn) STAILQ_FOREACH(cnd, &cn_devlist, cnd_next) { if (cnd->cnd_cn != cn) continue; + if (STAILQ_FIRST(&cn_devlist) == cnd) + ttyconsdev_select(NULL); STAILQ_REMOVE(&cn_devlist, cnd, cn_device, cnd_next); - if (cnd->cnd_vp != NULL) - vn_close(cnd->cnd_vp, openflag, NOCRED, NULL); - cnd->cnd_vp = NULL; cnd->cnd_cn = NULL; /* Remove this device from available mask. */ @@ -267,6 +236,7 @@ cnselect(struct consdev *cn) return; STAILQ_REMOVE(&cn_devlist, cnd, cn_device, cnd_next); STAILQ_INSERT_HEAD(&cn_devlist, cnd, cnd_next); + ttyconsdev_select(cnd->cnd_cn->cn_name); return; } } @@ -368,210 +338,12 @@ sysctl_kern_consmute(SYSCTL_HANDLER_ARGS error = sysctl_handle_int(oidp, &cn_mute, 0, req); if (error != 0 || req->newptr == NULL) return (error); - if (ocn_mute && !cn_mute && cn_is_open) - error = cnopen(NULL, openflag, 0, curthread); - else if (!ocn_mute && cn_mute && cn_is_open) { - error = cnclose(NULL, openflag, 0, curthread); - cn_is_open = 1; /* XXX hack */ - } return (error); } SYSCTL_PROC(_kern, OID_AUTO, consmute, CTLTYPE_INT|CTLFLAG_RW, 0, sizeof(cn_mute), sysctl_kern_consmute, "I", ""); -static int -cn_devopen(struct cn_device *cnd, struct thread *td, int forceopen) -{ - char path[CNDEVPATHMAX]; - struct nameidata nd; - struct vnode *vp; - struct cdev *dev; - struct cdevsw *csw; - int error; - - if ((vp = cnd->cnd_vp) != NULL) { - if (!forceopen && vp->v_type != VBAD) { - dev = vp->v_rdev; - csw = dev_refthread(dev); - if (csw == NULL) - return (ENXIO); - error = (*csw->d_open)(dev, openflag, 0, td); - dev_relthread(dev); - return (error); - } - cnd->cnd_vp = NULL; - vn_close(vp, openflag, td->td_ucred, td); - } - snprintf(path, sizeof(path), "/dev/%s", cnd->cnd_cn->cn_name); - NDINIT(&nd, LOOKUP, FOLLOW, UIO_SYSSPACE, path, td); - error = vn_open(&nd, &openflag, 0, NULL); - if (error == 0) { - NDFREE(&nd, NDF_ONLY_PNBUF); - VOP_UNLOCK(nd.ni_vp, 0); - if (nd.ni_vp->v_type == VCHR) - cnd->cnd_vp = nd.ni_vp; - else - vn_close(nd.ni_vp, openflag, td->td_ucred, td); - } - return (cnd->cnd_vp != NULL); -} - -static int -cnopen(struct cdev *dev, int flag, int mode, struct thread *td) -{ - struct cn_device *cnd; - - openflag = flag | FWRITE; /* XXX */ - cn_is_open = 1; /* console is logically open */ - if (cn_mute) - return (0); - STAILQ_FOREACH(cnd, &cn_devlist, cnd_next) - cn_devopen(cnd, td, 0); - return (0); -} - -static int -cnclose(struct cdev *dev, int flag, int mode, struct thread *td) -{ - struct cn_device *cnd; - struct vnode *vp; - - STAILQ_FOREACH(cnd, &cn_devlist, cnd_next) { - if ((vp = cnd->cnd_vp) == NULL) - continue; - cnd->cnd_vp = NULL; - vn_close(vp, openflag, td->td_ucred, td); - } - cn_is_open = 0; - return (0); -} - -static int -cnread(struct cdev *dev, struct uio *uio, int flag) -{ - struct cn_device *cnd; - struct cdevsw *csw; - int error; - - cnd = STAILQ_FIRST(&cn_devlist); - if (cn_mute || CND_INVALID(cnd, curthread)) - return (0); - dev = cnd->cnd_vp->v_rdev; - csw = dev_refthread(dev); - if (csw == NULL) - return (ENXIO); - error = (csw->d_read)(dev, uio, flag); - dev_relthread(dev); - return (error); -} - -static int -cnwrite(struct cdev *dev, struct uio *uio, int flag) -{ - struct cn_device *cnd; - struct cdevsw *csw; - int error; - - cnd = STAILQ_FIRST(&cn_devlist); - if (cn_mute || CND_INVALID(cnd, curthread)) - goto done; - if (constty) - dev = constty->t_dev; - else - dev = cnd->cnd_vp->v_rdev; - if (dev != NULL) { - log_console(uio); - csw = dev_refthread(dev); - if (csw == NULL) - return (ENXIO); - error = (csw->d_write)(dev, uio, flag); - dev_relthread(dev); - return (error); - } -done: - uio->uio_resid = 0; /* dump the data */ - return (0); -} - -static int -cnioctl(struct cdev *dev, u_long cmd, caddr_t data, int flag, struct thread *td) -{ - struct cn_device *cnd; - struct cdevsw *csw; - int error; - - cnd = STAILQ_FIRST(&cn_devlist); - if (cn_mute || CND_INVALID(cnd, td)) - return (0); - /* - * Superuser can always use this to wrest control of console - * output from the "virtual" console. - */ - if (cmd == TIOCCONS && constty) { - error = priv_check(td, PRIV_TTY_CONSOLE); - if (error) - return (error); - constty = NULL; - return (0); - } - dev = cnd->cnd_vp->v_rdev; - if (dev == NULL) - return (0); /* XXX : ENOTTY ? */ - csw = dev_refthread(dev); - if (csw == NULL) - return (ENXIO); - error = (csw->d_ioctl)(dev, cmd, data, flag, td); - dev_relthread(dev); - return (error); -} - -/* - * XXX - * poll/kqfilter do not appear to be correct - */ -static int -cnpoll(struct cdev *dev, int events, struct thread *td) -{ - struct cn_device *cnd; - struct cdevsw *csw; - int error; - - cnd = STAILQ_FIRST(&cn_devlist); - if (cn_mute || CND_INVALID(cnd, td)) - return (0); - dev = cnd->cnd_vp->v_rdev; - if (dev == NULL) - return (0); - csw = dev_refthread(dev); - if (csw == NULL) - return (ENXIO); - error = (csw->d_poll)(dev, events, td); - dev_relthread(dev); - return (error); -} - -static int -cnkqfilter(struct cdev *dev, struct knote *kn) -{ - struct cn_device *cnd; - struct cdevsw *csw; - int error; - - cnd = STAILQ_FIRST(&cn_devlist); - if (cn_mute || CND_INVALID(cnd, curthread)) - return (EINVAL); - dev = cnd->cnd_vp->v_rdev; - if (dev == NULL) - return (ENXIO); - csw = dev_refthread(dev); - if (csw == NULL) - return (ENXIO); - error = (csw->d_kqfilter)(dev, kn); - dev_relthread(dev); - return (error); -} - /* * Low level console routines. */ @@ -737,8 +509,6 @@ static void cn_drvinit(void *unused) { - make_dev(&cn_cdevsw, 0, UID_ROOT, GID_WHEEL, 0600, "console"); - mtx_init(&cnputs_mtx, "cnputs_mtx", NULL, MTX_SPIN | MTX_NOWITNESS); use_cnputs_mtx = 1; } Modified: head/sys/kern/tty.c ============================================================================== --- head/sys/kern/tty.c Sat Nov 1 08:07:02 2008 (r184520) +++ head/sys/kern/tty.c Sat Nov 1 08:35:28 2008 (r184521) @@ -73,6 +73,10 @@ static struct sx tty_list_sx; SX_SYSINIT(tty_list, &tty_list_sx, "tty list"); static unsigned int tty_list_count = 0; +/* Character device of /dev/console. */ +static struct cdev *dev_console; +static const char *dev_console_filename; + /* * Flags that are supported and stored by this implementation. */ @@ -86,7 +90,7 @@ static unsigned int tty_list_count = 0; HUPCL|CLOCAL|CCTS_OFLOW|CRTS_IFLOW|CDTR_IFLOW|\ CDSR_OFLOW|CCAR_OFLOW) -#define TTY_CALLOUT(tp,d) ((tp)->t_dev != (d)) +#define TTY_CALLOUT(tp,d) ((d) != (tp)->t_dev && (d) != dev_console) /* * Set TTY buffer sizes. @@ -1189,11 +1193,7 @@ tty_wait(struct tty *tp, struct cv *cv) int error; int revokecnt = tp->t_revokecnt; -#if 0 - /* XXX: /dev/console also picks up Giant. */ tty_lock_assert(tp, MA_OWNED|MA_NOTRECURSED); -#endif - tty_lock_assert(tp, MA_OWNED); MPASS(!tty_gone(tp)); error = cv_wait_sig(cv, tp->t_mtx); @@ -1215,11 +1215,7 @@ tty_timedwait(struct tty *tp, struct cv int error; int revokecnt = tp->t_revokecnt; -#if 0 - /* XXX: /dev/console also picks up Giant. */ tty_lock_assert(tp, MA_OWNED|MA_NOTRECURSED); -#endif - tty_lock_assert(tp, MA_OWNED); MPASS(!tty_gone(tp)); error = cv_timedwait_sig(cv, tp->t_mtx, hz); @@ -1662,6 +1658,10 @@ tty_hiwat_in_unblock(struct tty *tp) ttydevsw_inwakeup(tp); } +/* + * TTY hooks interface. + */ + static int ttyhook_defrint(struct tty *tp, char c, int flags) { @@ -1745,6 +1745,84 @@ ttyhook_unregister(struct tty *tp) tty_rel_free(tp); } +/* + * /dev/console handling. + */ + +static int +ttyconsdev_open(struct cdev *dev, int oflags, int devtype, struct thread *td) +{ + struct tty *tp; + + /* System has no console device. */ + if (dev_console_filename == NULL) + return (ENXIO); + + /* Look up corresponding TTY by device name. */ + sx_slock(&tty_list_sx); + TAILQ_FOREACH(tp, &tty_list, t_list) { + if (strcmp(dev_console_filename, tty_devname(tp)) == 0) { + dev_console->si_drv1 = tp; + break; + } + } + sx_sunlock(&tty_list_sx); + + /* System console has no TTY associated. */ + if (dev_console->si_drv1 == NULL) + return (ENXIO); + + return (ttydev_open(dev, oflags, devtype, td)); +} + +static int +ttyconsdev_write(struct cdev *dev, struct uio *uio, int ioflag) +{ + + log_console(uio); + + return (ttydev_write(dev, uio, ioflag)); +} + +/* + * /dev/console is a little different than normal TTY's. Unlike regular + * TTY device nodes, this device node will not revoke the entire TTY + * upon closure and all data written to it will be logged. + */ +static struct cdevsw ttyconsdev_cdevsw = { + .d_version = D_VERSION, + .d_open = ttyconsdev_open, + .d_read = ttydev_read, + .d_write = ttyconsdev_write, + .d_ioctl = ttydev_ioctl, + .d_kqfilter = ttydev_kqfilter, + .d_poll = ttydev_poll, + .d_mmap = ttydev_mmap, + .d_name = "ttyconsdev", + .d_flags = D_TTY, +}; + +static void +ttyconsdev_init(void *unused) +{ + + dev_console = make_dev(&ttyconsdev_cdevsw, 0, UID_ROOT, GID_WHEEL, + 0600, "console"); +} + +SYSINIT(tty, SI_SUB_DRIVERS, SI_ORDER_FIRST, ttyconsdev_init, NULL); + +void +ttyconsdev_select(const char *name) +{ + + dev_console_filename = name; +} + +/* + * Debugging routines. + */ + #include "opt_ddb.h" #ifdef DDB #include Modified: head/sys/sys/tty.h ============================================================================== --- head/sys/sys/tty.h Sat Nov 1 08:07:02 2008 (r184520) +++ head/sys/sys/tty.h Sat Nov 1 08:35:28 2008 (r184521) @@ -192,6 +192,9 @@ dev_t tty_udev(struct tty *tp); /* Status line printing. */ void tty_info(struct tty *tp); +/* /dev/console selection. */ +void ttyconsdev_select(const char *name); + /* Pseudo-terminal hooks. */ int pts_alloc_external(int fd, struct thread *td, struct file *fp, struct cdev *dev, const char *name); From kostikbel at gmail.com Sat Nov 1 03:30:31 2008 From: kostikbel at gmail.com (Kostik Belousov) Date: Sat Nov 1 03:30:37 2008 Subject: svn commit: r184515 - in head/sys: conf modules/rl pci In-Reply-To: <200810312324.m9VNOE88093395@svn.freebsd.org> References: <200810312324.m9VNOE88093395@svn.freebsd.org> Message-ID: <20081101103025.GU18100@deviant.kiev.zoral.com.ua> On Fri, Oct 31, 2008 at 11:24:14PM +0000, Warner Losh wrote: > Author: imp > Date: Fri Oct 31 23:24:13 2008 > New Revision: 184515 > URL: http://svn.freebsd.org/changeset/base/184515 > > Log: > Add RL_TWISTER_ENABLE option. This enables the magic bits to do long > cable tuning. This has helped in some installations for hardware > deployed by a former employer. Made optional because the lists aren't > full of complaints about these cards... even when they were wildly > popular. > > Reviewed by: attilio@, jhb@, trhodes@ (all an older version of the patch) > > Modified: > head/sys/conf/options > head/sys/modules/rl/Makefile > head/sys/pci/if_rl.c > head/sys/pci/if_rlreg.h > > Modified: head/sys/conf/options > ============================================================================== > --- head/sys/conf/options Fri Oct 31 18:40:35 2008 (r184514) > +++ head/sys/conf/options Fri Oct 31 23:24:13 2008 (r184515) > @@ -672,6 +672,9 @@ ED_SIC opt_ed.h > # bce driver > BCE_DEBUG opt_bce.h > > +# rl driver > +RL_TWISTER_ENABLE opt_rl.h Would it make sense to compile it unconditionally, but enable by a sysctl or loader knob ? -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 195 bytes Desc: not available Url : http://lists.freebsd.org/pipermail/svn-src-all/attachments/20081101/dad4ad51/attachment.pgp From brde at optusnet.com.au Sat Nov 1 04:05:45 2008 From: brde at optusnet.com.au (Bruce Evans) Date: Sat Nov 1 04:05:56 2008 Subject: svn commit: r184509 - head/share/man/man9 In-Reply-To: <200810311447.m9VElFtp083250@svn.freebsd.org> References: <200810311447.m9VElFtp083250@svn.freebsd.org> Message-ID: <20081101212937.D12448@delplex.bde.org> On Fri, 31 Oct 2008, Robert Watson wrote: > Log: > In style(9) examples of err() and errx(), use sysexits(3) errors rather > than returning 1. style(9) was correct. Using sysexits(3) is a style bug in most cases, especially in err() and errx() messages where there is a text message and not just a cryptic error code. (Originally, in 4.4BSD, sysexits.3 doesn't exist and /usr/src/admin/style/style had no mention of sysexits.h. What /usr/src/admin/style/style had was a rule to not label every error exit with a unique error code, since this gives a large undocumented set of program-specific error codes which no one remembers. Using sysexits gives the same results in practice -- it gives a large documented set of generic error codes which no one remembers, so it was a bug to change the rule from disallowing lots of error codes to encouraging use of sysexits. In 4.4BSD-Lite2, sysexits.3 still doesn't exist, and sysexits.h is only referred to in 11 .c files. This shows that use of sysexits is very unusual in BSD code. Some FreeBSD users like it and added it to style.9 and some FreeBSD .c files, so it is just unusual in FreeBSD code.) Bruce From brde at optusnet.com.au Sat Nov 1 04:32:16 2008 From: brde at optusnet.com.au (Bruce Evans) Date: Sat Nov 1 04:32:23 2008 Subject: svn commit: r184511 - head/lib/libc/gen In-Reply-To: <200810311514.m9VFEfi9083785@svn.freebsd.org> References: <200810311514.m9VFEfi9083785@svn.freebsd.org> Message-ID: <20081101220954.B12551@delplex.bde.org> On Fri, 31 Oct 2008, Robert Watson wrote: > Log: > In example use of err(3) and errx(3), use sysexits(3) constants. Use of sysexits is a style bug here too (see a reply to the corresponding change in style.9 for more details). > Modified: head/lib/libc/gen/err.3 > ============================================================================== > --- head/lib/libc/gen/err.3 Fri Oct 31 15:11:01 2008 (r184510) > +++ head/lib/libc/gen/err.3 Fri Oct 31 15:14:40 2008 (r184511) > @@ -178,15 +178,16 @@ or a null pointer > Display the current errno information string and exit: > .Bd -literal -offset indent > if ((p = malloc(size)) == NULL) > - err(1, NULL); > + err(EX_OSERR, NULL); > if ((fd = open(file_name, O_RDONLY, 0)) == -1) > - err(1, "%s", file_name); > + err(EX_NOINPUT, "%s", file_name); These have other style bugs -- a null or incomplete error message makes a sysexits error code almost useful. Normal for malloc failure is errx(1, "malloc failed"). This intentionally uses errx() instead of err() since the usual error ENOMEM for malloc() failure is considered useless, and/or the code is supposed to be portable to systems where malloc() is not guaranteed to set errno on failure. FreeBSD's actually malloc() claims to always set errno to ENOMEM on error. It seems to actually do this. This involves clobbering any possibly-more useful different errno set by mmap() etc. after preserving the original errno in a nonstandard place. Apart from this, with malloc() being even more in userland and with possibly more complicated failure modes, the printing error code might be more useful. (Except of couse malloc9) neverl fails :-), and when it does the MALLOC_OPTIONS="A" mistake makes it abort.) Also, with malloc() more in userland, EX_OSERR for malloc failure is wronger than before. Normal for open failure is err(1, "cannot open %s", file_name);. Bruce From ed at FreeBSD.org Sat Nov 1 06:40:46 2008 From: ed at FreeBSD.org (Ed Schouten) Date: Sat Nov 1 06:40:52 2008 Subject: svn commit: r184522 - in head: sys/kern usr.sbin/pstat Message-ID: <200811011340.mA1Dekxr010308@svn.freebsd.org> Author: ed Date: Sat Nov 1 13:40:46 2008 New Revision: 184522 URL: http://svn.freebsd.org/changeset/base/184522 Log: Clamp the values of t_column to 5 digits in `pstat -t' and `show all ttys'. We often run into these very high column numbers when we run curses applications, because they don't print any newlines. This messes up the table output of `pstat -t'. If these numbers get really high, they aren't of any use to the reader anyway. Convert them to `99999' when they run out of bounds. Modified: head/sys/kern/tty.c head/usr.sbin/pstat/pstat.c Modified: head/sys/kern/tty.c ============================================================================== --- head/sys/kern/tty.c Sat Nov 1 08:35:28 2008 (r184521) +++ head/sys/kern/tty.c Sat Nov 1 13:40:46 2008 (r184522) @@ -2007,7 +2007,7 @@ DB_SHOW_ALL_COMMAND(ttys, db_show_all_tt osiz, tp->t_outq.to_end - tp->t_outq.to_begin, osiz - tp->t_outlow, - tp->t_column, + MIN(tp->t_column, 99999), tp->t_session ? tp->t_session->s_sid : 0, tp->t_pgrp ? tp->t_pgrp->pg_id : 0); Modified: head/usr.sbin/pstat/pstat.c ============================================================================== --- head/usr.sbin/pstat/pstat.c Sat Nov 1 08:35:28 2008 (r184521) +++ head/usr.sbin/pstat/pstat.c Sat Nov 1 13:40:46 2008 (r184522) @@ -334,7 +334,7 @@ ttyprt(struct xtty *xt) xt->xt_insize, xt->xt_incc, xt->xt_inlc, (xt->xt_insize - xt->xt_inlow), xt->xt_outsize, xt->xt_outcc, (xt->xt_outsize - xt->xt_outlow), - xt->xt_column, xt->xt_sid, xt->xt_pgid); + MIN(xt->xt_column, 99999), xt->xt_sid, xt->xt_pgid); for (i = j = 0; ttystates[i].flag; i++) if (xt->xt_flags & ttystates[i].flag) { putchar(ttystates[i].val); From brueffer at FreeBSD.org Sat Nov 1 07:19:56 2008 From: brueffer at FreeBSD.org (Christian Brueffer) Date: Sat Nov 1 07:20:08 2008 Subject: svn commit: r184523 - head/share/man/man4 Message-ID: <200811011419.mA1EJu4o011420@svn.freebsd.org> Author: brueffer Date: Sat Nov 1 14:19:55 2008 New Revision: 184523 URL: http://svn.freebsd.org/changeset/base/184523 Log: - Add one more supported adapter (1) - Fix a couple of typos Submitted by: Horvath Andras (1) Modified: head/share/man/man4/zyd.4 Modified: head/share/man/man4/zyd.4 ============================================================================== --- head/share/man/man4/zyd.4 Sat Nov 1 13:40:46 2008 (r184522) +++ head/share/man/man4/zyd.4 Sat Nov 1 14:19:55 2008 (r184523) @@ -32,7 +32,7 @@ .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF .\" THE POSSIBILITY OF SUCH DAMAGE. .\" -.Dd Apri 13, 2008 +.Dd November 1, 2008 .Dt ZYD 4 .Os .Sh NAME @@ -84,7 +84,7 @@ driver: .It Airlink+ AWLL3025 .It Airlink 101 AWLL3026 .It AOpen 802.11g WL54 -.It Asus A9T integrated wirless +.It Asus A9T integrated wireless .It Asus WL-159g .It Belkin F5D7050 v.4000 .It Billion BiPAC 3011G @@ -98,6 +98,7 @@ driver: .It Linksys WUSBF54G .It Longshine LCS-8131G3 .It MSI US54SE +.It MyTek MWU-201 USB adapter .It Philips SNU5600 .It Planet WL-U356 .It Planex GW-US54GZ @@ -124,7 +125,7 @@ driver: .El .Sh EXAMPLES The following -examples configures zyd0 to join any BSS network using WEP key +example configures zyd0 to join any BSS network using WEP key .Dq 0x1deadbeef1 , channel 11: .Bd -literal -offset indent @@ -167,7 +168,7 @@ This should not happen. .Xr wlan_tkip 4 , .Xr wlan_wep 4 , .Xr ifconfig 8 , -.Xr wpa_supplicant 8 . +.Xr wpa_supplicant 8 .Sh AUTHORS .An -nosplit The original From imp at bsdimp.com Sat Nov 1 09:47:21 2008 From: imp at bsdimp.com (M. Warner Losh) Date: Sat Nov 1 09:47:32 2008 Subject: svn commit: r184515 - in head/sys: conf modules/rl pci In-Reply-To: <20081101103025.GU18100@deviant.kiev.zoral.com.ua> References: <200810312324.m9VNOE88093395@svn.freebsd.org> <20081101103025.GU18100@deviant.kiev.zoral.com.ua> Message-ID: <20081101.104607.1844477909.imp@bsdimp.com> In message: <20081101103025.GU18100@deviant.kiev.zoral.com.ua> Kostik Belousov writes: : On Fri, Oct 31, 2008 at 11:24:14PM +0000, Warner Losh wrote: : > Author: imp : > Date: Fri Oct 31 23:24:13 2008 : > New Revision: 184515 : > URL: http://svn.freebsd.org/changeset/base/184515 : > : > Log: : > Add RL_TWISTER_ENABLE option. This enables the magic bits to do long : > cable tuning. This has helped in some installations for hardware : > deployed by a former employer. Made optional because the lists aren't : > full of complaints about these cards... even when they were wildly : > popular. : > : > Reviewed by: attilio@, jhb@, trhodes@ (all an older version of the patch) : > : > Modified: : > head/sys/conf/options : > head/sys/modules/rl/Makefile : > head/sys/pci/if_rl.c : > head/sys/pci/if_rlreg.h : > : > Modified: head/sys/conf/options : > ============================================================================== : > --- head/sys/conf/options Fri Oct 31 18:40:35 2008 (r184514) : > +++ head/sys/conf/options Fri Oct 31 23:24:13 2008 (r184515) : > @@ -672,6 +672,9 @@ ED_SIC opt_ed.h : > # bce driver : > BCE_DEBUG opt_bce.h : > : > +# rl driver : > +RL_TWISTER_ENABLE opt_rl.h : Would it make sense to compile it unconditionally, but enable by a sysctl : or loader knob ? That's a good idea. Given the level of problems here, and my lack of time, I'll leave it to someone else I think. Warner From imp at FreeBSD.org Sat Nov 1 10:02:02 2008 From: imp at FreeBSD.org (Warner Losh) Date: Sat Nov 1 10:02:08 2008 Subject: svn commit: r184524 - head/sys/pci Message-ID: <200811011702.mA1H22vn014217@svn.freebsd.org> Author: imp Date: Sat Nov 1 17:02:01 2008 New Revision: 184524 URL: http://svn.freebsd.org/changeset/base/184524 Log: Fix a few typos/spelling errors in my comments from the last commit, plus a few others that had lingered in this driver... Submitted by: "b." bf2006a att yahoo KIBO com Modified: head/sys/pci/if_rl.c Modified: head/sys/pci/if_rl.c ============================================================================== --- head/sys/pci/if_rl.c Sat Nov 1 14:19:55 2008 (r184523) +++ head/sys/pci/if_rl.c Sat Nov 1 17:02:01 2008 (r184524) @@ -156,7 +156,7 @@ static struct rl_type rl_devs[] = { { DELTA_VENDORID, DELTA_DEVICEID_8139, RL_8139, "Delta Electronics 8139 10/100BaseTX" }, { ADDTRON_VENDORID, ADDTRON_DEVICEID_8139, RL_8139, - "Addtron Technolgy 8139 10/100BaseTX" }, + "Addtron Technology 8139 10/100BaseTX" }, { DLINK_VENDORID, DLINK_DEVICEID_530TXPLUS, RL_8139, "D-Link DFE-530TX+ 10/100BaseTX" }, { DLINK_VENDORID, DLINK_DEVICEID_690TXD, RL_8139, @@ -1319,7 +1319,7 @@ rl_rxeof(struct rl_softc *sc) RL_LOCK(sc); } - /* No need to sync Rx memory block as we didn't mofify it. */ + /* No need to sync Rx memory block as we didn't modify it. */ } /* @@ -1402,15 +1402,15 @@ rl_twister_update(struct rl_softc *sc) /* * Tune the so-called twister registers of the RTL8139. These - * are used to compensate for impendence mismatches. The - * method for tuning these registes is undocumented and the - * following proceedure is collected from public sources. + * are used to compensate for impedance mismatches. The + * method for tuning these registers is undocumented and the + * following procedure is collected from public sources. */ switch (sc->rl_twister) { case CHK_LINK: /* - * If we have a sufficent link, then we can proceed in + * If we have a sufficient link, then we can proceed in * the state machine to the next stage. If not, then * disable further tuning after writing sane defaults. */ @@ -1649,7 +1649,7 @@ rl_encap(struct rl_softc *sc, struct mbu if (padlen > 0) { /* - * Make security concious people happy: zero out the + * Make security-conscious people happy: zero out the * bytes in the pad area, since we don't know what * this mbuf cluster buffer's previous user might * have left in it. From trasz at FreeBSD.org Sat Nov 1 12:02:06 2008 From: trasz at FreeBSD.org (Edward Tomasz Napierala) Date: Sat Nov 1 12:02:17 2008 Subject: svn commit: r184528 - head/share/man/man9 Message-ID: <200811011902.mA1J25nC016486@svn.freebsd.org> Author: trasz Date: Sat Nov 1 19:02:05 2008 New Revision: 184528 URL: http://svn.freebsd.org/changeset/base/184528 Log: Remove obsolete pseudocode from VOP_ACCESS.9, replacing it with something closer to reality. Approved by: rwatson (mentor) Modified: head/share/man/man9/VOP_ACCESS.9 Modified: head/share/man/man9/VOP_ACCESS.9 ============================================================================== --- head/share/man/man9/VOP_ACCESS.9 Sat Nov 1 18:57:58 2008 (r184527) +++ head/share/man/man9/VOP_ACCESS.9 Sat Nov 1 19:02:05 2008 (r184528) @@ -94,45 +94,12 @@ vop_access(struct vnode *vp, accmode_t a /* If immutable bit set, nobody gets to write it. */ if ((accmode & VWRITE) && vp has immutable bit set) - return EPERM; + return (EPERM); - /* Otherwise, user id 0 always gets access. */ - if (cred->cr_uid == 0) - return 0; + error = vaccess(vp->v_type, mode of vp, owner of vp, + group of vp, ap->a_accmode, ap->a_cred, NULL); - mask = 0; - - /* Otherwise, check the owner. */ - if (cred->cr_uid == owner of vp) { - if (accmode & VEXEC) - mask |= S_IXUSR; - if (accmode & VREAD) - mask |= S_IRUSR; - if (accmode & VWRITE) - mask |= S_IWUSR; - return (((mode of vp) & mask) == mask ? 0 : EACCES); - } - - /* Otherwise, check the groups. */ - for (i = 0, gp = cred->cr_groups; i < cred->cr_ngroups; i++, gp++) - if (group of vp == *gp) { - if (accmode & VEXEC) - mask |= S_IXGRP; - if (accmode & VREAD) - mask |= S_IRGRP; - if (accmode & VWRITE) - mask |= S_IWGRP; - return (((mode of vp) & mask) == mask ? 0 : EACCES); - } - - /* Otherwise, check everyone else. */ - if (accmode & VEXEC) - mask |= S_IXOTH; - if (accmode & VREAD) - mask |= S_IROTH; - if (accmode & VWRITE) - mask |= S_IWOTH; - return (((mode of vp) & mask) == mask ? 0 : EACCES); + return (error); } .Ed .Sh ERRORS From kientzle at FreeBSD.org Sat Nov 1 12:11:21 2008 From: kientzle at FreeBSD.org (Tim Kientzle) Date: Sat Nov 1 12:11:28 2008 Subject: svn commit: r184529 - head/lib/libarchive Message-ID: <200811011911.mA1JBLXp016673@svn.freebsd.org> Author: kientzle Date: Sat Nov 1 19:11:21 2008 New Revision: 184529 URL: http://svn.freebsd.org/changeset/base/184529 Log: Correct the documented declaration of the archive_write_callback to match the code. PR: docs/128089 Submitted by: Mel MFC after: 3 days Modified: head/lib/libarchive/archive_write.3 Modified: head/lib/libarchive/archive_write.3 ============================================================================== --- head/lib/libarchive/archive_write.3 Sat Nov 1 19:02:05 2008 (r184528) +++ head/lib/libarchive/archive_write.3 Sat Nov 1 19:11:21 2008 (r184529) @@ -342,7 +342,7 @@ to register an error code and message an .Fo archive_write_callback .Fa "struct archive *" .Fa "void *client_data" -.Fa "void *buffer" +.Fa "const void *buffer" .Fa "size_t length" .Fc .El @@ -410,7 +410,7 @@ myopen(struct archive *a, void *client_d } ssize_t -mywrite(struct archive *a, void *client_data, void *buff, size_t n) +mywrite(struct archive *a, void *client_data, const void *buff, size_t n) { struct mydata *mydata = client_data; From rwatson at FreeBSD.org Sat Nov 1 14:16:09 2008 From: rwatson at FreeBSD.org (Robert Watson) Date: Sat Nov 1 14:16:16 2008 Subject: svn commit: r184534 - head/sys/security/audit Message-ID: <200811012116.mA1LG91K019044@svn.freebsd.org> Author: rwatson Date: Sat Nov 1 21:16:09 2008 New Revision: 184534 URL: http://svn.freebsd.org/changeset/base/184534 Log: Allow a single read(2) system call on an audit pipe to retrieve data from more than one audit record at a time in order to improve efficiency. MFC after: 2 months Sponsored by: Apple, Inc. Modified: head/sys/security/audit/audit_pipe.c Modified: head/sys/security/audit/audit_pipe.c ============================================================================== --- head/sys/security/audit/audit_pipe.c Sat Nov 1 20:54:52 2008 (r184533) +++ head/sys/security/audit/audit_pipe.c Sat Nov 1 21:16:09 2008 (r184534) @@ -930,19 +930,8 @@ audit_pipe_ioctl(struct cdev *dev, u_lon } /* - * Audit pipe read. Pull one record off the queue and copy to user space. - * On error, the record is dropped. - * - * Providing more sophisticated behavior, such as partial reads, is tricky - * due to the potential for parallel I/O. If partial read support is - * required, it will require a per-pipe "current record being read" along - * with an offset into that trecord which has already been read. Threads - * performing partial reads will need to allocate per-thread copies of the - * data so that if another thread completes the read of the record, it can be - * freed without adding reference count logic. If this is added, a flag to - * indicate that only atomic record reads are desired would be useful, as if - * different threads are all waiting for records on the pipe, they will want - * independent record reads, which is currently the behavior. + * Audit pipe read. Read one or more partial or complete records to user + * memory. */ static int audit_pipe_read(struct cdev *dev, struct uio *uio, int flag) @@ -978,40 +967,43 @@ audit_pipe_read(struct cdev *dev, struct /* * Copy as many remaining bytes from the current record to userspace - * as we can. + * as we can. Keep processing records until we run out of records in + * the queue, or until the user buffer runs out of space. * * Note: we rely on the SX lock to maintain ape's stability here. */ ap->ap_reads++; - ape = TAILQ_FIRST(&ap->ap_queue); - toread = MIN(ape->ape_record_len - ape->ape_record_offset, - uio->uio_resid); - AUDIT_PIPE_UNLOCK(ap); - error = uiomove((char *)ape->ape_record + ape->ape_record_offset, - toread, uio); - if (error) { - AUDIT_PIPE_SX_XUNLOCK(ap); - return (error); - } + while ((ape = TAILQ_FIRST(&ap->ap_queue)) != NULL && + uio->uio_resid > 0) { + AUDIT_PIPE_LOCK_ASSERT(ap); - /* - * If the copy succeeded, update book-keeping, and if no bytes remain - * in the current record, free it. - */ - AUDIT_PIPE_LOCK(ap); - KASSERT(TAILQ_FIRST(&ap->ap_queue) == ape, - ("audit_pipe_read: queue out of sync after uiomove")); - ape->ape_record_offset += toread; - if (ape->ape_record_offset == ape->ape_record_len) { - TAILQ_REMOVE(&ap->ap_queue, ape, ape_queue); - ap->ap_qlen--; - } else - ape = NULL; + toread = MIN(ape->ape_record_len - ape->ape_record_offset, + uio->uio_resid); + AUDIT_PIPE_UNLOCK(ap); + error = uiomove((char *)ape->ape_record + + ape->ape_record_offset, toread, uio); + if (error) { + AUDIT_PIPE_SX_XUNLOCK(ap); + return (error); + } + + /* + * If the copy succeeded, update book-keeping, and if no + * bytes remain in the current record, free it. + */ + AUDIT_PIPE_LOCK(ap); + KASSERT(TAILQ_FIRST(&ap->ap_queue) == ape, + ("audit_pipe_read: queue out of sync after uiomove")); + ape->ape_record_offset += toread; + if (ape->ape_record_offset == ape->ape_record_len) { + TAILQ_REMOVE(&ap->ap_queue, ape, ape_queue); + audit_pipe_entry_free(ape); + ap->ap_qlen--; + } + } AUDIT_PIPE_UNLOCK(ap); AUDIT_PIPE_SX_XUNLOCK(ap); - if (ape != NULL) - audit_pipe_entry_free(ape); - return (error); + return (0); } /* From rwatson at FreeBSD.org Sat Nov 1 14:56:45 2008 From: rwatson at FreeBSD.org (Robert Watson) Date: Sat Nov 1 14:56:52 2008 Subject: svn commit: r184536 - head/sys/security/audit Message-ID: <200811012156.mA1Lujju019836@svn.freebsd.org> Author: rwatson Date: Sat Nov 1 21:56:45 2008 New Revision: 184536 URL: http://svn.freebsd.org/changeset/base/184536 Log: We only allow a partial read of the first record in an audit pipe record queue, so move the offset field from the per-record audit_pipe_entry structure to the audit_pipe structure. Now that we support reading more than one record at a time, add a new summary field to audit_pipe, ap_qbyteslen, which tracks the total number of bytes present in a pipe, and return that (minus the current offset) via FIONREAD and kqueue's data variable for the pending byte count rather than the number of bytes remaining in only the first record. Add a number of asserts to confirm that these counts and offsets following the expected rules. MFC after: 2 months Sponsored by: Apple, Inc. Modified: head/sys/security/audit/audit_pipe.c Modified: head/sys/security/audit/audit_pipe.c ============================================================================== --- head/sys/security/audit/audit_pipe.c Sat Nov 1 21:49:32 2008 (r184535) +++ head/sys/security/audit/audit_pipe.c Sat Nov 1 21:56:45 2008 (r184536) @@ -85,7 +85,6 @@ static MALLOC_DEFINE(M_AUDIT_PIPE_PRESEL struct audit_pipe_entry { void *ape_record; u_int ape_record_len; - u_int ape_record_offset; TAILQ_ENTRY(audit_pipe_entry) ape_queue; }; @@ -138,8 +137,17 @@ struct audit_pipe { */ struct cv ap_cv; + /* + * Various queue-reated variables: qlen and qlimit are a count of + * records in the queue; qbyteslen is the number of bytes of data + * across all records, and qoffset is the amount read so far of the + * first record in the queue. The number of bytes available for + * reading in the queue is qbyteslen - qoffset. + */ u_int ap_qlen; u_int ap_qlimit; + u_int ap_qbyteslen; + u_int ap_qoffset; u_int64_t ap_inserts; /* Records added. */ u_int64_t ap_reads; /* Records read. */ @@ -474,11 +482,11 @@ audit_pipe_append(struct audit_pipe *ap, bcopy(record, ape->ape_record, record_len); ape->ape_record_len = record_len; - ape->ape_record_offset = 0; TAILQ_INSERT_TAIL(&ap->ap_queue, ape, ape_queue); ap->ap_inserts++; ap->ap_qlen++; + ap->ap_qbyteslen += ape->ape_record_len; selwakeuppri(&ap->ap_selinfo, PSOCK); KNOTE_LOCKED(&ap->ap_selinfo.si_note, 0); if (ap->ap_flags & AUDIT_PIPE_ASYNC) @@ -603,10 +611,14 @@ audit_pipe_flush(struct audit_pipe *ap) while ((ape = TAILQ_FIRST(&ap->ap_queue)) != NULL) { TAILQ_REMOVE(&ap->ap_queue, ape, ape_queue); + ap->ap_qbyteslen -= ape->ape_record_len; audit_pipe_entry_free(ape); ap->ap_qlen--; } - KASSERT(ap->ap_qlen == 0, ("audit_pipe_free: ap_qlen")); + ap->ap_qoffset = 0; + + KASSERT(ap->ap_qlen == 0, ("audit_pipe_free: ap_qbyteslen")); + KASSERT(ap->ap_qbyteslen == 0, ("audit_pipe_flush: ap_qbyteslen")); } /* @@ -752,12 +764,7 @@ audit_pipe_ioctl(struct cdev *dev, u_lon case FIONREAD: AUDIT_PIPE_LOCK(ap); - if (TAILQ_FIRST(&ap->ap_queue) != NULL) - *(int *)data = - TAILQ_FIRST(&ap->ap_queue)->ape_record_len - - TAILQ_FIRST(&ap->ap_queue)->ape_record_offset; - else - *(int *)data = 0; + *(int *)data = ap->ap_qbyteslen - ap->ap_qoffset; AUDIT_PIPE_UNLOCK(ap); error = 0; break; @@ -977,11 +984,13 @@ audit_pipe_read(struct cdev *dev, struct uio->uio_resid > 0) { AUDIT_PIPE_LOCK_ASSERT(ap); - toread = MIN(ape->ape_record_len - ape->ape_record_offset, + KASSERT(ape->ape_record_len > ap->ap_qoffset, + ("audit_pipe_read: record_len > qoffset (1)")); + toread = MIN(ape->ape_record_len - ap->ap_qoffset, uio->uio_resid); AUDIT_PIPE_UNLOCK(ap); - error = uiomove((char *)ape->ape_record + - ape->ape_record_offset, toread, uio); + error = uiomove((char *)ape->ape_record + ap->ap_qoffset, + toread, uio); if (error) { AUDIT_PIPE_SX_XUNLOCK(ap); return (error); @@ -994,11 +1003,15 @@ audit_pipe_read(struct cdev *dev, struct AUDIT_PIPE_LOCK(ap); KASSERT(TAILQ_FIRST(&ap->ap_queue) == ape, ("audit_pipe_read: queue out of sync after uiomove")); - ape->ape_record_offset += toread; - if (ape->ape_record_offset == ape->ape_record_len) { + ap->ap_qoffset += toread; + KASSERT(ape->ape_record_len >= ap->ap_qoffset, + ("audit_pipe_read: record_len >= qoffset (2)")); + if (ap->ap_qoffset == ape->ape_record_len) { TAILQ_REMOVE(&ap->ap_queue, ape, ape_queue); + ap->ap_qbyteslen -= ape->ape_record_len; audit_pipe_entry_free(ape); ap->ap_qlen--; + ap->ap_qoffset = 0; } } AUDIT_PIPE_UNLOCK(ap); @@ -1071,7 +1084,7 @@ audit_pipe_kqread(struct knote *kn, long ape = TAILQ_FIRST(&ap->ap_queue); KASSERT(ape != NULL, ("audit_pipe_kqread: ape == NULL")); - kn->kn_data = ape->ape_record_len - ape->ape_record_offset; + kn->kn_data = ap->ap_qbyteslen - ap->ap_qoffset; return (1); } else { kn->kn_data = 0; From rwatson at FreeBSD.org Sat Nov 1 16:05:49 2008 From: rwatson at FreeBSD.org (Robert Watson) Date: Sat Nov 1 16:06:01 2008 Subject: svn commit: r184540 - head/sys/security/audit Message-ID: <200811012305.mA1N5nRU022064@svn.freebsd.org> Author: rwatson Date: Sat Nov 1 23:05:49 2008 New Revision: 184540 URL: http://svn.freebsd.org/changeset/base/184540 Log: Add comment for per-pipe stats. MFC after: 2 months Sponsored by: Apple, Inc. Modified: head/sys/security/audit/audit_pipe.c Modified: head/sys/security/audit/audit_pipe.c ============================================================================== --- head/sys/security/audit/audit_pipe.c Sat Nov 1 22:18:49 2008 (r184539) +++ head/sys/security/audit/audit_pipe.c Sat Nov 1 23:05:49 2008 (r184540) @@ -149,6 +149,9 @@ struct audit_pipe { u_int ap_qbyteslen; u_int ap_qoffset; + /* + * Per-pipe operation statistics. + */ u_int64_t ap_inserts; /* Records added. */ u_int64_t ap_reads; /* Records read. */ u_int64_t ap_drops; /* Records dropped. */ From rwatson at FreeBSD.org Sat Nov 1 17:18:19 2008 From: rwatson at FreeBSD.org (Robert Watson) Date: Sat Nov 1 17:18:25 2008 Subject: svn commit: r184544 - head/sys/security/audit Message-ID: <200811020018.mA20IJtR023710@svn.freebsd.org> Author: rwatson Date: Sun Nov 2 00:18:19 2008 New Revision: 184544 URL: http://svn.freebsd.org/changeset/base/184544 Log: Remove stale comment about filtering in audit pipe ioctl routine: we do support filtering now, although we may want to make it more interesting in the future. MFC after: 2 months Sponsored by: Apple, Inc. Modified: head/sys/security/audit/audit_pipe.c Modified: head/sys/security/audit/audit_pipe.c ============================================================================== --- head/sys/security/audit/audit_pipe.c Sun Nov 2 00:14:54 2008 (r184543) +++ head/sys/security/audit/audit_pipe.c Sun Nov 2 00:18:19 2008 (r184544) @@ -732,9 +732,6 @@ audit_pipe_close(struct cdev *dev, int f /* * Audit pipe ioctl() routine. Handle file descriptor and audit pipe layer * commands. - * - * Would be desirable to support filtering, although perhaps something simple - * like an event mask, as opposed to something complicated like BPF. */ static int audit_pipe_ioctl(struct cdev *dev, u_long cmd, caddr_t data, int flag, From rwatson at FreeBSD.org Sat Nov 1 17:25:49 2008 From: rwatson at FreeBSD.org (Robert Watson) Date: Sat Nov 1 17:26:00 2008 Subject: svn commit: r184545 - head/sys/security/audit Message-ID: <200811020025.mA20PnMp023884@svn.freebsd.org> Author: rwatson Date: Sun Nov 2 00:25:48 2008 New Revision: 184545 URL: http://svn.freebsd.org/changeset/base/184545 Log: Update introductory comment for audit pipes. MFC after: 2 months Sponsored by: Apple, Inc. Modified: head/sys/security/audit/audit_pipe.c Modified: head/sys/security/audit/audit_pipe.c ============================================================================== --- head/sys/security/audit/audit_pipe.c Sun Nov 2 00:18:19 2008 (r184544) +++ head/sys/security/audit/audit_pipe.c Sun Nov 2 00:25:48 2008 (r184545) @@ -57,10 +57,10 @@ __FBSDID("$FreeBSD$"); /* * Implementation of a clonable special device providing a live stream of BSM - * audit data. This is a "tee" of the data going to the file. It provides - * unreliable but timely access to audit events. Consumers of this interface - * should be very careful to avoid introducing event cycles. Consumers may - * express interest via a set of preselection ioctls. + * audit data. Consumers receive a "tee" of the system audit trail by + * default, but may also define alternative event selections using ioctls. + * This interface provides unreliable but timely access to audit events. + * Consumers should be very careful to avoid introducing event cycles. */ /* From keramida at FreeBSD.org Sat Nov 1 17:41:27 2008 From: keramida at FreeBSD.org (Giorgos Keramidas) Date: Sat Nov 1 17:41:34 2008 Subject: svn commit: r184546 - head/sys/vm Message-ID: <200811020041.mA20fQCt024181@svn.freebsd.org> Author: keramida (doc committer) Date: Sun Nov 2 00:41:26 2008 New Revision: 184546 URL: http://svn.freebsd.org/changeset/base/184546 Log: Various comment nits, and typos. Modified: head/sys/vm/uma.h Modified: head/sys/vm/uma.h ============================================================================== --- head/sys/vm/uma.h Sun Nov 2 00:25:48 2008 (r184545) +++ head/sys/vm/uma.h Sun Nov 2 00:41:26 2008 (r184546) @@ -39,7 +39,7 @@ #include /* For NULL */ #include /* For M_* */ -/* User visable parameters */ +/* User visible parameters */ #define UMA_SMALLEST_UNIT (PAGE_SIZE / 256) /* Smallest item allocated */ /* Types and type defs */ @@ -101,7 +101,8 @@ typedef void (*uma_dtor)(void *mem, int * * Discussion: * The initializer is called when the memory is cached in the uma zone. - * this should be the same state that the destructor leaves the object in. + * The initializer and the destructor should leave the object in the same + * state. */ typedef int (*uma_init)(void *mem, int size, int flags); @@ -118,7 +119,7 @@ typedef int (*uma_init)(void *mem, int s * * Discussion: * This routine is called when memory leaves a zone and is returned to the - * system for other uses. It is the counter part to the init function. + * system for other uses. It is the counter-part to the init function. */ typedef void (*uma_fini)(void *mem, int size); @@ -131,7 +132,7 @@ typedef void (*uma_fini)(void *mem, int * utilizing a known, stable state. This differs from the constructor which * will be called on EVERY allocation. * - * For example, in the initializer you may want to initialize embeded locks, + * For example, in the initializer you may want to initialize embedded locks, * NULL list pointers, set up initial states, magic numbers, etc. This way if * the object is held in the allocator and re-used it won't be necessary to * re-initialize it. @@ -148,17 +149,17 @@ typedef void (*uma_fini)(void *mem, int * Create a new uma zone * * Arguments: - * name The text name of the zone for debugging and stats, this memory + * name The text name of the zone for debugging and stats. This memory * should not be freed until the zone has been deallocated. * size The size of the object that is being created. - * ctor The constructor that is called when the object is allocated + * ctor The constructor that is called when the object is allocated. * dtor The destructor that is called when the object is freed. * init An initializer that sets up the initial state of the memory. * fini A discard function that undoes initialization done by init. * ctor/dtor/init/fini may all be null, see notes above. - * align A bitmask that corisponds to the requested alignment + * align A bitmask that corresponds to the requested alignment * eg 4 would be 0x3 - * flags A set of parameters that control the behavior of the zone + * flags A set of parameters that control the behavior of the zone. * * Returns: * A pointer to a structure which is intended to be opaque to users of @@ -172,9 +173,9 @@ uma_zone_t uma_zcreate(char *name, size_ * Create a secondary uma zone * * Arguments: - * name The text name of the zone for debugging and stats, this memory + * name The text name of the zone for debugging and stats. This memory * should not be freed until the zone has been deallocated. - * ctor The constructor that is called when the object is allocated + * ctor The constructor that is called when the object is allocated. * dtor The destructor that is called when the object is freed. * zinit An initializer that sets up the initial state of the memory * as the object passes from the Keg's slab to the Zone's cache. @@ -212,7 +213,7 @@ uma_zone_t uma_zsecond_create(char *name #define UMA_ZONE_PAGEABLE 0x0001 /* Return items not fully backed by physical memory XXX Not yet */ #define UMA_ZONE_ZINIT 0x0002 /* Initialize with zeros */ -#define UMA_ZONE_STATIC 0x0004 /* Staticly sized zone */ +#define UMA_ZONE_STATIC 0x0004 /* Statically sized zone */ #define UMA_ZONE_OFFPAGE 0x0008 /* Force the slab structure allocation off of the real memory */ #define UMA_ZONE_MALLOC 0x0010 /* For use by malloc(9) only! */ @@ -256,9 +257,9 @@ void uma_zdestroy(uma_zone_t zone); * flags See sys/malloc.h for available flags. * * Returns: - * A non null pointer to an initialized element from the zone is - * garanteed if the wait flag is M_WAITOK, otherwise a null pointer may be - * returned if the zone is empty or the ctor failed. + * A non-null pointer to an initialized element from the zone is + * guaranteed if the wait flag is M_WAITOK. Otherwise a null pointer + * may be returned if the zone is empty or the ctor failed. */ void *uma_zalloc_arg(uma_zone_t zone, void *arg, int flags); @@ -314,13 +315,13 @@ uma_zfree(uma_zone_t zone, void *item) * Backend page supplier routines * * Arguments: - * zone The zone that is requesting pages - * size The number of bytes being requested + * zone The zone that is requesting pages. + * size The number of bytes being requested. * pflag Flags for these memory pages, see below. * wait Indicates our willingness to block. * * Returns: - * A pointer to the alloced memory or NULL on failure. + * A pointer to the allocated memory or NULL on failure. */ typedef void *(*uma_alloc)(uma_zone_t zone, int size, u_int8_t *pflag, int wait); @@ -329,9 +330,9 @@ typedef void *(*uma_alloc)(uma_zone_t zo * Backend page free routines * * Arguments: - * item A pointer to the previously allocated pages - * size The original size of the allocation - * pflag The flags for the slab. See UMA_SLAB_* below + * item A pointer to the previously allocated pages. + * size The original size of the allocation. + * pflag The flags for the slab. See UMA_SLAB_* below. * * Returns: * None @@ -403,9 +404,9 @@ void uma_set_align(int align); * Switches the backing object of a zone * * Arguments: - * zone The zone to update - * obj The obj to use for future allocations - * size The size of the object to allocate + * zone The zone to update. + * obj The VM object to use for future allocations. + * size The size of the object to allocate. * * Returns: * 0 if kva space can not be allocated @@ -435,7 +436,7 @@ void uma_zone_set_max(uma_zone_t zone, i * are used to set the backend init/fini pair which acts on an * object as it becomes allocated and is placed in a slab within * the specified zone's backing keg. These should probably not - * be changed once allocations have already begun and only + * be changed once allocations have already begun, but only be set * immediately upon zone creation. */ void uma_zone_set_init(uma_zone_t zone, uma_init uminit); @@ -446,8 +447,8 @@ void uma_zone_set_fini(uma_zone_t zone, * used to set the zinit/zfini pair which acts on an object as * it passes from the backing Keg's slab cache to the * specified Zone's bucket cache. These should probably not - * be changed once allocations have already begun and - * only immediately upon zone creation. + * be changed once allocations have already begun, but only be set + * immediately upon zone creation. */ void uma_zone_set_zinit(uma_zone_t zone, uma_init zinit); void uma_zone_set_zfini(uma_zone_t zone, uma_fini zfini); @@ -456,7 +457,7 @@ void uma_zone_set_zfini(uma_zone_t zone, * Replaces the standard page_alloc or obj_alloc functions for this zone * * Arguments: - * zone The zone whos back end allocator is being changed. + * zone The zone whose backend allocator is being changed. * allocf A pointer to the allocation function * * Returns: @@ -484,7 +485,7 @@ void uma_zone_set_allocf(uma_zone_t zone void uma_zone_set_freef(uma_zone_t zone, uma_free freef); /* - * These flags are setable in the allocf and visable in the freef. + * These flags are setable in the allocf and visible in the freef. */ #define UMA_SLAB_BOOT 0x01 /* Slab alloced from boot pages */ #define UMA_SLAB_KMEM 0x02 /* Slab alloced from kmem_map */ @@ -537,9 +538,8 @@ int uma_zone_exhausted_nolock(uma_zone_t /* * Exported statistics structures to be used by user space monitoring tools. - * Statistics stream consusts of a uma_stream_header, followed by a series of - * alternative uma_type_header and uma_type_stat structures. Statistics - * structures + * Statistics stream consists of a uma_stream_header, followed by a series of + * alternative uma_type_header and uma_type_stat structures. */ #define UMA_STREAM_VERSION 0x00000001 struct uma_stream_header { @@ -577,7 +577,7 @@ struct uma_type_header { }; struct uma_percpu_stat { - u_int64_t ups_allocs; /* Cache: number of alloctions. */ + u_int64_t ups_allocs; /* Cache: number of allocations. */ u_int64_t ups_frees; /* Cache: number of frees. */ u_int64_t ups_cache_free; /* Cache: free items in cache. */ u_int64_t _ups_reserved[5]; /* Reserved. */ From peter at FreeBSD.org Sat Nov 1 18:10:56 2008 From: peter at FreeBSD.org (Peter Wemm) Date: Sat Nov 1 18:11:02 2008 Subject: svn commit: r184547 - in head/lib/libc/amd64: . gen stdlib string sys Message-ID: <200811020110.mA21At7Y024785@svn.freebsd.org> Author: peter Date: Sun Nov 2 01:10:54 2008 New Revision: 184547 URL: http://svn.freebsd.org/changeset/base/184547 Log: We've been lax about matching END() macros in asm code for some time. This is used to set the ELF size attribute for functions. It isn't normally critical but some things can make use of it (gdb for stack traces). Valgrind needs it so I'm adding it in. The problem is present on all branches and on both i386 and amd64. Modified: head/lib/libc/amd64/SYS.h head/lib/libc/amd64/gen/_setjmp.S head/lib/libc/amd64/gen/fabs.S head/lib/libc/amd64/gen/modf.S head/lib/libc/amd64/gen/rfork_thread.S head/lib/libc/amd64/gen/setjmp.S head/lib/libc/amd64/gen/sigsetjmp.S head/lib/libc/amd64/stdlib/div.S head/lib/libc/amd64/stdlib/ldiv.S head/lib/libc/amd64/stdlib/lldiv.S head/lib/libc/amd64/string/bcmp.S head/lib/libc/amd64/string/bcopy.S head/lib/libc/amd64/string/bzero.S head/lib/libc/amd64/string/memcmp.S head/lib/libc/amd64/string/memset.S head/lib/libc/amd64/string/strcat.S head/lib/libc/amd64/string/strcmp.S head/lib/libc/amd64/string/strcpy.S head/lib/libc/amd64/sys/brk.S head/lib/libc/amd64/sys/exect.S head/lib/libc/amd64/sys/getcontext.S head/lib/libc/amd64/sys/pipe.S head/lib/libc/amd64/sys/ptrace.S head/lib/libc/amd64/sys/reboot.S head/lib/libc/amd64/sys/sbrk.S head/lib/libc/amd64/sys/setlogin.S head/lib/libc/amd64/sys/vfork.S Modified: head/lib/libc/amd64/SYS.h ============================================================================== --- head/lib/libc/amd64/SYS.h Sun Nov 2 00:41:26 2008 (r184546) +++ head/lib/libc/amd64/SYS.h Sun Nov 2 01:10:54 2008 (r184547) @@ -43,13 +43,15 @@ .weak CNAME(__CONCAT(_,x)); \ .set CNAME(__CONCAT(_,x)),CNAME(__CONCAT(__sys_,x)); \ mov __CONCAT($SYS_,x),%rax; KERNCALL; jb 2f; ret; \ - 2: movq PIC_GOT(HIDENAME(cerror)),%rcx; jmp *%rcx + 2: movq PIC_GOT(HIDENAME(cerror)),%rcx; jmp *%rcx; \ + END(__CONCAT(__sys_,x)) #define PSEUDO(x) ENTRY(__CONCAT(__sys_,x)); \ .weak CNAME(__CONCAT(_,x)); \ .set CNAME(__CONCAT(_,x)),CNAME(__CONCAT(__sys_,x)); \ mov __CONCAT($SYS_,x),%rax; KERNCALL; jb 2f; ret ; \ - 2: movq PIC_GOT(HIDENAME(cerror)),%rcx; jmp *%rcx + 2: movq PIC_GOT(HIDENAME(cerror)),%rcx; jmp *%rcx; \ + END(__CONCAT(__sys_,x)) #else #define RSYSCALL(x) ENTRY(__CONCAT(__sys_,x)); \ .weak CNAME(x); \ @@ -57,13 +59,15 @@ .weak CNAME(__CONCAT(_,x)); \ .set CNAME(__CONCAT(_,x)),CNAME(__CONCAT(__sys_,x)); \ mov __CONCAT($SYS_,x),%rax; KERNCALL; jb 2f; ret; \ - 2: jmp HIDENAME(cerror) + 2: jmp HIDENAME(cerror); \ + END(__CONCAT(__sys_,x)) #define PSEUDO(x) ENTRY(__CONCAT(__sys_,x)); \ .weak CNAME(__CONCAT(_,x)); \ .set CNAME(__CONCAT(_,x)),CNAME(__CONCAT(__sys_,x)); \ mov __CONCAT($SYS_,x),%rax; KERNCALL; jb 2f; ret; \ - 2: jmp HIDENAME(cerror) + 2: jmp HIDENAME(cerror); \ + END(__CONCAT(__sys_,x)) #endif #define KERNCALL movq %rcx, %r10; syscall Modified: head/lib/libc/amd64/gen/_setjmp.S ============================================================================== --- head/lib/libc/amd64/gen/_setjmp.S Sun Nov 2 00:41:26 2008 (r184546) +++ head/lib/libc/amd64/gen/_setjmp.S Sun Nov 2 01:10:54 2008 (r184547) @@ -61,6 +61,7 @@ ENTRY(_setjmp) stmxcsr 68(%rax) /* and mxcsr */ xorq %rax,%rax ret +END(_setjmp) .weak CNAME(_longjmp) .set CNAME(_longjmp),CNAME(___longjmp) @@ -90,3 +91,4 @@ ENTRY(___longjmp) incq %rax 1: movq %rcx,0(%rsp) ret +END(___longjmp) Modified: head/lib/libc/amd64/gen/fabs.S ============================================================================== --- head/lib/libc/amd64/gen/fabs.S Sun Nov 2 00:41:26 2008 (r184546) +++ head/lib/libc/amd64/gen/fabs.S Sun Nov 2 01:10:54 2008 (r184547) @@ -37,6 +37,7 @@ ENTRY(fabs) movsd signbit(%rip), %xmm0 andnpd %xmm1, %xmm0 ret +END(fabs) .data signbit: Modified: head/lib/libc/amd64/gen/modf.S ============================================================================== --- head/lib/libc/amd64/gen/modf.S Sun Nov 2 00:41:26 2008 (r184546) +++ head/lib/libc/amd64/gen/modf.S Sun Nov 2 01:10:54 2008 (r184547) @@ -86,3 +86,4 @@ ENTRY(modf) movsd -8(%rsp),%xmm0 ret +END(modf) Modified: head/lib/libc/amd64/gen/rfork_thread.S ============================================================================== --- head/lib/libc/amd64/gen/rfork_thread.S Sun Nov 2 00:41:26 2008 (r184546) +++ head/lib/libc/amd64/gen/rfork_thread.S Sun Nov 2 01:10:54 2008 (r184547) @@ -99,3 +99,4 @@ ENTRY(rfork_thread) #else jmp HIDENAME(cerror) #endif +END(rfork_thread) Modified: head/lib/libc/amd64/gen/setjmp.S ============================================================================== --- head/lib/libc/amd64/gen/setjmp.S Sun Nov 2 00:41:26 2008 (r184546) +++ head/lib/libc/amd64/gen/setjmp.S Sun Nov 2 01:10:54 2008 (r184547) @@ -70,6 +70,7 @@ ENTRY(setjmp) stmxcsr 68(%rcx) /* and mxcsr */ xorq %rax,%rax ret +END(setjmp) .weak CNAME(longjmp) .set CNAME(longjmp),CNAME(__longjmp) @@ -108,3 +109,4 @@ ENTRY(__longjmp) incq %rax 1: movq %rcx,0(%rsp) ret +END(__longjmp) Modified: head/lib/libc/amd64/gen/sigsetjmp.S ============================================================================== --- head/lib/libc/amd64/gen/sigsetjmp.S Sun Nov 2 00:41:26 2008 (r184546) +++ head/lib/libc/amd64/gen/sigsetjmp.S Sun Nov 2 01:10:54 2008 (r184547) @@ -77,6 +77,7 @@ ENTRY(sigsetjmp) fnstcw 64(%rcx) /* 8; fpu cw */ xorq %rax,%rax ret +END(sigsetjmp) .weak CNAME(siglongjmp) .set CNAME(siglongjmp),CNAME(__siglongjmp) @@ -109,3 +110,4 @@ ENTRY(__siglongjmp) incq %rax 1: movq %rcx,0(%rsp) ret +END(__siglongjmp) Modified: head/lib/libc/amd64/stdlib/div.S ============================================================================== --- head/lib/libc/amd64/stdlib/div.S Sun Nov 2 00:41:26 2008 (r184546) +++ head/lib/libc/amd64/stdlib/div.S Sun Nov 2 01:10:54 2008 (r184547) @@ -15,3 +15,4 @@ ENTRY(div) salq $32,%rdx orq %rdx,%rax ret +END(div) Modified: head/lib/libc/amd64/stdlib/ldiv.S ============================================================================== --- head/lib/libc/amd64/stdlib/ldiv.S Sun Nov 2 00:41:26 2008 (r184546) +++ head/lib/libc/amd64/stdlib/ldiv.S Sun Nov 2 01:10:54 2008 (r184547) @@ -13,3 +13,4 @@ ENTRY(ldiv) cqto idivq %rsi ret +END(ldiv) Modified: head/lib/libc/amd64/stdlib/lldiv.S ============================================================================== --- head/lib/libc/amd64/stdlib/lldiv.S Sun Nov 2 00:41:26 2008 (r184546) +++ head/lib/libc/amd64/stdlib/lldiv.S Sun Nov 2 01:10:54 2008 (r184547) @@ -13,3 +13,4 @@ ENTRY(lldiv) cqto idivq %rsi ret +END(lldiv) Modified: head/lib/libc/amd64/string/bcmp.S ============================================================================== --- head/lib/libc/amd64/string/bcmp.S Sun Nov 2 00:41:26 2008 (r184546) +++ head/lib/libc/amd64/string/bcmp.S Sun Nov 2 01:10:54 2008 (r184547) @@ -22,3 +22,4 @@ L1: setne %al movsbl %al,%eax ret +END(bcmp) Modified: head/lib/libc/amd64/string/bcopy.S ============================================================================== --- head/lib/libc/amd64/string/bcopy.S Sun Nov 2 00:41:26 2008 (r184546) +++ head/lib/libc/amd64/string/bcopy.S Sun Nov 2 01:10:54 2008 (r184547) @@ -86,3 +86,12 @@ ENTRY(bcopy) movsq cld ret +#ifdef MEMCOPY +END(memcpy) +#else +#ifdef MEMMOVE +END(memmove) +#else +END(bcopy) +#endif +#endif Modified: head/lib/libc/amd64/string/bzero.S ============================================================================== --- head/lib/libc/amd64/string/bzero.S Sun Nov 2 00:41:26 2008 (r184546) +++ head/lib/libc/amd64/string/bzero.S Sun Nov 2 01:10:54 2008 (r184547) @@ -41,3 +41,4 @@ L1: movq %rsi,%rcx /* zero remainder by stosb ret +END(bzero) Modified: head/lib/libc/amd64/string/memcmp.S ============================================================================== --- head/lib/libc/amd64/string/memcmp.S Sun Nov 2 00:41:26 2008 (r184546) +++ head/lib/libc/amd64/string/memcmp.S Sun Nov 2 01:10:54 2008 (r184547) @@ -39,3 +39,4 @@ L6: xorl %eax,%eax /* Perform unsigned movb -1(%rsi),%dl subl %edx,%eax ret +END(memcmp) Modified: head/lib/libc/amd64/string/memset.S ============================================================================== --- head/lib/libc/amd64/string/memset.S Sun Nov 2 00:41:26 2008 (r184546) +++ head/lib/libc/amd64/string/memset.S Sun Nov 2 01:10:54 2008 (r184547) @@ -58,3 +58,4 @@ L1: rep movq %r11,%rax ret +END(memset) Modified: head/lib/libc/amd64/string/strcat.S ============================================================================== --- head/lib/libc/amd64/string/strcat.S Sun Nov 2 00:41:26 2008 (r184546) +++ head/lib/libc/amd64/string/strcat.S Sun Nov 2 01:10:54 2008 (r184547) @@ -163,3 +163,4 @@ ENTRY(strcat) .Ldone: ret +END(strcat) Modified: head/lib/libc/amd64/string/strcmp.S ============================================================================== --- head/lib/libc/amd64/string/strcmp.S Sun Nov 2 00:41:26 2008 (r184546) +++ head/lib/libc/amd64/string/strcmp.S Sun Nov 2 01:10:54 2008 (r184547) @@ -71,3 +71,4 @@ ENTRY(strcmp) movzbq %dl,%rdx subq %rdx,%rax ret +END(strcmp) Modified: head/lib/libc/amd64/string/strcpy.S ============================================================================== --- head/lib/libc/amd64/string/strcpy.S Sun Nov 2 00:41:26 2008 (r184546) +++ head/lib/libc/amd64/string/strcpy.S Sun Nov 2 01:10:54 2008 (r184547) @@ -109,3 +109,4 @@ ENTRY(strcpy) .Ldone: ret +END(strcpy) Modified: head/lib/libc/amd64/sys/brk.S ============================================================================== --- head/lib/libc/amd64/sys/brk.S Sun Nov 2 00:41:26 2008 (r184546) +++ head/lib/libc/amd64/sys/brk.S Sun Nov 2 01:10:54 2008 (r184547) @@ -43,6 +43,7 @@ __FBSDID("$FreeBSD$"); ENTRY(_brk) pushq %rdi jmp ok +END(_brk) ENTRY(brk) pushq %rdi @@ -81,3 +82,4 @@ err: #else jmp HIDENAME(cerror) #endif +END(brk) Modified: head/lib/libc/amd64/sys/exect.S ============================================================================== --- head/lib/libc/amd64/sys/exect.S Sun Nov 2 00:41:26 2008 (r184546) +++ head/lib/libc/amd64/sys/exect.S Sun Nov 2 01:10:54 2008 (r184547) @@ -53,3 +53,4 @@ ENTRY(exect) #else jmp HIDENAME(cerror) #endif +END(exect) Modified: head/lib/libc/amd64/sys/getcontext.S ============================================================================== --- head/lib/libc/amd64/sys/getcontext.S Sun Nov 2 00:41:26 2008 (r184546) +++ head/lib/libc/amd64/sys/getcontext.S Sun Nov 2 01:10:54 2008 (r184547) @@ -52,3 +52,4 @@ ENTRY(__sys_getcontext) #else jmp HIDENAME(cerror) #endif +END(__sys_getcontext) Modified: head/lib/libc/amd64/sys/pipe.S ============================================================================== --- head/lib/libc/amd64/sys/pipe.S Sun Nov 2 00:41:26 2008 (r184546) +++ head/lib/libc/amd64/sys/pipe.S Sun Nov 2 01:10:54 2008 (r184547) @@ -57,3 +57,4 @@ ENTRY(__sys_pipe) #else jmp HIDENAME(cerror) #endif +END(__sys_pipe) Modified: head/lib/libc/amd64/sys/ptrace.S ============================================================================== --- head/lib/libc/amd64/sys/ptrace.S Sun Nov 2 00:41:26 2008 (r184546) +++ head/lib/libc/amd64/sys/ptrace.S Sun Nov 2 01:10:54 2008 (r184547) @@ -57,3 +57,4 @@ err: #else jmp HIDENAME(cerror) #endif +END(ptrace) Modified: head/lib/libc/amd64/sys/reboot.S ============================================================================== --- head/lib/libc/amd64/sys/reboot.S Sun Nov 2 00:41:26 2008 (r184546) +++ head/lib/libc/amd64/sys/reboot.S Sun Nov 2 01:10:54 2008 (r184547) @@ -54,3 +54,4 @@ ENTRY(__sys_reboot) #else jmp HIDENAME(cerror) #endif +END(__sys_reboot) Modified: head/lib/libc/amd64/sys/sbrk.S ============================================================================== --- head/lib/libc/amd64/sys/sbrk.S Sun Nov 2 00:41:26 2008 (r184546) +++ head/lib/libc/amd64/sys/sbrk.S Sun Nov 2 01:10:54 2008 (r184547) @@ -85,3 +85,4 @@ err: #else jmp HIDENAME(cerror) #endif +END(sbrk) Modified: head/lib/libc/amd64/sys/setlogin.S ============================================================================== --- head/lib/libc/amd64/sys/setlogin.S Sun Nov 2 00:41:26 2008 (r184546) +++ head/lib/libc/amd64/sys/setlogin.S Sun Nov 2 01:10:54 2008 (r184547) @@ -62,3 +62,4 @@ ENTRY(__sys_setlogin) #else jmp HIDENAME(cerror) #endif +END(__sys_setlogin) Modified: head/lib/libc/amd64/sys/vfork.S ============================================================================== --- head/lib/libc/amd64/sys/vfork.S Sun Nov 2 00:41:26 2008 (r184546) +++ head/lib/libc/amd64/sys/vfork.S Sun Nov 2 01:10:54 2008 (r184547) @@ -56,3 +56,4 @@ ENTRY(__sys_vfork) #else jmp HIDENAME(cerror) #endif +END(__sys_vfork) From peter at FreeBSD.org Sat Nov 1 18:28:49 2008 From: peter at FreeBSD.org (Peter Wemm) Date: Sat Nov 1 18:28:55 2008 Subject: svn commit: r184548 - in head/lib/libc/i386: . gen stdlib string sys Message-ID: <200811020128.mA21Sl2D025187@svn.freebsd.org> Author: peter Date: Sun Nov 2 01:28:47 2008 New Revision: 184548 URL: http://svn.freebsd.org/changeset/base/184548 Log: Add missing END() macros, as per rev 184547 for amd64. The lack of these is mostly harmless, but it does upset some of valgrind's functionality. Modified: head/lib/libc/i386/SYS.h head/lib/libc/i386/gen/_ctx_start.S head/lib/libc/i386/gen/_setjmp.S head/lib/libc/i386/gen/fabs.S head/lib/libc/i386/gen/modf.S head/lib/libc/i386/gen/rfork_thread.S head/lib/libc/i386/gen/setjmp.S head/lib/libc/i386/gen/sigsetjmp.S head/lib/libc/i386/stdlib/abs.S head/lib/libc/i386/stdlib/div.S head/lib/libc/i386/stdlib/labs.S head/lib/libc/i386/stdlib/ldiv.S head/lib/libc/i386/string/bcmp.S head/lib/libc/i386/string/bcopy.S head/lib/libc/i386/string/bzero.S head/lib/libc/i386/string/ffs.S head/lib/libc/i386/string/index.S head/lib/libc/i386/string/memchr.S head/lib/libc/i386/string/memcmp.S head/lib/libc/i386/string/memset.S head/lib/libc/i386/string/rindex.S head/lib/libc/i386/string/strcat.S head/lib/libc/i386/string/strchr.S head/lib/libc/i386/string/strcmp.S head/lib/libc/i386/string/strcpy.S head/lib/libc/i386/string/strlen.S head/lib/libc/i386/string/strncmp.S head/lib/libc/i386/string/strrchr.S head/lib/libc/i386/string/swab.S head/lib/libc/i386/string/wcschr.S head/lib/libc/i386/string/wcscmp.S head/lib/libc/i386/string/wcslen.S head/lib/libc/i386/string/wmemchr.S head/lib/libc/i386/sys/Ovfork.S head/lib/libc/i386/sys/brk.S head/lib/libc/i386/sys/exect.S head/lib/libc/i386/sys/getcontext.S head/lib/libc/i386/sys/pipe.S head/lib/libc/i386/sys/ptrace.S head/lib/libc/i386/sys/reboot.S head/lib/libc/i386/sys/sbrk.S head/lib/libc/i386/sys/setlogin.S head/lib/libc/i386/sys/syscall.S Modified: head/lib/libc/i386/SYS.h ============================================================================== --- head/lib/libc/i386/SYS.h Sun Nov 2 01:10:54 2008 (r184547) +++ head/lib/libc/i386/SYS.h Sun Nov 2 01:28:47 2008 (r184548) @@ -44,13 +44,14 @@ .set CNAME(__CONCAT(_,x)),CNAME(__CONCAT(__sys_,x)); \ mov __CONCAT($SYS_,x),%eax; KERNCALL; jb 2b -#define RSYSCALL(x) SYSCALL(x); ret +#define RSYSCALL(x) SYSCALL(x); ret; END(__CONCAT(__sys_,x)) #define PSEUDO(x) 2: PIC_PROLOGUE; jmp PIC_PLT(HIDENAME(cerror)); \ ENTRY(__CONCAT(__sys_,x)); \ .weak CNAME(__CONCAT(_,x)); \ .set CNAME(__CONCAT(_,x)),CNAME(__CONCAT(__sys_,x)); \ - mov __CONCAT($SYS_,x),%eax; KERNCALL; jb 2b; ret + mov __CONCAT($SYS_,x),%eax; KERNCALL; jb 2b; ret; \ + END(__CONCAT(__sys_,x)) /* gas messes up offset -- although we don't currently need it, do for BCS */ #define LCALL(x,y) .byte 0x9a ; .long y; .word x Modified: head/lib/libc/i386/gen/_ctx_start.S ============================================================================== --- head/lib/libc/i386/gen/_ctx_start.S Sun Nov 2 01:10:54 2008 (r184547) +++ head/lib/libc/i386/gen/_ctx_start.S Sun Nov 2 01:28:47 2008 (r184548) @@ -49,3 +49,4 @@ ENTRY(_ctx_start) call PIC_PLT(_ctx_done) /* should never return */ call PIC_PLT(abort) /* fubar */ ret +END(_ctx_start) Modified: head/lib/libc/i386/gen/_setjmp.S ============================================================================== --- head/lib/libc/i386/gen/_setjmp.S Sun Nov 2 01:10:54 2008 (r184547) +++ head/lib/libc/i386/gen/_setjmp.S Sun Nov 2 01:28:47 2008 (r184548) @@ -58,6 +58,7 @@ ENTRY(_setjmp) fnstcw 24(%eax) xorl %eax,%eax ret +END(_setjmp) .weak CNAME(_longjmp) .set CNAME(_longjmp),CNAME(___longjmp) @@ -76,3 +77,4 @@ ENTRY(___longjmp) incl %eax 1: movl %ecx,0(%esp) ret +END(___longjmp) Modified: head/lib/libc/i386/gen/fabs.S ============================================================================== --- head/lib/libc/i386/gen/fabs.S Sun Nov 2 01:10:54 2008 (r184547) +++ head/lib/libc/i386/gen/fabs.S Sun Nov 2 01:28:47 2008 (r184548) @@ -40,3 +40,4 @@ ENTRY(fabs) fldl 4(%esp) fabs ret +END(fabs) Modified: head/lib/libc/i386/gen/modf.S ============================================================================== --- head/lib/libc/i386/gen/modf.S Sun Nov 2 01:10:54 2008 (r184547) +++ head/lib/libc/i386/gen/modf.S Sun Nov 2 01:28:47 2008 (r184548) @@ -82,3 +82,4 @@ ENTRY(modf) fdivp /* return +/- 0 for +/- Inf, NaN for NaN */ leave ret +END(modf) Modified: head/lib/libc/i386/gen/rfork_thread.S ============================================================================== --- head/lib/libc/i386/gen/rfork_thread.S Sun Nov 2 01:10:54 2008 (r184547) +++ head/lib/libc/i386/gen/rfork_thread.S Sun Nov 2 01:28:47 2008 (r184548) @@ -115,3 +115,4 @@ ENTRY(rfork_thread) popl %ebp PIC_PROLOGUE jmp PIC_PLT(HIDENAME(cerror)) +END(rfork_thread) Modified: head/lib/libc/i386/gen/setjmp.S ============================================================================== --- head/lib/libc/i386/gen/setjmp.S Sun Nov 2 01:10:54 2008 (r184547) +++ head/lib/libc/i386/gen/setjmp.S Sun Nov 2 01:28:47 2008 (r184548) @@ -69,6 +69,7 @@ ENTRY(setjmp) fnstcw 24(%ecx) xorl %eax,%eax ret +END(setjmp) .weak CNAME(longjmp) .set CNAME(longjmp),CNAME(__longjmp) @@ -96,3 +97,4 @@ ENTRY(__longjmp) incl %eax 1: movl %ecx,0(%esp) ret +END(__longjmp) Modified: head/lib/libc/i386/gen/sigsetjmp.S ============================================================================== --- head/lib/libc/i386/gen/sigsetjmp.S Sun Nov 2 01:10:54 2008 (r184547) +++ head/lib/libc/i386/gen/sigsetjmp.S Sun Nov 2 01:28:47 2008 (r184548) @@ -78,10 +78,11 @@ ENTRY(sigsetjmp) fnstcw 24(%ecx) xorl %eax,%eax ret +END(sigsetjmp) .weak CNAME(siglongjmp); - .set CNAME(siglongjmp),CNAME(__siglongjmp); -ENTRY(__siglongjmp); + .set CNAME(siglongjmp),CNAME(__siglongjmp) +ENTRY(__siglongjmp) movl 4(%esp),%edx cmpl $0,44(%edx) jz 2f @@ -108,3 +109,4 @@ ENTRY(__siglongjmp); incl %eax 1: movl %ecx,0(%esp) ret +END(__siglongjmp) Modified: head/lib/libc/i386/stdlib/abs.S ============================================================================== --- head/lib/libc/i386/stdlib/abs.S Sun Nov 2 01:10:54 2008 (r184547) +++ head/lib/libc/i386/stdlib/abs.S Sun Nov 2 01:28:47 2008 (r184548) @@ -44,3 +44,4 @@ ENTRY(abs) jns 1f negl %eax 1: ret +END(abs) Modified: head/lib/libc/i386/stdlib/div.S ============================================================================== --- head/lib/libc/i386/stdlib/div.S Sun Nov 2 01:10:54 2008 (r184547) +++ head/lib/libc/i386/stdlib/div.S Sun Nov 2 01:28:47 2008 (r184548) @@ -36,3 +36,4 @@ ENTRY(div) movl %eax,4(%esp) movl %edx,8(%esp) ret +END(div) Modified: head/lib/libc/i386/stdlib/labs.S ============================================================================== --- head/lib/libc/i386/stdlib/labs.S Sun Nov 2 01:10:54 2008 (r184547) +++ head/lib/libc/i386/stdlib/labs.S Sun Nov 2 01:28:47 2008 (r184548) @@ -44,3 +44,4 @@ ENTRY(labs) jns 1f negl %eax 1: ret +END(labs) Modified: head/lib/libc/i386/stdlib/ldiv.S ============================================================================== --- head/lib/libc/i386/stdlib/ldiv.S Sun Nov 2 01:10:54 2008 (r184547) +++ head/lib/libc/i386/stdlib/ldiv.S Sun Nov 2 01:28:47 2008 (r184548) @@ -39,3 +39,4 @@ ENTRY(ldiv) movl %eax,4(%esp) movl %edx,8(%esp) ret +END(ldiv) Modified: head/lib/libc/i386/string/bcmp.S ============================================================================== --- head/lib/libc/i386/string/bcmp.S Sun Nov 2 01:10:54 2008 (r184547) +++ head/lib/libc/i386/string/bcmp.S Sun Nov 2 01:28:47 2008 (r184548) @@ -61,3 +61,4 @@ L1: popl %esi popl %edi ret +END(bcmp) Modified: head/lib/libc/i386/string/bcopy.S ============================================================================== --- head/lib/libc/i386/string/bcopy.S Sun Nov 2 01:10:54 2008 (r184547) +++ head/lib/libc/i386/string/bcopy.S Sun Nov 2 01:28:47 2008 (r184548) @@ -97,3 +97,12 @@ ENTRY(bcopy) popl %esi cld ret +#ifdef MEMCOPY +END(memcpy) +#else +#ifdef MEMMOVE +END(memmove) +#else +END(bcopy) +#endif +#endif Modified: head/lib/libc/i386/string/bzero.S ============================================================================== --- head/lib/libc/i386/string/bzero.S Sun Nov 2 01:10:54 2008 (r184547) +++ head/lib/libc/i386/string/bzero.S Sun Nov 2 01:28:47 2008 (r184548) @@ -79,3 +79,4 @@ L1: rep popl %ebx popl %edi ret +END(bzero) Modified: head/lib/libc/i386/string/ffs.S ============================================================================== --- head/lib/libc/i386/string/ffs.S Sun Nov 2 01:10:54 2008 (r184547) +++ head/lib/libc/i386/string/ffs.S Sun Nov 2 01:28:47 2008 (r184548) @@ -51,3 +51,4 @@ ENTRY(ffs) .align 2 L1: xorl %eax,%eax /* clear result */ ret +END(ffs) Modified: head/lib/libc/i386/string/index.S ============================================================================== --- head/lib/libc/i386/string/index.S Sun Nov 2 01:10:54 2008 (r184547) +++ head/lib/libc/i386/string/index.S Sun Nov 2 01:28:47 2008 (r184548) @@ -61,3 +61,4 @@ L1: L2: popl %ebx ret +END(index) Modified: head/lib/libc/i386/string/memchr.S ============================================================================== --- head/lib/libc/i386/string/memchr.S Sun Nov 2 01:10:54 2008 (r184547) +++ head/lib/libc/i386/string/memchr.S Sun Nov 2 01:28:47 2008 (r184548) @@ -56,3 +56,4 @@ ENTRY(memchr) L1: xorl %eax,%eax popl %edi ret +END(memchr) Modified: head/lib/libc/i386/string/memcmp.S ============================================================================== --- head/lib/libc/i386/string/memcmp.S Sun Nov 2 01:10:54 2008 (r184547) +++ head/lib/libc/i386/string/memcmp.S Sun Nov 2 01:28:47 2008 (r184548) @@ -73,3 +73,4 @@ L6: movzbl -1(%edi),%eax /* Perform un popl %esi popl %edi ret +END(memcmp) Modified: head/lib/libc/i386/string/memset.S ============================================================================== --- head/lib/libc/i386/string/memset.S Sun Nov 2 01:10:54 2008 (r184547) +++ head/lib/libc/i386/string/memset.S Sun Nov 2 01:28:47 2008 (r184548) @@ -87,3 +87,4 @@ L1: rep popl %ebx popl %edi ret +END(memset) Modified: head/lib/libc/i386/string/rindex.S ============================================================================== --- head/lib/libc/i386/string/rindex.S Sun Nov 2 01:10:54 2008 (r184547) +++ head/lib/libc/i386/string/rindex.S Sun Nov 2 01:28:47 2008 (r184548) @@ -62,3 +62,4 @@ L2: jne L1 popl %ebx ret +END(rindex) Modified: head/lib/libc/i386/string/strcat.S ============================================================================== --- head/lib/libc/i386/string/strcat.S Sun Nov 2 01:10:54 2008 (r184547) +++ head/lib/libc/i386/string/strcat.S Sun Nov 2 01:28:47 2008 (r184548) @@ -98,3 +98,4 @@ L1: movb (%edx),%al /* unroll loop, but L2: popl %eax /* pop destination address */ popl %edi /* restore edi */ ret +END(strcat) Modified: head/lib/libc/i386/string/strchr.S ============================================================================== --- head/lib/libc/i386/string/strchr.S Sun Nov 2 01:10:54 2008 (r184547) +++ head/lib/libc/i386/string/strchr.S Sun Nov 2 01:28:47 2008 (r184548) @@ -61,3 +61,4 @@ L1: L2: popl %ebx ret +END(strchr) Modified: head/lib/libc/i386/string/strcmp.S ============================================================================== --- head/lib/libc/i386/string/strcmp.S Sun Nov 2 01:10:54 2008 (r184547) +++ head/lib/libc/i386/string/strcmp.S Sun Nov 2 01:28:47 2008 (r184548) @@ -117,3 +117,4 @@ L3: movzbl (%eax),%eax movzbl (%edx),%edx subl %edx,%eax ret +END(strcmp) Modified: head/lib/libc/i386/string/strcpy.S ============================================================================== --- head/lib/libc/i386/string/strcpy.S Sun Nov 2 01:10:54 2008 (r184547) +++ head/lib/libc/i386/string/strcpy.S Sun Nov 2 01:28:47 2008 (r184548) @@ -87,3 +87,4 @@ L1: movb (%edx),%al /* unroll loop, but jne L1 L2: popl %eax /* pop dst address */ ret +END(strcpy) Modified: head/lib/libc/i386/string/strlen.S ============================================================================== --- head/lib/libc/i386/string/strlen.S Sun Nov 2 01:10:54 2008 (r184547) +++ head/lib/libc/i386/string/strlen.S Sun Nov 2 01:28:47 2008 (r184548) @@ -51,3 +51,4 @@ ENTRY(strlen) leal -1(%ecx),%eax /* and subtracting one */ popl %edi ret +END(strlen) Modified: head/lib/libc/i386/string/strncmp.S ============================================================================== --- head/lib/libc/i386/string/strncmp.S Sun Nov 2 01:10:54 2008 (r184547) +++ head/lib/libc/i386/string/strncmp.S Sun Nov 2 01:28:47 2008 (r184548) @@ -164,3 +164,4 @@ L3: movzbl (%eax),%eax /* unsigned comp L4: xorl %eax,%eax popl %ebx ret +END(strncmp) Modified: head/lib/libc/i386/string/strrchr.S ============================================================================== --- head/lib/libc/i386/string/strrchr.S Sun Nov 2 01:10:54 2008 (r184547) +++ head/lib/libc/i386/string/strrchr.S Sun Nov 2 01:28:47 2008 (r184548) @@ -62,3 +62,4 @@ L2: jne L1 popl %ebx ret +END(strrchr) Modified: head/lib/libc/i386/string/swab.S ============================================================================== --- head/lib/libc/i386/string/swab.S Sun Nov 2 01:10:54 2008 (r184547) +++ head/lib/libc/i386/string/swab.S Sun Nov 2 01:28:47 2008 (r184548) @@ -97,3 +97,4 @@ L3: lodsw L4: popl %edi popl %esi ret +END(swab) Modified: head/lib/libc/i386/string/wcschr.S ============================================================================== --- head/lib/libc/i386/string/wcschr.S Sun Nov 2 01:10:54 2008 (r184547) +++ head/lib/libc/i386/string/wcschr.S Sun Nov 2 01:28:47 2008 (r184548) @@ -74,3 +74,4 @@ found0: popl %ebx no: popl %ebx xorl %eax,%eax ret +END(wcschr) Modified: head/lib/libc/i386/string/wcscmp.S ============================================================================== --- head/lib/libc/i386/string/wcscmp.S Sun Nov 2 01:10:54 2008 (r184547) +++ head/lib/libc/i386/string/wcscmp.S Sun Nov 2 01:28:47 2008 (r184548) @@ -77,3 +77,4 @@ no0: subl (%esi),%eax popl %esi popl %edi ret +END(wcscmp) Modified: head/lib/libc/i386/string/wcslen.S ============================================================================== --- head/lib/libc/i386/string/wcslen.S Sun Nov 2 01:10:54 2008 (r184547) +++ head/lib/libc/i386/string/wcslen.S Sun Nov 2 01:28:47 2008 (r184548) @@ -66,3 +66,4 @@ found2: incl %eax found1: incl %eax found0: popl %ebx ret +END(wcslen) Modified: head/lib/libc/i386/string/wmemchr.S ============================================================================== --- head/lib/libc/i386/string/wmemchr.S Sun Nov 2 01:10:54 2008 (r184547) +++ head/lib/libc/i386/string/wmemchr.S Sun Nov 2 01:28:47 2008 (r184548) @@ -103,3 +103,4 @@ no: xorl %eax,%eax popl %ebx popl %edi ret +END(wmemchr) Modified: head/lib/libc/i386/sys/Ovfork.S ============================================================================== --- head/lib/libc/i386/sys/Ovfork.S Sun Nov 2 01:10:54 2008 (r184547) +++ head/lib/libc/i386/sys/Ovfork.S Sun Nov 2 01:28:47 2008 (r184548) @@ -52,3 +52,4 @@ ENTRY(__sys_vfork) pushl %ecx PIC_PROLOGUE jmp PIC_PLT(HIDENAME(cerror)) +END(__sys_vfork) Modified: head/lib/libc/i386/sys/brk.S ============================================================================== --- head/lib/libc/i386/sys/brk.S Sun Nov 2 01:10:54 2008 (r184547) +++ head/lib/libc/i386/sys/brk.S Sun Nov 2 01:28:47 2008 (r184548) @@ -42,6 +42,7 @@ __FBSDID("$FreeBSD$"); .globl HIDENAME(minbrk) ENTRY(_brk) jmp ok +END(_brk) ENTRY(brk) #ifdef PIC @@ -84,3 +85,4 @@ ok: err: jmp HIDENAME(cerror) #endif +END(brk) Modified: head/lib/libc/i386/sys/exect.S ============================================================================== --- head/lib/libc/i386/sys/exect.S Sun Nov 2 01:10:54 2008 (r184547) +++ head/lib/libc/i386/sys/exect.S Sun Nov 2 01:28:47 2008 (r184548) @@ -49,3 +49,4 @@ ENTRY(exect) KERNCALL PIC_PROLOGUE jmp PIC_PLT(HIDENAME(cerror)) /* exect(file, argv, env); */ +END(exect) Modified: head/lib/libc/i386/sys/getcontext.S ============================================================================== --- head/lib/libc/i386/sys/getcontext.S Sun Nov 2 01:10:54 2008 (r184547) +++ head/lib/libc/i386/sys/getcontext.S Sun Nov 2 01:28:47 2008 (r184548) @@ -48,3 +48,4 @@ ENTRY(__sys_getcontext) 1: PIC_PROLOGUE jmp PIC_PLT(HIDENAME(cerror)) +END(__sys_getcontext) Modified: head/lib/libc/i386/sys/pipe.S ============================================================================== --- head/lib/libc/i386/sys/pipe.S Sun Nov 2 01:10:54 2008 (r184547) +++ head/lib/libc/i386/sys/pipe.S Sun Nov 2 01:28:47 2008 (r184548) @@ -44,3 +44,4 @@ SYSCALL(pipe) movl %edx,4(%ecx) movl $0,%eax ret +END(pipe) Modified: head/lib/libc/i386/sys/ptrace.S ============================================================================== --- head/lib/libc/i386/sys/ptrace.S Sun Nov 2 01:10:54 2008 (r184547) +++ head/lib/libc/i386/sys/ptrace.S Sun Nov 2 01:28:47 2008 (r184548) @@ -55,3 +55,4 @@ ENTRY(ptrace) err: PIC_PROLOGUE jmp PIC_PLT(HIDENAME(cerror)) +END(ptrace) Modified: head/lib/libc/i386/sys/reboot.S ============================================================================== --- head/lib/libc/i386/sys/reboot.S Sun Nov 2 01:10:54 2008 (r184547) +++ head/lib/libc/i386/sys/reboot.S Sun Nov 2 01:28:47 2008 (r184548) @@ -40,3 +40,4 @@ __FBSDID("$FreeBSD$"); SYSCALL(reboot) iret +END(reboot) Modified: head/lib/libc/i386/sys/sbrk.S ============================================================================== --- head/lib/libc/i386/sys/sbrk.S Sun Nov 2 01:10:54 2008 (r184547) +++ head/lib/libc/i386/sys/sbrk.S Sun Nov 2 01:28:47 2008 (r184548) @@ -88,3 +88,4 @@ back: err: jmp HIDENAME(cerror) #endif /* PIC */ +END(sbrk) Modified: head/lib/libc/i386/sys/setlogin.S ============================================================================== --- head/lib/libc/i386/sys/setlogin.S Sun Nov 2 01:10:54 2008 (r184547) +++ head/lib/libc/i386/sys/setlogin.S Sun Nov 2 01:28:47 2008 (r184548) @@ -52,3 +52,4 @@ SYSCALL(setlogin) movl $0,CNAME(_logname_valid) #endif ret /* setlogin(name) */ +END(setlogin) Modified: head/lib/libc/i386/sys/syscall.S ============================================================================== --- head/lib/libc/i386/sys/syscall.S Sun Nov 2 01:10:54 2008 (r184547) +++ head/lib/libc/i386/sys/syscall.S Sun Nov 2 01:28:47 2008 (r184548) @@ -50,3 +50,4 @@ ENTRY(syscall) 1: PIC_PROLOGUE jmp PIC_PLT(HIDENAME(cerror)) +END(syscall) From imp at FreeBSD.org Sat Nov 1 19:58:24 2008 From: imp at FreeBSD.org (Warner Losh) Date: Sat Nov 1 19:58:31 2008 Subject: svn commit: r184550 - head/sys/mips/idt Message-ID: <200811020258.mA22wOAI026856@svn.freebsd.org> Author: imp Date: Sun Nov 2 02:58:24 2008 New Revision: 184550 URL: http://svn.freebsd.org/changeset/base/184550 Log: Remove cardbus attachment. It likely was a cut-n-paste left over from whatever template was used to create this driver. It is not necessary, and wouldn't work anyway since (a) this device will never be in a cardbus tin-can and (b) the driver isn't even PCI, but instead a built-in NIC on the IDT RC32434 on its internal bus. Modified: head/sys/mips/idt/if_kr.c Modified: head/sys/mips/idt/if_kr.c ============================================================================== --- head/sys/mips/idt/if_kr.c Sun Nov 2 02:56:16 2008 (r184549) +++ head/sys/mips/idt/if_kr.c Sun Nov 2 02:58:24 2008 (r184550) @@ -139,7 +139,6 @@ static driver_t kr_driver = { static devclass_t kr_devclass; DRIVER_MODULE(kr, obio, kr_driver, kr_devclass, 0, 0); -DRIVER_MODULE(kr, cardbus, kr_driver, kr_devclass, 0, 0); DRIVER_MODULE(miibus, kr, miibus_driver, miibus_devclass, 0, 0); static int From imp at FreeBSD.org Sat Nov 1 20:00:37 2008 From: imp at FreeBSD.org (Warner Losh) Date: Sat Nov 1 20:00:42 2008 Subject: svn commit: r184551 - head/sys/dev/usb Message-ID: <200811020300.mA230aPT026951@svn.freebsd.org> Author: imp Date: Sun Nov 2 03:00:36 2008 New Revision: 184551 URL: http://svn.freebsd.org/changeset/base/184551 Log: Merge some minor deltas from p4 newcard tree: (1) Belkin F5D7050_V4000 was also sold as 'Ativa 802.11g wireless card' (document) (2) Add HP Office Jet 4215 Modified: head/sys/dev/usb/usbdevs Modified: head/sys/dev/usb/usbdevs ============================================================================== --- head/sys/dev/usb/usbdevs Sun Nov 2 02:58:24 2008 (r184550) +++ head/sys/dev/usb/usbdevs Sun Nov 2 03:00:36 2008 (r184551) @@ -944,6 +944,7 @@ product BELKIN F5D5055 0x5055 F5D5055 product BELKIN F5D7050 0x7050 F5D7050 Wireless Adapter product BELKIN F5D7051 0x7051 F5D7051 54g USB Network Adapter product BELKIN F5D7050A 0x705a F5D7050A Wireless Adapter +/* Also sold as 'Ativa 802.11g wireless card' */ product BELKIN F5D7050_V4000 0x705c F5D7050 v4000 Wireless Adapter product BELKIN F5D9050V3 0x905b F5D9050 ver 3 Wireless Adapter product BELKIN2 F5U002 0x0002 F5U002 Parallel printer @@ -1424,6 +1425,7 @@ product HP P2000U 0x1801 Inkjet P-2000U product HP 640C 0x2004 DeskJet 640c product HP 4670V 0x3005 ScanJet 4670v product HP P1100 0x3102 Photosmart P1100 +product HP OJ4215 0x3d11 OfficeJet 4215 product HP HN210E 0x811c Ethernet HN210E product HP2 C500 0x6002 PhotoSmart C500 From imp at FreeBSD.org Sat Nov 1 20:02:56 2008 From: imp at FreeBSD.org (Warner Losh) Date: Sat Nov 1 20:03:04 2008 Subject: svn commit: r184552 - head/sys/geom/part Message-ID: <200811020302.mA232uDa027133@svn.freebsd.org> Author: imp Date: Sun Nov 2 03:02:56 2008 New Revision: 184552 URL: http://svn.freebsd.org/changeset/base/184552 Log: Add support for reading Tivo Series 1 partitioning. This likely needs a little refinement, but is good enough to commit as is. # Should look to see if I should move swab(3) into the kernel or just # provide the unoptimized routine here. Reviewed by: marcel@ Modified: head/sys/geom/part/g_part_apm.c Modified: head/sys/geom/part/g_part_apm.c ============================================================================== --- head/sys/geom/part/g_part_apm.c Sun Nov 2 03:00:36 2008 (r184551) +++ head/sys/geom/part/g_part_apm.c Sun Nov 2 03:02:56 2008 (r184552) @@ -50,6 +50,7 @@ struct g_part_apm_table { struct g_part_table base; struct apm_ddr ddr; struct apm_ent self; + int tivo_series1; }; struct g_part_apm_entry { @@ -99,6 +100,19 @@ static struct g_part_scheme g_part_apm_s }; G_PART_SCHEME_DECLARE(g_part_apm); +static void +swab(char *buf, size_t bufsz) +{ + int i; + char ch; + + for (i = 0; i < bufsz; i += 2) { + ch = buf[i]; + buf[i] = buf[i + 1]; + buf[i + 1] = ch; + } +} + static int apm_parse_type(const char *type, char *buf, size_t bufsz) { @@ -143,7 +157,8 @@ apm_parse_type(const char *type, char *b } static int -apm_read_ent(struct g_consumer *cp, uint32_t blk, struct apm_ent *ent) +apm_read_ent(struct g_consumer *cp, uint32_t blk, struct apm_ent *ent, + int tivo_series1) { struct g_provider *pp; char *buf; @@ -153,6 +168,8 @@ apm_read_ent(struct g_consumer *cp, uint buf = g_read_data(cp, pp->sectorsize * blk, pp->sectorsize, &error); if (buf == NULL) return (error); + if (tivo_series1) + swab(buf, pp->sectorsize); ent->ent_sig = be16dec(buf); ent->ent_pmblkcnt = be32dec(buf + 4); ent->ent_start = be32dec(buf + 8); @@ -316,6 +333,7 @@ g_part_apm_probe(struct g_part_table *ba return (ENXIO); table = (struct g_part_apm_table *)basetable; + table->tivo_series1 = 0; pp = cp->provider; /* Sanity-check the provider. */ @@ -323,21 +341,38 @@ g_part_apm_probe(struct g_part_table *ba return (ENOSPC); /* Check that there's a Driver Descriptor Record (DDR). */ - /* XXX Tivo APM drives do not have a DDR */ buf = g_read_data(cp, 0L, pp->sectorsize, &error); if (buf == NULL) return (error); - table->ddr.ddr_sig = be16dec(buf); - table->ddr.ddr_blksize = be16dec(buf + 2); - table->ddr.ddr_blkcount = be32dec(buf + 4); - g_free(buf); - if (table->ddr.ddr_sig != APM_DDR_SIG) - return (ENXIO); - if (table->ddr.ddr_blksize != pp->sectorsize) - return (ENXIO); + if (be16dec(buf) == be16toh(APM_DDR_SIG)) { + /* Normal Apple DDR */ + table->ddr.ddr_sig = be16dec(buf); + table->ddr.ddr_blksize = be16dec(buf + 2); + table->ddr.ddr_blkcount = be32dec(buf + 4); + g_free(buf); + if (table->ddr.ddr_blksize != pp->sectorsize) + return (ENXIO); + } else { + /* + * Check for Tivo drives, which have no DDR and a different + * signature. Those whose first two bytes are 14 92 are + * Series 2 drives, and aren't supported. Those that start + * with 92 14 are series 1 drives and are supported. + */ + if (be16dec(buf) != 0x9214) { + /* If this is 0x1492 it could be a series 2 drive */ + g_free(buf); + return (ENXIO); + } + table->ddr.ddr_sig = APM_DDR_SIG; /* XXX */ + table->ddr.ddr_blksize = pp->sectorsize; /* XXX */ + table->ddr.ddr_blkcount = pp->mediasize / pp->sectorsize;/* XXX */ + table->tivo_series1 = 1; + g_free(buf); + } /* Check that there's a Partition Map. */ - error = apm_read_ent(cp, 1, &table->self); + error = apm_read_ent(cp, 1, &table->self, table->tivo_series1); if (error) return (error); if (table->self.ent_sig != APM_ENT_SIG) @@ -364,7 +399,7 @@ g_part_apm_read(struct g_part_table *bas basetable->gpt_entries = table->self.ent_pmblkcnt - 1; for (index = table->self.ent_pmblkcnt - 1; index > 0; index--) { - error = apm_read_ent(cp, index + 1, &ent); + error = apm_read_ent(cp, index + 1, &ent, table->tivo_series1); if (error) continue; if (!strcmp(ent.ent_type, APM_ENT_TYPE_UNUSED)) @@ -414,6 +449,11 @@ g_part_apm_write(struct g_part_table *ba int error, index; table = (struct g_part_apm_table *)basetable; + /* + * Tivo Series 1 disk partitions are currently read-only. + */ + if (table->tivo_series1) + return (EOPNOTSUPP); bzero(buf, sizeof(buf)); /* Write the DDR and 'self' entry only when we're newly created. */ From attilio at FreeBSD.org Sun Nov 2 02:15:43 2008 From: attilio at FreeBSD.org (Attilio Rao) Date: Sun Nov 2 02:15:50 2008 Subject: svn commit: r184554 - in head/sys: geom/journal gnu/fs/ext2fs kern nfsclient sys ufs/ffs ufs/ufs Message-ID: <200811021015.mA2AFgim036178@svn.freebsd.org> Author: attilio Date: Sun Nov 2 10:15:42 2008 New Revision: 184554 URL: http://svn.freebsd.org/changeset/base/184554 Log: Improve VFS locking: - Implement real draining for vfs consumers by not relying on the mnt_lock and using instead a refcount in order to keep track of lock requesters. - Due to the change above, remove the mnt_lock lockmgr because it is now useless. - Due to the change above, vfs_busy() is no more linked to a lockmgr. Change so its KPI by removing the interlock argument and defining 2 new flags for it: MBF_NOWAIT which basically replaces the LK_NOWAIT of the old version (which was unlinked from the lockmgr alredy) and MBF_MNTLSTLOCK which provides the ability to drop the mountlist_mtx once the mnt interlock is held (ability still desired by most consumers). - The stub used into vfs_mount_destroy(), that allows to override the mnt_ref if running for more than 3 seconds, make it totally useless. Remove it as it was thought to work into older versions. If a problem of "refcount held never going away" should appear, we will need to fix properly instead than trust on such hackish solution. - Fix a bug where returning (with an error) from dounmount() was still leaving the MNTK_MWAIT flag on even if it the waiters were actually woken up. Just a place in vfs_mount_destroy() is left because it is going to recycle the structure in any case, so it doesn't matter. - Remove the markercnt refcount as it is useless. This patch modifies VFS ABI and breaks KPI for vfs_busy() so manpages and __FreeBSD_version will be modified accordingly. Discussed with: kib Tested by: pho Modified: head/sys/geom/journal/g_journal.c head/sys/gnu/fs/ext2fs/ext2_vfsops.c head/sys/kern/vfs_lookup.c head/sys/kern/vfs_mount.c head/sys/kern/vfs_subr.c head/sys/kern/vfs_syscalls.c head/sys/kern/vfs_vnops.c head/sys/nfsclient/nfs_socket.c head/sys/nfsclient/nfs_vfsops.c head/sys/sys/mount.h head/sys/ufs/ffs/ffs_softdep.c head/sys/ufs/ufs/ufs_vfsops.c Modified: head/sys/geom/journal/g_journal.c ============================================================================== --- head/sys/geom/journal/g_journal.c Sun Nov 2 06:40:33 2008 (r184553) +++ head/sys/geom/journal/g_journal.c Sun Nov 2 10:15:42 2008 (r184554) @@ -2879,7 +2879,7 @@ g_journal_do_switch(struct g_class *clas desc = g_journal_find_desc(mp->mnt_stat.f_fstypename); if (desc == NULL) continue; - if (vfs_busy(mp, LK_NOWAIT, &mountlist_mtx)) + if (vfs_busy(mp, MBF_NOWAIT | MBF_MNTLSTLOCK)) continue; /* mtx_unlock(&mountlist_mtx) was done inside vfs_busy() */ Modified: head/sys/gnu/fs/ext2fs/ext2_vfsops.c ============================================================================== --- head/sys/gnu/fs/ext2fs/ext2_vfsops.c Sun Nov 2 06:40:33 2008 (r184553) +++ head/sys/gnu/fs/ext2fs/ext2_vfsops.c Sun Nov 2 10:15:42 2008 (r184554) @@ -171,7 +171,7 @@ ext2_mount(mp, td) flags = WRITECLOSE; if (mp->mnt_flag & MNT_FORCE) flags |= FORCECLOSE; - if (vfs_busy(mp, LK_NOWAIT, 0)) + if (vfs_busy(mp, MBF_NOWAIT)) return (EBUSY); error = ext2_flushfiles(mp, flags, td); vfs_unbusy(mp); Modified: head/sys/kern/vfs_lookup.c ============================================================================== --- head/sys/kern/vfs_lookup.c Sun Nov 2 06:40:33 2008 (r184553) +++ head/sys/kern/vfs_lookup.c Sun Nov 2 10:15:42 2008 (r184554) @@ -684,7 +684,7 @@ unionlookup: */ while (dp->v_type == VDIR && (mp = dp->v_mountedhere) && (cnp->cn_flags & NOCROSSMOUNT) == 0) { - if (vfs_busy(mp, 0, 0)) + if (vfs_busy(mp, 0)) continue; vput(dp); VFS_UNLOCK_GIANT(vfslocked); Modified: head/sys/kern/vfs_mount.c ============================================================================== --- head/sys/kern/vfs_mount.c Sun Nov 2 06:40:33 2008 (r184553) +++ head/sys/kern/vfs_mount.c Sun Nov 2 10:15:42 2008 (r184554) @@ -450,7 +450,6 @@ mount_init(void *mem, int size, int flag mp = (struct mount *)mem; mtx_init(&mp->mnt_mtx, "struct mount mtx", NULL, MTX_DEF); - lockinit(&mp->mnt_lock, PVFS, "vfslock", 0, 0); lockinit(&mp->mnt_explock, PVFS, "explock", 0, 0); return (0); } @@ -462,7 +461,6 @@ mount_fini(void *mem, int size) mp = (struct mount *)mem; lockdestroy(&mp->mnt_explock); - lockdestroy(&mp->mnt_lock); mtx_destroy(&mp->mnt_mtx); } @@ -481,7 +479,7 @@ vfs_mount_alloc(struct vnode *vp, struct TAILQ_INIT(&mp->mnt_nvnodelist); mp->mnt_nvnodelistsize = 0; mp->mnt_ref = 0; - (void) vfs_busy(mp, LK_NOWAIT, 0); + (void) vfs_busy(mp, MBF_NOWAIT); mp->mnt_op = vfsp->vfc_vfsops; mp->mnt_vfc = vfsp; vfsp->vfc_refcount++; /* XXX Unlocked */ @@ -507,19 +505,10 @@ vfs_mount_alloc(struct vnode *vp, struct void vfs_mount_destroy(struct mount *mp) { - int i; MNT_ILOCK(mp); - for (i = 0; mp->mnt_ref && i < 3; i++) - msleep(mp, MNT_MTX(mp), PVFS, "mntref", hz); - /* - * This will always cause a 3 second delay in rebooting due to - * refs on the root mountpoint that never go away. Most of these - * are held by init which never exits. - */ - if (i == 3 && (!rebooting || bootverbose)) - printf("Mount point %s had %d dangling refs\n", - mp->mnt_stat.f_mntonname, mp->mnt_ref); + while (mp->mnt_ref) + msleep(mp, MNT_MTX(mp), PVFS, "mntref", 0); if (mp->mnt_holdcnt != 0) { printf("Waiting for mount point to be unheld\n"); while (mp->mnt_holdcnt != 0) { @@ -928,7 +917,7 @@ vfs_domount( vput(vp); return (error); } - if (vfs_busy(mp, LK_NOWAIT, 0)) { + if (vfs_busy(mp, MBF_NOWAIT)) { vput(vp); return (EBUSY); } @@ -1245,19 +1234,31 @@ dounmount(mp, flags, td) /* Allow filesystems to detect that a forced unmount is in progress. */ if (flags & MNT_FORCE) mp->mnt_kern_flag |= MNTK_UNMOUNTF; - error = lockmgr(&mp->mnt_lock, LK_DRAIN | LK_INTERLOCK | - ((flags & MNT_FORCE) ? 0 : LK_NOWAIT), MNT_MTX(mp)); - if (error) { - MNT_ILOCK(mp); - mp->mnt_kern_flag &= ~(MNTK_UNMOUNT | MNTK_NOINSMNTQ | - MNTK_UNMOUNTF); - if (mp->mnt_kern_flag & MNTK_MWAIT) - wakeup(mp); - MNT_IUNLOCK(mp); - if (coveredvp) - VOP_UNLOCK(coveredvp, 0); - return (error); + error = 0; + if (mp->mnt_lockref) { + if (flags & MNT_FORCE) { + mp->mnt_kern_flag &= ~(MNTK_UNMOUNT | MNTK_NOINSMNTQ | + MNTK_UNMOUNTF); + if (mp->mnt_kern_flag & MNTK_MWAIT) { + mp->mnt_kern_flag &= ~MNTK_MWAIT; + wakeup(mp); + } + MNT_IUNLOCK(mp); + if (coveredvp) + VOP_UNLOCK(coveredvp, 0); + return (EBUSY); + } + mp->mnt_kern_flag |= MNTK_DRAINING; + error = msleep(&mp->mnt_lockref, MNT_MTX(mp), PVFS, + "mount drain", 0); } + MNT_IUNLOCK(mp); + KASSERT(mp->mnt_lockref == 0, + ("%s: invalid lock refcount in the drain path @ %s:%d", + __func__, __FILE__, __LINE__)); + KASSERT(error == 0, + ("%s: invalid return value for msleep in the drain path @ %s:%d", + __func__, __FILE__, __LINE__)); vn_start_write(NULL, &mp, V_WAIT); if (mp->mnt_flag & MNT_EXPUBLIC) @@ -1321,9 +1322,10 @@ dounmount(mp, flags, td) mp->mnt_flag |= async_flag; if ((mp->mnt_flag & MNT_ASYNC) != 0 && mp->mnt_noasync == 0) mp->mnt_kern_flag |= MNTK_ASYNC; - lockmgr(&mp->mnt_lock, LK_RELEASE, NULL); - if (mp->mnt_kern_flag & MNTK_MWAIT) + if (mp->mnt_kern_flag & MNTK_MWAIT) { + mp->mnt_kern_flag &= ~MNTK_MWAIT; wakeup(mp); + } MNT_IUNLOCK(mp); if (coveredvp) VOP_UNLOCK(coveredvp, 0); @@ -1337,7 +1339,6 @@ dounmount(mp, flags, td) vput(coveredvp); } vfs_event_signal(NULL, VQ_UNMOUNT, 0); - lockmgr(&mp->mnt_lock, LK_RELEASE, NULL); vfs_mount_destroy(mp); return (0); } @@ -2070,7 +2071,6 @@ __mnt_vnode_first(struct vnode **mvp, st wakeup(&mp->mnt_holdcnt); return (NULL); } - mp->mnt_markercnt++; (*mvp)->v_mount = mp; TAILQ_INSERT_AFTER(&mp->mnt_nvnodelist, vp, *mvp, v_nmntvnodes); return (vp); @@ -2093,7 +2093,6 @@ __mnt_vnode_markerfree(struct vnode **mv MNT_ILOCK(mp); *mvp = NULL; - mp->mnt_markercnt--; mp->mnt_holdcnt--; if (mp->mnt_holdcnt == 0 && mp->mnt_holdcntwaiters != 0) wakeup(&mp->mnt_holdcnt); Modified: head/sys/kern/vfs_subr.c ============================================================================== --- head/sys/kern/vfs_subr.c Sun Nov 2 06:40:33 2008 (r184553) +++ head/sys/kern/vfs_subr.c Sun Nov 2 10:15:42 2008 (r184554) @@ -335,42 +335,36 @@ SYSINIT(vfs, SI_SUB_VFS, SI_ORDER_FIRST, /* * Mark a mount point as busy. Used to synchronize access and to delay - * unmounting. Interlock is not released on failure. + * unmounting. Eventually, mountlist_mtx is not released on failure. */ int -vfs_busy(struct mount *mp, int flags, struct mtx *interlkp) +vfs_busy(struct mount *mp, int flags) { - int lkflags; + + MPASS((flags & ~MBF_MASK) == 0); MNT_ILOCK(mp); MNT_REF(mp); if (mp->mnt_kern_flag & MNTK_UNMOUNT) { - if (flags & LK_NOWAIT) { + if (flags & MBF_NOWAIT) { MNT_REL(mp); MNT_IUNLOCK(mp); return (ENOENT); } - if (interlkp) - mtx_unlock(interlkp); + if (flags & MBF_MNTLSTLOCK) + mtx_unlock(&mountlist_mtx); mp->mnt_kern_flag |= MNTK_MWAIT; - /* - * Since all busy locks are shared except the exclusive - * lock granted when unmounting, the only place that a - * wakeup needs to be done is at the release of the - * exclusive lock at the end of dounmount. - */ msleep(mp, MNT_MTX(mp), PVFS, "vfs_busy", 0); MNT_REL(mp); MNT_IUNLOCK(mp); - if (interlkp) - mtx_lock(interlkp); + if (flags & MBF_MNTLSTLOCK) + mtx_lock(&mountlist_mtx); return (ENOENT); } - if (interlkp) - mtx_unlock(interlkp); - lkflags = LK_SHARED | LK_INTERLOCK | LK_NOWAIT; - if (lockmgr(&mp->mnt_lock, lkflags, MNT_MTX(mp))) - panic("vfs_busy: unexpected lock failure"); + if (flags & MBF_MNTLSTLOCK) + mtx_unlock(&mountlist_mtx); + mp->mnt_lockref++; + MNT_IUNLOCK(mp); return (0); } @@ -381,8 +375,15 @@ void vfs_unbusy(struct mount *mp) { - lockmgr(&mp->mnt_lock, LK_RELEASE, NULL); - vfs_rel(mp); + MNT_ILOCK(mp); + MNT_REL(mp); + mp->mnt_lockref--; + if (mp->mnt_lockref == 0 && (mp->mnt_kern_flag & MNTK_DRAINING) != 0) { + MPASS(mp->mnt_kern_flag & MNTK_UNMOUNT); + mp->mnt_kern_flag &= ~MNTK_DRAINING; + wakeup(&mp->mnt_lockref); + } + MNT_IUNLOCK(mp); } /* @@ -747,7 +748,7 @@ vnlru_proc(void) mtx_lock(&mountlist_mtx); for (mp = TAILQ_FIRST(&mountlist); mp != NULL; mp = nmp) { int vfsunlocked; - if (vfs_busy(mp, LK_NOWAIT, &mountlist_mtx)) { + if (vfs_busy(mp, MBF_NOWAIT | MBF_MNTLSTLOCK)) { nmp = TAILQ_NEXT(mp, mnt_list); continue; } @@ -2837,7 +2838,6 @@ DB_SHOW_COMMAND(mount, db_show_mount) db_printf(" mnt_maxsymlinklen = %d\n", mp->mnt_maxsymlinklen); db_printf(" mnt_iosize_max = %d\n", mp->mnt_iosize_max); db_printf(" mnt_hashseed = %u\n", mp->mnt_hashseed); - db_printf(" mnt_markercnt = %d\n", mp->mnt_markercnt); db_printf(" mnt_holdcnt = %d\n", mp->mnt_holdcnt); db_printf(" mnt_holdcntwaiters = %d\n", mp->mnt_holdcntwaiters); db_printf(" mnt_secondary_writes = %d\n", mp->mnt_secondary_writes); @@ -2999,7 +2999,7 @@ sysctl_vnode(SYSCTL_HANDLER_ARGS) n = 0; mtx_lock(&mountlist_mtx); TAILQ_FOREACH(mp, &mountlist, mnt_list) { - if (vfs_busy(mp, LK_NOWAIT, &mountlist_mtx)) + if (vfs_busy(mp, MBF_NOWAIT | MBF_MNTLSTLOCK)) continue; MNT_ILOCK(mp); TAILQ_FOREACH(vp, &mp->mnt_nvnodelist, v_nmntvnodes) { @@ -3361,7 +3361,7 @@ sync_fsync(struct vop_fsync_args *ap) * not already on the sync list. */ mtx_lock(&mountlist_mtx); - if (vfs_busy(mp, LK_EXCLUSIVE | LK_NOWAIT, &mountlist_mtx) != 0) { + if (vfs_busy(mp, MBF_NOWAIT | MBF_MNTLSTLOCK) != 0) { mtx_unlock(&mountlist_mtx); return (0); } Modified: head/sys/kern/vfs_syscalls.c ============================================================================== --- head/sys/kern/vfs_syscalls.c Sun Nov 2 06:40:33 2008 (r184553) +++ head/sys/kern/vfs_syscalls.c Sun Nov 2 10:15:42 2008 (r184554) @@ -124,7 +124,7 @@ sync(td, uap) mtx_lock(&mountlist_mtx); for (mp = TAILQ_FIRST(&mountlist); mp != NULL; mp = nmp) { - if (vfs_busy(mp, LK_NOWAIT, &mountlist_mtx)) { + if (vfs_busy(mp, MBF_NOWAIT | MBF_MNTLSTLOCK)) { nmp = TAILQ_NEXT(mp, mnt_list); continue; } @@ -197,7 +197,7 @@ quotactl(td, uap) vfslocked = NDHASGIANT(&nd); NDFREE(&nd, NDF_ONLY_PNBUF); mp = nd.ni_vp->v_mount; - if ((error = vfs_busy(mp, 0, NULL))) { + if ((error = vfs_busy(mp, 0))) { vrele(nd.ni_vp); VFS_UNLOCK_GIANT(vfslocked); return (error); @@ -479,7 +479,7 @@ kern_getfsstat(struct thread *td, struct continue; } #endif - if (vfs_busy(mp, LK_NOWAIT, &mountlist_mtx)) { + if (vfs_busy(mp, MBF_NOWAIT | MBF_MNTLSTLOCK)) { nmp = TAILQ_NEXT(mp, mnt_list); continue; } @@ -741,7 +741,7 @@ fchdir(td, uap) error = change_dir(vp, td); while (!error && (mp = vp->v_mountedhere) != NULL) { int tvfslocked; - if (vfs_busy(mp, 0, 0)) + if (vfs_busy(mp, 0)) continue; tvfslocked = VFS_LOCK_GIANT(mp); error = VFS_ROOT(mp, LK_EXCLUSIVE, &tdp, td); Modified: head/sys/kern/vfs_vnops.c ============================================================================== --- head/sys/kern/vfs_vnops.c Sun Nov 2 06:40:33 2008 (r184553) +++ head/sys/kern/vfs_vnops.c Sun Nov 2 10:15:42 2008 (r184554) @@ -957,9 +957,18 @@ vn_start_write(vp, mpp, flags) } if ((mp = *mpp) == NULL) return (0); + + /* + * VOP_GETWRITEMOUNT() returns with the mp refcount held through + * a vfs_ref(). + * As long as a vnode is not provided we need to acquire a + * refcount for the provided mountpoint too, in order to + * emulate a vfs_ref(). + */ MNT_ILOCK(mp); if (vp == NULL) MNT_REF(mp); + /* * Check on status of suspension. */ @@ -1021,6 +1030,14 @@ vn_start_secondary_write(vp, mpp, flags) */ if ((mp = *mpp) == NULL) return (0); + + /* + * VOP_GETWRITEMOUNT() returns with the mp refcount held through + * a vfs_ref(). + * As long as a vnode is not provided we need to acquire a + * refcount for the provided mountpoint too, in order to + * emulate a vfs_ref(). + */ MNT_ILOCK(mp); if (vp == NULL) MNT_REF(mp); Modified: head/sys/nfsclient/nfs_socket.c ============================================================================== --- head/sys/nfsclient/nfs_socket.c Sun Nov 2 06:40:33 2008 (r184553) +++ head/sys/nfsclient/nfs_socket.c Sun Nov 2 10:15:42 2008 (r184554) @@ -1429,8 +1429,8 @@ nfs_timer(void *arg) /* * Terminate request if force-unmount in progress. * Note that NFS could have vfs_busy'ed the mount, - * causing the unmount to wait for the mnt_lock, making - * this bit of logic necessary. + * causing the unmount to wait and making this bit + * of logic necessary. */ if (rep->r_nmp->nm_mountp->mnt_kern_flag & MNTK_UNMOUNTF) { nfs_softterm(rep); Modified: head/sys/nfsclient/nfs_vfsops.c ============================================================================== --- head/sys/nfsclient/nfs_vfsops.c Sun Nov 2 06:40:33 2008 (r184553) +++ head/sys/nfsclient/nfs_vfsops.c Sun Nov 2 10:15:42 2008 (r184554) @@ -258,7 +258,7 @@ nfs_statfs(struct mount *mp, struct stat #ifndef nolint sfp = NULL; #endif - error = vfs_busy(mp, LK_NOWAIT, NULL); + error = vfs_busy(mp, MBF_NOWAIT); if (error) return (error); error = nfs_nget(mp, (nfsfh_t *)nmp->nm_fh, nmp->nm_fhsize, &np, LK_EXCLUSIVE); Modified: head/sys/sys/mount.h ============================================================================== --- head/sys/sys/mount.h Sun Nov 2 06:40:33 2008 (r184553) +++ head/sys/sys/mount.h Sun Nov 2 10:15:42 2008 (r184554) @@ -142,13 +142,11 @@ struct vfsopt; * Lock reference: * m - mountlist_mtx * i - interlock - * l - mnt_lock * * Unmarked fields are considered stable as long as a ref is held. * */ struct mount { - struct lock mnt_lock; /* mount structure lock */ struct mtx mnt_mtx; /* mount structure interlock */ int mnt_gen; /* struct mount generation */ #define mnt_startzero mnt_list @@ -175,7 +173,7 @@ struct mount { struct netexport *mnt_export; /* export list */ struct label *mnt_label; /* MAC label for the fs */ u_int mnt_hashseed; /* Random seed for vfs_hash */ - int mnt_markercnt; /* marker vnodes in use */ + int mnt_lockref; /* (i) Lock reference count */ int mnt_holdcnt; /* hold count */ int mnt_holdcntwaiters; /* waits on hold count */ int mnt_secondary_writes; /* (i) # of secondary writes */ @@ -319,6 +317,7 @@ void __mnt_vnode_markerfree(str #define MNTK_ASYNC 0x00000002 /* filtered async flag */ #define MNTK_SOFTDEP 0x00000004 /* async disabled by softdep */ #define MNTK_NOINSMNTQ 0x00000008 /* insmntque is not allowed */ +#define MNTK_DRAINING 0x00000010 /* lock draining is happening */ #define MNTK_UNMOUNT 0x01000000 /* unmount in progress */ #define MNTK_MWAIT 0x02000000 /* waiting for unmount to finish */ #define MNTK_SUSPEND 0x08000000 /* request write suspension */ @@ -506,6 +505,13 @@ struct uio; #ifdef _KERNEL +/* + * vfs_busy specific flags and mask. + */ +#define MBF_NOWAIT 0x01 +#define MBF_MNTLSTLOCK 0x02 +#define MBF_MASK (MBF_NOWAIT | MBF_MNTLSTLOCK) + #ifdef MALLOC_DECLARE MALLOC_DECLARE(M_MOUNT); #endif @@ -686,7 +692,7 @@ int vfs_scanopt(struct vfsoptlist *opts, int vfs_setpublicfs /* set publicly exported fs */ (struct mount *, struct netexport *, struct export_args *); void vfs_msync(struct mount *, int); -int vfs_busy(struct mount *, int, struct mtx *); +int vfs_busy(struct mount *, int); int vfs_export /* process mount export info */ (struct mount *, struct export_args *); int vfs_allocate_syncvnode(struct mount *); Modified: head/sys/ufs/ffs/ffs_softdep.c ============================================================================== --- head/sys/ufs/ffs/ffs_softdep.c Sun Nov 2 06:40:33 2008 (r184553) +++ head/sys/ufs/ffs/ffs_softdep.c Sun Nov 2 10:15:42 2008 (r184554) @@ -745,7 +745,7 @@ softdep_flush(void) nmp = TAILQ_NEXT(mp, mnt_list); if ((mp->mnt_flag & MNT_SOFTDEP) == 0) continue; - if (vfs_busy(mp, LK_NOWAIT, &mountlist_mtx)) + if (vfs_busy(mp, MBF_NOWAIT | MBF_MNTLSTLOCK)) continue; vfslocked = VFS_LOCK_GIANT(mp); softdep_process_worklist(mp, 0); Modified: head/sys/ufs/ufs/ufs_vfsops.c ============================================================================== --- head/sys/ufs/ufs/ufs_vfsops.c Sun Nov 2 06:40:33 2008 (r184553) +++ head/sys/ufs/ufs/ufs_vfsops.c Sun Nov 2 10:15:42 2008 (r184554) @@ -118,7 +118,7 @@ ufs_quotactl(mp, cmds, id, arg, td) if ((u_int)type >= MAXQUOTAS) return (EINVAL); - if (vfs_busy(mp, LK_NOWAIT, 0)) + if (vfs_busy(mp, MBF_NOWAIT)) return (0); switch (cmd) { From attilio at FreeBSD.org Sun Nov 2 02:20:19 2008 From: attilio at FreeBSD.org (Attilio Rao) Date: Sun Nov 2 02:20:31 2008 Subject: svn commit: r184555 - head/sys/sys Message-ID: <200811021020.mA2AKJGx036298@svn.freebsd.org> Author: attilio Date: Sun Nov 2 10:20:18 2008 New Revision: 184555 URL: http://svn.freebsd.org/changeset/base/184555 Log: Bump __FreeBSD_version in order to reflect vfs_busy() prototype changing and its flags (MBF_NOWAIT, MBF_MNTLSTLOCK) introduction. Modified: head/sys/sys/param.h Modified: head/sys/sys/param.h ============================================================================== --- head/sys/sys/param.h Sun Nov 2 10:15:42 2008 (r184554) +++ head/sys/sys/param.h Sun Nov 2 10:20:18 2008 (r184555) @@ -57,7 +57,7 @@ * is created, otherwise 1. */ #undef __FreeBSD_version -#define __FreeBSD_version 800052 /* Master, propagated to newvers */ +#define __FreeBSD_version 800053 /* Master, propagated to newvers */ #ifndef LOCORE #include From bzeeb-lists at lists.zabbadoz.net Sun Nov 2 02:25:11 2008 From: bzeeb-lists at lists.zabbadoz.net (Bjoern A. Zeeb) Date: Sun Nov 2 02:25:17 2008 Subject: svn commit: r184554 - in head/sys: geom/journal gnu/fs/ext2fs kern nfsclient sys ufs/ffs ufs/ufs In-Reply-To: <200811021015.mA2AFgim036178@svn.freebsd.org> References: <200811021015.mA2AFgim036178@svn.freebsd.org> Message-ID: <20081102102108.B41609@maildrop.int.zabbadoz.net> On Sun, 2 Nov 2008, Attilio Rao wrote: > Author: attilio > Date: Sun Nov 2 10:15:42 2008 > New Revision: 184554 > URL: http://svn.freebsd.org/changeset/base/184554 > > Log: > Improve VFS locking: > - Implement real draining for vfs consumers by not relying on the > mnt_lock and using instead a refcount in order to keep track of lock > requesters. > - Due to the change above, remove the mnt_lock lockmgr because it is now > useless. > - Due to the change above, vfs_busy() is no more linked to a lockmgr. > Change so its KPI by removing the interlock argument and defining 2 new > flags for it: MBF_NOWAIT which basically replaces the LK_NOWAIT of the > old version (which was unlinked from the lockmgr alredy) and > MBF_MNTLSTLOCK which provides the ability to drop the mountlist_mtx > once the mnt interlock is held (ability still desired by most consumers). > - The stub used into vfs_mount_destroy(), that allows to override the > mnt_ref if running for more than 3 seconds, make it totally useless. > Remove it as it was thought to work into older versions. > If a problem of "refcount held never going away" should appear, we will > need to fix properly instead than trust on such hackish solution. > - Fix a bug where returning (with an error) from dounmount() was still > leaving the MNTK_MWAIT flag on even if it the waiters were actually > woken up. Just a place in vfs_mount_destroy() is left because it is > going to recycle the structure in any case, so it doesn't matter. > - Remove the markercnt refcount as it is useless. > > This patch modifies VFS ABI and breaks KPI for vfs_busy() so manpages and > __FreeBSD_version will be modified accordingly. So why didn't you update __FreeBSD_version with the same commit that changed the KPI? > Discussed with: kib > Tested by: pho > > Modified: > head/sys/geom/journal/g_journal.c > head/sys/gnu/fs/ext2fs/ext2_vfsops.c > head/sys/kern/vfs_lookup.c > head/sys/kern/vfs_mount.c > head/sys/kern/vfs_subr.c > head/sys/kern/vfs_syscalls.c > head/sys/kern/vfs_vnops.c > head/sys/nfsclient/nfs_socket.c > head/sys/nfsclient/nfs_vfsops.c > head/sys/sys/mount.h > head/sys/ufs/ffs/ffs_softdep.c > head/sys/ufs/ufs/ufs_vfsops.c > > Modified: head/sys/geom/journal/g_journal.c > ============================================================================== > --- head/sys/geom/journal/g_journal.c Sun Nov 2 06:40:33 2008 (r184553) > +++ head/sys/geom/journal/g_journal.c Sun Nov 2 10:15:42 2008 (r184554) > @@ -2879,7 +2879,7 @@ g_journal_do_switch(struct g_class *clas > desc = g_journal_find_desc(mp->mnt_stat.f_fstypename); > if (desc == NULL) > continue; > - if (vfs_busy(mp, LK_NOWAIT, &mountlist_mtx)) > + if (vfs_busy(mp, MBF_NOWAIT | MBF_MNTLSTLOCK)) > continue; > /* mtx_unlock(&mountlist_mtx) was done inside vfs_busy() */ > > > Modified: head/sys/gnu/fs/ext2fs/ext2_vfsops.c > ============================================================================== > --- head/sys/gnu/fs/ext2fs/ext2_vfsops.c Sun Nov 2 06:40:33 2008 (r184553) > +++ head/sys/gnu/fs/ext2fs/ext2_vfsops.c Sun Nov 2 10:15:42 2008 (r184554) > @@ -171,7 +171,7 @@ ext2_mount(mp, td) > flags = WRITECLOSE; > if (mp->mnt_flag & MNT_FORCE) > flags |= FORCECLOSE; > - if (vfs_busy(mp, LK_NOWAIT, 0)) > + if (vfs_busy(mp, MBF_NOWAIT)) > return (EBUSY); > error = ext2_flushfiles(mp, flags, td); > vfs_unbusy(mp); > > Modified: head/sys/kern/vfs_lookup.c > ============================================================================== > --- head/sys/kern/vfs_lookup.c Sun Nov 2 06:40:33 2008 (r184553) > +++ head/sys/kern/vfs_lookup.c Sun Nov 2 10:15:42 2008 (r184554) > @@ -684,7 +684,7 @@ unionlookup: > */ > while (dp->v_type == VDIR && (mp = dp->v_mountedhere) && > (cnp->cn_flags & NOCROSSMOUNT) == 0) { > - if (vfs_busy(mp, 0, 0)) > + if (vfs_busy(mp, 0)) > continue; > vput(dp); > VFS_UNLOCK_GIANT(vfslocked); > > Modified: head/sys/kern/vfs_mount.c > ============================================================================== > --- head/sys/kern/vfs_mount.c Sun Nov 2 06:40:33 2008 (r184553) > +++ head/sys/kern/vfs_mount.c Sun Nov 2 10:15:42 2008 (r184554) > @@ -450,7 +450,6 @@ mount_init(void *mem, int size, int flag > > mp = (struct mount *)mem; > mtx_init(&mp->mnt_mtx, "struct mount mtx", NULL, MTX_DEF); > - lockinit(&mp->mnt_lock, PVFS, "vfslock", 0, 0); > lockinit(&mp->mnt_explock, PVFS, "explock", 0, 0); > return (0); > } > @@ -462,7 +461,6 @@ mount_fini(void *mem, int size) > > mp = (struct mount *)mem; > lockdestroy(&mp->mnt_explock); > - lockdestroy(&mp->mnt_lock); > mtx_destroy(&mp->mnt_mtx); > } > > @@ -481,7 +479,7 @@ vfs_mount_alloc(struct vnode *vp, struct > TAILQ_INIT(&mp->mnt_nvnodelist); > mp->mnt_nvnodelistsize = 0; > mp->mnt_ref = 0; > - (void) vfs_busy(mp, LK_NOWAIT, 0); > + (void) vfs_busy(mp, MBF_NOWAIT); > mp->mnt_op = vfsp->vfc_vfsops; > mp->mnt_vfc = vfsp; > vfsp->vfc_refcount++; /* XXX Unlocked */ > @@ -507,19 +505,10 @@ vfs_mount_alloc(struct vnode *vp, struct > void > vfs_mount_destroy(struct mount *mp) > { > - int i; > > MNT_ILOCK(mp); > - for (i = 0; mp->mnt_ref && i < 3; i++) > - msleep(mp, MNT_MTX(mp), PVFS, "mntref", hz); > - /* > - * This will always cause a 3 second delay in rebooting due to > - * refs on the root mountpoint that never go away. Most of these > - * are held by init which never exits. > - */ > - if (i == 3 && (!rebooting || bootverbose)) > - printf("Mount point %s had %d dangling refs\n", > - mp->mnt_stat.f_mntonname, mp->mnt_ref); > + while (mp->mnt_ref) > + msleep(mp, MNT_MTX(mp), PVFS, "mntref", 0); > if (mp->mnt_holdcnt != 0) { > printf("Waiting for mount point to be unheld\n"); > while (mp->mnt_holdcnt != 0) { > @@ -928,7 +917,7 @@ vfs_domount( > vput(vp); > return (error); > } > - if (vfs_busy(mp, LK_NOWAIT, 0)) { > + if (vfs_busy(mp, MBF_NOWAIT)) { > vput(vp); > return (EBUSY); > } > @@ -1245,19 +1234,31 @@ dounmount(mp, flags, td) > /* Allow filesystems to detect that a forced unmount is in progress. */ > if (flags & MNT_FORCE) > mp->mnt_kern_flag |= MNTK_UNMOUNTF; > - error = lockmgr(&mp->mnt_lock, LK_DRAIN | LK_INTERLOCK | > - ((flags & MNT_FORCE) ? 0 : LK_NOWAIT), MNT_MTX(mp)); > - if (error) { > - MNT_ILOCK(mp); > - mp->mnt_kern_flag &= ~(MNTK_UNMOUNT | MNTK_NOINSMNTQ | > - MNTK_UNMOUNTF); > - if (mp->mnt_kern_flag & MNTK_MWAIT) > - wakeup(mp); > - MNT_IUNLOCK(mp); > - if (coveredvp) > - VOP_UNLOCK(coveredvp, 0); > - return (error); > + error = 0; > + if (mp->mnt_lockref) { > + if (flags & MNT_FORCE) { > + mp->mnt_kern_flag &= ~(MNTK_UNMOUNT | MNTK_NOINSMNTQ | > + MNTK_UNMOUNTF); > + if (mp->mnt_kern_flag & MNTK_MWAIT) { > + mp->mnt_kern_flag &= ~MNTK_MWAIT; > + wakeup(mp); > + } > + MNT_IUNLOCK(mp); > + if (coveredvp) > + VOP_UNLOCK(coveredvp, 0); > + return (EBUSY); > + } > + mp->mnt_kern_flag |= MNTK_DRAINING; > + error = msleep(&mp->mnt_lockref, MNT_MTX(mp), PVFS, > + "mount drain", 0); > } > + MNT_IUNLOCK(mp); > + KASSERT(mp->mnt_lockref == 0, > + ("%s: invalid lock refcount in the drain path @ %s:%d", > + __func__, __FILE__, __LINE__)); > + KASSERT(error == 0, > + ("%s: invalid return value for msleep in the drain path @ %s:%d", > + __func__, __FILE__, __LINE__)); > vn_start_write(NULL, &mp, V_WAIT); > > if (mp->mnt_flag & MNT_EXPUBLIC) > @@ -1321,9 +1322,10 @@ dounmount(mp, flags, td) > mp->mnt_flag |= async_flag; > if ((mp->mnt_flag & MNT_ASYNC) != 0 && mp->mnt_noasync == 0) > mp->mnt_kern_flag |= MNTK_ASYNC; > - lockmgr(&mp->mnt_lock, LK_RELEASE, NULL); > - if (mp->mnt_kern_flag & MNTK_MWAIT) > + if (mp->mnt_kern_flag & MNTK_MWAIT) { > + mp->mnt_kern_flag &= ~MNTK_MWAIT; > wakeup(mp); > + } > MNT_IUNLOCK(mp); > if (coveredvp) > VOP_UNLOCK(coveredvp, 0); > @@ -1337,7 +1339,6 @@ dounmount(mp, flags, td) > vput(coveredvp); > } > vfs_event_signal(NULL, VQ_UNMOUNT, 0); > - lockmgr(&mp->mnt_lock, LK_RELEASE, NULL); > vfs_mount_destroy(mp); > return (0); > } > @@ -2070,7 +2071,6 @@ __mnt_vnode_first(struct vnode **mvp, st > wakeup(&mp->mnt_holdcnt); > return (NULL); > } > - mp->mnt_markercnt++; > (*mvp)->v_mount = mp; > TAILQ_INSERT_AFTER(&mp->mnt_nvnodelist, vp, *mvp, v_nmntvnodes); > return (vp); > @@ -2093,7 +2093,6 @@ __mnt_vnode_markerfree(struct vnode **mv > MNT_ILOCK(mp); > *mvp = NULL; > > - mp->mnt_markercnt--; > mp->mnt_holdcnt--; > if (mp->mnt_holdcnt == 0 && mp->mnt_holdcntwaiters != 0) > wakeup(&mp->mnt_holdcnt); > > Modified: head/sys/kern/vfs_subr.c > ============================================================================== > --- head/sys/kern/vfs_subr.c Sun Nov 2 06:40:33 2008 (r184553) > +++ head/sys/kern/vfs_subr.c Sun Nov 2 10:15:42 2008 (r184554) > @@ -335,42 +335,36 @@ SYSINIT(vfs, SI_SUB_VFS, SI_ORDER_FIRST, > > /* > * Mark a mount point as busy. Used to synchronize access and to delay > - * unmounting. Interlock is not released on failure. > + * unmounting. Eventually, mountlist_mtx is not released on failure. > */ > int > -vfs_busy(struct mount *mp, int flags, struct mtx *interlkp) > +vfs_busy(struct mount *mp, int flags) > { > - int lkflags; > + > + MPASS((flags & ~MBF_MASK) == 0); > > MNT_ILOCK(mp); > MNT_REF(mp); > if (mp->mnt_kern_flag & MNTK_UNMOUNT) { > - if (flags & LK_NOWAIT) { > + if (flags & MBF_NOWAIT) { > MNT_REL(mp); > MNT_IUNLOCK(mp); > return (ENOENT); > } > - if (interlkp) > - mtx_unlock(interlkp); > + if (flags & MBF_MNTLSTLOCK) > + mtx_unlock(&mountlist_mtx); > mp->mnt_kern_flag |= MNTK_MWAIT; > - /* > - * Since all busy locks are shared except the exclusive > - * lock granted when unmounting, the only place that a > - * wakeup needs to be done is at the release of the > - * exclusive lock at the end of dounmount. > - */ > msleep(mp, MNT_MTX(mp), PVFS, "vfs_busy", 0); > MNT_REL(mp); > MNT_IUNLOCK(mp); > - if (interlkp) > - mtx_lock(interlkp); > + if (flags & MBF_MNTLSTLOCK) > + mtx_lock(&mountlist_mtx); > return (ENOENT); > } > - if (interlkp) > - mtx_unlock(interlkp); > - lkflags = LK_SHARED | LK_INTERLOCK | LK_NOWAIT; > - if (lockmgr(&mp->mnt_lock, lkflags, MNT_MTX(mp))) > - panic("vfs_busy: unexpected lock failure"); > + if (flags & MBF_MNTLSTLOCK) > + mtx_unlock(&mountlist_mtx); > + mp->mnt_lockref++; > + MNT_IUNLOCK(mp); > return (0); > } > > @@ -381,8 +375,15 @@ void > vfs_unbusy(struct mount *mp) > { > > - lockmgr(&mp->mnt_lock, LK_RELEASE, NULL); > - vfs_rel(mp); > + MNT_ILOCK(mp); > + MNT_REL(mp); > + mp->mnt_lockref--; > + if (mp->mnt_lockref == 0 && (mp->mnt_kern_flag & MNTK_DRAINING) != 0) { > + MPASS(mp->mnt_kern_flag & MNTK_UNMOUNT); > + mp->mnt_kern_flag &= ~MNTK_DRAINING; > + wakeup(&mp->mnt_lockref); > + } > + MNT_IUNLOCK(mp); > } > > /* > @@ -747,7 +748,7 @@ vnlru_proc(void) > mtx_lock(&mountlist_mtx); > for (mp = TAILQ_FIRST(&mountlist); mp != NULL; mp = nmp) { > int vfsunlocked; > - if (vfs_busy(mp, LK_NOWAIT, &mountlist_mtx)) { > + if (vfs_busy(mp, MBF_NOWAIT | MBF_MNTLSTLOCK)) { > nmp = TAILQ_NEXT(mp, mnt_list); > continue; > } > @@ -2837,7 +2838,6 @@ DB_SHOW_COMMAND(mount, db_show_mount) > db_printf(" mnt_maxsymlinklen = %d\n", mp->mnt_maxsymlinklen); > db_printf(" mnt_iosize_max = %d\n", mp->mnt_iosize_max); > db_printf(" mnt_hashseed = %u\n", mp->mnt_hashseed); > - db_printf(" mnt_markercnt = %d\n", mp->mnt_markercnt); > db_printf(" mnt_holdcnt = %d\n", mp->mnt_holdcnt); > db_printf(" mnt_holdcntwaiters = %d\n", mp->mnt_holdcntwaiters); > db_printf(" mnt_secondary_writes = %d\n", mp->mnt_secondary_writes); > @@ -2999,7 +2999,7 @@ sysctl_vnode(SYSCTL_HANDLER_ARGS) > n = 0; > mtx_lock(&mountlist_mtx); > TAILQ_FOREACH(mp, &mountlist, mnt_list) { > - if (vfs_busy(mp, LK_NOWAIT, &mountlist_mtx)) > + if (vfs_busy(mp, MBF_NOWAIT | MBF_MNTLSTLOCK)) > continue; > MNT_ILOCK(mp); > TAILQ_FOREACH(vp, &mp->mnt_nvnodelist, v_nmntvnodes) { > @@ -3361,7 +3361,7 @@ sync_fsync(struct vop_fsync_args *ap) > * not already on the sync list. > */ > mtx_lock(&mountlist_mtx); > - if (vfs_busy(mp, LK_EXCLUSIVE | LK_NOWAIT, &mountlist_mtx) != 0) { > + if (vfs_busy(mp, MBF_NOWAIT | MBF_MNTLSTLOCK) != 0) { > mtx_unlock(&mountlist_mtx); > return (0); > } > > Modified: head/sys/kern/vfs_syscalls.c > ============================================================================== > --- head/sys/kern/vfs_syscalls.c Sun Nov 2 06:40:33 2008 (r184553) > +++ head/sys/kern/vfs_syscalls.c Sun Nov 2 10:15:42 2008 (r184554) > @@ -124,7 +124,7 @@ sync(td, uap) > > mtx_lock(&mountlist_mtx); > for (mp = TAILQ_FIRST(&mountlist); mp != NULL; mp = nmp) { > - if (vfs_busy(mp, LK_NOWAIT, &mountlist_mtx)) { > + if (vfs_busy(mp, MBF_NOWAIT | MBF_MNTLSTLOCK)) { > nmp = TAILQ_NEXT(mp, mnt_list); > continue; > } > @@ -197,7 +197,7 @@ quotactl(td, uap) > vfslocked = NDHASGIANT(&nd); > NDFREE(&nd, NDF_ONLY_PNBUF); > mp = nd.ni_vp->v_mount; > - if ((error = vfs_busy(mp, 0, NULL))) { > + if ((error = vfs_busy(mp, 0))) { > vrele(nd.ni_vp); > VFS_UNLOCK_GIANT(vfslocked); > return (error); > @@ -479,7 +479,7 @@ kern_getfsstat(struct thread *td, struct > continue; > } > #endif > - if (vfs_busy(mp, LK_NOWAIT, &mountlist_mtx)) { > + if (vfs_busy(mp, MBF_NOWAIT | MBF_MNTLSTLOCK)) { > nmp = TAILQ_NEXT(mp, mnt_list); > continue; > } > @@ -741,7 +741,7 @@ fchdir(td, uap) > error = change_dir(vp, td); > while (!error && (mp = vp->v_mountedhere) != NULL) { > int tvfslocked; > - if (vfs_busy(mp, 0, 0)) > + if (vfs_busy(mp, 0)) > continue; > tvfslocked = VFS_LOCK_GIANT(mp); > error = VFS_ROOT(mp, LK_EXCLUSIVE, &tdp, td); > > Modified: head/sys/kern/vfs_vnops.c > ============================================================================== > --- head/sys/kern/vfs_vnops.c Sun Nov 2 06:40:33 2008 (r184553) > +++ head/sys/kern/vfs_vnops.c Sun Nov 2 10:15:42 2008 (r184554) > @@ -957,9 +957,18 @@ vn_start_write(vp, mpp, flags) > } > if ((mp = *mpp) == NULL) > return (0); > + > + /* > + * VOP_GETWRITEMOUNT() returns with the mp refcount held through > + * a vfs_ref(). > + * As long as a vnode is not provided we need to acquire a > + * refcount for the provided mountpoint too, in order to > + * emulate a vfs_ref(). > + */ > MNT_ILOCK(mp); > if (vp == NULL) > MNT_REF(mp); > + > /* > * Check on status of suspension. > */ > @@ -1021,6 +1030,14 @@ vn_start_secondary_write(vp, mpp, flags) > */ > if ((mp = *mpp) == NULL) > return (0); > + > + /* > + * VOP_GETWRITEMOUNT() returns with the mp refcount held through > + * a vfs_ref(). > + * As long as a vnode is not provided we need to acquire a > + * refcount for the provided mountpoint too, in order to > + * emulate a vfs_ref(). > + */ > MNT_ILOCK(mp); > if (vp == NULL) > MNT_REF(mp); > > Modified: head/sys/nfsclient/nfs_socket.c > ============================================================================== > --- head/sys/nfsclient/nfs_socket.c Sun Nov 2 06:40:33 2008 (r184553) > +++ head/sys/nfsclient/nfs_socket.c Sun Nov 2 10:15:42 2008 (r184554) > @@ -1429,8 +1429,8 @@ nfs_timer(void *arg) > /* > * Terminate request if force-unmount in progress. > * Note that NFS could have vfs_busy'ed the mount, > - * causing the unmount to wait for the mnt_lock, making > - * this bit of logic necessary. > + * causing the unmount to wait and making this bit > + * of logic necessary. > */ > if (rep->r_nmp->nm_mountp->mnt_kern_flag & MNTK_UNMOUNTF) { > nfs_softterm(rep); > > Modified: head/sys/nfsclient/nfs_vfsops.c > ============================================================================== > --- head/sys/nfsclient/nfs_vfsops.c Sun Nov 2 06:40:33 2008 (r184553) > +++ head/sys/nfsclient/nfs_vfsops.c Sun Nov 2 10:15:42 2008 (r184554) > @@ -258,7 +258,7 @@ nfs_statfs(struct mount *mp, struct stat > #ifndef nolint > sfp = NULL; > #endif > - error = vfs_busy(mp, LK_NOWAIT, NULL); > + error = vfs_busy(mp, MBF_NOWAIT); > if (error) > return (error); > error = nfs_nget(mp, (nfsfh_t *)nmp->nm_fh, nmp->nm_fhsize, &np, LK_EXCLUSIVE); > > Modified: head/sys/sys/mount.h > ============================================================================== > --- head/sys/sys/mount.h Sun Nov 2 06:40:33 2008 (r184553) > +++ head/sys/sys/mount.h Sun Nov 2 10:15:42 2008 (r184554) > @@ -142,13 +142,11 @@ struct vfsopt; > * Lock reference: > * m - mountlist_mtx > * i - interlock > - * l - mnt_lock > * > * Unmarked fields are considered stable as long as a ref is held. > * > */ > struct mount { > - struct lock mnt_lock; /* mount structure lock */ > struct mtx mnt_mtx; /* mount structure interlock */ > int mnt_gen; /* struct mount generation */ > #define mnt_startzero mnt_list > @@ -175,7 +173,7 @@ struct mount { > struct netexport *mnt_export; /* export list */ > struct label *mnt_label; /* MAC label for the fs */ > u_int mnt_hashseed; /* Random seed for vfs_hash */ > - int mnt_markercnt; /* marker vnodes in use */ > + int mnt_lockref; /* (i) Lock reference count */ > int mnt_holdcnt; /* hold count */ > int mnt_holdcntwaiters; /* waits on hold count */ > int mnt_secondary_writes; /* (i) # of secondary writes */ > @@ -319,6 +317,7 @@ void __mnt_vnode_markerfree(str > #define MNTK_ASYNC 0x00000002 /* filtered async flag */ > #define MNTK_SOFTDEP 0x00000004 /* async disabled by softdep */ > #define MNTK_NOINSMNTQ 0x00000008 /* insmntque is not allowed */ > +#define MNTK_DRAINING 0x00000010 /* lock draining is happening */ > #define MNTK_UNMOUNT 0x01000000 /* unmount in progress */ > #define MNTK_MWAIT 0x02000000 /* waiting for unmount to finish */ > #define MNTK_SUSPEND 0x08000000 /* request write suspension */ > @@ -506,6 +505,13 @@ struct uio; > > #ifdef _KERNEL > > +/* > + * vfs_busy specific flags and mask. > + */ > +#define MBF_NOWAIT 0x01 > +#define MBF_MNTLSTLOCK 0x02 > +#define MBF_MASK (MBF_NOWAIT | MBF_MNTLSTLOCK) > + > #ifdef MALLOC_DECLARE > MALLOC_DECLARE(M_MOUNT); > #endif > @@ -686,7 +692,7 @@ int vfs_scanopt(struct vfsoptlist *opts, > int vfs_setpublicfs /* set publicly exported fs */ > (struct mount *, struct netexport *, struct export_args *); > void vfs_msync(struct mount *, int); > -int vfs_busy(struct mount *, int, struct mtx *); > +int vfs_busy(struct mount *, int); > int vfs_export /* process mount export info */ > (struct mount *, struct export_args *); > int vfs_allocate_syncvnode(struct mount *); > > Modified: head/sys/ufs/ffs/ffs_softdep.c > ============================================================================== > --- head/sys/ufs/ffs/ffs_softdep.c Sun Nov 2 06:40:33 2008 (r184553) > +++ head/sys/ufs/ffs/ffs_softdep.c Sun Nov 2 10:15:42 2008 (r184554) > @@ -745,7 +745,7 @@ softdep_flush(void) > nmp = TAILQ_NEXT(mp, mnt_list); > if ((mp->mnt_flag & MNT_SOFTDEP) == 0) > continue; > - if (vfs_busy(mp, LK_NOWAIT, &mountlist_mtx)) > + if (vfs_busy(mp, MBF_NOWAIT | MBF_MNTLSTLOCK)) > continue; > vfslocked = VFS_LOCK_GIANT(mp); > softdep_process_worklist(mp, 0); > > Modified: head/sys/ufs/ufs/ufs_vfsops.c > ============================================================================== > --- head/sys/ufs/ufs/ufs_vfsops.c Sun Nov 2 06:40:33 2008 (r184553) > +++ head/sys/ufs/ufs/ufs_vfsops.c Sun Nov 2 10:15:42 2008 (r184554) > @@ -118,7 +118,7 @@ ufs_quotactl(mp, cmds, id, arg, td) > if ((u_int)type >= MAXQUOTAS) > return (EINVAL); > > - if (vfs_busy(mp, LK_NOWAIT, 0)) > + if (vfs_busy(mp, MBF_NOWAIT)) > return (0); > > switch (cmd) { > -- Bjoern A. Zeeb Stop bit received. Insert coin for new game. From attilio at FreeBSD.org Sun Nov 2 02:33:58 2008 From: attilio at FreeBSD.org (Attilio Rao) Date: Sun Nov 2 02:34:10 2008 Subject: svn commit: r184556 - head/share/man/man9 Message-ID: <200811021033.mA2AXwH4036565@svn.freebsd.org> Author: attilio Date: Sun Nov 2 10:33:57 2008 New Revision: 184556 URL: http://svn.freebsd.org/changeset/base/184556 Log: Reflect changes for the vfs_busy() prototype. Modified: head/share/man/man9/vfs_busy.9 Modified: head/share/man/man9/vfs_busy.9 ============================================================================== --- head/share/man/man9/vfs_busy.9 Sun Nov 2 10:20:18 2008 (r184555) +++ head/share/man/man9/vfs_busy.9 Sun Nov 2 10:33:57 2008 (r184556) @@ -26,7 +26,7 @@ .\" .\" $FreeBSD$ .\" -.Dd August 29, 2008 +.Dd November 2, 2008 .Dt VFS_BUSY 9 .Os .Sh NAME @@ -36,7 +36,7 @@ .In sys/param.h .In sys/mount.h .Ft int -.Fn vfs_busy "struct mount *mp" "int flags" "struct mtx *interlkp" +.Fn vfs_busy "struct mount *mp" "int flags" .Sh DESCRIPTION The .Fn vfs_busy @@ -56,33 +56,22 @@ flag is set. .Pp Its arguments are: -.Bl -tag -width ".Fa interlkp" +.Bl -tag -width ".Fa flags" .It Fa mp The mount point to busy. .It Fa flags Flags controlling how .Fn vfs_busy should act. -.Bl -tag -width ".Dv LK_NOWAIT" -.It Dv LK_NOWAIT +.Bl -tag -width ".Dv MBF_MNTLSTLOCK" +.It Dv MBF_NOWAIT do not sleep if .Dv MNTK_UNMOUNT is set. +.It Dv MBF_MNTLSTLOCK +drop the mountlist_mtx in the critical path. .El -.It Fa interlkp -The interlock mutex for -.Fa mp->mount_lock . -If there is any chance -the mount point is being unmounted and -.Dv LK_NOWAIT -is not set then -interlock must be valid locked mutex. .El -.Sh LOCKS -If -.Fa interlkp -is a valid pointer it must be locked on entry, -and it will not be unlocked even in the case of an error. .Sh RETURN VALUES A 0 value is returned on success. If the mount point is being From attilio at freebsd.org Sun Nov 2 02:34:55 2008 From: attilio at freebsd.org (Attilio Rao) Date: Sun Nov 2 02:35:29 2008 Subject: svn commit: r184554 - in head/sys: geom/journal gnu/fs/ext2fs kern nfsclient sys ufs/ffs ufs/ufs In-Reply-To: <20081102102108.B41609@maildrop.int.zabbadoz.net> References: <200811021015.mA2AFgim036178@svn.freebsd.org> <20081102102108.B41609@maildrop.int.zabbadoz.net> Message-ID: <3bbf2fe10811020234n14f554b3ld60eca8527e2647b@mail.gmail.com> 2008/11/2, Bjoern A. Zeeb : > On Sun, 2 Nov 2008, Attilio Rao wrote: > > > > Author: attilio > > Date: Sun Nov 2 10:15:42 2008 > > New Revision: 184554 > > URL: http://svn.freebsd.org/changeset/base/184554 > > > > Log: > > Improve VFS locking: > > - Implement real draining for vfs consumers by not relying on the > > mnt_lock and using instead a refcount in order to keep track of lock > > requesters. > > - Due to the change above, remove the mnt_lock lockmgr because it is now > > useless. > > - Due to the change above, vfs_busy() is no more linked to a lockmgr. > > Change so its KPI by removing the interlock argument and defining 2 new > > flags for it: MBF_NOWAIT which basically replaces the LK_NOWAIT of the > > old version (which was unlinked from the lockmgr alredy) and > > MBF_MNTLSTLOCK which provides the ability to drop the mountlist_mtx > > once the mnt interlock is held (ability still desired by most > consumers). > > - The stub used into vfs_mount_destroy(), that allows to override the > > mnt_ref if running for more than 3 seconds, make it totally useless. > > Remove it as it was thought to work into older versions. > > If a problem of "refcount held never going away" should appear, we will > > need to fix properly instead than trust on such hackish solution. > > - Fix a bug where returning (with an error) from dounmount() was still > > leaving the MNTK_MWAIT flag on even if it the waiters were actually > > woken up. Just a place in vfs_mount_destroy() is left because it is > > going to recycle the structure in any case, so it doesn't matter. > > - Remove the markercnt refcount as it is useless. > > > > This patch modifies VFS ABI and breaks KPI for vfs_busy() so manpages and > > __FreeBSD_version will be modified accordingly. > > > > So why didn't you update __FreeBSD_version with the same commit that > changed the KPI? I just prefer to split "managing" stuff from the tecnical content. Attilio -- Peace can only be achieved by understanding - A. Einstein From bzeeb-lists at lists.zabbadoz.net Sun Nov 2 02:40:06 2008 From: bzeeb-lists at lists.zabbadoz.net (Bjoern A. Zeeb) Date: Sun Nov 2 02:40:23 2008 Subject: svn commit: r184554 - in head/sys: geom/journal gnu/fs/ext2fs kern nfsclient sys ufs/ffs ufs/ufs In-Reply-To: <3bbf2fe10811020234n14f554b3ld60eca8527e2647b@mail.gmail.com> References: <200811021015.mA2AFgim036178@svn.freebsd.org> <20081102102108.B41609@maildrop.int.zabbadoz.net> <3bbf2fe10811020234n14f554b3ld60eca8527e2647b@mail.gmail.com> Message-ID: <20081102103546.S41609@maildrop.int.zabbadoz.net> On Sun, 2 Nov 2008, Attilio Rao wrote: >>> This patch modifies VFS ABI and breaks KPI for vfs_busy() so manpages and >>> __FreeBSD_version will be modified accordingly. >>> >> >> So why didn't you update __FreeBSD_version with the same commit that >> changed the KPI? > > I just prefer to split "managing" stuff from the tecnical content. Well we have changesets with SVN and looking at the FreeBSD version bump I have no idea what changeset(s) it's actually refering to. I think we should exploit the features SVN gives us and either do it in the same commit (if possible because it's a single commit) or reference the relevant SVN revisions in the bump in the future so that the xPI change and the bump can be easily linked together. /bz -- Bjoern A. Zeeb Stop bit received. Insert coin for new game. From attilio at freebsd.org Sun Nov 2 03:41:37 2008 From: attilio at freebsd.org (Attilio Rao) Date: Sun Nov 2 03:41:43 2008 Subject: svn commit: r184554 - in head/sys: geom/journal gnu/fs/ext2fs kern nfsclient sys ufs/ffs ufs/ufs In-Reply-To: <20081102103546.S41609@maildrop.int.zabbadoz.net> References: <200811021015.mA2AFgim036178@svn.freebsd.org> <20081102102108.B41609@maildrop.int.zabbadoz.net> <3bbf2fe10811020234n14f554b3ld60eca8527e2647b@mail.gmail.com> <20081102103546.S41609@maildrop.int.zabbadoz.net> Message-ID: <3bbf2fe10811020341y4ae59546jb073b42945356b8c@mail.gmail.com> 2008/11/2, Bjoern A. Zeeb : > On Sun, 2 Nov 2008, Attilio Rao wrote: > > > > > > > > > > > This patch modifies VFS ABI and breaks KPI for vfs_busy() so manpages > and > > > > __FreeBSD_version will be modified accordingly. > > > > > > > > > > > > > > So why didn't you update __FreeBSD_version with the same commit that > > > changed the KPI? > > > > > > > I just prefer to split "managing" stuff from the tecnical content. > > > > Well we have changesets with SVN and looking at the FreeBSD version > bump I have no idea what changeset(s) it's actually refering to. I > think we should exploit the features SVN gives us and either do it in > the same commit (if possible because it's a single commit) or > reference the relevant SVN revisions in the bump in the future so that > the xPI change and the bump can be easily linked together. I totally didn't take into consideration that. Thanks for pointing out, it is a good point, and will try to follow in next KPI modifies. Attilio -- Peace can only be achieved by understanding - A. Einstein From trasz at FreeBSD.org Sun Nov 2 03:49:19 2008 From: trasz at FreeBSD.org (Edward Tomasz Napierala) Date: Sun Nov 2 03:49:30 2008 Subject: svn commit: r184557 - head/sys/fs/ntfs Message-ID: <200811021149.mA2BnJ1c037891@svn.freebsd.org> Author: trasz Date: Sun Nov 2 11:49:19 2008 New Revision: 184557 URL: http://svn.freebsd.org/changeset/base/184557 Log: Remove the call to getinoquota() from ntfs_access. How did it get there?! Approved by: rwatson (mentor) Modified: head/sys/fs/ntfs/ntfs_vnops.c Modified: head/sys/fs/ntfs/ntfs_vnops.c ============================================================================== --- head/sys/fs/ntfs/ntfs_vnops.c Sun Nov 2 10:33:57 2008 (r184556) +++ head/sys/fs/ntfs/ntfs_vnops.c Sun Nov 2 11:49:19 2008 (r184557) @@ -394,9 +394,6 @@ ntfs_access(ap) struct vnode *vp = ap->a_vp; struct ntnode *ip = VTONT(vp); accmode_t accmode = ap->a_accmode; -#ifdef QUOTA - int error; -#endif dprintf(("ntfs_access: %d\n",ip->i_number)); @@ -412,10 +409,6 @@ ntfs_access(ap) case VREG: if (vp->v_mount->mnt_flag & MNT_RDONLY) return (EROFS); -#ifdef QUOTA - if (error = getinoquota(ip)) - return (error); -#endif break; } } From mav at FreeBSD.org Sun Nov 2 04:50:17 2008 From: mav at FreeBSD.org (Alexander Motin) Date: Sun Nov 2 04:50:25 2008 Subject: svn commit: r184558 - head/sys/dev/acpica/Osd Message-ID: <200811021250.mA2CoGs1038957@svn.freebsd.org> Author: mav Date: Sun Nov 2 12:50:16 2008 New Revision: 184558 URL: http://svn.freebsd.org/changeset/base/184558 Log: As soon as we have several threads per process now, it is not correct to use process ID as ACPI thread ID. Concurrent requests with equal thread IDs broke ACPI mutexes operation causing unpredictable errors including AE_AML_MUTEX_NOT_ACQUIRED that I have seen. Use kernel thread ID instead of process ID for ACPI thread. Modified: head/sys/dev/acpica/Osd/OsdSchedule.c Modified: head/sys/dev/acpica/Osd/OsdSchedule.c ============================================================================== --- head/sys/dev/acpica/Osd/OsdSchedule.c Sun Nov 2 11:49:19 2008 (r184557) +++ head/sys/dev/acpica/Osd/OsdSchedule.c Sun Nov 2 12:50:16 2008 (r184558) @@ -187,13 +187,9 @@ AcpiOsStall(UINT32 Microseconds) ACPI_THREAD_ID AcpiOsGetThreadId(void) { - struct proc *p; /* XXX do not add ACPI_FUNCTION_TRACE here, results in recursive call. */ - p = curproc; - KASSERT(p != NULL, ("%s: curproc is NULL!", __func__)); - /* Returning 0 is not allowed. */ - return (p->p_pid + 1); + return (curthread->td_tid + 1); } From imp at FreeBSD.org Sun Nov 2 08:50:59 2008 From: imp at FreeBSD.org (Warner Losh) Date: Sun Nov 2 08:51:05 2008 Subject: svn commit: r184559 - in head/sys: conf modules/rl pci Message-ID: <200811021650.mA2GowCr043365@svn.freebsd.org> Author: imp Date: Sun Nov 2 16:50:57 2008 New Revision: 184559 URL: http://svn.freebsd.org/changeset/base/184559 Log: Make RL_TWISTER_ENABLE a tunable/sysctl. Eliminate it as an option. Fix module build. Submitted by: Kostik Belousov Modified: head/sys/conf/options head/sys/modules/rl/Makefile head/sys/pci/if_rl.c head/sys/pci/if_rlreg.h Modified: head/sys/conf/options ============================================================================== --- head/sys/conf/options Sun Nov 2 12:50:16 2008 (r184558) +++ head/sys/conf/options Sun Nov 2 16:50:57 2008 (r184559) @@ -672,9 +672,6 @@ ED_SIC opt_ed.h # bce driver BCE_DEBUG opt_bce.h -# rl driver -RL_TWISTER_ENABLE opt_rl.h - SOCKBUF_DEBUG opt_global.h # options for ubsec driver Modified: head/sys/modules/rl/Makefile ============================================================================== --- head/sys/modules/rl/Makefile Sun Nov 2 12:50:16 2008 (r184558) +++ head/sys/modules/rl/Makefile Sun Nov 2 16:50:57 2008 (r184559) @@ -3,7 +3,7 @@ .PATH: ${.CURDIR}/../../pci KMOD= if_rl -SRCS= if_rl.c device_if.h bus_if.h pci_if.h opt_rl.h +SRCS= if_rl.c device_if.h bus_if.h pci_if.h SRCS+= miibus_if.h .include Modified: head/sys/pci/if_rl.c ============================================================================== --- head/sys/pci/if_rl.c Sun Nov 2 12:50:16 2008 (r184558) +++ head/sys/pci/if_rl.c Sun Nov 2 16:50:57 2008 (r184559) @@ -85,7 +85,6 @@ __FBSDID("$FreeBSD$"); #ifdef HAVE_KERNEL_OPTION_HEADERS #include "opt_device_polling.h" -#include "opt_rl.h" #endif #include @@ -97,6 +96,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -801,14 +801,25 @@ rl_attach(device_t dev) struct ifnet *ifp; struct rl_softc *sc; struct rl_type *t; + struct sysctl_ctx_list *ctx; + struct sysctl_oid_list *children; int error = 0, i, rid; int unit; uint16_t rl_did = 0; + char tn[32]; sc = device_get_softc(dev); unit = device_get_unit(dev); sc->rl_dev = dev; + sc->rl_twister_enable = 0; + snprintf(tn, sizeof(tn), "dev.rl.%d.twister_enable", unit); + TUNABLE_INT_FETCH(tn, &sc->rl_twister_enable); + ctx = device_get_sysctl_ctx(sc->rl_dev); + children = SYSCTL_CHILDREN(device_get_sysctl_tree(sc->rl_dev)); + SYSCTL_ADD_INT(ctx, children, OID_AUTO, "twister_enable", CTLFLAG_RD, + &sc->rl_twister_enable, 0, ""); + mtx_init(&sc->rl_mtx, device_get_nameunit(dev), MTX_NETWORK_LOCK, MTX_DEF); callout_init_mtx(&sc->rl_stat_callout, &sc->rl_mtx, 0); @@ -1384,7 +1395,6 @@ rl_txeof(struct rl_softc *sc) sc->rl_watchdog_timer = 0; } -#ifdef RL_TWISTER_ENABLE static void rl_twister_update(struct rl_softc *sc) { @@ -1483,7 +1493,6 @@ rl_twister_update(struct rl_softc *sc) } } -#endif static void rl_tick(void *xsc) @@ -1506,19 +1515,19 @@ rl_tick(void *xsc) */ mii = device_get_softc(sc->rl_miibus); mii_tick(mii); -#ifdef RL_TWISTER_ENABLE - if (sc->rl_twister == DONE) + if (sc->rl_twister_enable) { + if (sc->rl_twister == DONE) + rl_watchdog(sc); + else + rl_twister_update(sc); + if (sc->rl_twister == DONE) + ticks = hz; + else + ticks = hz / 10; + } else { rl_watchdog(sc); - else - rl_twister_update(sc); - if (sc->rl_twister == DONE) ticks = hz; - else - ticks = hz / 10; -#else - rl_watchdog(sc); - ticks = hz; -#endif + } callout_reset(&sc->rl_stat_callout, ticks, rl_tick, sc); } @@ -1768,14 +1777,15 @@ rl_init_locked(struct rl_softc *sc) rl_stop(sc); rl_reset(sc); -#ifdef RL_TWISTER_ENABLE - /* - * Reset twister register tuning state. The twister registers - * and their tuning are undocumented, but are necessary to cope - * with bad links. rl_twister = DONE here will disable this entirely. - */ - sc->rl_twister = CHK_LINK; -#endif + if (sc->rl_twister_enable) { + /* + * Reset twister register tuning state. The twister + * registers and their tuning are undocumented, but + * are necessary to cope with bad links. rl_twister = + * DONE here will disable this entirely. + */ + sc->rl_twister = CHK_LINK; + } /* * Init our MAC address. Even though the chipset Modified: head/sys/pci/if_rlreg.h ============================================================================== --- head/sys/pci/if_rlreg.h Sun Nov 2 12:50:16 2008 (r184558) +++ head/sys/pci/if_rlreg.h Sun Nov 2 16:50:57 2008 (r184559) @@ -830,9 +830,7 @@ struct rl_list_data { bus_addr_t rl_tx_list_addr; }; -#ifdef RL_TWISTER_ENABLE enum rl_twist { DONE, CHK_LINK, FIND_ROW, SET_PARAM, RECHK_LONG, RETUNE }; -#endif struct rl_softc { struct ifnet *rl_ifp; /* interface info */ @@ -862,11 +860,10 @@ struct rl_softc { uint32_t rl_rxlenmask; int rl_testmode; int rl_if_flags; -#ifdef RL_TWISTER_ENABLE + int rl_twister_enable; enum rl_twist rl_twister; int rl_twist_row; int rl_twist_col; -#endif int suspended; /* 0 = normal 1 = suspended */ #ifdef DEVICE_POLLING int rxcycles; From imp at FreeBSD.org Sun Nov 2 08:51:57 2008 From: imp at FreeBSD.org (Warner Losh) Date: Sun Nov 2 08:52:04 2008 Subject: svn commit: r184560 - head/share/man/man4 Message-ID: <200811021651.mA2Gpv5b043420@svn.freebsd.org> Author: imp Date: Sun Nov 2 16:51:57 2008 New Revision: 184560 URL: http://svn.freebsd.org/changeset/base/184560 Log: Document dev.rl.%unit.twister_enable sysctl/tunable. Submitted by: Kostik Belousov Modified: head/share/man/man4/rl.4 Modified: head/share/man/man4/rl.4 ============================================================================== --- head/share/man/man4/rl.4 Sun Nov 2 16:50:57 2008 (r184559) +++ head/share/man/man4/rl.4 Sun Nov 2 16:51:57 2008 (r184560) @@ -30,7 +30,7 @@ .\" .\" $FreeBSD$ .\" -.Dd November 28, 2007 +.Dd November 1, 2008 .Dt RL 4 .Os .Sh NAME @@ -201,6 +201,12 @@ SMC EZ Card 10/100 PCI 1211-TX .It SOHO (PRAGMATIC) UE-1211C .El +.Sh LOADER TUNABLES +.Bl -tag -width indent +.It Va dev.rl.%unit.twister_enable +Non-zero value enables the long cable tuning on the specified device. +Disabled by default. +.El .Sh DIAGNOSTICS .Bl -diag .It "rl%d: couldn't map memory" From trhodes at FreeBSD.org Sun Nov 2 09:00:23 2008 From: trhodes at FreeBSD.org (Tom Rhodes) Date: Sun Nov 2 09:00:29 2008 Subject: svn commit: r184561 - in head/sys: nfsclient nfsserver Message-ID: <200811021700.mA2H0Nlr043624@svn.freebsd.org> Author: trhodes Date: Sun Nov 2 17:00:23 2008 New Revision: 184561 URL: http://svn.freebsd.org/changeset/base/184561 Log: Document a few sysctls in the NFS client and server code. Minor style(9) where applicable. Approved by: alfred (slightly older version) Modified: head/sys/nfsclient/nfs_nfsiod.c head/sys/nfsclient/nfs_socket.c head/sys/nfsclient/nfs_subs.c head/sys/nfsclient/nfs_vfsops.c head/sys/nfsserver/nfs_serv.c head/sys/nfsserver/nfs_syscalls.c Modified: head/sys/nfsclient/nfs_nfsiod.c ============================================================================== --- head/sys/nfsclient/nfs_nfsiod.c Sun Nov 2 16:51:57 2008 (r184560) +++ head/sys/nfsclient/nfs_nfsiod.c Sun Nov 2 17:00:23 2008 (r184561) @@ -84,7 +84,8 @@ SYSCTL_DECL(_vfs_nfs); /* Maximum number of seconds a nfsiod kthread will sleep before exiting */ static unsigned int nfs_iodmaxidle = 120; -SYSCTL_UINT(_vfs_nfs, OID_AUTO, iodmaxidle, CTLFLAG_RW, &nfs_iodmaxidle, 0, ""); +SYSCTL_UINT(_vfs_nfs, OID_AUTO, iodmaxidle, CTLFLAG_RW, &nfs_iodmaxidle, 0, + "Max number of seconds an nfsiod kthread will sleep before exiting"); /* Maximum number of nfsiod kthreads */ unsigned int nfs_iodmax = 20; @@ -121,7 +122,8 @@ out: return (0); } SYSCTL_PROC(_vfs_nfs, OID_AUTO, iodmin, CTLTYPE_UINT | CTLFLAG_RW, 0, - sizeof (nfs_iodmin), sysctl_iodmin, "IU", ""); + sizeof (nfs_iodmin), sysctl_iodmin, "IU", + "Min number of nfsiod kthreads to keep as spares"); static int @@ -157,7 +159,8 @@ out: return (0); } SYSCTL_PROC(_vfs_nfs, OID_AUTO, iodmax, CTLTYPE_UINT | CTLFLAG_RW, 0, - sizeof (nfs_iodmax), sysctl_iodmax, "IU", ""); + sizeof (nfs_iodmax), sysctl_iodmax, "IU", + "Max number of nfsiod kthreads"); int nfs_nfsiodnew(void) @@ -208,7 +211,8 @@ nfsiod_setup(void *dummy) SYSINIT(nfsiod, SI_SUB_KTHREAD_IDLE, SI_ORDER_ANY, nfsiod_setup, NULL); static int nfs_defect = 0; -SYSCTL_INT(_vfs_nfs, OID_AUTO, defect, CTLFLAG_RW, &nfs_defect, 0, ""); +SYSCTL_INT(_vfs_nfs, OID_AUTO, defect, CTLFLAG_RW, &nfs_defect, 0, + "Allow nfsiods to migrate serving different mounts"); /* * Asynchronous I/O daemons for client nfs. Modified: head/sys/nfsclient/nfs_socket.c ============================================================================== --- head/sys/nfsclient/nfs_socket.c Sun Nov 2 16:51:57 2008 (r184560) +++ head/sys/nfsclient/nfs_socket.c Sun Nov 2 17:00:23 2008 (r184561) @@ -87,14 +87,18 @@ static int fake_wchan; SYSCTL_DECL(_vfs_nfs); -SYSCTL_INT(_vfs_nfs, OID_AUTO, realign_test, CTLFLAG_RW, &nfs_realign_test, 0, ""); -SYSCTL_INT(_vfs_nfs, OID_AUTO, realign_count, CTLFLAG_RW, &nfs_realign_count, 0, ""); -SYSCTL_INT(_vfs_nfs, OID_AUTO, bufpackets, CTLFLAG_RW, &nfs_bufpackets, 0, ""); +SYSCTL_INT(_vfs_nfs, OID_AUTO, realign_test, CTLFLAG_RW, &nfs_realign_test, 0, + "Number of realign tests done"); +SYSCTL_INT(_vfs_nfs, OID_AUTO, realign_count, CTLFLAG_RW, &nfs_realign_count, 0, + "Number of mbuf realignments done"); +SYSCTL_INT(_vfs_nfs, OID_AUTO, bufpackets, CTLFLAG_RW, &nfs_bufpackets, 0, + "Buffer reservation size 2 < x < 64"); SYSCTL_INT(_vfs_nfs, OID_AUTO, reconnects, CTLFLAG_RD, &nfs_reconnects, 0, - "number of times the nfs client has had to reconnect"); + "Number of times the nfs client has had to reconnect"); SYSCTL_INT(_vfs_nfs, OID_AUTO, nfs3_jukebox_delay, CTLFLAG_RW, &nfs3_jukebox_delay, 0, - "number of seconds to delay a retry after receiving EJUKEBOX"); -SYSCTL_INT(_vfs_nfs, OID_AUTO, skip_wcc_data_onerr, CTLFLAG_RW, &nfs_skip_wcc_data_onerr, 0, ""); + "Number of seconds to delay a retry after receiving EJUKEBOX"); +SYSCTL_INT(_vfs_nfs, OID_AUTO, skip_wcc_data_onerr, CTLFLAG_RW, &nfs_skip_wcc_data_onerr, 0, + "Disable weak cache consistency checking when server returns an error"); /* * There is a congestion window for outstanding rpcs maintained per mount Modified: head/sys/nfsclient/nfs_subs.c ============================================================================== --- head/sys/nfsclient/nfs_subs.c Sun Nov 2 16:51:57 2008 (r184560) +++ head/sys/nfsclient/nfs_subs.c Sun Nov 2 17:00:23 2008 (r184561) @@ -730,7 +730,8 @@ nfs_loadattrcache(struct vnode **vpp, st #include SYSCTL_DECL(_vfs_nfs); static int nfs_acdebug; -SYSCTL_INT(_vfs_nfs, OID_AUTO, acdebug, CTLFLAG_RW, &nfs_acdebug, 0, ""); +SYSCTL_INT(_vfs_nfs, OID_AUTO, acdebug, CTLFLAG_RW, &nfs_acdebug, 0, + "Toggle acdebug (access cache debug) flag"); #endif /* Modified: head/sys/nfsclient/nfs_vfsops.c ============================================================================== --- head/sys/nfsclient/nfs_vfsops.c Sun Nov 2 16:51:57 2008 (r184560) +++ head/sys/nfsclient/nfs_vfsops.c Sun Nov 2 17:00:23 2008 (r184561) @@ -92,18 +92,22 @@ SYSCTL_STRUCT(_vfs_nfs, NFS_NFSSTATS, nf &nfsstats, nfsstats, "S,nfsstats"); static int nfs_ip_paranoia = 1; SYSCTL_INT(_vfs_nfs, OID_AUTO, nfs_ip_paranoia, CTLFLAG_RW, - &nfs_ip_paranoia, 0, ""); + &nfs_ip_paranoia, 0, + "Disallow accepting replies from IPs which differ from those sent"); #ifdef NFS_DEBUG int nfs_debug; -SYSCTL_INT(_vfs_nfs, OID_AUTO, debug, CTLFLAG_RW, &nfs_debug, 0, ""); +SYSCTL_INT(_vfs_nfs, OID_AUTO, debug, CTLFLAG_RW, &nfs_debug, 0, + "Toggle debug flag"); #endif static int nfs_tprintf_initial_delay = NFS_TPRINTF_INITIAL_DELAY; SYSCTL_INT(_vfs_nfs, NFS_TPRINTF_INITIAL_DELAY, - downdelayinitial, CTLFLAG_RW, &nfs_tprintf_initial_delay, 0, ""); + downdelayinitial, CTLFLAG_RW, &nfs_tprintf_initial_delay, 0, + "Delay before printing \"nfs server not responding\" messages"); /* how long between console messages "nfs server foo not responding" */ static int nfs_tprintf_delay = NFS_TPRINTF_DELAY; SYSCTL_INT(_vfs_nfs, NFS_TPRINTF_DELAY, - downdelayinterval, CTLFLAG_RW, &nfs_tprintf_delay, 0, ""); + downdelayinterval, CTLFLAG_RW, &nfs_tprintf_delay, 0, + "Delay between printing \"nfs server not responding\" messages"); static void nfs_decode_args(struct mount *mp, struct nfsmount *nmp, struct nfs_args *argp, const char *hostname); @@ -158,14 +162,15 @@ struct nfsv3_diskless nfsv3_diskless = { int nfs_diskless_valid = 0; SYSCTL_INT(_vfs_nfs, OID_AUTO, diskless_valid, CTLFLAG_RD, - &nfs_diskless_valid, 0, ""); + &nfs_diskless_valid, 0, + "Has the diskless struct been filled correctly"); SYSCTL_STRING(_vfs_nfs, OID_AUTO, diskless_rootpath, CTLFLAG_RD, - nfsv3_diskless.root_hostnam, 0, ""); + nfsv3_diskless.root_hostnam, 0, "Path to nfs root"); SYSCTL_OPAQUE(_vfs_nfs, OID_AUTO, diskless_rootaddr, CTLFLAG_RD, - &nfsv3_diskless.root_saddr, sizeof nfsv3_diskless.root_saddr, - "%Ssockaddr_in", ""); + &nfsv3_diskless.root_saddr, sizeof nfsv3_diskless.root_saddr, + "%Ssockaddr_in", "Diskless root nfs address"); void nfsargs_ntoh(struct nfs_args *); Modified: head/sys/nfsserver/nfs_serv.c ============================================================================== --- head/sys/nfsserver/nfs_serv.c Sun Nov 2 16:51:57 2008 (r184560) +++ head/sys/nfsserver/nfs_serv.c Sun Nov 2 17:00:23 2008 (r184561) @@ -130,8 +130,10 @@ SYSCTL_NODE(_vfs, OID_AUTO, nfsrv, CTLFL static int nfs_async; static int nfs_commit_blks; static int nfs_commit_miss; -SYSCTL_INT(_vfs_nfsrv, OID_AUTO, async, CTLFLAG_RW, &nfs_async, 0, ""); -SYSCTL_INT(_vfs_nfsrv, OID_AUTO, commit_blks, CTLFLAG_RW, &nfs_commit_blks, 0, ""); +SYSCTL_INT(_vfs_nfsrv, OID_AUTO, async, CTLFLAG_RW, &nfs_async, 0, + "Tell client that writes were synced even though they were not"); +SYSCTL_INT(_vfs_nfsrv, OID_AUTO, commit_blks, CTLFLAG_RW, &nfs_commit_blks, 0, + "Number of completed commits"); SYSCTL_INT(_vfs_nfsrv, OID_AUTO, commit_miss, CTLFLAG_RW, &nfs_commit_miss, 0, ""); struct nfsrvstats nfsrvstats; Modified: head/sys/nfsserver/nfs_syscalls.c ============================================================================== --- head/sys/nfsserver/nfs_syscalls.c Sun Nov 2 16:51:57 2008 (r184560) +++ head/sys/nfsserver/nfs_syscalls.c Sun Nov 2 17:00:23 2008 (r184561) @@ -89,11 +89,14 @@ static int notstarted = 1; static int nfs_privport = 0; SYSCTL_INT(_vfs_nfsrv, NFS_NFSPRIVPORT, nfs_privport, CTLFLAG_RW, - &nfs_privport, 0, ""); + &nfs_privport, 0, + "Only allow clients using a privileged port"); SYSCTL_INT(_vfs_nfsrv, OID_AUTO, gatherdelay, CTLFLAG_RW, - &nfsrvw_procrastinate, 0, ""); + &nfsrvw_procrastinate, 0, + "Delay value for write gathering"); SYSCTL_INT(_vfs_nfsrv, OID_AUTO, gatherdelay_v3, CTLFLAG_RW, - &nfsrvw_procrastinate_v3, 0, ""); + &nfsrvw_procrastinate_v3, 0, + "Delay in seconds for NFSv3 write gathering"); static int nfssvc_addsock(struct file *, struct sockaddr *); static void nfsrv_zapsock(struct nfssvc_sock *slp); From imp at FreeBSD.org Sun Nov 2 09:04:55 2008 From: imp at FreeBSD.org (Warner Losh) Date: Sun Nov 2 09:05:07 2008 Subject: svn commit: r184562 - in head/sys: conf dev/mn pci Message-ID: <200811021704.mA2H4txm043746@svn.freebsd.org> Author: imp Date: Sun Nov 2 17:04:54 2008 New Revision: 184562 URL: http://svn.freebsd.org/changeset/base/184562 Log: Move mn over. One of the last stragglers in sys/pci. There's no module built for this hardware, so no changes needed. Added: head/sys/dev/mn/ head/sys/dev/mn/if_mn.c (props changed) - copied unchanged from r184514, head/sys/pci/if_mn.c Deleted: head/sys/pci/if_mn.c Modified: head/sys/conf/files Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Sun Nov 2 17:00:23 2008 (r184561) +++ head/sys/conf/files Sun Nov 2 17:04:54 2008 (r184562) @@ -961,6 +961,7 @@ dev/mmc/mmc.c optional mmc dev/mmc/mmcbr_if.m standard dev/mmc/mmcbus_if.m standard dev/mmc/mmcsd.c optional mmcsd +dev/mn/if_mn.c optional mn pci dev/mpt/mpt.c optional mpt dev/mpt/mpt_cam.c optional mpt dev/mpt/mpt_debug.c optional mpt @@ -2137,7 +2138,6 @@ opencrypto/xform.c optional crypto pci/alpm.c optional alpm pci pci/amdpm.c optional amdpm pci | nfpm pci pci/amdsmb.c optional amdsmb pci -pci/if_mn.c optional mn pci pci/if_rl.c optional rl pci pci/intpm.c optional intpm pci pci/ncr.c optional ncr pci Copied: head/sys/dev/mn/if_mn.c (from r184514, head/sys/pci/if_mn.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/mn/if_mn.c Sun Nov 2 17:04:54 2008 (r184562, copy of r184514, head/sys/pci/if_mn.c) @@ -0,0 +1,1450 @@ +/*- + * ---------------------------------------------------------------------------- + * "THE BEER-WARE LICENSE" (Revision 42): + * wrote this file. As long as you retain this notice you + * can do whatever you want with this stuff. If we meet some day, and you think + * this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp + * ---------------------------------------------------------------------------- + */ + +/* + * Driver for Siemens reference design card "Easy321-R1". + * + * This card contains a FALC54 E1/T1 framer and a MUNICH32X 32-channel HDLC + * controller. + * + * The driver supports E1 mode with up to 31 channels. We send CRC4 but don't + * check it coming in. + * + * The FALC54 and MUNICH32X have far too many registers and weird modes for + * comfort, so I have not bothered typing it all into a "fooreg.h" file, + * you will (badly!) need the documentation anyway if you want to mess with + * this gadget. + */ + +#include +__FBSDID("$FreeBSD$"); + +/* + * Stuff to describe the MUNIC32X and FALC54 chips. + */ + +#define M32_CHAN 32 /* We have 32 channels */ +#define M32_TS 32 /* We have 32 timeslots */ + +#define NG_MN_NODE_TYPE "mn" + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include "pci_if.h" + +#include +#include + +#include + +#include +#include + +#include +#include + + +static int mn_maxlatency = 1000; +SYSCTL_INT(_debug, OID_AUTO, mn_maxlatency, CTLFLAG_RW, + &mn_maxlatency, 0, + "The number of milliseconds a packet is allowed to spend in the output queue. " + "If the output queue is longer than this number of milliseconds when the packet " + "arrives for output, the packet will be dropped." +); + +#ifndef NMN +/* Most machines don't support more than 4 busmaster PCI slots, if even that many */ +#define NMN 4 +#endif + +/* From: PEB 20321 data sheet, p187, table 22 */ +struct m32xreg { + u_int32_t conf, cmd, stat, imask; + u_int32_t fill10, piqba, piql, fill1c; + u_int32_t mode1, mode2, ccba, txpoll; + u_int32_t tiqba, tiql, riqba, riql; + u_int32_t lconf, lccba, fill48, ltran; + u_int32_t ltiqba, ltiql, lriqba, lriql; + u_int32_t lreg0, lreg1, lreg2, lreg3; + u_int32_t lreg4, lreg5, lre6, lstat; + u_int32_t gpdir, gpdata, gpod, fill8c; + u_int32_t ssccon, sscbr, ssctb, sscrb; + u_int32_t ssccse, sscim, fillab, fillac; + u_int32_t iomcon1, iomcon2, iomstat, fillbc; + u_int32_t iomcit0, iomcit1, iomcir0, iomcir1; + u_int32_t iomtmo, iomrmo, filld8, filldc; + u_int32_t mbcmd, mbdata1, mbdata2, mbdata3; + u_int32_t mbdata4, mbdata5, mbdata6, mbdata7; +}; + +/* From: PEB 2254 data sheet, p80, table 10 */ +struct f54wreg { + u_int16_t xfifo; + u_int8_t cmdr, mode, rah1, rah2, ral1, ral2; + u_int8_t ipc, ccr1, ccr3, pre, rtr1, rtr2, rtr3, rtr4; + u_int8_t ttr1, ttr2, ttr3, ttr4, imr0, imr1, imr2, imr3; + u_int8_t imr4, fill19, fmr0, fmr1, fmr2, loop, xsw, xsp; + u_int8_t xc0, xc1, rc0, rc1, xpm0, xpm1, xpm2, tswm; + u_int8_t test1, idle, xsa4, xsa5, xsa6, xsa7, xsa8, fmr3; + u_int8_t icb1, icb2, icb3, icb4, lim0, lim1, pcd, pcr; + u_int8_t lim2, fill39[7]; + u_int8_t fill40[8]; + u_int8_t fill48[8]; + u_int8_t fill50[8]; + u_int8_t fill58[8]; + u_int8_t dec, fill61, test2, fill63[5]; + u_int8_t fill68[8]; + u_int8_t xs[16]; +}; + +/* From: PEB 2254 data sheet, p117, table 10 */ +struct f54rreg { + u_int16_t rfifo; + u_int8_t fill2, mode, rah1, rah2, ral1, ral2; + u_int8_t ipc, ccr1, ccr3, pre, rtr1, rtr2, rtr3, rtr4; + u_int8_t ttr1, ttr2, ttr3, ttr4, imr0, imr1, imr2, imr3; + u_int8_t imr4, fill19, fmr0, fmr1, fmr2, loop, xsw, xsp; + u_int8_t xc0, xc1, rc0, rc1, xpm0, xpm1, xpm2, tswm; + u_int8_t test, idle, xsa4, xsa5, xsa6, xsa7, xsa8, fmr13; + u_int8_t icb1, icb2, icb3, icb4, lim0, lim1, pcd, pcr; + u_int8_t lim2, fill39[7]; + u_int8_t fill40[8]; + u_int8_t fill48[4], frs0, frs1, rsw, rsp; + u_int16_t fec, cvc, cec1, ebc; + u_int16_t cec2, cec3; + u_int8_t rsa4, rsa5, rsa6, rsa7; + u_int8_t rsa8, rsa6s, tsr0, tsr1, sis, rsis; + u_int16_t rbc; + u_int8_t isr0, isr1, isr2, isr3, fill6c, fill6d, gis, vstr; + u_int8_t rs[16]; +}; + +/* Transmit & receive descriptors */ +struct trxd { + u_int32_t flags; + vm_offset_t next; + vm_offset_t data; + u_int32_t status; /* only used for receive */ + struct mbuf *m; /* software use only */ + struct trxd *vnext; /* software use only */ +}; + +/* Channel specification */ +struct cspec { + u_int32_t flags; + vm_offset_t rdesc; + vm_offset_t tdesc; + u_int32_t itbs; +}; + +struct m32_mem { + vm_offset_t csa; + u_int32_t ccb; + u_int32_t reserve1[2]; + u_int32_t ts[M32_TS]; + struct cspec cs[M32_CHAN]; + vm_offset_t crxd[M32_CHAN]; + vm_offset_t ctxd[M32_CHAN]; +}; + +struct mn_softc; +struct sockaddr; +struct rtentry; + +static int mn_probe(device_t self); +static int mn_attach(device_t self); +static void mn_create_channel(struct mn_softc *sc, int chan); +static int mn_reset(struct mn_softc *sc); +static struct trxd * mn_alloc_desc(void); +static void mn_free_desc(struct trxd *dp); +static void mn_intr(void *xsc); +static u_int32_t mn_parse_ts(const char *s, int *nbit); +#ifdef notyet +static void m32_dump(struct mn_softc *sc); +static void f54_dump(struct mn_softc *sc); +static void mn_fmt_ts(char *p, u_int32_t ts); +#endif /* notyet */ +static void f54_init(struct mn_softc *sc); + +static ng_constructor_t ngmn_constructor; +static ng_rcvmsg_t ngmn_rcvmsg; +static ng_shutdown_t ngmn_shutdown; +static ng_newhook_t ngmn_newhook; +static ng_connect_t ngmn_connect; +static ng_rcvdata_t ngmn_rcvdata; +static ng_disconnect_t ngmn_disconnect; + +static struct ng_type mntypestruct = { + .version = NG_ABI_VERSION, + .name = NG_MN_NODE_TYPE, + .constructor = ngmn_constructor, + .rcvmsg = ngmn_rcvmsg, + .shutdown = ngmn_shutdown, + .newhook = ngmn_newhook, + .connect = ngmn_connect, + .rcvdata = ngmn_rcvdata, + .disconnect = ngmn_disconnect, +}; + +static MALLOC_DEFINE(M_MN, "mn", "Mx driver related"); + +#define NIQB 64 + +struct schan { + enum {DOWN, UP} state; + struct mn_softc *sc; + int chan; + u_int32_t ts; + char name[8]; + struct trxd *r1, *rl; + struct trxd *x1, *xl; + hook_p hook; + + time_t last_recv; + time_t last_rxerr; + time_t last_xmit; + + u_long rx_error; + + u_long short_error; + u_long crc_error; + u_long dribble_error; + u_long long_error; + u_long abort_error; + u_long overflow_error; + + int last_error; + int prev_error; + + u_long tx_pending; + u_long tx_limit; +}; + +enum framing {WHOKNOWS, E1, E1U, T1, T1U}; + +struct mn_softc { + int unit; + device_t dev; + struct resource *irq; + void *intrhand; + enum framing framing; + int nhooks; + void *m0v, *m1v; + vm_offset_t m0p, m1p; + struct m32xreg *m32x; + struct f54wreg *f54w; + struct f54rreg *f54r; + struct m32_mem m32_mem; + u_int32_t tiqb[NIQB]; + u_int32_t riqb[NIQB]; + u_int32_t piqb[NIQB]; + u_int32_t ltiqb[NIQB]; + u_int32_t lriqb[NIQB]; + char name[8]; + u_int32_t falc_irq, falc_state, framer_state; + struct schan *ch[M32_CHAN]; + char nodename[NG_NODESIZ]; + node_p node; + + u_long cnt_fec; + u_long cnt_cvc; + u_long cnt_cec1; + u_long cnt_ebc; + u_long cnt_cec2; + u_long cnt_cec3; + u_long cnt_rbc; +}; + +static int +ngmn_constructor(node_p node) +{ + + return (EINVAL); +} + +static int +ngmn_shutdown(node_p nodep) +{ + + return (EINVAL); +} + +static void +ngmn_config(node_p node, char *set, char *ret) +{ + struct mn_softc *sc; + enum framing wframing; + + sc = NG_NODE_PRIVATE(node); + + if (set != NULL) { + if (!strncmp(set, "line ", 5)) { + wframing = sc->framing; + if (!strcmp(set, "line e1")) { + wframing = E1; + } else if (!strcmp(set, "line e1u")) { + wframing = E1U; + } else { + strcat(ret, "ENOGROK\n"); + return; + } + if (wframing == sc->framing) + return; + if (sc->nhooks > 0) { + sprintf(ret, "Cannot change line when %d hooks open\n", sc->nhooks); + return; + } + sc->framing = wframing; +#if 1 + f54_init(sc); +#else + mn_reset(sc); +#endif + } else { + printf("%s CONFIG SET [%s]\n", sc->nodename, set); + strcat(ret, "ENOGROK\n"); + return; + } + } + +} + +static int +ngmn_rcvmsg(node_p node, item_p item, hook_p lasthook) +{ + struct mn_softc *sc; + struct ng_mesg *resp = NULL; + struct schan *sch; + char *s, *r; + int pos, i; + struct ng_mesg *msg; + + NGI_GET_MSG(item, msg); + sc = NG_NODE_PRIVATE(node); + + if (msg->header.typecookie != NGM_GENERIC_COOKIE) { + NG_FREE_ITEM(item); + NG_FREE_MSG(msg); + return (EINVAL); + } + + if (msg->header.cmd != NGM_TEXT_CONFIG && + msg->header.cmd != NGM_TEXT_STATUS) { + NG_FREE_ITEM(item); + NG_FREE_MSG(msg); + return (EINVAL); + } + + NG_MKRESPONSE(resp, msg, sizeof(struct ng_mesg) + NG_TEXTRESPONSE, + M_NOWAIT); + if (resp == NULL) { + NG_FREE_ITEM(item); + NG_FREE_MSG(msg); + return (ENOMEM); + } + + if (msg->header.arglen) + s = (char *)msg->data; + else + s = NULL; + r = (char *)resp->data; + *r = '\0'; + + if (msg->header.cmd == NGM_TEXT_CONFIG) { + ngmn_config(node, s, r); + resp->header.arglen = strlen(r) + 1; + NG_RESPOND_MSG(i, node, item, resp); + NG_FREE_MSG(msg); + return (0); + } + pos = 0; + pos += sprintf(pos + r,"Framer status %b;\n", sc->framer_state, "\20" + "\40LOS\37AIS\36LFA\35RRA" + "\34AUXP\33NMF\32LMFA\31frs0.0" + "\30frs1.7\27TS16RA\26TS16LOS\25TS16AIS" + "\24TS16LFA\23frs1.2\22XLS\21XLO" + "\20RS1\17rsw.6\16RRA\15RY0" + "\14RY1\13RY2\12RY3\11RY4" + "\10SI1\7SI2\6rsp.5\5rsp.4" + "\4rsp.3\3RSIF\2RS13\1RS15"); + pos += sprintf(pos + r," Framing errors: %lu", sc->cnt_fec); + pos += sprintf(pos + r," Code Violations: %lu\n", sc->cnt_cvc); + + pos += sprintf(pos + r," Falc State %b;\n", sc->falc_state, "\20" + "\40LOS\37AIS\36LFA\35RRA" + "\34AUXP\33NMF\32LMFA\31frs0.0" + "\30frs1.7\27TS16RA\26TS16LOS\25TS16AIS" + "\24TS16LFA\23frs1.2\22XLS\21XLO" + "\20RS1\17rsw.6\16RRA\15RY0" + "\14RY1\13RY2\12RY3\11RY4" + "\10SI1\7SI2\6rsp.5\5rsp.4" + "\4rsp.3\3RSIF\2RS13\1RS15"); + pos += sprintf(pos + r, " Falc IRQ %b\n", sc->falc_irq, "\20" + "\40RME\37RFS\36T8MS\35RMB\34CASC\33CRC4\32SA6SC\31RPF" + "\30b27\27RDO\26ALLS\25XDU\24XMB\23b22\22XLSC\21XPR" + "\20FAR\17LFA\16MFAR\15T400MS\14AIS\13LOS\12RAR\11RA" + "\10ES\7SEC\6LMFA16\5AIS16\4RA16\3API\2SLN\1SLP"); + for (i = 0; i < M32_CHAN; i++) { + if (!sc->ch[i]) + continue; + sch = sc->ch[i]; + + pos += sprintf(r + pos, " Chan %d <%s> ", + i, NG_HOOK_NAME(sch->hook)); + + pos += sprintf(r + pos, " Last Rx: "); + if (sch->last_recv) + pos += sprintf(r + pos, "%lu s", + (unsigned long)(time_second - sch->last_recv)); + else + pos += sprintf(r + pos, "never"); + + pos += sprintf(r + pos, ", last RxErr: "); + if (sch->last_rxerr) + pos += sprintf(r + pos, "%lu s", + (unsigned long)(time_second - sch->last_rxerr)); + else + pos += sprintf(r + pos, "never"); + + pos += sprintf(r + pos, ", last Tx: "); + if (sch->last_xmit) + pos += sprintf(r + pos, "%lu s\n", + (unsigned long)(time_second - sch->last_xmit)); + else + pos += sprintf(r + pos, "never\n"); + + pos += sprintf(r + pos, " RX error(s) %lu", sch->rx_error); + pos += sprintf(r + pos, " Short: %lu", sch->short_error); + pos += sprintf(r + pos, " CRC: %lu", sch->crc_error); + pos += sprintf(r + pos, " Mod8: %lu", sch->dribble_error); + pos += sprintf(r + pos, " Long: %lu", sch->long_error); + pos += sprintf(r + pos, " Abort: %lu", sch->abort_error); + pos += sprintf(r + pos, " Overflow: %lu\n", sch->overflow_error); + + pos += sprintf(r + pos, " Last error: %b Prev error: %b\n", + sch->last_error, "\20\7SHORT\5CRC\4MOD8\3LONG\2ABORT\1OVERRUN", + sch->prev_error, "\20\7SHORT\5CRC\4MOD8\3LONG\2ABORT\1OVERRUN"); + pos += sprintf(r + pos, " Xmit bytes pending %ld\n", + sch->tx_pending); + } + resp->header.arglen = pos + 1; + + /* Take care of synchronous response, if any */ + NG_RESPOND_MSG(i, node, item, resp); + NG_FREE_MSG(msg); + return (0); +} + +static int +ngmn_newhook(node_p node, hook_p hook, const char *name) +{ + u_int32_t ts, chan; + struct mn_softc *sc; + int nbit; + + sc = NG_NODE_PRIVATE(node); + + if (name[0] != 't' || name[1] != 's') + return (EINVAL); + + ts = mn_parse_ts(name + 2, &nbit); + printf("%d bits %x\n", nbit, ts); + if (sc->framing == E1 && (ts & 1)) + return (EINVAL); + if (sc->framing == E1U && nbit != 32) + return (EINVAL); + if (ts == 0) + return (EINVAL); + if (sc->framing == E1) + chan = ffs(ts) - 1; + else + chan = 1; + if (!sc->ch[chan]) + mn_create_channel(sc, chan); + else if (sc->ch[chan]->state == UP) + return (EBUSY); + sc->ch[chan]->ts = ts; + sc->ch[chan]->hook = hook; + sc->ch[chan]->tx_limit = nbit * 8; + NG_HOOK_SET_PRIVATE(hook, sc->ch[chan]); + sc->nhooks++; + return(0); +} + + +static struct trxd *mn_desc_free; + +static struct trxd * +mn_alloc_desc(void) +{ + struct trxd *dp; + + dp = mn_desc_free; + if (dp) + mn_desc_free = dp->vnext; + else + dp = (struct trxd *)malloc(sizeof *dp, M_MN, M_NOWAIT); + return (dp); +} + +static void +mn_free_desc(struct trxd *dp) +{ + dp->vnext = mn_desc_free; + mn_desc_free = dp; +} + +static u_int32_t +mn_parse_ts(const char *s, int *nbit) +{ + unsigned r; + int i, j; + char *p; + + r = 0; + j = -1; + *nbit = 0; + while(*s) { + i = strtol(s, &p, 0); + if (i < 0 || i > 31) + return (0); + while (j != -1 && j < i) { + r |= 1 << j++; + (*nbit)++; + } + j = -1; + r |= 1 << i; + (*nbit)++; + if (*p == ',') { + s = p + 1; + continue; + } else if (*p == '-') { + j = i + 1; + s = p + 1; + continue; + } else if (!*p) { + break; + } else { + return (0); + } + } + return (r); +} + +#ifdef notyet +static void +mn_fmt_ts(char *p, u_int32_t ts) +{ + char *s; + int j; + + s = ""; + ts &= 0xffffffff; + for (j = 0; j < 32; j++) { + if (!(ts & (1 << j))) + continue; + sprintf(p, "%s%d", s, j); + p += strlen(p); + s = ","; + if (!(ts & (1 << (j+1)))) + continue; + for (; j < 32; j++) + if (!(ts & (1 << (j+1)))) + break; + sprintf(p, "-%d", j); + p += strlen(p); + s = ","; + } +} +#endif /* notyet */ + +/* + * OUTPUT + */ + +static int +ngmn_rcvdata(hook_p hook, item_p item) +{ + struct mbuf *m2; + struct trxd *dp, *dp2; + struct schan *sch; + struct mn_softc *sc; + int chan, pitch, len; + struct mbuf *m; + + sch = NG_HOOK_PRIVATE(hook); + sc = sch->sc; + chan = sch->chan; + + if (sch->state != UP) { + NG_FREE_ITEM(item); + return (0); + } + NGI_GET_M(item, m); + if (sch->tx_pending + m->m_pkthdr.len > sch->tx_limit * mn_maxlatency) { + NG_FREE_M(m); + NG_FREE_ITEM(item); + return (0); + } + NG_FREE_ITEM(item); + pitch = 0; + m2 = m; + dp2 = sc->ch[chan]->xl; + len = m->m_pkthdr.len; + while (len) { + dp = mn_alloc_desc(); + if (!dp) { + pitch++; + m_freem(m); + sc->ch[chan]->xl = dp2; + dp = dp2->vnext; + while (dp) { + dp2 = dp->vnext; + mn_free_desc(dp); + dp = dp2; + } + sc->ch[chan]->xl->vnext = 0; + break; + } + dp->data = vtophys(m2->m_data); + dp->flags = m2->m_len << 16; + dp->flags += 1; + len -= m2->m_len; + dp->next = vtophys(dp); + dp->vnext = 0; + sc->ch[chan]->xl->next = vtophys(dp); + sc->ch[chan]->xl->vnext = dp; + sc->ch[chan]->xl = dp; + if (!len) { + dp->m = m; + dp->flags |= 0xc0000000; + dp2->flags &= ~0x40000000; + } else { + dp->m = 0; + m2 = m2->m_next; + } + } + if (pitch) + printf("%s%d: Short on mem, pitched %d packets\n", + sc->name, chan, pitch); + else { +#if 0 + printf("%d = %d + %d (%p)\n", + sch->tx_pending + m->m_pkthdr.len, + sch->tx_pending , m->m_pkthdr.len, m); +#endif + sch->tx_pending += m->m_pkthdr.len; + sc->m32x->txpoll &= ~(1 << chan); + } + return (0); +} + +/* + * OPEN + */ +static int +ngmn_connect(hook_p hook) +{ + int i, nts, chan; + struct trxd *dp, *dp2; + struct mbuf *m; + struct mn_softc *sc; + struct schan *sch; + u_int32_t u; + + sch = NG_HOOK_PRIVATE(hook); + chan = sch->chan; + sc = sch->sc; + + if (sch->state == UP) + return (0); + sch->state = UP; + + /* Count and configure the timeslots for this channel */ + for (nts = i = 0; i < 32; i++) + if (sch->ts & (1 << i)) { + sc->m32_mem.ts[i] = 0x00ff00ff | + (chan << 24) | (chan << 8); + nts++; + } + + /* Init the receiver & xmitter to HDLC */ + sc->m32_mem.cs[chan].flags = 0x80e90006; + /* Allocate two buffers per timeslot */ + if (nts == 32) + sc->m32_mem.cs[chan].itbs = 63; + else + sc->m32_mem.cs[chan].itbs = nts * 2; + + /* Setup a transmit chain with one descriptor */ + /* XXX: we actually send a 1 byte packet */ + dp = mn_alloc_desc(); + MGETHDR(m, M_WAIT, MT_DATA); + m->m_pkthdr.len = 0; + dp->m = m; + dp->flags = 0xc0000000 + (1 << 16); + dp->next = vtophys(dp); + dp->vnext = 0; + dp->data = vtophys(sc->name); + sc->m32_mem.cs[chan].tdesc = vtophys(dp); + sc->ch[chan]->x1 = dp; + sc->ch[chan]->xl = dp; + + /* Setup a receive chain with 5 + NTS descriptors */ + + dp = mn_alloc_desc(); + m = NULL; + MGETHDR(m, M_WAIT, MT_DATA); + MCLGET(m, M_WAIT); + dp->m = m; + dp->data = vtophys(m->m_data); + dp->flags = 0x40000000; + dp->flags += 1600 << 16; + dp->next = vtophys(dp); + dp->vnext = 0; + sc->ch[chan]->rl = dp; + + for (i = 0; i < (nts + 10); i++) { + dp2 = dp; + dp = mn_alloc_desc(); + m = NULL; + MGETHDR(m, M_WAIT, MT_DATA); + MCLGET(m, M_WAIT); + dp->m = m; + dp->data = vtophys(m->m_data); + dp->flags = 0x00000000; + dp->flags += 1600 << 16; + dp->next = vtophys(dp2); + dp->vnext = dp2; + } + sc->m32_mem.cs[chan].rdesc = vtophys(dp); + sc->ch[chan]->r1 = dp; + + /* Initialize this channel */ + sc->m32_mem.ccb = 0x00008000 + (chan << 8); + sc->m32x->cmd = 0x1; + DELAY(1000); + u = sc->m32x->stat; + if (!(u & 1)) + printf("%s: init chan %d stat %08x\n", sc->name, chan, u); + sc->m32x->stat = 1; + /* probably not at splnet, force outward queueing */ + NG_HOOK_FORCE_QUEUE(NG_HOOK_PEER(hook)); + + return (0); +} + +/* + * CLOSE + */ +static int +ngmn_disconnect(hook_p hook) +{ + int chan, i; + struct mn_softc *sc; + struct schan *sch; + struct trxd *dp, *dp2; + u_int32_t u; + + sch = NG_HOOK_PRIVATE(hook); + chan = sch->chan; + sc = sch->sc; + + if (sch->state == DOWN) + return (0); + sch->state = DOWN; + + /* Set receiver & transmitter off */ + sc->m32_mem.cs[chan].flags = 0x80920006; + sc->m32_mem.cs[chan].itbs = 0; + + /* free the timeslots */ + for (i = 0; i < 32; i++) + if (sc->ch[chan]->ts & (1 << i)) + sc->m32_mem.ts[i] = 0x20002000; + + /* Initialize this channel */ + sc->m32_mem.ccb = 0x00008000 + (chan << 8); + sc->m32x->cmd = 0x1; + DELAY(30); + u = sc->m32x->stat; + if (!(u & 1)) + printf("%s: zap chan %d stat %08x\n", sc->name, chan, u); + sc->m32x->stat = 1; + + /* Free all receive descriptors and mbufs */ + for (dp = sc->ch[chan]->r1; dp ; dp = dp2) { + if (dp->m) + m_freem(dp->m); + sc->ch[chan]->r1 = dp2 = dp->vnext; + mn_free_desc(dp); + } + + /* Free all transmit descriptors and mbufs */ + for (dp = sc->ch[chan]->x1; dp ; dp = dp2) { + if (dp->m) { + sc->ch[chan]->tx_pending -= dp->m->m_pkthdr.len; + m_freem(dp->m); + } + sc->ch[chan]->x1 = dp2 = dp->vnext; + mn_free_desc(dp); + } + sc->nhooks--; + return(0); +} + +/* + * Create a new channel. + */ +static void +mn_create_channel(struct mn_softc *sc, int chan) +{ + struct schan *sch; + + sch = sc->ch[chan] = (struct schan *)malloc(sizeof *sc->ch[chan], + M_MN, M_WAITOK | M_ZERO); + sch->sc = sc; + sch->state = DOWN; + sch->chan = chan; + sprintf(sch->name, "%s%d", sc->name, chan); + return; +} + +#ifdef notyet +/* + * Dump Munich32x state + */ +static void +m32_dump(struct mn_softc *sc) +{ + u_int32_t *tp4; + int i, j; + + printf("mn%d: MUNICH32X dump\n", sc->unit); + tp4 = (u_int32_t *)sc->m0v; + for(j = 0; j < 64; j += 8) { + printf("%02x", j * sizeof *tp4); + for(i = 0; i < 8; i++) + printf(" %08x", tp4[i+j]); + printf("\n"); + } + for(j = 0; j < M32_CHAN; j++) { + if (!sc->ch[j]) + continue; + printf("CH%d: state %d ts %08x", + j, sc->ch[j]->state, sc->ch[j]->ts); + printf(" %08x %08x %08x %08x %08x %08x\n", + sc->m32_mem.cs[j].flags, + sc->m32_mem.cs[j].rdesc, + sc->m32_mem.cs[j].tdesc, + sc->m32_mem.cs[j].itbs, + sc->m32_mem.crxd[j], + sc->m32_mem.ctxd[j] ); + } +} + +/* + * Dump Falch54 state + */ +static void +f54_dump(struct mn_softc *sc) +{ + u_int8_t *tp1; + int i, j; + + printf("%s: FALC54 dump\n", sc->name); + tp1 = (u_int8_t *)sc->m1v; + for(j = 0; j < 128; j += 16) { + printf("%s: %02x |", sc->name, j * sizeof *tp1); + for(i = 0; i < 16; i++) + printf(" %02x", tp1[i+j]); + printf("\n"); + } +} +#endif /* notyet */ + +/* + * Init Munich32x + */ +static void +m32_init(struct mn_softc *sc) +{ + + sc->m32x->conf = 0x00000000; + sc->m32x->mode1 = 0x81048000 + 1600; /* XXX: temp */ +#if 1 + sc->m32x->mode2 = 0x00000081; + sc->m32x->txpoll = 0xffffffff; +#elif 1 + sc->m32x->mode2 = 0x00000081; + sc->m32x->txpoll = 0xffffffff; +#else + sc->m32x->mode2 = 0x00000101; +#endif + sc->m32x->lconf = 0x6060009B; + sc->m32x->imask = 0x00000000; +} + +/* + * Init the Falc54 + */ +static void +f54_init(struct mn_softc *sc) +{ + sc->f54w->ipc = 0x07; + + sc->f54w->xpm0 = 0xbd; + sc->f54w->xpm1 = 0x03; + sc->f54w->xpm2 = 0x00; + + sc->f54w->imr0 = 0x18; /* RMB, CASC */ + sc->f54w->imr1 = 0x08; /* XMB */ + sc->f54w->imr2 = 0x00; + sc->f54w->imr3 = 0x38; /* LMFA16, AIS16, RA16 */ + sc->f54w->imr4 = 0x00; + + sc->f54w->fmr0 = 0xf0; /* X: HDB3, R: HDB3 */ + sc->f54w->fmr1 = 0x0e; /* Send CRC4, 2Mbit, ECM */ + if (sc->framing == E1) + sc->f54w->fmr2 = 0x03; /* Auto Rem-Alarm, Auto resync */ + else if (sc->framing == E1U) + sc->f54w->fmr2 = 0x33; /* dais, rtm, Auto Rem-Alarm, Auto resync */ + + sc->f54w->lim1 = 0xb0; /* XCLK=8kHz, .62V threshold */ + sc->f54w->pcd = 0x0a; + sc->f54w->pcr = 0x15; + sc->f54w->xsw = 0x9f; /* fmr4 */ + if (sc->framing == E1) + sc->f54w->xsp = 0x1c; /* fmr5 */ + else if (sc->framing == E1U) + sc->f54w->xsp = 0x3c; /* tt0, fmr5 */ + sc->f54w->xc0 = 0x07; + sc->f54w->xc1 = 0x3d; + sc->f54w->rc0 = 0x05; + sc->f54w->rc1 = 0x00; + sc->f54w->cmdr = 0x51; +} + +static int +mn_reset(struct mn_softc *sc) +{ + u_int32_t u; + int i; + + sc->m32x->ccba = vtophys(&sc->m32_mem.csa); + sc->m32_mem.csa = vtophys(&sc->m32_mem.ccb); + + bzero(sc->tiqb, sizeof sc->tiqb); + sc->m32x->tiqba = vtophys(&sc->tiqb); + sc->m32x->tiql = NIQB / 16 - 1; + + bzero(sc->riqb, sizeof sc->riqb); + sc->m32x->riqba = vtophys(&sc->riqb); + sc->m32x->riql = NIQB / 16 - 1; + + bzero(sc->ltiqb, sizeof sc->ltiqb); + sc->m32x->ltiqba = vtophys(&sc->ltiqb); + sc->m32x->ltiql = NIQB / 16 - 1; + + bzero(sc->lriqb, sizeof sc->lriqb); + sc->m32x->lriqba = vtophys(&sc->lriqb); + sc->m32x->lriql = NIQB / 16 - 1; + + bzero(sc->piqb, sizeof sc->piqb); + sc->m32x->piqba = vtophys(&sc->piqb); + sc->m32x->piql = NIQB / 16 - 1; + + m32_init(sc); + f54_init(sc); + + u = sc->m32x->stat; + sc->m32x->stat = u; + sc->m32_mem.ccb = 0x4; + sc->m32x->cmd = 0x1; + DELAY(1000); + u = sc->m32x->stat; *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From imp at FreeBSD.org Sun Nov 2 09:35:15 2008 From: imp at FreeBSD.org (Warner Losh) Date: Sun Nov 2 09:35:22 2008 Subject: svn commit: r184563 - head/sys/dev/acpica Message-ID: <200811021735.mA2HZFNT044307@svn.freebsd.org> Author: imp Date: Sun Nov 2 17:35:15 2008 New Revision: 184563 URL: http://svn.freebsd.org/changeset/base/184563 Log: Make the no driver stuff an ifdef. Modified: head/sys/dev/acpica/acpi.c Modified: head/sys/dev/acpica/acpi.c ============================================================================== --- head/sys/dev/acpica/acpi.c Sun Nov 2 17:04:54 2008 (r184562) +++ head/sys/dev/acpica/acpi.c Sun Nov 2 17:35:15 2008 (r184563) @@ -789,8 +789,9 @@ acpi_print_child(device_t bus, device_t static void acpi_probe_nomatch(device_t bus, device_t child) { - - /* pci_set_powerstate(child, PCI_POWERSTATE_D3); */ +#ifdef ACPI_ENABLE_POWERDOWN_NODRIVER + pci_set_powerstate(child, PCI_POWERSTATE_D3); +#endif } /* @@ -810,9 +811,13 @@ acpi_driver_added(device_t dev, driver_t for (i = 0; i < numdevs; i++) { child = devlist[i]; if (device_get_state(child) == DS_NOTPRESENT) { - /* pci_set_powerstate(child, PCI_POWERSTATE_D0); */ +#ifdef ACPI_ENABLE_POWERDOWN_NODRIVER + pci_set_powerstate(child, PCI_POWERSTATE_D0); if (device_probe_and_attach(child) != 0) - ; /* pci_set_powerstate(child, PCI_POWERSTATE_D3); */ + pci_set_powerstate(child, PCI_POWERSTATE_D3); +#else + device_probe_and_attach(child); +#endif } } free(devlist, M_TEMP); From imp at FreeBSD.org Sun Nov 2 10:48:54 2008 From: imp at FreeBSD.org (Warner Losh) Date: Sun Nov 2 10:49:06 2008 Subject: svn commit: r184564 - in head/sys: i386/i386 isa Message-ID: <200811021848.mA2Ims7Y045601@svn.freebsd.org> Author: imp Date: Sun Nov 2 18:48:54 2008 New Revision: 184564 URL: http://svn.freebsd.org/changeset/base/184564 Log: MFp4: Make the ISA bus keep track of more PNP details. Plus a minor style fix while I'm here. More could be done here, but except for some SBCs that don't have ACPI, there's limited value to anybody in doing so. Modified: head/sys/i386/i386/bios.c head/sys/isa/isa_common.c head/sys/isa/isa_common.h head/sys/isa/isavar.h head/sys/isa/pnp.c Modified: head/sys/i386/i386/bios.c ============================================================================== --- head/sys/i386/i386/bios.c Sun Nov 2 17:35:15 2008 (r184563) +++ head/sys/i386/i386/bios.c Sun Nov 2 18:48:54 2008 (r184564) @@ -699,9 +699,10 @@ pnpbios_identify(driver_t *driver, devic (!(pd->attrib & PNPATTR_NOCONFIG) && PNPATTR_CONFIG(pd->attrib) != PNPATTR_CONFIG_STATIC) ? ISACFGATTR_DYNAMIC : 0); + isa_set_pnpbios_handle(dev, pd->handle); ISA_SET_CONFIG_CALLBACK(parent, dev, pnpbios_set_config, 0); pnp_parse_resources(dev, &pd->devdata[0], - pd->size - sizeof(struct pnp_sysdev), 0); + pd->size - sizeof(struct pnp_sysdev), 0); if (!device_get_desc(dev)) device_set_desc_copy(dev, pnp_eisaformat(pd->devid)); Modified: head/sys/isa/isa_common.c ============================================================================== --- head/sys/isa/isa_common.c Sun Nov 2 17:35:15 2008 (r184563) +++ head/sys/isa/isa_common.c Sun Nov 2 18:48:54 2008 (r184564) @@ -467,9 +467,6 @@ isa_assign_resources(device_t child) return (0); } -/* - * Called after other devices have initialised to probe for isa devices. - */ void isa_probe_children(device_t dev) { @@ -762,6 +759,18 @@ isa_read_ivar(device_t bus, device_t dev *result = idev->id_config_attr; break; + case ISA_IVAR_PNP_CSN: + *result = idev->id_pnp_csn; + break; + + case ISA_IVAR_PNP_LDN: + *result = idev->id_pnp_ldn; + break; + + case ISA_IVAR_PNPBIOS_HANDLE: + *result = idev->id_pnpbios_handle; + break; + default: return (ENOENT); } @@ -1026,6 +1035,13 @@ static int isa_child_location_str(device_t bus, device_t child, char *buf, size_t buflen) { +#if 0 + /* id_pnphandle isn't there yet */ + struct isa_device *idev = DEVTOISA(child); + + if (idev->id_vendorid) + snprintf(buf, buflen, "pnphandle=%d", idev->id_pnphandle); +#endif /* Nothing here yet */ *buf = '\0'; return (0); Modified: head/sys/isa/isa_common.h ============================================================================== --- head/sys/isa/isa_common.h Sun Nov 2 17:35:15 2008 (r184563) +++ head/sys/isa/isa_common.h Sun Nov 2 18:48:54 2008 (r184564) @@ -56,6 +56,9 @@ struct isa_device { isa_config_cb *id_config_cb; /* callback function */ void *id_config_arg; /* callback argument */ int id_config_attr; /* pnp config attributes */ + int id_pnpbios_handle; /* pnp handle, if any */ + int id_pnp_csn; /* pnp Card Number */ + int id_pnp_ldn; /* pnp Logical device on card */ }; #define DEVTOISA(dev) ((struct isa_device *) device_get_ivars(dev)) Modified: head/sys/isa/isavar.h ============================================================================== --- head/sys/isa/isavar.h Sun Nov 2 17:35:15 2008 (r184563) +++ head/sys/isa/isavar.h Sun Nov 2 18:48:54 2008 (r184564) @@ -48,7 +48,7 @@ typedef void isa_config_cb(void *arg, st #define ISA_ORDER_PNPBIOS 10 /* plug-and-play BIOS inflexible hardware */ #define ISA_ORDER_SENSITIVE 20 /* legacy sensitive hardware */ #define ISA_ORDER_SPECULATIVE 30 /* legacy non-sensitive hardware */ -#define ISA_ORDER_PNP 40 /* plug-and-play hardware */ +#define ISA_ORDER_PNP 40 /* plug-and-play flexible hardware */ /* * Limits on resources that we can manage @@ -125,7 +125,10 @@ enum isa_device_ivars { ISA_IVAR_SERIAL, ISA_IVAR_LOGICALID, ISA_IVAR_COMPATID, - ISA_IVAR_CONFIGATTR + ISA_IVAR_CONFIGATTR, + ISA_IVAR_PNP_CSN, + ISA_IVAR_PNP_LDN, + ISA_IVAR_PNPBIOS_HANDLE }; /* @@ -152,6 +155,9 @@ ISA_ACCESSOR(serial, SERIAL, int) ISA_ACCESSOR(logicalid, LOGICALID, int) ISA_ACCESSOR(compatid, COMPATID, int) ISA_ACCESSOR(configattr, CONFIGATTR, int) +ISA_ACCESSOR(pnp_csn, PNP_CSN, int) +ISA_ACCESSOR(pnp_ldn, PNP_LDN, int) +ISA_ACCESSOR(pnpbios_handle, PNPBIOS_HANDLE, int) /* Device class for ISA bridges. */ extern devclass_t isab_devclass; Modified: head/sys/isa/pnp.c ============================================================================== --- head/sys/isa/pnp.c Sun Nov 2 17:35:15 2008 (r184563) +++ head/sys/isa/pnp.c Sun Nov 2 18:48:54 2008 (r184564) @@ -522,6 +522,8 @@ pnp_create_devices(device_t parent, pnp_ csnldn->ldn = ldn; ISA_SET_CONFIG_CALLBACK(parent, dev, pnp_set_config, csnldn); + isa_set_pnp_csn(dev, csn); + isa_set_pnp_ldn(dev, ldn); ldn++; startres = resp; break; From ed at FreeBSD.org Sun Nov 2 11:08:10 2008 From: ed at FreeBSD.org (Ed Schouten) Date: Sun Nov 2 11:08:16 2008 Subject: svn commit: r184565 - head/sys/dev/adb Message-ID: <200811021908.mA2J8Axn045951@svn.freebsd.org> Author: ed Date: Sun Nov 2 19:08:10 2008 New Revision: 184565 URL: http://svn.freebsd.org/changeset/base/184565 Log: Make the touch pad on my PowerBook G4 12" a little more usable. For an unknown reason the touch pad of my PowerBook generates button 5 events when you operate it. This causes the adb_mouse code to convert them to button 2 events, which is not what we want. Add a new flag, AMS_TOUCHPAD, which is used to distinguish the touch pad. When set, don't convert button events of unknown buttons to the last button. There are still three problems left with respect to user input: - The mouse button events are not properly processed when the touch pad isn't touched. - The arrow keys on the keyboard don't work inside X11. - The power button isn't handled by the kernel, similar to the ACPI power button on i386/amd64. Approved by: nwhitehorn Modified: head/sys/dev/adb/adb_mouse.c Modified: head/sys/dev/adb/adb_mouse.c ============================================================================== --- head/sys/dev/adb/adb_mouse.c Sun Nov 2 18:48:54 2008 (r184564) +++ head/sys/dev/adb/adb_mouse.c Sun Nov 2 19:08:10 2008 (r184565) @@ -67,7 +67,9 @@ struct adb_mouse_softc { struct mtx sc_mtx; struct cv sc_cv; - int extended; + int flags; +#define AMS_EXTENDED 0x1 +#define AMS_TOUCHPAD 0x2 uint16_t dpi; mousehw_t hw; @@ -150,7 +152,7 @@ adb_mouse_attach(device_t dev) mtx_init(&sc->sc_mtx,"ams",MTX_DEF,0); cv_init(&sc->sc_cv,"ams"); - sc->extended = 0; + sc->flags = 0; sc->hw.buttons = 2; sc->hw.iftype = MOUSE_IF_UNKNOWN; @@ -183,7 +185,7 @@ adb_mouse_attach(device_t dev) if (r1_len < 8) break; - sc->extended = 1; + sc->flags |= AMS_EXTENDED; memcpy(&sc->hw.hwid,r1,4); sc->mode.resolution = (r1[4] << 8) | r1[5]; @@ -200,6 +202,11 @@ adb_mouse_attach(device_t dev) sc->hw.type = MOUSE_TRACKBALL; description = "Trackball"; break; + case 3: + sc->flags |= AMS_TOUCHPAD; + sc->hw.type = MOUSE_PAD; + description = "Touchpad"; + break; } sc->hw.buttons = r1[7]; @@ -219,7 +226,7 @@ adb_mouse_attach(device_t dev) if (adb_get_device_handler(dev) == 0x42) { device_printf(dev, "MacAlly 2-Button Mouse\n"); - sc->extended = 0; + sc->flags &= ~AMS_EXTENDED; } } @@ -272,7 +279,7 @@ adb_mouse_receive_packet(device_t dev, u buttons |= !(data[0] & 0x80); buttons |= !(data[1] & 0x80) << 1; - if (sc->extended) { + if (sc->flags & AMS_EXTENDED) { for (i = 2; i < len && i < 5; i++) { xdelta |= (data[i] & 0x07) << (3*i + 1); ydelta |= (data[i] & 0x70) << (3*i - 3); @@ -294,12 +301,16 @@ adb_mouse_receive_packet(device_t dev, u * Some mice report high-numbered buttons on the wrong button number, * so set the highest-numbered real button as pressed if there are * mysterious high-numbered ones set. + * + * Don't do this for touchpads, because touchpads also trigger + * high button events when they are touched. */ - if (buttons & ~((1 << sc->hw.buttons) - 1)) { + if (buttons & ~((1 << sc->hw.buttons) - 1) + && !(sc->flags & AMS_TOUCHPAD)) { buttons |= 1 << (sc->hw.buttons - 1); - buttons &= (1 << sc->hw.buttons) - 1; } + buttons &= (1 << sc->hw.buttons) - 1; mtx_lock(&sc->sc_mtx); From kib at FreeBSD.org Sun Nov 2 11:40:24 2008 From: kib at FreeBSD.org (Konstantin Belousov) Date: Sun Nov 2 11:40:31 2008 Subject: svn commit: r184566 - head/sys/conf Message-ID: <200811021940.mA2JeOnv046540@svn.freebsd.org> Author: kib Date: Sun Nov 2 19:40:24 2008 New Revision: 184566 URL: http://svn.freebsd.org/changeset/base/184566 Log: Revert r184516. Option RL_TWISTER_ENABLE is no more after it became loader tunable. Pointy hat to: me Modified: head/sys/conf/NOTES Modified: head/sys/conf/NOTES ============================================================================== --- head/sys/conf/NOTES Sun Nov 2 19:08:10 2008 (r184565) +++ head/sys/conf/NOTES Sun Nov 2 19:40:24 2008 (r184566) @@ -1875,7 +1875,6 @@ device my # Myson Fast Ethernet (MTD80 device nge # NatSemi DP83820 gigabit Ethernet device re # RealTek 8139C+/8169/8169S/8110S device rl # RealTek 8129/8139 -options RL_TWISTER_ENABLE # Enable long cable compensation code device pcn # AMD Am79C97x PCI 10/100 NICs device sf # Adaptec AIC-6915 (``Starfire'') device sis # Silicon Integrated Systems SiS 900/SiS 7016 From rwatson at FreeBSD.org Sun Nov 2 11:48:15 2008 From: rwatson at FreeBSD.org (Robert Watson) Date: Sun Nov 2 11:48:21 2008 Subject: svn commit: r184567 - head/contrib/smbfs/lib/smb Message-ID: <200811021948.mA2JmFtl046702@svn.freebsd.org> Author: rwatson Date: Sun Nov 2 19:48:15 2008 New Revision: 184567 URL: http://svn.freebsd.org/changeset/base/184567 Log: When encoding an smb name, truncate one byte earlier in order than we did previously in order to ensure it fit properly in the bufer when encoded. This prevents a debugging printf from firing if a source or destination host name for an smb mount exceeds 15 characters. MFC after: 3 days Obtained from: Apple, Inc. Modified: head/contrib/smbfs/lib/smb/nb_name.c Modified: head/contrib/smbfs/lib/smb/nb_name.c ============================================================================== --- head/contrib/smbfs/lib/smb/nb_name.c Sun Nov 2 19:40:24 2008 (r184566) +++ head/contrib/smbfs/lib/smb/nb_name.c Sun Nov 2 19:48:15 2008 (r184567) @@ -169,7 +169,7 @@ nb_name_encode(struct nb_name *np, u_cha memsetw(cp + 2, NB_NAMELEN - 1, NBENCODE(' ')); cp += NB_ENCNAMELEN; } else { - for (i = 0; *name && i < NB_NAMELEN; i++, cp += 2, name++) + for (i = 0; *name && i < NB_NAMELEN - 1; i++, cp += 2, name++) *(u_short*)cp = NBENCODE(toupper(*name)); i = NB_NAMELEN - i - 1; if (i > 0) { From uspoerlein at gmail.com Sun Nov 2 11:50:41 2008 From: uspoerlein at gmail.com (Ulrich Spoerlein) Date: Sun Nov 2 11:50:47 2008 Subject: svn commit: r184471 - in head/bin: cat cp In-Reply-To: <200810301405.m9UE5wwZ053250@svn.freebsd.org> References: <200810301405.m9UE5wwZ053250@svn.freebsd.org> Message-ID: <20081102191127.GB1487@roadrunner.spoerlein.net> On Thu, 30.10.2008 at 14:05:58 +0000, Ivan Voras wrote: > Author: ivoras > Date: Thu Oct 30 14:05:57 2008 > New Revision: 184471 > URL: http://svn.freebsd.org/changeset/base/184471 > > Log: > Teach cat(1) and cp(1) to use a larger buffer if enough memory is present > in the system. A simple heuristics is used to detect what is "enough" > memory: if number of physmem pages is greater than 32k (equalling 128 MB > on machines with 4 kB pages). Hi Ivan, curiosity speaking: Isn't amd64 and the superpages work by alc@ making it possible, to have pages of dynamic size, and of sizes > 1MB. If so, how are these static (?) macros affected. Not that it would matter performance wise ... Cheers, Ulrich Spoerlein -- It is better to remain silent and be thought a fool, than to speak, and remove all doubt. From rwatson at FreeBSD.org Sun Nov 2 12:22:25 2008 From: rwatson at FreeBSD.org (Robert Watson) Date: Sun Nov 2 12:22:36 2008 Subject: svn commit: r184568 - head/sys/netsmb Message-ID: <200811022022.mA2KMOCC047394@svn.freebsd.org> Author: rwatson Date: Sun Nov 2 20:22:24 2008 New Revision: 184568 URL: http://svn.freebsd.org/changeset/base/184568 Log: smb_vc_put() requires that the passed vcp be locked, so lock it before dropping the connection when the requested service isn't available, or we may try to release a lock that isn't locked. This prevents an assertion failure when trying to mount a non-present share using smbfs with INVARIANTS; a lock order reversal warning that immediately follows is not yet fixed. Reported by: attilio MFC after: 3 days Modified: head/sys/netsmb/smb_conn.c Modified: head/sys/netsmb/smb_conn.c ============================================================================== --- head/sys/netsmb/smb_conn.c Sun Nov 2 19:48:15 2008 (r184567) +++ head/sys/netsmb/smb_conn.c Sun Nov 2 20:22:24 2008 (r184568) @@ -218,8 +218,10 @@ out: smb_sm_unlockvclist(td); if (error == 0) *vcpp = vcp; - else if (vcp) + else if (vcp) { + smb_vc_lock(vcp, LK_EXCLUSIVE, scred->scr_td); smb_vc_put(vcp, scred); + } return error; } From delphij at FreeBSD.org Sun Nov 2 14:43:38 2008 From: delphij at FreeBSD.org (Xin LI) Date: Sun Nov 2 14:43:58 2008 Subject: svn commit: r184569 - in stable/7/sys: . dev/aac Message-ID: <200811022243.mA2MhcRf049860@svn.freebsd.org> Author: delphij Date: Sun Nov 2 22:43:37 2008 New Revision: 184569 URL: http://svn.freebsd.org/changeset/base/184569 Log: MFC revisions 180072 and 182967 by emaste: Add explicit PCI IDs for the following Adaptec RAID Series 2 adapters: Adaptec RAID 2045 Adaptec RAID 2405 Adaptec RAID 2445 Adaptec RAID 2805 Without this change these devices are supported by the driver's family support, but they then appear as "Adaptec RAID Controller" in boot messages and the dev.aac.0.%desc sysctl. Approved by: re (kib) Modified: stable/7/sys/ (props changed) stable/7/sys/dev/aac/aac_pci.c Modified: stable/7/sys/dev/aac/aac_pci.c ============================================================================== --- stable/7/sys/dev/aac/aac_pci.c Sun Nov 2 20:22:24 2008 (r184568) +++ stable/7/sys/dev/aac/aac_pci.c Sun Nov 2 22:43:37 2008 (r184569) @@ -245,7 +245,15 @@ struct aac_ident {0x9005, 0x0285, 0x9005, 0x02d0, AAC_HWIF_I960RX, 0, "Adaptec RAID 52445"}, {0x9005, 0x0285, 0x9005, 0x02d1, AAC_HWIF_I960RX, 0, - "Adaptec RAID 5405"}, + "Adaptec RAID 5405"}, + {0x9005, 0x0285, 0x9005, 0x02d4, AAC_HWIF_I960RX, 0, + "Adaptec RAID 2045"}, + {0x9005, 0x0285, 0x9005, 0x02d5, AAC_HWIF_I960RX, 0, + "Adaptec RAID 2405"}, + {0x9005, 0x0285, 0x9005, 0x02d6, AAC_HWIF_I960RX, 0, + "Adaptec RAID 2445"}, + {0x9005, 0x0285, 0x9005, 0x02d7, AAC_HWIF_I960RX, 0, + "Adaptec RAID 2805"}, {0x9005, 0x0286, 0x1014, 0x9580, AAC_HWIF_RKT, 0, "IBM ServeRAID-8k"}, {0x9005, 0x0285, 0x1014, 0x034d, AAC_HWIF_I960RX, 0, From ivoras at FreeBSD.org Sun Nov 2 15:11:21 2008 From: ivoras at FreeBSD.org (Ivan Voras) Date: Sun Nov 2 15:12:06 2008 Subject: svn commit: r184570 - head/sys/kern Message-ID: <200811022311.mA2NBKj2050514@svn.freebsd.org> Author: ivoras Date: Sun Nov 2 23:11:20 2008 New Revision: 184570 URL: http://svn.freebsd.org/changeset/base/184570 Log: Increase the initial sbuf size for CPU topology dump to something more usable for newer CPUs. The new value allows 2 x quad core configuration dumps to fit within the initial buffer without reallocations. Approved by: gnn (mentor) (older version) Pointed out by: rdivacky Modified: head/sys/kern/sched_ule.c Modified: head/sys/kern/sched_ule.c ============================================================================== --- head/sys/kern/sched_ule.c Sun Nov 2 22:43:37 2008 (r184569) +++ head/sys/kern/sched_ule.c Sun Nov 2 23:11:20 2008 (r184570) @@ -2665,7 +2665,7 @@ sysctl_kern_sched_topology_spec(SYSCTL_H KASSERT(cpu_top != NULL, ("cpu_top isn't initialized")); - topo = sbuf_new(NULL, NULL, 100, SBUF_AUTOEXTEND); + topo = sbuf_new(NULL, NULL, 500, SBUF_AUTOEXTEND); if (topo == NULL) return (ENOMEM); From rwatson at FreeBSD.org Sun Nov 2 15:15:32 2008 From: rwatson at FreeBSD.org (Robert Watson) Date: Sun Nov 2 15:15:39 2008 Subject: svn commit: r184571 - head/sys/netsmb Message-ID: <200811022315.mA2NFWdD050617@svn.freebsd.org> Author: rwatson Date: Sun Nov 2 23:15:32 2008 New Revision: 184571 URL: http://svn.freebsd.org/changeset/base/184571 Log: Catch up internal locking routines in netsmb with lockmgr changes -- explicit thread arguments are no longer required in many places. Modified: head/sys/netsmb/smb_conn.c head/sys/netsmb/smb_conn.h Modified: head/sys/netsmb/smb_conn.c ============================================================================== --- head/sys/netsmb/smb_conn.c Sun Nov 2 23:11:20 2008 (r184570) +++ head/sys/netsmb/smb_conn.c Sun Nov 2 23:15:32 2008 (r184571) @@ -63,9 +63,9 @@ SYSCTL_NODE(_net, OID_AUTO, smb, CTLFLAG MALLOC_DEFINE(M_SMBCONN, "smb_conn", "SMB connection"); static void smb_co_init(struct smb_connobj *cp, int level, char *ilockname, - char *lockname, struct thread *td); + char *lockname); static void smb_co_done(struct smb_connobj *cp); -static int smb_co_lockstatus(struct smb_connobj *cp, struct thread *td); +static int smb_co_lockstatus(struct smb_connobj *cp); static int smb_vc_disconnect(struct smb_vc *vcp); static void smb_vc_free(struct smb_connobj *cp); @@ -82,8 +82,8 @@ int smb_sm_init(void) { - smb_co_init(&smb_vclist, SMBL_SM, "smbsm ilock", "smbsm", curthread); - smb_co_unlock(&smb_vclist, 0, curthread); + smb_co_init(&smb_vclist, SMBL_SM, "smbsm ilock", "smbsm"); + smb_co_unlock(&smb_vclist, 0); return 0; } @@ -96,30 +96,29 @@ smb_sm_done(void) SMBERROR("%d connections still active\n", smb_vclist.co_usecount - 1); return EBUSY; } - lockmgr(&smb_vclist.co_lock, LK_DRAIN, 0); + lockmgr(&smb_vclist.co_lock, LK_DRAIN, NULL); smb_co_done(&smb_vclist); return 0; } static int -smb_sm_lockvclist(int flags, struct thread *td) +smb_sm_lockvclist(int flags) { - return smb_co_lock(&smb_vclist, flags | LK_CANRECURSE, td); + return smb_co_lock(&smb_vclist, flags | LK_CANRECURSE); } static void -smb_sm_unlockvclist(struct thread *td) +smb_sm_unlockvclist(void) { - smb_co_unlock(&smb_vclist, LK_RELEASE, td); + smb_co_unlock(&smb_vclist, LK_RELEASE); } static int smb_sm_lookupint(struct smb_vcspec *vcspec, struct smb_sharespec *shspec, struct smb_cred *scred, struct smb_vc **vcpp) { - struct thread *td = scred->scr_td; struct smb_connobj *scp; struct smb_vc *vcp; int exact = 1; @@ -130,7 +129,7 @@ smb_sm_lookupint(struct smb_vcspec *vcsp vcp = NULL; SMBCO_FOREACH(scp, &smb_vclist) { vcp = (struct smb_vc *)scp; - error = smb_vc_lock(vcp, LK_EXCLUSIVE, td); + error = smb_vc_lock(vcp, LK_EXCLUSIVE); if (error) continue; @@ -167,7 +166,7 @@ smb_sm_lookupint(struct smb_vcspec *vcsp err1: error = 1; fail: - smb_vc_unlock(vcp, 0, td); + smb_vc_unlock(vcp, 0); } if (vcp) { smb_vc_ref(vcp); @@ -180,19 +179,18 @@ int smb_sm_lookup(struct smb_vcspec *vcspec, struct smb_sharespec *shspec, struct smb_cred *scred, struct smb_vc **vcpp) { - struct thread *td = scred->scr_td; struct smb_vc *vcp; struct smb_share *ssp = NULL; int error; *vcpp = vcp = NULL; - error = smb_sm_lockvclist(LK_EXCLUSIVE, td); + error = smb_sm_lockvclist(LK_EXCLUSIVE); if (error) return error; error = smb_sm_lookupint(vcspec, shspec, scred, vcpp); if (error == 0 || (vcspec->flags & SMBV_CREATE) == 0) { - smb_sm_unlockvclist(td); + smb_sm_unlockvclist(); return error; } error = smb_sm_lookupint(vcspec, NULL, scred, &vcp); @@ -215,11 +213,11 @@ smb_sm_lookup(struct smb_vcspec *vcspec, else smb_share_put(ssp, scred); out: - smb_sm_unlockvclist(td); + smb_sm_unlockvclist(); if (error == 0) *vcpp = vcp; else if (vcp) { - smb_vc_lock(vcp, LK_EXCLUSIVE, scred->scr_td); + smb_vc_lock(vcp, LK_EXCLUSIVE); smb_vc_put(vcp, scred); } return error; @@ -229,15 +227,14 @@ out: * Common code for connection object */ static void -smb_co_init(struct smb_connobj *cp, int level, char *ilockname, char *lockname, - struct thread *td) +smb_co_init(struct smb_connobj *cp, int level, char *ilockname, char *lockname) { SLIST_INIT(&cp->co_children); smb_sl_init(&cp->co_interlock, ilockname); lockinit(&cp->co_lock, PZERO, lockname, 0, 0); cp->co_level = level; cp->co_usecount = 1; - if (smb_co_lock(cp, LK_EXCLUSIVE, td) != 0) + if (smb_co_lock(cp, LK_EXCLUSIVE) != 0) panic("smb_co_init: lock failed"); } @@ -245,7 +242,7 @@ static void smb_co_done(struct smb_connobj *cp) { smb_sl_destroy(&cp->co_interlock); - lockmgr(&cp->co_lock, LK_RELEASE, 0); + lockmgr(&cp->co_lock, LK_RELEASE, NULL); lockdestroy(&cp->co_lock); } @@ -258,7 +255,7 @@ smb_co_gone(struct smb_connobj *cp, stru cp->co_gone(cp, scred); parent = cp->co_parent; if (parent) { - smb_co_lock(parent, LK_EXCLUSIVE, scred->scr_td); + smb_co_lock(parent, LK_EXCLUSIVE); SLIST_REMOVE(&parent->co_children, cp, smb_connobj, co_next); smb_co_put(parent, scred); } @@ -305,7 +302,7 @@ smb_co_get(struct smb_connobj *cp, int f if ((flags & LK_INTERLOCK) == 0) SMB_CO_LOCK(cp); cp->co_usecount++; - error = smb_co_lock(cp, flags | LK_INTERLOCK, scred->scr_td); + error = smb_co_lock(cp, flags | LK_INTERLOCK); if (error) { SMB_CO_LOCK(cp); cp->co_usecount--; @@ -336,20 +333,20 @@ smb_co_put(struct smb_connobj *cp, struc } int -smb_co_lockstatus(struct smb_connobj *cp, struct thread *td) +smb_co_lockstatus(struct smb_connobj *cp) { return lockstatus(&cp->co_lock); } int -smb_co_lock(struct smb_connobj *cp, int flags, struct thread *td) +smb_co_lock(struct smb_connobj *cp, int flags) { if (cp->co_flags & SMBO_GONE) return EINVAL; if ((flags & LK_TYPE_MASK) == 0) flags |= LK_EXCLUSIVE; - if (smb_co_lockstatus(cp, td) == LK_EXCLUSIVE && + if (smb_co_lockstatus(cp) == LK_EXCLUSIVE && (flags & LK_CANRECURSE) == 0) { SMBERROR("recursive lock for object %d\n", cp->co_level); return 0; @@ -358,7 +355,7 @@ smb_co_lock(struct smb_connobj *cp, int } void -smb_co_unlock(struct smb_connobj *cp, int flags, struct thread *td) +smb_co_unlock(struct smb_connobj *cp, int flags) { (void)lockmgr(&cp->co_lock, flags | LK_RELEASE, &cp->co_interlock); } @@ -366,8 +363,11 @@ smb_co_unlock(struct smb_connobj *cp, in static void smb_co_addchild(struct smb_connobj *parent, struct smb_connobj *child) { - KASSERT(smb_co_lockstatus(parent, curthread) == LK_EXCLUSIVE, ("smb_co_addchild: parent not locked")); - KASSERT(smb_co_lockstatus(child, curthread) == LK_EXCLUSIVE, ("smb_co_addchild: child not locked")); + + KASSERT(smb_co_lockstatus(parent) == LK_EXCLUSIVE, + ("smb_co_addchild: parent not locked")); + KASSERT(smb_co_lockstatus(child) == LK_EXCLUSIVE, + ("smb_co_addchild: child not locked")); smb_co_ref(parent); SLIST_INSERT_HEAD(&parent->co_children, child, co_next); @@ -383,7 +383,6 @@ smb_vc_create(struct smb_vcspec *vcspec, struct smb_cred *scred, struct smb_vc **vcpp) { struct smb_vc *vcp; - struct thread *td = scred->scr_td; struct ucred *cred = scred->scr_cred; uid_t uid = vcspec->owner; gid_t gid = vcspec->group; @@ -401,7 +400,7 @@ smb_vc_create(struct smb_vcspec *vcspec, return EPERM; vcp = smb_zmalloc(sizeof(*vcp), M_SMBCONN, M_WAITOK); - smb_co_init(VCTOCP(vcp), SMBL_VC, "smb_vc ilock", "smb_vc", td); + smb_co_init(VCTOCP(vcp), SMBL_VC, "smb_vc ilock", "smb_vc"); vcp->obj.co_free = smb_vc_free; vcp->obj.co_gone = smb_vc_gone; vcp->vc_number = smb_vcnext++; @@ -538,15 +537,15 @@ smb_vc_put(struct smb_vc *vcp, struct sm } int -smb_vc_lock(struct smb_vc *vcp, int flags, struct thread *td) +smb_vc_lock(struct smb_vc *vcp, int flags) { - return smb_co_lock(VCTOCP(vcp), flags, td); + return smb_co_lock(VCTOCP(vcp), flags); } void -smb_vc_unlock(struct smb_vc *vcp, int flags, struct thread *td) +smb_vc_unlock(struct smb_vc *vcp, int flags) { - smb_co_unlock(VCTOCP(vcp), flags, td); + smb_co_unlock(VCTOCP(vcp), flags); } int @@ -598,7 +597,6 @@ int smb_vc_lookupshare(struct smb_vc *vcp, struct smb_sharespec *dp, struct smb_cred *scred, struct smb_share **sspp) { - struct thread *td = scred->scr_td; struct smb_connobj *scp = NULL; struct smb_share *ssp = NULL; int error; @@ -607,12 +605,12 @@ smb_vc_lookupshare(struct smb_vc *vcp, s dp->scred = scred; SMBCO_FOREACH(scp, VCTOCP(vcp)) { ssp = (struct smb_share *)scp; - error = smb_share_lock(ssp, LK_EXCLUSIVE, td); + error = smb_share_lock(ssp, LK_EXCLUSIVE); if (error) continue; if (smb_vc_cmpshare(ssp, dp) == 0) break; - smb_share_unlock(ssp, 0, td); + smb_share_unlock(ssp, 0); } if (ssp) { smb_share_ref(ssp); @@ -694,7 +692,6 @@ smb_share_create(struct smb_vc *vcp, str struct smb_cred *scred, struct smb_share **sspp) { struct smb_share *ssp; - struct thread *td = scred->scr_td; struct ucred *cred = scred->scr_cred; uid_t realuid = cred->cr_uid; uid_t uid = shspec->owner; @@ -719,7 +716,7 @@ smb_share_create(struct smb_vc *vcp, str if (gid == SMBM_ANY_GROUP) gid = cred->cr_groups[0]; ssp = smb_zmalloc(sizeof(*ssp), M_SMBCONN, M_WAITOK); - smb_co_init(SSTOCP(ssp), SMBL_SHARE, "smbss ilock", "smbss", td); + smb_co_init(SSTOCP(ssp), SMBL_SHARE, "smbss ilock", "smbss"); ssp->obj.co_free = smb_share_free; ssp->obj.co_gone = smb_share_gone; smb_sl_init(&ssp->ss_stlock, "ssstlock"); @@ -781,15 +778,15 @@ smb_share_put(struct smb_share *ssp, str } int -smb_share_lock(struct smb_share *ssp, int flags, struct thread *td) +smb_share_lock(struct smb_share *ssp, int flags) { - return smb_co_lock(SSTOCP(ssp), flags, td); + return smb_co_lock(SSTOCP(ssp), flags); } void -smb_share_unlock(struct smb_share *ssp, int flags, struct thread *td) +smb_share_unlock(struct smb_share *ssp, int flags) { - smb_co_unlock(SSTOCP(ssp), flags, td); + smb_co_unlock(SSTOCP(ssp), flags); } int @@ -866,34 +863,34 @@ smb_sysctl_treedump(SYSCTL_HANDLER_ARGS) error = sysctl_wire_old_buffer(req, 0); if (error) return (error); - error = smb_sm_lockvclist(LK_SHARED, td); + error = smb_sm_lockvclist(LK_SHARED); if (error) return error; SMBCO_FOREACH(scp1, &smb_vclist) { vcp = (struct smb_vc *)scp1; - error = smb_vc_lock(vcp, LK_SHARED, td); + error = smb_vc_lock(vcp, LK_SHARED); if (error) continue; smb_vc_getinfo(vcp, &vci); error = SYSCTL_OUT(req, &vci, sizeof(struct smb_vc_info)); if (error) { - smb_vc_unlock(vcp, 0, td); + smb_vc_unlock(vcp, 0); break; } SMBCO_FOREACH(scp2, VCTOCP(vcp)) { ssp = (struct smb_share *)scp2; - error = smb_share_lock(ssp, LK_SHARED, td); + error = smb_share_lock(ssp, LK_SHARED); if (error) { error = 0; continue; } smb_share_getinfo(ssp, &ssi); - smb_share_unlock(ssp, 0, td); + smb_share_unlock(ssp, 0); error = SYSCTL_OUT(req, &ssi, sizeof(struct smb_share_info)); if (error) break; } - smb_vc_unlock(vcp, 0, td); + smb_vc_unlock(vcp, 0); if (error) break; } @@ -901,6 +898,6 @@ smb_sysctl_treedump(SYSCTL_HANDLER_ARGS) itype = SMB_INFO_NONE; error = SYSCTL_OUT(req, &itype, sizeof(itype)); } - smb_sm_unlockvclist(td); + smb_sm_unlockvclist(); return error; } Modified: head/sys/netsmb/smb_conn.h ============================================================================== --- head/sys/netsmb/smb_conn.h Sun Nov 2 23:11:20 2008 (r184570) +++ head/sys/netsmb/smb_conn.h Sun Nov 2 23:15:32 2008 (r184571) @@ -363,8 +363,8 @@ void smb_co_ref(struct smb_connobj *cp); void smb_co_rele(struct smb_connobj *cp, struct smb_cred *scred); int smb_co_get(struct smb_connobj *cp, int flags, struct smb_cred *scred); void smb_co_put(struct smb_connobj *cp, struct smb_cred *scred); -int smb_co_lock(struct smb_connobj *cp, int flags, struct thread *td); -void smb_co_unlock(struct smb_connobj *cp, int flags, struct thread *td); +int smb_co_lock(struct smb_connobj *cp, int flags); +void smb_co_unlock(struct smb_connobj *cp, int flags); /* * session level functions @@ -377,8 +377,8 @@ int smb_vc_get(struct smb_vc *vcp, int void smb_vc_put(struct smb_vc *vcp, struct smb_cred *scred); void smb_vc_ref(struct smb_vc *vcp); void smb_vc_rele(struct smb_vc *vcp, struct smb_cred *scred); -int smb_vc_lock(struct smb_vc *vcp, int flags, struct thread *td); -void smb_vc_unlock(struct smb_vc *vcp, int flags, struct thread *td); +int smb_vc_lock(struct smb_vc *vcp, int flags); +void smb_vc_unlock(struct smb_vc *vcp, int flags); int smb_vc_lookupshare(struct smb_vc *vcp, struct smb_sharespec *shspec, struct smb_cred *scred, struct smb_share **sspp); const char * smb_vc_getpass(struct smb_vc *vcp); @@ -394,8 +394,8 @@ void smb_share_ref(struct smb_share *ssp void smb_share_rele(struct smb_share *ssp, struct smb_cred *scred); int smb_share_get(struct smb_share *ssp, int flags, struct smb_cred *scred); void smb_share_put(struct smb_share *ssp, struct smb_cred *scred); -int smb_share_lock(struct smb_share *ssp, int flags, struct thread *td); -void smb_share_unlock(struct smb_share *ssp, int flags, struct thread *td); +int smb_share_lock(struct smb_share *ssp, int flags); +void smb_share_unlock(struct smb_share *ssp, int flags); void smb_share_invalidate(struct smb_share *ssp); int smb_share_valid(struct smb_share *ssp); const char * smb_share_getpass(struct smb_share *ssp); From rwatson at FreeBSD.org Sun Nov 2 15:20:28 2008 From: rwatson at FreeBSD.org (Robert Watson) Date: Sun Nov 2 15:20:34 2008 Subject: svn commit: r184572 - in head/sys: fs/smbfs netsmb Message-ID: <200811022320.mA2NKSe7050734@svn.freebsd.org> Author: rwatson Date: Sun Nov 2 23:20:27 2008 New Revision: 184572 URL: http://svn.freebsd.org/changeset/base/184572 Log: Catch up with netsmb locking: explicit thread arguments no longer required. Modified: head/sys/fs/smbfs/smbfs_vfsops.c head/sys/netsmb/smb_dev.c Modified: head/sys/fs/smbfs/smbfs_vfsops.c ============================================================================== --- head/sys/fs/smbfs/smbfs_vfsops.c Sun Nov 2 23:15:32 2008 (r184571) +++ head/sys/fs/smbfs/smbfs_vfsops.c Sun Nov 2 23:20:27 2008 (r184572) @@ -173,7 +173,7 @@ smbfs_mount(struct mount *mp, struct thr return error; } vcp = SSTOVC(ssp); - smb_share_unlock(ssp, 0, td); + smb_share_unlock(ssp, 0); mp->mnt_stat.f_iosize = SSTOVC(ssp)->vc_txmax; #ifdef SMBFS_USEZONE @@ -305,7 +305,7 @@ smbfs_unmount(struct mount *mp, int mntf if (error) return error; smb_makescred(&scred, td, td->td_ucred); - error = smb_share_lock(smp->sm_share, LK_EXCLUSIVE, td); + error = smb_share_lock(smp->sm_share, LK_EXCLUSIVE); if (error) return error; smb_share_put(smp->sm_share, &scred); Modified: head/sys/netsmb/smb_dev.c ============================================================================== --- head/sys/netsmb/smb_dev.c Sun Nov 2 23:15:32 2008 (r184571) +++ head/sys/netsmb/smb_dev.c Sun Nov 2 23:20:27 2008 (r184572) @@ -204,7 +204,7 @@ nsmb_dev_ioctl(struct cdev *dev, u_long if (error) break; sdp->sd_vc = vcp; - smb_vc_unlock(vcp, 0, td); + smb_vc_unlock(vcp, 0); sdp->sd_level = SMBL_VC; break; case SMBIOC_OPENSHARE: @@ -217,7 +217,7 @@ nsmb_dev_ioctl(struct cdev *dev, u_long if (error) break; sdp->sd_share = ssp; - smb_share_unlock(ssp, 0, td); + smb_share_unlock(ssp, 0); sdp->sd_level = SMBL_SHARE; break; case SMBIOC_REQUEST: @@ -287,12 +287,12 @@ nsmb_dev_ioctl(struct cdev *dev, u_long break; if (vcp) { sdp->sd_vc = vcp; - smb_vc_unlock(vcp, 0, td); + smb_vc_unlock(vcp, 0); sdp->sd_level = SMBL_VC; } if (ssp) { sdp->sd_share = ssp; - smb_share_unlock(ssp, 0, td); + smb_share_unlock(ssp, 0); sdp->sd_level = SMBL_SHARE; } break; From ivoras at freebsd.org Sun Nov 2 15:34:49 2008 From: ivoras at freebsd.org (Ivan Voras) Date: Sun Nov 2 15:38:08 2008 Subject: svn commit: r184471 - in head/bin: cat cp In-Reply-To: <877i7pdzva.fsf@kobe.laptop> References: <200810301405.m9UE5wwZ053250@svn.freebsd.org> <877i7pdzva.fsf@kobe.laptop> Message-ID: <9bbcef730811021534gb114db9x16a2d6c9a3ecee8b@mail.gmail.com> 2008/10/31 Giorgos Keramidas : > Nice :) > > I didn't notice this in -hackers, but it may be worth letting the buffer > size grow above 1 MB when we have more than, say, 512 MB of memory. By > running dd(1) with buffer sizes of 1, 2, 4, 6, 8, 10, 12, 14, and 16 MB > there are larger buffer sizes that reduce involuntary context switches > even more. > > My laptop (with more than 2 GB or memory), with powerd disabled, running > in single user mode, and copying a file of 200 MB using the script: >... > got the following results for sizes < 10 MB: >... As I read it, for x memory you have y context switches: 64 kB - 11194 (old, pre-patch behaviour) 1 MB - 1493 2 MB - 1381 4 MB - 1342 6 MB - 1292 8 MB - 1275 16 MB - 1246 The difference between the best and the worst is 247 context switches (total, not per second). > It looks like it's probably worth pushing the limit up to 8 MB when we > have lots of memory :) Yes, it's an improvement, but who will ever notice? :) I have no strong reason against increasing the buffer for cp to even 8 MB but I really think it's not worth it at this point. In the patch, I've actually allowed the buffer size to grow to 2 MB if MAXPHYS ever gets bumped up (and would gladly increase *this* limit up). I think that, at this point, increasing MAXPHYS will give better performance than increasing this particular buffer. From ivoras at freebsd.org Sun Nov 2 15:47:15 2008 From: ivoras at freebsd.org (Ivan Voras) Date: Sun Nov 2 15:47:21 2008 Subject: svn commit: r184471 - in head/bin: cat cp In-Reply-To: <20081102191127.GB1487@roadrunner.spoerlein.net> References: <200810301405.m9UE5wwZ053250@svn.freebsd.org> <20081102191127.GB1487@roadrunner.spoerlein.net> Message-ID: <9bbcef730811021522l54efd4c7l8f34e6e285894aaa@mail.gmail.com> 2008/11/2 Ulrich Spoerlein : > On Thu, 30.10.2008 at 14:05:58 +0000, Ivan Voras wrote: >> Author: ivoras >> Date: Thu Oct 30 14:05:57 2008 >> New Revision: 184471 >> URL: http://svn.freebsd.org/changeset/base/184471 >> >> Log: >> Teach cat(1) and cp(1) to use a larger buffer if enough memory is present >> in the system. A simple heuristics is used to detect what is "enough" >> memory: if number of physmem pages is greater than 32k (equalling 128 MB >> on machines with 4 kB pages). > > Hi Ivan, > > curiosity speaking: Isn't amd64 and the superpages work by alc@ making > it possible, to have pages of dynamic size, and of sizes > 1MB. If so, > how are these static (?) macros affected. I think the base page size of the architecture (which amd64 inherited from i386) will always stay at 4 kB. For architectures with bigger page size (as returned by sysconf(_SC_PAGESIZE)), it's forseeable they will have more than 32k pages of active RAM in any case so it doesn't really matter what the threshold is (assuming, of course, there will be no architectures with *smaller* page size :) ). The reason I introduced this threshold at all is to support old or embedded (small) hardware in which 1 MB could be thought of as a "big" buffer. I think 1 MB is "good enough" for all larger machines. From scottl at FreeBSD.org Sun Nov 2 16:53:55 2008 From: scottl at FreeBSD.org (Scott Long) Date: Sun Nov 2 16:54:07 2008 Subject: svn commit: r184573 - in head/sys: conf dev/amr i386/conf modules/amr Message-ID: <200811030053.mA30rsdg052353@svn.freebsd.org> Author: scottl Date: Mon Nov 3 00:53:54 2008 New Revision: 184573 URL: http://svn.freebsd.org/changeset/base/184573 Log: Move the CAM passthrough code into a true module so that it doesn't have to be compiled into the main AMR driver. It's code that is nice to have but not required for normal operation, and it is reported to cause problems for some people. Modified: head/sys/conf/NOTES head/sys/conf/files head/sys/dev/amr/amr.c head/sys/dev/amr/amr_cam.c head/sys/dev/amr/amrvar.h head/sys/i386/conf/XEN head/sys/modules/amr/Makefile Modified: head/sys/conf/NOTES ============================================================================== --- head/sys/conf/NOTES Sun Nov 2 23:20:27 2008 (r184572) +++ head/sys/conf/NOTES Mon Nov 3 00:53:54 2008 (r184573) @@ -1579,6 +1579,7 @@ device mly device ida # Compaq Smart RAID device mlx # Mylex DAC960 device amr # AMI MegaRAID +device amrp # SCSI Passthrough interface (optional, CAM req.) device mfi # LSI MegaRAID SAS device mfip # LSI MegaRAID SAS passthrough, requires CAM options MFI_DEBUG Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Sun Nov 2 23:20:27 2008 (r184572) +++ head/sys/conf/files Mon Nov 3 00:53:54 2008 (r184573) @@ -450,7 +450,7 @@ dev/aic7xxx/aic7xxx_osm.c optional ahc dev/aic7xxx/aic7xxx_pci.c optional ahc pci dev/amd/amd.c optional amd dev/amr/amr.c optional amr -dev/amr/amr_cam.c optional amr +dev/amr/amr_cam.c optional amrp amr dev/amr/amr_disk.c optional amr dev/amr/amr_linux.c optional amr compat_linux dev/amr/amr_pci.c optional amr pci Modified: head/sys/dev/amr/amr.c ============================================================================== --- head/sys/dev/amr/amr.c Sun Nov 2 23:20:27 2008 (r184572) +++ head/sys/dev/amr/amr.c Mon Nov 3 00:53:54 2008 (r184573) @@ -88,13 +88,6 @@ __FBSDID("$FreeBSD$"); #define AMR_DEFINE_TABLES #include -/* - * The CAM interface appears to be completely broken. Disable it. - */ -#ifndef AMR_ENABLE_CAM -#define AMR_ENABLE_CAM 1 -#endif - SYSCTL_NODE(_hw, OID_AUTO, amr, CTLFLAG_RD, 0, "AMR driver parameters"); static d_open_t amr_open; @@ -202,6 +195,7 @@ MALLOC_DEFINE(M_AMR, "amr", "AMR memory" int amr_attach(struct amr_softc *sc) { + device_t child; debug_called(1); @@ -259,14 +253,16 @@ amr_attach(struct amr_softc *sc) */ amr_init_sysctl(sc); -#if AMR_ENABLE_CAM != 0 /* * Attach our 'real' SCSI channels to CAM. */ - if (amr_cam_attach(sc)) - return(ENXIO); - debug(2, "CAM attach done"); -#endif + child = device_add_child(sc->amr_dev, "amrp", -1); + sc->amr_pass = child; + if (child != NULL) { + device_set_softc(child, sc); + device_set_desc(child, "SCSI Passthrough Bus"); + bus_generic_attach(sc->amr_dev); + } /* * Create the control device. @@ -391,10 +387,9 @@ amr_free(struct amr_softc *sc) { struct amr_command_cluster *acc; -#if AMR_ENABLE_CAM != 0 /* detach from CAM */ - amr_cam_detach(sc); -#endif + if (sc->amr_pass != NULL) + device_delete_child(sc->amr_dev, sc->amr_pass); /* cancel status timeout */ untimeout(amr_periodic, sc, sc->amr_timeout); @@ -1240,11 +1235,9 @@ amr_startio(struct amr_softc *sc) if (ac == NULL) (void)amr_bio_command(sc, &ac); -#if AMR_ENABLE_CAM != 0 /* if that failed, build a command from a ccb */ - if (ac == NULL) - (void)amr_cam_command(sc, &ac); -#endif + if ((ac == NULL) && (sc->amr_cam_command != NULL)) + sc->amr_cam_command(sc, &ac); /* if we don't have anything to do, give up */ if (ac == NULL) Modified: head/sys/dev/amr/amr_cam.c ============================================================================== --- head/sys/dev/amr/amr_cam.c Sun Nov 2 23:20:27 2008 (r184572) +++ head/sys/dev/amr/amr_cam.c Mon Nov 3 00:53:54 2008 (r184573) @@ -61,6 +61,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -82,9 +83,31 @@ __FBSDID("$FreeBSD$"); #include #include +static int amr_cam_probe(device_t dev); +static int amr_cam_attach(device_t dev); +static int amr_cam_detach(device_t dev); static void amr_cam_action(struct cam_sim *sim, union ccb *ccb); static void amr_cam_poll(struct cam_sim *sim); static void amr_cam_complete(struct amr_command *ac); +static int amr_cam_command(struct amr_softc *sc, struct amr_command **acp); + +static devclass_t amr_pass_devclass; + +static device_method_t amr_pass_methods[] = { + DEVMETHOD(device_probe, amr_cam_probe), + DEVMETHOD(device_attach, amr_cam_attach), + DEVMETHOD(device_detach, amr_cam_detach), + { 0, 0 } +}; + +static driver_t amr_pass_driver = { + "amrp", + amr_pass_methods, + 0 +}; + +DRIVER_MODULE(amrp, amr, amr_pass_driver, amr_pass_devclass, 0, 0); +MODULE_DEPEND(amrp, cam, 1, 1, 1); MALLOC_DEFINE(M_AMRCAM, "amrcam", "AMR CAM memory"); @@ -115,14 +138,23 @@ amr_dequeue_ccb(struct amr_softc *sc) return(ccb); } +static int +amr_cam_probe(device_t dev) +{ + return (0); +} + /******************************************************************************** * Attach our 'real' SCSI channels to CAM */ -int -amr_cam_attach(struct amr_softc *sc) +static int +amr_cam_attach(device_t dev) { + struct amr_softc *sc; struct cam_devq *devq; - int chn, error; + int chn, error; + + sc = device_get_softc(dev); /* initialise the ccb queue */ TAILQ_INIT(&sc->amr_cam_ccbq); @@ -134,7 +166,7 @@ amr_cam_attach(struct amr_softc *sc) * during detach. */ if ((devq = cam_simq_alloc(AMR_MAX_SCSI_CMDS)) == NULL) - return(ENOMEM); + return(ENOMEM); sc->amr_cam_devq = devq; /* @@ -165,17 +197,20 @@ amr_cam_attach(struct amr_softc *sc) * XXX we should scan the config and work out which devices are * actually protected. */ + sc->amr_cam_command = amr_cam_command; return(0); } /******************************************************************************** * Disconnect ourselves from CAM */ -void -amr_cam_detach(struct amr_softc *sc) +static int +amr_cam_detach(device_t dev) { + struct amr_softc *sc; int chn; + sc = device_get_softc(dev); mtx_lock(&sc->amr_list_lock); for (chn = 0; chn < sc->amr_maxchan; chn++) { /* @@ -191,6 +226,8 @@ amr_cam_detach(struct amr_softc *sc) /* Now free the devq */ if (sc->amr_cam_devq != NULL) cam_simq_free(sc->amr_cam_devq); + + return (0); } /*********************************************************************** @@ -379,7 +416,7 @@ amr_cam_action(struct cam_sim *sim, unio * Convert a CAM CCB off the top of the CCB queue to a passthrough SCSI * command. */ -int +static int amr_cam_command(struct amr_softc *sc, struct amr_command **acp) { struct amr_command *ac; Modified: head/sys/dev/amr/amrvar.h ============================================================================== --- head/sys/dev/amr/amrvar.h Sun Nov 2 23:20:27 2008 (r184572) +++ head/sys/dev/amr/amrvar.h Mon Nov 3 00:53:54 2008 (r184573) @@ -253,6 +253,8 @@ struct amr_softc int support_ext_cdb; /* greater than 10 byte cdb support */ /* misc glue */ + device_t amr_pass; + int (*amr_cam_command)(struct amr_softc *sc, struct amr_command **acp); struct intr_config_hook amr_ich; /* wait-for-interrupts probe hook */ struct callout_handle amr_timeout; /* periodic status check */ int amr_allow_vol_config; @@ -277,13 +279,6 @@ extern struct amr_command *amr_alloccmd( extern void amr_releasecmd(struct amr_command *ac); /* - * CAM interface - */ -extern int amr_cam_attach(struct amr_softc *sc); -extern void amr_cam_detach(struct amr_softc *sc); -extern int amr_cam_command(struct amr_softc *sc, struct amr_command **acp); - -/* * MegaRAID logical disk driver */ struct amrd_softc Modified: head/sys/i386/conf/XEN ============================================================================== --- head/sys/i386/conf/XEN Sun Nov 2 23:20:27 2008 (r184572) +++ head/sys/i386/conf/XEN Mon Nov 3 00:53:54 2008 (r184573) @@ -1,28 +1,10 @@ # -# GENERIC -- Generic kernel configuration file for FreeBSD/i386 -# -# For more information on this file, please read the handbook section on -# Kernel Configuration Files: -# -# http://www.FreeBSD.org/doc/en_US.ISO8859-1/books/handbook/kernelconfig-config.html -# -# The handbook is also available locally in /usr/share/doc/handbook -# if you've installed the doc distribution, otherwise always see the -# FreeBSD World Wide Web server (http://www.FreeBSD.org/) for the -# latest information. -# -# An exhaustive list of options and more detailed explanations of the -# device lines is also present in the ../../conf/NOTES and NOTES files. -# If you are in doubt as to the purpose or necessity of a line, check first -# in NOTES. +# XEN -- Kernel configuration for i386 XEN DomU # # $FreeBSD$ cpu I686_CPU -ident GENERIC - -# To statically compile in device wiring instead of /boot/device.hints -#hints "GENERIC.hints" # Default places to look for devices. +ident XEN makeoptions DEBUG=-g # Build kernel with gdb(1) debug symbols makeoptions MODULES_OVERRIDE="" @@ -39,7 +21,6 @@ options SOFTUPDATES # Enable FFS soft options UFS_ACL # Support for access control lists options UFS_DIRHASH # Improve performance on big directories options UFS_GJOURNAL # Enable gjournal-based UFS journaling -options MD_ROOT # MD is a potential root device options NFSCLIENT # Network Filesystem Client options NFSSERVER # Network Filesystem Server options NFSLOCKD # Network Lock Manager @@ -55,7 +36,6 @@ options COMPAT_FREEBSD4 # Compatible w options COMPAT_FREEBSD5 # Compatible with FreeBSD5 options COMPAT_FREEBSD6 # Compatible with FreeBSD6 options COMPAT_FREEBSD7 # Compatible with FreeBSD7 -options SCSI_DELAY=5000 # Delay (in ms) before probing SCSI options KTRACE # ktrace(1) support options STACK # stack(9) support options SYSVSHM # SYSV-style shared memory @@ -63,7 +43,6 @@ options SYSVMSG # SYSV-style message options SYSVSEM # SYSV-style semaphores options _KPOSIX_PRIORITY_SCHEDULING # POSIX P1003_1B real-time extensions options KBD_INSTALL_CDEV # install a CDEV entry in /dev -options HWPMC_HOOKS # Necessary kernel hooks for hwpmc(4) options AUDIT # Security event auditing # Debugging for use in -current @@ -86,53 +65,8 @@ options MCLSHIFT=12 options SMP # Symmetric MultiProcessor Kernel device apic # I/O APIC -# CPU frequency control -#device cpufreq - -# atkbdc0 controls both the keyboard and the PS/2 mouse -device atkbdc # AT keyboard controller -device atkbd # AT keyboard -device psm # PS/2 mouse - device kbdmux # keyboard multiplexer -#device vga # VGA video card driver - -device splash # Splash screen and screen saver support - -# syscons is the default console driver, resembling an SCO console -#device sc - -# Power management support (see NOTES for more options) -#device apm -# Add suspend/resume support for the i8254. -device pmtimer - - -device pci - -# PCCARD (PCMCIA) support -# PCMCIA and cardbus bridge support -#device cbb # cardbus (yenta) bridge -#device pccard # PC Card (16-bit) bus -#device cardbus # CardBus (32-bit) bus - -# Serial (COM) ports -device uart # Generic UART driver - -# Parallel port -device ppc -device ppbus # Parallel port bus (required) -device lpt # Printer -device plip # TCP/IP over parallel -device ppi # Parallel port interface device -#device vpo # Requires scbus and da - -# If you've got a "dumb" serial or parallel PCI card that is -# supported by the puc(4) glue driver, uncomment the following -# line to enable it (connects to sio, uart and/or ppc drivers): -#device puc - # Pseudo devices. device loop # Network loopback device random # Entropy device @@ -142,7 +76,6 @@ device pty # Pseudo-ttys (telnet etc) device md # Memory "disks" device gif # IPv6 and IPv4 tunneling device faith # IPv6-to-IPv4 relaying (translation) -device firmware # firmware assist module # The `bpf' device enables the Berkeley Packet Filter. # Be aware of the administrative consequences of enabling this! Modified: head/sys/modules/amr/Makefile ============================================================================== --- head/sys/modules/amr/Makefile Sun Nov 2 23:20:27 2008 (r184572) +++ head/sys/modules/amr/Makefile Mon Nov 3 00:53:54 2008 (r184573) @@ -2,15 +2,16 @@ .PATH: ${.CURDIR}/../../dev/amr +SUBDIR= amr_cam .if ${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH} == "amd64" -SUBDIR= amr_linux +SUBDIR+= amr_linux .endif KMOD= amr SRCS= amr.c amr_pci.c amr_disk.c device_if.h bus_if.h pci_if.h # SCSI passthrough support for non-disk devices -SRCS+= amr_cam.c opt_cam.h opt_scsi.h +#SRCS+= amr_cam.c opt_cam.h opt_scsi.h # Enable a questionable optimisation for newer adapters #CFLAGS+= -DAMR_QUARTZ_GOFASTER From scottl at FreeBSD.org Sun Nov 2 20:13:28 2008 From: scottl at FreeBSD.org (Scott Long) Date: Sun Nov 2 20:13:39 2008 Subject: svn commit: r184577 - in head/sys/modules/amr: . amr_cam Message-ID: <200811030413.mA34DROB056208@svn.freebsd.org> Author: scottl Date: Mon Nov 3 04:13:27 2008 New Revision: 184577 URL: http://svn.freebsd.org/changeset/base/184577 Log: Add amr_cam module directory that was missed in the previous commit. Added: head/sys/modules/amr/amr_cam/ head/sys/modules/amr/amr_cam/Makefile (contents, props changed) Modified: head/sys/modules/amr/Makefile Modified: head/sys/modules/amr/Makefile ============================================================================== --- head/sys/modules/amr/Makefile Mon Nov 3 03:18:29 2008 (r184576) +++ head/sys/modules/amr/Makefile Mon Nov 3 04:13:27 2008 (r184577) @@ -10,9 +10,6 @@ SUBDIR+= amr_linux KMOD= amr SRCS= amr.c amr_pci.c amr_disk.c device_if.h bus_if.h pci_if.h -# SCSI passthrough support for non-disk devices -#SRCS+= amr_cam.c opt_cam.h opt_scsi.h - # Enable a questionable optimisation for newer adapters #CFLAGS+= -DAMR_QUARTZ_GOFASTER Added: head/sys/modules/amr/amr_cam/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/modules/amr/amr_cam/Makefile Mon Nov 3 04:13:27 2008 (r184577) @@ -0,0 +1,9 @@ +# $FreeBSD$ + +.PATH: ${.CURDIR}/../../../dev/amr + +KMOD= amr_cam +SRCS= amr_cam.c device_if.h bus_if.h +SRCS+= opt_cam.h opt_scsi.h + +.include From delphij at FreeBSD.org Sun Nov 2 21:19:46 2008 From: delphij at FreeBSD.org (Xin LI) Date: Sun Nov 2 21:19:52 2008 Subject: svn commit: r184578 - head/lib/libc/gen Message-ID: <200811030519.mA35JkBo057371@svn.freebsd.org> Author: delphij Date: Mon Nov 3 05:19:45 2008 New Revision: 184578 URL: http://svn.freebsd.org/changeset/base/184578 Log: Sync with OpenBSD's dirname(3) - license change, avoid strcpy() over string constant, use memcpy() instead of strncpy() and improve code readibility. No functional change. Modified: head/lib/libc/gen/dirname.3 head/lib/libc/gen/dirname.c Modified: head/lib/libc/gen/dirname.3 ============================================================================== --- head/lib/libc/gen/dirname.3 Mon Nov 3 04:13:27 2008 (r184577) +++ head/lib/libc/gen/dirname.3 Mon Nov 3 05:19:45 2008 (r184578) @@ -1,30 +1,19 @@ +.\" $OpenBSD: dirname.3,v 1.17 2007/05/31 19:19:28 jmc Exp $ .\" .\" Copyright (c) 1997 Todd C. Miller -.\" All rights reserved. .\" -.\" Redistribution and use in source and binary forms, with or without -.\" modification, are permitted provided that the following conditions -.\" are met: -.\" 1. Redistributions of source code must retain the above copyright -.\" notice, this list of conditions and the following disclaimer. -.\" 2. Redistributions in binary form must reproduce the above copyright -.\" notice, this list of conditions and the following disclaimer in the -.\" documentation and/or other materials provided with the distribution. -.\" 3. The name of the author may not be used to endorse or promote products -.\" derived from this software without specific prior written permission. +.\" Permission to use, copy, modify, and distribute this software for any +.\" purpose with or without fee is hereby granted, provided that the above +.\" copyright notice and this permission notice appear in all copies. .\" -.\" THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, -.\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY -.\" AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL -.\" THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -.\" EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -.\" PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; -.\" OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, -.\" WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR -.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF -.\" ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. .\" -.\" $OpenBSD: dirname.3,v 1.9 2000/04/18 03:01:25 aaron Exp $ .\" $FreeBSD$ .\" .Dd October 12, 2006 @@ -40,8 +29,7 @@ .Sh DESCRIPTION The .Fn dirname -function -is the converse of +function is the converse of .Xr basename 3 ; it returns a pointer to the parent directory of the pathname pointed to by .Fa path . @@ -108,4 +96,4 @@ function first appeared in and .Fx 4.2 . .Sh AUTHORS -.An "Todd C. Miller" Aq Todd.Miller@courtesan.com +.An "Todd C. Miller" Modified: head/lib/libc/gen/dirname.c ============================================================================== --- head/lib/libc/gen/dirname.c Mon Nov 3 04:13:27 2008 (r184577) +++ head/lib/libc/gen/dirname.c Mon Nov 3 05:19:45 2008 (r184578) @@ -1,35 +1,21 @@ +/* $OpenBSD: dirname.c,v 1.13 2005/08/08 08:05:33 espie Exp $ */ + /* - * Copyright (c) 1997 Todd C. Miller - * All rights reserved. + * Copyright (c) 1997, 2004 Todd C. Miller * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY - * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL - * THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -#if 0 -#ifndef lint -static char rcsid[] = "$OpenBSD: dirname.c,v 1.4 1999/05/30 17:10:30 espie Exp $"; -#endif /* not lint */ -#endif #include __FBSDID("$FreeBSD$"); @@ -40,25 +26,26 @@ __FBSDID("$FreeBSD$"); #include char * -dirname(path) - const char *path; +dirname(const char *path) { - static char *bname = NULL; + static char *dname = NULL; + size_t len; const char *endp; - if (bname == NULL) { - bname = (char *)malloc(MAXPATHLEN); - if (bname == NULL) + if (dname == NULL) { + dname = (char *)malloc(MAXPATHLEN); + if (dname == NULL) return(NULL); } /* Empty or NULL string gets treated as "." */ if (path == NULL || *path == '\0') { - (void)strcpy(bname, "."); - return(bname); + dname[0] = '.'; + dname[1] = '\0'; + return (dname); } - /* Strip trailing slashes */ + /* Strip any trailing slashes */ endp = path + strlen(path) - 1; while (endp > path && *endp == '/') endp--; @@ -69,19 +56,22 @@ dirname(path) /* Either the dir is "/" or there are no slashes */ if (endp == path) { - (void)strcpy(bname, *endp == '/' ? "/" : "."); - return(bname); + dname[0] = *endp == '/' ? '/' : '.'; + dname[1] = '\0'; + return (dname); } else { + /* Move forward past the separating slashes */ do { endp--; } while (endp > path && *endp == '/'); } - if (endp - path + 2 > MAXPATHLEN) { + len = endp - path + 1; + if (len >= MAXPATHLEN) { errno = ENAMETOOLONG; - return(NULL); + return (NULL); } - (void)strncpy(bname, path, endp - path + 1); - bname[endp - path + 1] = '\0'; - return(bname); + memcpy(dname, path, len); + dname[len] = '\0'; + return (dname); } From imp at FreeBSD.org Sun Nov 2 21:52:43 2008 From: imp at FreeBSD.org (Warner Losh) Date: Sun Nov 2 21:52:55 2008 Subject: svn commit: r184579 - head/sys/dev/cardbus Message-ID: <200811030552.mA35qhCb057962@svn.freebsd.org> Author: imp Date: Mon Nov 3 05:52:43 2008 New Revision: 184579 URL: http://svn.freebsd.org/changeset/base/184579 Log: We can't mask out the higher order bits and have the size come out right... Good thing the size was ignored... Where this macro is used, there's no reason to do it anyway. There seems to have been some old-time confusion between the CIS pointer definition, and the BAR definitions at the base of this bug. Modified: head/sys/dev/cardbus/cardbusreg.h Modified: head/sys/dev/cardbus/cardbusreg.h ============================================================================== --- head/sys/dev/cardbus/cardbusreg.h Mon Nov 3 05:19:45 2008 (r184578) +++ head/sys/dev/cardbus/cardbusreg.h Mon Nov 3 05:52:43 2008 (r184579) @@ -45,7 +45,7 @@ #define CARDBUS_EXROM_DATA_CODE_TYPE 0x14 /* Code Type */ #define CARDBUS_EXROM_DATA_INDICATOR 0x15 /* Indicator */ -#define CARDBUS_MAPREG_MEM_ADDR_MASK 0x0ffffff0 +#define CARDBUS_MAPREG_MEM_ADDR_MASK 0xfffffff0 #define CARDBUS_MAPREG_MEM_ADDR(mr) \ ((mr) & CARDBUS_MAPREG_MEM_ADDR_MASK) #define CARDBUS_MAPREG_MEM_SIZE(mr) \ From imp at FreeBSD.org Sun Nov 2 22:06:23 2008 From: imp at FreeBSD.org (Warner Losh) Date: Sun Nov 2 22:06:55 2008 Subject: svn commit: r184581 - head/sys/dev/cardbus Message-ID: <200811030606.mA366Mlf058286@svn.freebsd.org> Author: imp Date: Mon Nov 3 06:06:22 2008 New Revision: 184581 URL: http://svn.freebsd.org/changeset/base/184581 Log: Use child (the card) in preference to cbdev (the bridge) when allocating resources to read the CIS. I'm not sure when this changed, but it is totally wrong. Also, add a minor improvement to the debugging. This should help everybody trying to run dumpcis on atheros wireless card as well. MFC after: 2 days Modified: head/sys/dev/cardbus/cardbus_cis.c Modified: head/sys/dev/cardbus/cardbus_cis.c ============================================================================== --- head/sys/dev/cardbus/cardbus_cis.c Mon Nov 3 05:53:10 2008 (r184580) +++ head/sys/dev/cardbus/cardbus_cis.c Mon Nov 3 06:06:22 2008 (r184581) @@ -511,7 +511,7 @@ cardbus_read_tuple_init(device_t cbdev, device_printf(cbdev, "Bad header in rom %d: " "[%x] %04x\n", romnum, imagebase + CARDBUS_EXROM_SIGNATURE, romsig); - bus_release_resource(cbdev, SYS_RES_MEMORY, + bus_release_resource(child, SYS_RES_MEMORY, *rid, res); *rid = 0; return (NULL); @@ -548,7 +548,7 @@ cardbus_read_tuple_init(device_t cbdev, CARDBUS_EXROM_DATA_INDICATOR) & 0x80) != 0) { device_printf(cbdev, "Cannot find CIS in " "Option ROM\n"); - bus_release_resource(cbdev, SYS_RES_MEMORY, + bus_release_resource(child, SYS_RES_MEMORY, *rid, res); *rid = 0; return (NULL); @@ -559,6 +559,8 @@ cardbus_read_tuple_init(device_t cbdev, } else { *start = *start & PCIM_CIS_ADDR_MASK; } + if (cardbus_cis_debug) + device_printf(cbdev, "CIS offset is %#x\n", *start); return (res); } From imp at FreeBSD.org Sun Nov 2 22:38:00 2008 From: imp at FreeBSD.org (Warner Losh) Date: Sun Nov 2 22:38:11 2008 Subject: svn commit: r184584 - head/sys/dev/cardbus Message-ID: <200811030637.mA36bxRR058960@svn.freebsd.org> Author: imp Date: Mon Nov 3 06:37:59 2008 New Revision: 184584 URL: http://svn.freebsd.org/changeset/base/184584 Log: Turns out this isn't even used at all... The bogon that I was tracing was in code from my p4 tree, not -current. Delete it here. Modified: head/sys/dev/cardbus/cardbusreg.h Modified: head/sys/dev/cardbus/cardbusreg.h ============================================================================== --- head/sys/dev/cardbus/cardbusreg.h Mon Nov 3 06:26:26 2008 (r184583) +++ head/sys/dev/cardbus/cardbusreg.h Mon Nov 3 06:37:59 2008 (r184584) @@ -44,9 +44,3 @@ #define CARDBUS_EXROM_DATA_DATA_REV 0x12 /* Revision Level of Code/Data */ #define CARDBUS_EXROM_DATA_CODE_TYPE 0x14 /* Code Type */ #define CARDBUS_EXROM_DATA_INDICATOR 0x15 /* Indicator */ - -#define CARDBUS_MAPREG_MEM_ADDR_MASK 0xfffffff0 -#define CARDBUS_MAPREG_MEM_ADDR(mr) \ - ((mr) & CARDBUS_MAPREG_MEM_ADDR_MASK) -#define CARDBUS_MAPREG_MEM_SIZE(mr) \ - (CARDBUS_MAPREG_MEM_ADDR(mr) & (~CARDBUS_MAPREG_MEM_ADDR(mr) + 1)) From kib at FreeBSD.org Mon Nov 3 02:14:48 2008 From: kib at FreeBSD.org (Konstantin Belousov) Date: Mon Nov 3 02:14:58 2008 Subject: svn commit: r184586 - head/lib/libc/string Message-ID: <200811031014.mA3AElQU062872@svn.freebsd.org> Author: kib Date: Mon Nov 3 10:14:47 2008 New Revision: 184586 URL: http://svn.freebsd.org/changeset/base/184586 Log: Fix style. Modified: head/lib/libc/string/ffsl.c Modified: head/lib/libc/string/ffsl.c ============================================================================== --- head/lib/libc/string/ffsl.c Mon Nov 3 07:52:18 2008 (r184585) +++ head/lib/libc/string/ffsl.c Mon Nov 3 10:14:47 2008 (r184586) @@ -41,7 +41,7 @@ ffsl(long mask) int bit; if (mask == 0) - return(0); + return (0); for (bit = 1; !(mask & 1); bit++) mask = (unsigned long)mask >> 1; return (bit); From kib at FreeBSD.org Mon Nov 3 02:22:20 2008 From: kib at FreeBSD.org (Konstantin Belousov) Date: Mon Nov 3 02:22:27 2008 Subject: svn commit: r184587 - in head: include lib/libc/string Message-ID: <200811031022.mA3AMJcI064077@svn.freebsd.org> Author: kib Date: Mon Nov 3 10:22:19 2008 New Revision: 184587 URL: http://svn.freebsd.org/changeset/base/184587 Log: Add the ffsll and flsll functions. These are ffs and fls operating on long long arguments. Reviewed by: bde (previous version, that included asm implementation for all ffs and fls functions on i386 and amd64) MFC after: 2 weeks Added: head/lib/libc/string/ffsll.c (contents, props changed) - copied, changed from r184585, head/lib/libc/string/ffs.c head/lib/libc/string/flsll.c (contents, props changed) - copied, changed from r184585, head/lib/libc/string/fls.c Modified: head/include/strings.h head/lib/libc/string/Makefile.inc head/lib/libc/string/Symbol.map head/lib/libc/string/ffs.3 Modified: head/include/strings.h ============================================================================== --- head/include/strings.h Mon Nov 3 10:14:47 2008 (r184586) +++ head/include/strings.h Mon Nov 3 10:22:19 2008 (r184587) @@ -44,8 +44,10 @@ void bzero(void *, size_t); /* LEGA int ffs(int) __pure2; #ifdef __BSD_VISIBLE int ffsl(long) __pure2; +int ffsll(long long) __pure2; int fls(int) __pure2; int flsl(long) __pure2; +int flsll(long long) __pure2; #endif char *index(const char *, int) __pure; /* LEGACY */ char *rindex(const char *, int) __pure; /* LEGACY */ Modified: head/lib/libc/string/Makefile.inc ============================================================================== --- head/lib/libc/string/Makefile.inc Mon Nov 3 10:14:47 2008 (r184586) +++ head/lib/libc/string/Makefile.inc Mon Nov 3 10:22:19 2008 (r184587) @@ -6,8 +6,8 @@ CFLAGS+= -I${.CURDIR}/locale # machine-independent string sources -MISRCS+=bcmp.c bcopy.c bzero.c ffs.c ffsl.c fls.c flsl.c index.c memccpy.c \ - memchr.c memrchr.c memcmp.c \ +MISRCS+=bcmp.c bcopy.c bzero.c ffs.c ffsl.c ffsll.c fls.c flsl.c flsll.c \ + index.c memccpy.c memchr.c memrchr.c memcmp.c \ memcpy.c memmem.c memmove.c memset.c rindex.c stpcpy.c strcasecmp.c \ strcat.c strchr.c strcmp.c strcoll.c strcpy.c strcspn.c strdup.c \ strerror.c strlcat.c strlcpy.c strlen.c strmode.c strncat.c strncmp.c \ @@ -38,6 +38,8 @@ MAN+= bcmp.3 bcopy.3 bstring.3 bzero.3 f MLINKS+=ffs.3 ffsl.3 MLINKS+=ffs.3 fls.3 MLINKS+=ffs.3 flsl.3 +MLINKS+=ffs.3 ffsll.3 +MLINKS+=ffs.3 flsll.3 MLINKS+=index.3 rindex.3 MLINKS+=memchr.3 memrchr.3 MLINKS+=strcasecmp.3 strncasecmp.3 Modified: head/lib/libc/string/Symbol.map ============================================================================== --- head/lib/libc/string/Symbol.map Mon Nov 3 10:14:47 2008 (r184586) +++ head/lib/libc/string/Symbol.map Mon Nov 3 10:22:19 2008 (r184587) @@ -78,6 +78,8 @@ FBSD_1.0 { }; FBSD_1.1 { + ffsll; + flsll; memrchr; }; Modified: head/lib/libc/string/ffs.3 ============================================================================== --- head/lib/libc/string/ffs.3 Mon Nov 3 10:14:47 2008 (r184586) +++ head/lib/libc/string/ffs.3 Mon Nov 3 10:22:19 2008 (r184587) @@ -30,14 +30,16 @@ .\" @(#)ffs.3 8.2 (Berkeley) 4/19/94 .\" $FreeBSD$ .\" -.Dd October 12, 2006 +.Dd October 26, 2008 .Dt FFS 3 .Os .Sh NAME .Nm ffs , .Nm ffsl , +.Nm ffsll , .Nm fls , -.Nm flsl +.Nm flsl , +.Nm flsll .Nd find first or last bit set in a bit string .Sh LIBRARY .Lb libc @@ -48,14 +50,19 @@ .Ft int .Fn ffsl "long value" .Ft int +.Ft int +.Fn ffsll "long long value" .Fn fls "int value" .Ft int .Fn flsl "long value" +.Ft int +.Fn flsll "long long value" .Sh DESCRIPTION The -.Fn ffs -and +.Fn ffs , .Fn ffsl +and +.Fn ffsll functions find the first bit set (beginning with the least significant bit) in @@ -63,9 +70,10 @@ in and return the index of that bit. .Pp The -.Fn fls -and +.Fn fls , .Fn flsl +and +.Fn flsll functions find the last bit set in .Fa value and return the index of that bit. @@ -95,3 +103,9 @@ and .Fn flsl functions appeared in .Fx 5.3 . +The +.Fn ffsll +and +.Fn flsll +functions appeared in +.Fx 8.0 . Copied and modified: head/lib/libc/string/ffsll.c (from r184585, head/lib/libc/string/ffs.c) ============================================================================== --- head/lib/libc/string/ffs.c Mon Nov 3 07:52:18 2008 (r184585, copy source) +++ head/lib/libc/string/ffsll.c Mon Nov 3 10:22:19 2008 (r184587) @@ -27,9 +27,6 @@ * SUCH DAMAGE. */ -#if defined(LIBC_SCCS) && !defined(lint) -static char sccsid[] = "@(#)ffs.c 8.1 (Berkeley) 6/4/93"; -#endif /* LIBC_SCCS and not lint */ #include __FBSDID("$FreeBSD$"); @@ -39,13 +36,13 @@ __FBSDID("$FreeBSD$"); * Find First Set bit */ int -ffs(int mask) +ffsll(long long mask) { int bit; if (mask == 0) - return(0); + return (0); for (bit = 1; !(mask & 1); bit++) - mask = (unsigned int)mask >> 1; + mask = (unsigned long long)mask >> 1; return (bit); } Copied and modified: head/lib/libc/string/flsll.c (from r184585, head/lib/libc/string/fls.c) ============================================================================== --- head/lib/libc/string/fls.c Mon Nov 3 07:52:18 2008 (r184585, copy source) +++ head/lib/libc/string/flsll.c Mon Nov 3 10:22:19 2008 (r184587) @@ -36,13 +36,13 @@ __FBSDID("$FreeBSD$"); * Find Last Set bit */ int -fls(int mask) +flsll(long long mask) { int bit; if (mask == 0) return (0); for (bit = 1; mask != 1; bit++) - mask = (unsigned int)mask >> 1; + mask = (unsigned long long)mask >> 1; return (bit); } From dfr at FreeBSD.org Mon Nov 3 02:38:01 2008 From: dfr at FreeBSD.org (Doug Rabson) Date: Mon Nov 3 02:38:15 2008 Subject: svn commit: r184588 - in head: etc/gss etc/rc.d include/rpc lib/libc/sys lib/libc/xdr lib/librpcsec_gss sbin/mount_nfs sys/compat/freebsd32 sys/conf sys/fs/unionfs sys/kern sys/kgssapi sys/kgssapi/... Message-ID: <200811031038.mA3Ac0UR064387@svn.freebsd.org> Author: dfr Date: Mon Nov 3 10:38:00 2008 New Revision: 184588 URL: http://svn.freebsd.org/changeset/base/184588 Log: Implement support for RPCSEC_GSS authentication to both the NFS client and server. This replaces the RPC implementation of the NFS client and server with the newer RPC implementation originally developed (actually ported from the userland sunrpc code) to support the NFS Lock Manager. I have tested this code extensively and I believe it is stable and that performance is at least equal to the legacy RPC implementation. The NFS code currently contains support for both the new RPC implementation and the older legacy implementation inherited from the original NFS codebase. The default is to use the new implementation - add the NFS_LEGACYRPC option to fall back to the old code. When I merge this support back to RELENG_7, I will probably change this so that users have to 'opt in' to get the new code. To use RPCSEC_GSS on either client or server, you must build a kernel which includes the KGSSAPI option and the crypto device. On the userland side, you must build at least a new libc, mountd, mount_nfs and gssd. You must install new versions of /etc/rc.d/gssd and /etc/rc.d/nfsd and add 'gssd_enable=YES' to /etc/rc.conf. As long as gssd is running, you should be able to mount an NFS filesystem from a server that requires RPCSEC_GSS authentication. The mount itself can happen without any kerberos credentials but all access to the filesystem will be denied unless the accessing user has a valid ticket file in the standard place (/tmp/krb5cc_). There is currently no support for situations where the ticket file is in a different place, such as when the user logged in via SSH and has delegated credentials from that login. This restriction is also present in Solaris and Linux. In theory, we could improve this in future, possibly using Brooks Davis' implementation of variant symlinks. Supporting RPCSEC_GSS on a server is nearly as simple. You must create service creds for the server in the form 'nfs/@' and install them in /etc/krb5.keytab. The standard heimdal utility ktutil makes this fairly easy. After the service creds have been created, you can add a '-sec=krb5' option to /etc/exports and restart both mountd and nfsd. The only other difference an administrator should notice is that nfsd doesn't fork to create service threads any more. In normal operation, there will be two nfsd processes, one in userland waiting for TCP connections and one in the kernel handling requests. The latter process will create as many kthreads as required - these should be visible via 'top -H'. The code has some support for varying the number of service threads according to load but initially at least, nfsd uses a fixed number of threads according to the value supplied to its '-n' option. Sponsored by: Isilon Systems MFC after: 1 month Added: head/etc/rc.d/gssd (contents, props changed) head/sys/kgssapi/ head/sys/kgssapi/gss_accept_sec_context.c (contents, props changed) head/sys/kgssapi/gss_acquire_cred.c (contents, props changed) head/sys/kgssapi/gss_add_oid_set_member.c (contents, props changed) head/sys/kgssapi/gss_canonicalize_name.c (contents, props changed) head/sys/kgssapi/gss_create_empty_oid_set.c (contents, props changed) head/sys/kgssapi/gss_delete_sec_context.c (contents, props changed) head/sys/kgssapi/gss_display_status.c (contents, props changed) head/sys/kgssapi/gss_export_name.c (contents, props changed) head/sys/kgssapi/gss_get_mic.c (contents, props changed) head/sys/kgssapi/gss_impl.c (contents, props changed) head/sys/kgssapi/gss_import_name.c (contents, props changed) head/sys/kgssapi/gss_init_sec_context.c (contents, props changed) head/sys/kgssapi/gss_names.c (contents, props changed) head/sys/kgssapi/gss_pname_to_uid.c (contents, props changed) head/sys/kgssapi/gss_release_buffer.c (contents, props changed) head/sys/kgssapi/gss_release_cred.c (contents, props changed) head/sys/kgssapi/gss_release_name.c (contents, props changed) head/sys/kgssapi/gss_release_oid_set.c (contents, props changed) head/sys/kgssapi/gss_set_cred_option.c (contents, props changed) head/sys/kgssapi/gss_test_oid_set_member.c (contents, props changed) head/sys/kgssapi/gss_unwrap.c (contents, props changed) head/sys/kgssapi/gss_verify_mic.c (contents, props changed) head/sys/kgssapi/gss_wrap.c (contents, props changed) head/sys/kgssapi/gss_wrap_size_limit.c (contents, props changed) head/sys/kgssapi/gssapi.h (contents, props changed) head/sys/kgssapi/gssapi_impl.h (contents, props changed) head/sys/kgssapi/gssd.x (contents, props changed) head/sys/kgssapi/gssd_prot.c (contents, props changed) head/sys/kgssapi/gsstest.c (contents, props changed) head/sys/kgssapi/kgss_if.m (contents, props changed) head/sys/kgssapi/krb5/ head/sys/kgssapi/krb5/kcrypto.c (contents, props changed) head/sys/kgssapi/krb5/kcrypto.h (contents, props changed) head/sys/kgssapi/krb5/kcrypto_aes.c (contents, props changed) head/sys/kgssapi/krb5/kcrypto_arcfour.c (contents, props changed) head/sys/kgssapi/krb5/kcrypto_des.c (contents, props changed) head/sys/kgssapi/krb5/kcrypto_des3.c (contents, props changed) head/sys/kgssapi/krb5/krb5_mech.c (contents, props changed) head/sys/modules/kgssapi/ head/sys/modules/kgssapi/Makefile (contents, props changed) head/sys/modules/kgssapi_krb5/ head/sys/modules/kgssapi_krb5/Makefile (contents, props changed) head/sys/nfsclient/nfs_krpc.c (contents, props changed) head/sys/nfsserver/nfs_fha.c (contents, props changed) head/sys/nfsserver/nfs_fha.h (contents, props changed) head/sys/nfsserver/nfs_srvkrpc.c (contents, props changed) head/sys/rpc/replay.c (contents, props changed) head/sys/rpc/replay.h (contents, props changed) head/sys/rpc/rpcsec_gss/ head/sys/rpc/rpcsec_gss.h (contents, props changed) head/sys/rpc/rpcsec_gss/rpcsec_gss.c (contents, props changed) head/sys/rpc/rpcsec_gss/rpcsec_gss_conf.c (contents, props changed) head/sys/rpc/rpcsec_gss/rpcsec_gss_int.h (contents, props changed) head/sys/rpc/rpcsec_gss/rpcsec_gss_misc.c (contents, props changed) head/sys/rpc/rpcsec_gss/rpcsec_gss_prot.c (contents, props changed) head/sys/rpc/rpcsec_gss/svc_rpcsec_gss.c (contents, props changed) head/tools/regression/kgssapi/ head/tools/regression/kgssapi/Makefile (contents, props changed) head/tools/regression/kgssapi/gsstest.c (contents, props changed) head/tools/regression/rpcsec_gss/ head/tools/regression/rpcsec_gss/Makefile (contents, props changed) head/tools/regression/rpcsec_gss/rpctest.c (contents, props changed) head/usr.sbin/gssd/ head/usr.sbin/gssd/Makefile (contents, props changed) head/usr.sbin/gssd/gssd.8 (contents, props changed) head/usr.sbin/gssd/gssd.c (contents, props changed) Modified: head/etc/gss/mech head/etc/rc.d/Makefile head/etc/rc.d/nfsd head/include/rpc/xdr.h head/lib/libc/sys/Symbol.map head/lib/libc/xdr/Symbol.map head/lib/libc/xdr/xdr.c head/lib/librpcsec_gss/svc_rpcsec_gss.c head/sbin/mount_nfs/mount_nfs.c head/sys/compat/freebsd32/syscalls.master head/sys/conf/files head/sys/conf/options head/sys/fs/unionfs/union_vfsops.c head/sys/kern/syscalls.master head/sys/kern/vfs_export.c head/sys/kern/vfs_mount.c head/sys/modules/nfsclient/Makefile head/sys/modules/nfsserver/Makefile head/sys/nfsclient/nfs.h head/sys/nfsclient/nfs_socket.c head/sys/nfsclient/nfs_subs.c head/sys/nfsclient/nfs_vfsops.c head/sys/nfsclient/nfsmount.h head/sys/nfsserver/nfs.h head/sys/nfsserver/nfs_serv.c head/sys/nfsserver/nfs_srvcache.c head/sys/nfsserver/nfs_srvsock.c head/sys/nfsserver/nfs_srvsubs.c head/sys/nfsserver/nfs_syscalls.c head/sys/nfsserver/nfsm_subs.h head/sys/nfsserver/nfsrvcache.h head/sys/nlm/nlm.h head/sys/nlm/nlm_advlock.c head/sys/nlm/nlm_prot_impl.c head/sys/nlm/nlm_prot_svc.c head/sys/rpc/auth.h head/sys/rpc/auth_none.c head/sys/rpc/auth_unix.c head/sys/rpc/clnt.h head/sys/rpc/clnt_dg.c head/sys/rpc/clnt_rc.c head/sys/rpc/clnt_vc.c head/sys/rpc/rpc_com.h head/sys/rpc/rpc_generic.c head/sys/rpc/rpc_msg.h head/sys/rpc/rpc_prot.c head/sys/rpc/svc.c head/sys/rpc/svc.h head/sys/rpc/svc_auth.c head/sys/rpc/svc_auth.h head/sys/rpc/svc_auth_unix.c head/sys/rpc/svc_dg.c head/sys/rpc/svc_generic.c head/sys/rpc/svc_vc.c head/sys/rpc/xdr.h head/sys/sys/mount.h head/sys/xdr/xdr_mbuf.c head/usr.sbin/Makefile head/usr.sbin/mountd/exports.5 head/usr.sbin/mountd/mountd.c head/usr.sbin/nfsd/nfsd.c Modified: head/etc/gss/mech ============================================================================== --- head/etc/gss/mech Mon Nov 3 10:22:19 2008 (r184587) +++ head/etc/gss/mech Mon Nov 3 10:38:00 2008 (r184588) @@ -1,6 +1,6 @@ # $FreeBSD$ # # Name OID Library name Kernel module -kerberosv5 1.2.840.113554.1.2.2 /usr/lib/libgssapi_krb5.so.10 - +kerberosv5 1.2.840.113554.1.2.2 /usr/lib/libgssapi_krb5.so.10 kgssapi_krb5 spnego 1.3.6.1.5.5.2 /usr/lib/libgssapi_spnego.so.10 - #ntlm 1.3.6.1.4.1.311.2.2.10 /usr/lib/libgssapi_ntlm.so.10 - Modified: head/etc/rc.d/Makefile ============================================================================== --- head/etc/rc.d/Makefile Mon Nov 3 10:22:19 2008 (r184587) +++ head/etc/rc.d/Makefile Mon Nov 3 10:38:00 2008 (r184588) @@ -11,7 +11,7 @@ FILES= DAEMON FILESYSTEMS LOGIN NETWORKI dmesg dumpon \ early.sh encswap \ fsck ftp-proxy ftpd \ - gbde geli geli2 \ + gbde geli geli2 gssd \ hcsecd \ hostapd hostid hostname \ idmapd inetd initrandom \ Added: head/etc/rc.d/gssd ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/etc/rc.d/gssd Mon Nov 3 10:38:00 2008 (r184588) @@ -0,0 +1,18 @@ +#!/bin/sh +# +# $FreeBSD$ +# + +# PROVIDE: gssd +# REQUIRE: root +# KEYWORD: nojail shutdown + +. /etc/rc.subr + +name="gssd" + +load_rc_config $name +rcvar="gssd_enable" +command="${gssd:-/usr/sbin/${name}}" +eval ${name}_flags=\"${gssd_flags}\" +run_rc_command "$1" Modified: head/etc/rc.d/nfsd ============================================================================== --- head/etc/rc.d/nfsd Mon Nov 3 10:22:19 2008 (r184587) +++ head/etc/rc.d/nfsd Mon Nov 3 10:38:00 2008 (r184588) @@ -4,7 +4,7 @@ # # PROVIDE: nfsd -# REQUIRE: mountd +# REQUIRE: mountd hostname gssd # KEYWORD: nojail shutdown . /etc/rc.subr Modified: head/include/rpc/xdr.h ============================================================================== --- head/include/rpc/xdr.h Mon Nov 3 10:22:19 2008 (r184587) +++ head/include/rpc/xdr.h Mon Nov 3 10:38:00 2008 (r184588) @@ -294,10 +294,13 @@ extern bool_t xdr_short(XDR *, short *); extern bool_t xdr_u_short(XDR *, u_short *); extern bool_t xdr_int16_t(XDR *, int16_t *); extern bool_t xdr_u_int16_t(XDR *, u_int16_t *); +extern bool_t xdr_uint16_t(XDR *, u_int16_t *); extern bool_t xdr_int32_t(XDR *, int32_t *); extern bool_t xdr_u_int32_t(XDR *, u_int32_t *); +extern bool_t xdr_uint32_t(XDR *, u_int32_t *); extern bool_t xdr_int64_t(XDR *, int64_t *); extern bool_t xdr_u_int64_t(XDR *, u_int64_t *); +extern bool_t xdr_uint64_t(XDR *, u_int64_t *); extern bool_t xdr_bool(XDR *, bool_t *); extern bool_t xdr_enum(XDR *, enum_t *); extern bool_t xdr_array(XDR *, char **, u_int *, u_int, u_int, xdrproc_t); Modified: head/lib/libc/sys/Symbol.map ============================================================================== --- head/lib/libc/sys/Symbol.map Mon Nov 3 10:22:19 2008 (r184587) +++ head/lib/libc/sys/Symbol.map Mon Nov 3 10:38:00 2008 (r184588) @@ -982,4 +982,5 @@ FBSDprivate_1.0 { __sys_writev; __error_unthreaded; nlm_syscall; + gssd_syscall; }; Modified: head/lib/libc/xdr/Symbol.map ============================================================================== --- head/lib/libc/xdr/Symbol.map Mon Nov 3 10:22:19 2008 (r184587) +++ head/lib/libc/xdr/Symbol.map Mon Nov 3 10:38:00 2008 (r184588) @@ -45,3 +45,9 @@ FBSD_1.0 { /* xdr_sizeof; */ /* Why is xdr_sizeof.c not included in Makefileinc? */ xdrstdio_create; }; + +FBSD_1.1 { + xdr_uint16_t; + xdr_uint32_t; + xdr_uint64_t; +}; Modified: head/lib/libc/xdr/xdr.c ============================================================================== --- head/lib/libc/xdr/xdr.c Mon Nov 3 10:22:19 2008 (r184587) +++ head/lib/libc/xdr/xdr.c Mon Nov 3 10:38:00 2008 (r184588) @@ -263,6 +263,36 @@ xdr_u_int32_t(xdrs, u_int32_p) return (FALSE); } +/* + * XDR unsigned 32-bit integers + * same as xdr_int32_t - open coded to save a proc call! + */ +bool_t +xdr_uint32_t(xdrs, u_int32_p) + XDR *xdrs; + uint32_t *u_int32_p; +{ + u_long l; + + switch (xdrs->x_op) { + + case XDR_ENCODE: + l = (u_long) *u_int32_p; + return (XDR_PUTLONG(xdrs, (long *)&l)); + + case XDR_DECODE: + if (!XDR_GETLONG(xdrs, (long *)&l)) { + return (FALSE); + } + *u_int32_p = (u_int32_t) l; + return (TRUE); + + case XDR_FREE: + return (TRUE); + } + /* NOTREACHED */ + return (FALSE); +} /* * XDR short integers @@ -385,6 +415,36 @@ xdr_u_int16_t(xdrs, u_int16_p) return (FALSE); } +/* + * XDR unsigned 16-bit integers + */ +bool_t +xdr_uint16_t(xdrs, u_int16_p) + XDR *xdrs; + uint16_t *u_int16_p; +{ + u_long l; + + switch (xdrs->x_op) { + + case XDR_ENCODE: + l = (u_long) *u_int16_p; + return (XDR_PUTLONG(xdrs, (long *)&l)); + + case XDR_DECODE: + if (!XDR_GETLONG(xdrs, (long *)&l)) { + return (FALSE); + } + *u_int16_p = (u_int16_t) l; + return (TRUE); + + case XDR_FREE: + return (TRUE); + } + /* NOTREACHED */ + return (FALSE); +} + /* * XDR a char @@ -806,6 +866,38 @@ xdr_u_int64_t(xdrs, ullp) return (FALSE); } +/* + * XDR unsigned 64-bit integers + */ +bool_t +xdr_uint64_t(xdrs, ullp) + XDR *xdrs; + uint64_t *ullp; +{ + u_long ul[2]; + + switch (xdrs->x_op) { + case XDR_ENCODE: + ul[0] = (u_long)(*ullp >> 32) & 0xffffffff; + ul[1] = (u_long)(*ullp) & 0xffffffff; + if (XDR_PUTLONG(xdrs, (long *)&ul[0]) == FALSE) + return (FALSE); + return (XDR_PUTLONG(xdrs, (long *)&ul[1])); + case XDR_DECODE: + if (XDR_GETLONG(xdrs, (long *)&ul[0]) == FALSE) + return (FALSE); + if (XDR_GETLONG(xdrs, (long *)&ul[1]) == FALSE) + return (FALSE); + *ullp = (u_int64_t) + (((u_int64_t)ul[0] << 32) | ((u_int64_t)ul[1])); + return (TRUE); + case XDR_FREE: + return (TRUE); + } + /* NOTREACHED */ + return (FALSE); +} + /* * XDR hypers Modified: head/lib/librpcsec_gss/svc_rpcsec_gss.c ============================================================================== --- head/lib/librpcsec_gss/svc_rpcsec_gss.c Mon Nov 3 10:22:19 2008 (r184587) +++ head/lib/librpcsec_gss/svc_rpcsec_gss.c Mon Nov 3 10:38:00 2008 (r184588) @@ -168,7 +168,7 @@ rpc_gss_set_callback(rpc_gss_callback_t { struct svc_rpc_gss_callback *scb; - scb = malloc(sizeof(struct svc_rpc_gss_callback)); + scb = mem_alloc(sizeof(struct svc_rpc_gss_callback)); if (!scb) { _rpc_gss_set_error(RPC_GSS_ER_SYSTEMERROR, ENOMEM); return (FALSE); @@ -255,7 +255,7 @@ rpc_gss_get_principal_name(rpc_gss_princ namelen += strlen(domain) + 1; } - buf.value = malloc(namelen); + buf.value = mem_alloc(namelen); buf.length = namelen; strcpy((char *) buf.value, name); if (node) { @@ -273,7 +273,7 @@ rpc_gss_get_principal_name(rpc_gss_princ */ maj_stat = gss_import_name(&min_stat, &buf, GSS_C_NT_USER_NAME, &gss_name); - free(buf.value); + mem_free(buf.value, buf.length); if (maj_stat != GSS_S_COMPLETE) { log_status("gss_import_name", mech_oid, maj_stat, min_stat); return (FALSE); @@ -300,7 +300,7 @@ rpc_gss_get_principal_name(rpc_gss_princ } gss_release_name(&min_stat, &gss_mech_name); - result = malloc(sizeof(int) + buf.length); + result = mem_alloc(sizeof(int) + buf.length); if (!result) { gss_release_buffer(&min_stat, &buf); return (FALSE); @@ -443,7 +443,9 @@ svc_rpc_gss_destroy_client(struct svc_rp gss_release_name(&min_stat, &client->cl_cname); if (client->cl_rawcred.client_principal) - free(client->cl_rawcred.client_principal); + mem_free(client->cl_rawcred.client_principal, + sizeof(*client->cl_rawcred.client_principal) + + client->cl_rawcred.client_principal->len); if (client->cl_verf.value) gss_release_buffer(&min_stat, &client->cl_verf); @@ -527,7 +529,7 @@ gss_oid_to_str(OM_uint32 *minor_status, * here for "{ " and "}\0". */ string_length += 4; - if ((bp = (char *) malloc(string_length))) { + if ((bp = (char *) mem_alloc(string_length))) { strcpy(bp, "{ "); number = (unsigned long) cp[0]; sprintf(numstr, "%ld ", number/40); @@ -634,8 +636,15 @@ svc_rpc_gss_accept_sec_context(struct sv client->cl_sname = sname; break; } + client->cl_sname = sname; + break; } } + if (!sname) { + xdr_free((xdrproc_t) xdr_gss_buffer_desc, + (char *) &recv_tok); + return (FALSE); + } } else { gr->gr_major = gss_accept_sec_context( &gr->gr_minor, @@ -663,11 +672,11 @@ svc_rpc_gss_accept_sec_context(struct sv log_status("accept_sec_context", client->cl_mech, gr->gr_major, gr->gr_minor); client->cl_state = CLIENT_STALE; - return (FALSE); + return (TRUE); } gr->gr_handle.value = &client->cl_id; - gr->gr_handle.length = sizeof(uint32_t); + gr->gr_handle.length = sizeof(client->cl_id); gr->gr_win = SVC_RPC_GSS_SEQWINDOW; /* Save client info. */ @@ -703,7 +712,7 @@ svc_rpc_gss_accept_sec_context(struct sv return (FALSE); } client->cl_rawcred.client_principal = - malloc(sizeof(*client->cl_rawcred.client_principal) + mem_alloc(sizeof(*client->cl_rawcred.client_principal) + export_name.length); client->cl_rawcred.client_principal->len = export_name.length; memcpy(client->cl_rawcred.client_principal->name, @@ -718,6 +727,7 @@ svc_rpc_gss_accept_sec_context(struct sv * kerberos5, this uses krb5_aname_to_localname. */ svc_rpc_gss_build_ucred(client, client->cl_cname); + gss_release_name(&min_stat, &client->cl_cname); #ifdef DEBUG { @@ -892,13 +902,12 @@ svc_rpc_gss_check_replay(struct svc_rpc_ * discard it. */ offset = client->cl_seqlast - seq; - if (offset >= client->cl_win) + if (offset >= SVC_RPC_GSS_SEQWINDOW) return (FALSE); word = offset / 32; bit = offset % 32; if (client->cl_seqmask[word] & (1 << bit)) return (FALSE); - client->cl_seqmask[word] |= (1 << bit); } return (TRUE); @@ -907,7 +916,7 @@ svc_rpc_gss_check_replay(struct svc_rpc_ static void svc_rpc_gss_update_seq(struct svc_rpc_gss_client *client, uint32_t seq) { - int offset, i; + int offset, i, word, bit; uint32_t carry, newcarry; if (seq > client->cl_seqlast) { @@ -936,7 +945,13 @@ svc_rpc_gss_update_seq(struct svc_rpc_gs } client->cl_seqmask[0] |= 1; client->cl_seqlast = seq; + } else { + offset = client->cl_seqlast - seq; + word = offset / 32; + bit = offset % 32; + client->cl_seqmask[word] |= (1 << bit); } + } enum auth_stat @@ -983,6 +998,10 @@ svc_rpc_gss(struct svc_req *rqst, struct /* Check the proc and find the client (or create it) */ if (gc.gc_proc == RPCSEC_GSS_INIT) { + if (gc.gc_handle.length != 0) { + result = AUTH_BADCRED; + goto out; + } client = svc_rpc_gss_create_client(); } else { if (gc.gc_handle.length != sizeof(uint32_t)) { Modified: head/sbin/mount_nfs/mount_nfs.c ============================================================================== --- head/sbin/mount_nfs/mount_nfs.c Mon Nov 3 10:22:19 2008 (r184587) +++ head/sbin/mount_nfs/mount_nfs.c Mon Nov 3 10:38:00 2008 (r184588) @@ -134,6 +134,7 @@ struct sockaddr *addr; int addrlen = 0; u_char *fh = NULL; int fhsize = 0; +int secflavor = -1; enum mountmode { ANY, @@ -151,6 +152,8 @@ enum tryret { }; int fallback_mount(struct iovec *iov, int iovlen, int mntflags); +int sec_name_to_num(char *sec); +char *sec_num_to_name(int num); int getnfsargs(char *, struct iovec **iov, int *iovlen); int getnfs4args(char *, struct iovec **iov, int *iovlen); /* void set_rpc_maxgrouplist(int); */ @@ -308,6 +311,21 @@ main(int argc, char *argv[]) atoi(val)); if (portspec == NULL) err(1, "asprintf"); + } else if (strcmp(opt, "sec") == 0) { + /* + * Don't add this option to + * the iovec yet - we will + * negotiate which sec flavor + * to use with the remote + * mountd. + */ + pass_flag_to_nmount=0; + secflavor = sec_name_to_num(val); + if (secflavor < 0) { + errx(1, + "illegal sec value -- %s", + val); + } } else if (strcmp(opt, "retrycnt") == 0) { pass_flag_to_nmount=0; num = strtol(val, &p, 10); @@ -635,6 +653,36 @@ fallback_mount(struct iovec *iov, int io } int +sec_name_to_num(char *sec) +{ + if (!strcmp(sec, "krb5")) + return (RPCSEC_GSS_KRB5); + if (!strcmp(sec, "krb5i")) + return (RPCSEC_GSS_KRB5I); + if (!strcmp(sec, "krb5p")) + return (RPCSEC_GSS_KRB5P); + if (!strcmp(sec, "sys")) + return (AUTH_SYS); + return (-1); +} + +char * +sec_num_to_name(int flavor) +{ + switch (flavor) { + case RPCSEC_GSS_KRB5: + return ("krb5"); + case RPCSEC_GSS_KRB5I: + return ("krb5i"); + case RPCSEC_GSS_KRB5P: + return ("krb5p"); + case AUTH_SYS: + return ("sys"); + } + return (NULL); +} + +int getnfsargs(char *spec, struct iovec **iov, int *iovlen) { struct addrinfo hints, *ai_nfs, *ai; @@ -904,6 +952,7 @@ nfs_tryproto(struct addrinfo *ai, char * CLIENT *clp; struct netconfig *nconf, *nconf_mnt; const char *netid, *netid_mnt; + char *secname; int doconnect, nfsvers, mntvers, sotype; enum clnt_stat stat; enum mountmode trymntmode; @@ -1033,7 +1082,7 @@ tryagain: &rpc_createerr.cf_error)); } clp->cl_auth = authsys_create_default(); - nfhret.auth = -1; + nfhret.auth = secflavor; nfhret.vers = mntvers; stat = clnt_call(clp, RPCMNT_MOUNT, (xdrproc_t)xdr_dir, spec, (xdrproc_t)xdr_fh, &nfhret, @@ -1074,6 +1123,9 @@ tryagain: build_iovec(iov, iovlen, "addr", addr, addrlen); build_iovec(iov, iovlen, "fh", fh, fhsize); + secname = sec_num_to_name(nfhret.auth); + if (secname) + build_iovec(iov, iovlen, "sec", secname, (size_t)-1); if (nfsvers == 3) build_iovec(iov, iovlen, "nfsv3", NULL, 0); Modified: head/sys/compat/freebsd32/syscalls.master ============================================================================== --- head/sys/compat/freebsd32/syscalls.master Mon Nov 3 10:22:19 2008 (r184587) +++ head/sys/compat/freebsd32/syscalls.master Mon Nov 3 10:38:00 2008 (r184588) @@ -854,3 +854,5 @@ 503 AUE_UNLINKAT NOPROTO { int unlinkat(int fd, char *path, \ int flag); } 504 AUE_POSIX_OPENPT NOPROTO { int posix_openpt(int flags); } +; 505 is initialised by the kgssapi code, if present. +505 AUE_NULL UNIMPL gssd_syscall Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Mon Nov 3 10:22:19 2008 (r184587) +++ head/sys/conf/files Mon Nov 3 10:38:00 2008 (r184588) @@ -339,7 +339,7 @@ crypto/camellia/camellia.c optional cryp crypto/camellia/camellia-api.c optional crypto | ipsec crypto/des/des_ecb.c optional crypto | ipsec | netsmb crypto/des/des_setkey.c optional crypto | ipsec | netsmb -crypto/rc4/rc4.c optional netgraph_mppc_encryption +crypto/rc4/rc4.c optional netgraph_mppc_encryption | kgssapi crypto/rijndael/rijndael-alg-fst.c optional crypto | geom_bde | \ ipsec | random | wlan_ccmp crypto/rijndael/rijndael-api-fst.c optional geom_bde | random @@ -1746,6 +1746,56 @@ kern/vfs_subr.c standard kern/vfs_syscalls.c standard kern/vfs_vnops.c standard # +# Kernel GSS-API +# +gssd.h optional kgssapi \ + dependency "$S/kgssapi/gssd.x" \ + compile-with "rpcgen -hM $S/kgssapi/gssd.x | grep -v pthread.h > gssd.h" \ + no-obj no-implicit-rule before-depend local \ + clean "gssd.h" +gssd_xdr.c optional kgssapi \ + dependency "$S/kgssapi/gssd.x gssd.h" \ + compile-with "rpcgen -c $S/kgssapi/gssd.x -o gssd_xdr.c" \ + no-implicit-rule before-depend local \ + clean "gssd_xdr.c" +gssd_clnt.c optional kgssapi \ + dependency "$S/kgssapi/gssd.x gssd.h" \ + compile-with "rpcgen -lM $S/kgssapi/gssd.x | grep -v string.h > gssd_clnt.c" \ + no-implicit-rule before-depend local \ + clean "gssd_clnt.c" +kgssapi/gss_accept_sec_context.c optional kgssapi +kgssapi/gss_add_oid_set_member.c optional kgssapi +kgssapi/gss_acquire_cred.c optional kgssapi +kgssapi/gss_canonicalize_name.c optional kgssapi +kgssapi/gss_create_empty_oid_set.c optional kgssapi +kgssapi/gss_delete_sec_context.c optional kgssapi +kgssapi/gss_display_status.c optional kgssapi +kgssapi/gss_export_name.c optional kgssapi +kgssapi/gss_get_mic.c optional kgssapi +kgssapi/gss_init_sec_context.c optional kgssapi +kgssapi/gss_impl.c optional kgssapi +kgssapi/gss_import_name.c optional kgssapi +kgssapi/gss_names.c optional kgssapi +kgssapi/gss_pname_to_uid.c optional kgssapi +kgssapi/gss_release_buffer.c optional kgssapi +kgssapi/gss_release_cred.c optional kgssapi +kgssapi/gss_release_name.c optional kgssapi +kgssapi/gss_release_oid_set.c optional kgssapi +kgssapi/gss_set_cred_option.c optional kgssapi +kgssapi/gss_test_oid_set_member.c optional kgssapi +kgssapi/gss_unwrap.c optional kgssapi +kgssapi/gss_verify_mic.c optional kgssapi +kgssapi/gss_wrap.c optional kgssapi +kgssapi/gss_wrap_size_limit.c optional kgssapi +kgssapi/gssd_prot.c optional kgssapi +kgssapi/krb5/krb5_mech.c optional kgssapi +kgssapi/krb5/kcrypto.c optional kgssapi +kgssapi/krb5/kcrypto_aes.c optional kgssapi +kgssapi/krb5/kcrypto_arcfour.c optional kgssapi +kgssapi/krb5/kcrypto_des.c optional kgssapi +kgssapi/krb5/kcrypto_des3.c optional kgssapi +kgssapi/kgss_if.m optional kgssapi +kgssapi/gsstest.c optional kgssapi_debug # These files in libkern/ are those needed by all architectures. Some # of the files in libkern/ are only needed on some architectures, e.g., # libkern/divdi3.c is needed by i386 but not alpha. Also, some of these @@ -2106,18 +2156,21 @@ nfsclient/krpc_subr.c optional bootp nf nfsclient/nfs_bio.c optional nfsclient nfsclient/nfs_diskless.c optional nfsclient nfs_root nfsclient/nfs_node.c optional nfsclient -nfsclient/nfs_socket.c optional nfsclient +nfsclient/nfs_socket.c optional nfsclient nfs_legacyrpc +nfsclient/nfs_krpc.c optional nfsclient nfsclient/nfs_subs.c optional nfsclient nfsclient/nfs_nfsiod.c optional nfsclient nfsclient/nfs_vfsops.c optional nfsclient nfsclient/nfs_vnops.c optional nfsclient nfsclient/nfs_lock.c optional nfsclient +nfsserver/nfs_fha.c optional nfsserver nfsserver/nfs_serv.c optional nfsserver -nfsserver/nfs_srvsock.c optional nfsserver -nfsserver/nfs_srvcache.c optional nfsserver +nfsserver/nfs_srvkrpc.c optional nfsserver +nfsserver/nfs_srvsock.c optional nfsserver nfs_legacyrpc +nfsserver/nfs_srvcache.c optional nfsserver nfs_legacyrpc nfsserver/nfs_srvsubs.c optional nfsserver -nfsserver/nfs_syscalls.c optional nfsserver -nlm/nlm_advlock.c optional nfslockd +nfsserver/nfs_syscalls.c optional nfsserver nfs_legacyrpc +nlm/nlm_advlock.c optional nfslockd nfsclient nlm/nlm_prot_clnt.c optional nfslockd nlm/nlm_prot_impl.c optional nfslockd nlm/nlm_prot_server.c optional nfslockd @@ -2143,27 +2196,33 @@ pci/intpm.c optional intpm pci pci/ncr.c optional ncr pci pci/nfsmb.c optional nfsmb pci pci/viapm.c optional viapm pci -rpc/auth_none.c optional krpc | nfslockd -rpc/auth_unix.c optional krpc | nfslockd -rpc/authunix_prot.c optional krpc | nfslockd -rpc/clnt_dg.c optional krpc | nfslockd -rpc/clnt_rc.c optional krpc | nfslockd -rpc/clnt_vc.c optional krpc | nfslockd -rpc/getnetconfig.c optional krpc | nfslockd -rpc/inet_ntop.c optional krpc | nfslockd -rpc/inet_pton.c optional krpc | nfslockd -rpc/rpc_callmsg.c optional krpc | nfslockd -rpc/rpc_generic.c optional krpc | nfslockd -rpc/rpc_prot.c optional krpc | nfslockd -rpc/rpcb_clnt.c optional krpc | nfslockd -rpc/rpcb_prot.c optional krpc | nfslockd +rpc/auth_none.c optional krpc | nfslockd | nfsclient | nfsserver +rpc/auth_unix.c optional krpc | nfslockd | nfsclient +rpc/authunix_prot.c optional krpc | nfslockd | nfsclient | nfsserver +rpc/clnt_dg.c optional krpc | nfslockd | nfsclient +rpc/clnt_rc.c optional krpc | nfslockd | nfsclient +rpc/clnt_vc.c optional krpc | nfslockd | nfsclient | nfsserver +rpc/getnetconfig.c optional krpc | nfslockd | nfsclient | nfsserver +rpc/inet_ntop.c optional krpc | nfslockd | nfsclient | nfsserver +rpc/inet_pton.c optional krpc | nfslockd | nfsclient | nfsserver +rpc/replay.c optional krpc | nfslockd | nfsserver +rpc/rpc_callmsg.c optional krpc | nfslockd | nfsclient | nfsserver +rpc/rpc_generic.c optional krpc | nfslockd | nfsclient | nfsserver +rpc/rpc_prot.c optional krpc | nfslockd | nfsclient | nfsserver +rpc/rpcb_clnt.c optional krpc | nfslockd | nfsclient | nfsserver +rpc/rpcb_prot.c optional krpc | nfslockd | nfsclient | nfsserver rpc/rpcclnt.c optional nfsclient -rpc/svc.c optional krpc | nfslockd -rpc/svc_auth.c optional krpc | nfslockd -rpc/svc_auth_unix.c optional krpc | nfslockd -rpc/svc_dg.c optional krpc | nfslockd -rpc/svc_generic.c optional krpc | nfslockd -rpc/svc_vc.c optional krpc | nfslockd +rpc/svc.c optional krpc | nfslockd | nfsserver +rpc/svc_auth.c optional krpc | nfslockd | nfsserver +rpc/svc_auth_unix.c optional krpc | nfslockd | nfsserver +rpc/svc_dg.c optional krpc | nfslockd | nfsserver +rpc/svc_generic.c optional krpc | nfslockd | nfsserver +rpc/svc_vc.c optional krpc | nfslockd | nfsserver +rpc/rpcsec_gss/rpcsec_gss.c optional krpc kgssapi | nfslockd kgssapi +rpc/rpcsec_gss/rpcsec_gss_conf.c optional krpc kgssapi | nfslockd kgssapi +rpc/rpcsec_gss/rpcsec_gss_misc.c optional krpc kgssapi | nfslockd kgssapi +rpc/rpcsec_gss/rpcsec_gss_prot.c optional krpc kgssapi | nfslockd kgssapi +rpc/rpcsec_gss/svc_rpcsec_gss.c optional krpc kgssapi | nfslockd kgssapi security/audit/audit.c optional audit security/audit/audit_arg.c optional audit security/audit/audit_bsm.c optional audit @@ -2251,12 +2310,12 @@ vm/vm_reserv.c standard vm/vm_unix.c standard vm/vm_zeroidle.c standard vm/vnode_pager.c standard -xdr/xdr.c optional krpc | nfslockd -xdr/xdr_array.c optional krpc | nfslockd -xdr/xdr_mbuf.c optional krpc | nfslockd -xdr/xdr_mem.c optional krpc | nfslockd -xdr/xdr_reference.c optional krpc | nfslockd -xdr/xdr_sizeof.c optional krpc | nfslockd +xdr/xdr.c optional krpc | nfslockd | nfsclient | nfsserver +xdr/xdr_array.c optional krpc | nfslockd | nfsclient | nfsserver +xdr/xdr_mbuf.c optional krpc | nfslockd | nfsclient | nfsserver +xdr/xdr_mem.c optional krpc | nfslockd | nfsclient | nfsserver +xdr/xdr_reference.c optional krpc | nfslockd | nfsclient | nfsserver +xdr/xdr_sizeof.c optional krpc | nfslockd | nfsclient | nfsserver # gnu/fs/xfs/xfs_alloc.c optional xfs \ compile-with "${NORMAL_C} -I$S/gnu/fs/xfs/FreeBSD -I$S/gnu/fs/xfs/FreeBSD/support -I$S/gnu/fs/xfs" \ Modified: head/sys/conf/options ============================================================================== --- head/sys/conf/options Mon Nov 3 10:22:19 2008 (r184587) +++ head/sys/conf/options Mon Nov 3 10:38:00 2008 (r184588) @@ -214,6 +214,10 @@ PSEUDOFS_TRACE opt_pseudofs.h # Broken - ffs_snapshot() dependency from ufs_lookup() :-( FFS opt_ffs_broken_fixme.h +# In-kernel GSS-API +KGSSAPI opt_kgssapi.h +KGSSAPI_DEBUG opt_kgssapi.h + # These static filesystems have one slightly bogus static dependency in # sys/i386/i386/autoconf.c. If any of these filesystems are # statically compiled into the kernel, code for mounting them as root @@ -222,6 +226,11 @@ NFSCLIENT opt_nfs.h NFSSERVER opt_nfs.h NFS4CLIENT opt_nfs.h +# Use this option to compile both NFS client and server using the +# legacy RPC implementation instead of the newer KRPC system (which +# supports modern features such as RPCSEC_GSS +NFS_LEGACYRPC opt_nfs.h + # filesystems and libiconv bridge CD9660_ICONV opt_dontuse.h MSDOSFS_ICONV opt_dontuse.h Modified: head/sys/fs/unionfs/union_vfsops.c ============================================================================== --- head/sys/fs/unionfs/union_vfsops.c Mon Nov 3 10:22:19 2008 (r184587) +++ head/sys/fs/unionfs/union_vfsops.c Mon Nov 3 10:38:00 2008 (r184588) @@ -521,7 +521,7 @@ unionfs_fhtovp(struct mount *mp, struct static int unionfs_checkexp(struct mount *mp, struct sockaddr *nam, int *extflagsp, - struct ucred **credanonp) + struct ucred **credanonp, int *numsecflavors, int **secflavors) { return (EOPNOTSUPP); } Modified: head/sys/kern/syscalls.master ============================================================================== --- head/sys/kern/syscalls.master Mon Nov 3 10:22:19 2008 (r184587) +++ head/sys/kern/syscalls.master Mon Nov 3 10:38:00 2008 (r184588) @@ -895,5 +895,7 @@ char *path2); } 503 AUE_UNLINKAT STD { int unlinkat(int fd, char *path, int flag); } 504 AUE_POSIX_OPENPT STD { int posix_openpt(int flags); } +; 505 is initialised by the kgssapi code, if present. +505 AUE_NULL NOSTD { int gssd_syscall(char *path); } ; Please copy any additions and changes to the following compatability tables: ; sys/compat/freebsd32/syscalls.master Modified: head/sys/kern/vfs_export.c ============================================================================== --- head/sys/kern/vfs_export.c Mon Nov 3 10:22:19 2008 (r184587) +++ head/sys/kern/vfs_export.c Mon Nov 3 10:38:00 2008 (r184588) @@ -68,6 +68,8 @@ struct netcred { struct radix_node netc_rnodes[2]; int netc_exflags; struct ucred netc_anon; + int netc_numsecflavors; + int netc_secflavors[MAXSECFLAVORS]; }; /* @@ -120,6 +122,9 @@ vfs_hang_addrlist(struct mount *mp, stru np->netc_anon.cr_ngroups = argp->ex_anon.cr_ngroups; bcopy(argp->ex_anon.cr_groups, np->netc_anon.cr_groups, sizeof(np->netc_anon.cr_groups)); + np->netc_numsecflavors = argp->ex_numsecflavors; + bcopy(argp->ex_secflavors, np->netc_secflavors, + sizeof(np->netc_secflavors)); refcount_init(&np->netc_anon.cr_ref, 1); MNT_ILOCK(mp); mp->mnt_flag |= MNT_DEFEXPORTED; @@ -203,6 +208,9 @@ vfs_hang_addrlist(struct mount *mp, stru np->netc_anon.cr_ngroups = argp->ex_anon.cr_ngroups; bcopy(argp->ex_anon.cr_groups, np->netc_anon.cr_groups, sizeof(np->netc_anon.cr_groups)); + np->netc_numsecflavors = argp->ex_numsecflavors; + bcopy(argp->ex_secflavors, np->netc_secflavors, + sizeof(np->netc_secflavors)); refcount_init(&np->netc_anon.cr_ref, 1); return (0); out: @@ -253,6 +261,10 @@ vfs_export(struct mount *mp, struct expo struct netexport *nep; int error; + if (argp->ex_numsecflavors < 0 + || argp->ex_numsecflavors >= MAXSECFLAVORS) + return (EINVAL); + nep = mp->mnt_export; error = 0; lockmgr(&mp->mnt_explock, LK_EXCLUSIVE, NULL); @@ -441,7 +453,7 @@ vfs_export_lookup(struct mount *mp, stru int vfs_stdcheckexp(struct mount *mp, struct sockaddr *nam, int *extflagsp, - struct ucred **credanonp) + struct ucred **credanonp, int *numsecflavors, int **secflavors) { struct netcred *np; @@ -452,6 +464,10 @@ vfs_stdcheckexp(struct mount *mp, struct return (EACCES); *extflagsp = np->netc_exflags; *credanonp = &np->netc_anon; + if (numsecflavors) + *numsecflavors = np->netc_numsecflavors; + if (secflavors) + *secflavors = np->netc_secflavors; return (0); } Modified: head/sys/kern/vfs_mount.c ============================================================================== --- head/sys/kern/vfs_mount.c Mon Nov 3 10:22:19 2008 (r184587) +++ head/sys/kern/vfs_mount.c Mon Nov 3 10:38:00 2008 (r184588) @@ -827,6 +827,7 @@ vfs_domount( struct vnode *vp; struct mount *mp; struct vfsconf *vfsp; + struct oexport_args oexport; struct export_args export; int error, flag = 0; struct vattr va; @@ -1010,6 +1011,19 @@ vfs_domount( if (vfs_copyopt(mp->mnt_optnew, "export", &export, sizeof(export)) == 0) error = vfs_export(mp, &export); + else if (vfs_copyopt(mp->mnt_optnew, "export", &oexport, + sizeof(oexport)) == 0) { + export.ex_flags = oexport.ex_flags; + export.ex_root = oexport.ex_root; + export.ex_anon = oexport.ex_anon; + export.ex_addr = oexport.ex_addr; + export.ex_addrlen = oexport.ex_addrlen; + export.ex_mask = oexport.ex_mask; + export.ex_masklen = oexport.ex_masklen; + export.ex_indexfile = oexport.ex_indexfile; + export.ex_numsecflavors = 0; + error = vfs_export(mp, &export); + } } if (!error) { Added: head/sys/kgssapi/gss_accept_sec_context.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/kgssapi/gss_accept_sec_context.c Mon Nov 3 10:38:00 2008 (r184588) @@ -0,0 +1,138 @@ +/*- + * Copyright (c) 2008 Isilon Inc http://www.isilon.com/ + * Authors: Doug Rabson + * Developed with Red Inc: Alfred Perlstein + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include + +#include +#include +#include + +#include "gssd.h" +#include "kgss_if.h" + +OM_uint32 gss_accept_sec_context(OM_uint32 *minor_status, + gss_ctx_id_t *context_handle, + const gss_cred_id_t acceptor_cred_handle, + const gss_buffer_t input_token, + const gss_channel_bindings_t input_chan_bindings, + gss_name_t *src_name, + gss_OID *mech_type, + gss_buffer_t output_token, + OM_uint32 *ret_flags, + OM_uint32 *time_rec, + gss_cred_id_t *delegated_cred_handle) +{ + struct accept_sec_context_res res; + struct accept_sec_context_args args; + enum clnt_stat stat; + gss_ctx_id_t ctx = *context_handle; + gss_name_t name; + gss_cred_id_t cred; + + if (!kgss_gssd_handle) + return (GSS_S_FAILURE); + + if (ctx) + args.ctx = ctx->handle; + else + args.ctx = 0; + if (acceptor_cred_handle) + args.cred = acceptor_cred_handle->handle; + else + args.cred = 0; + args.input_token = *input_token; + args.input_chan_bindings = input_chan_bindings; + + bzero(&res, sizeof(res)); + stat = gssd_accept_sec_context_1(&args, &res, kgss_gssd_handle); + if (stat != RPC_SUCCESS) { + *minor_status = stat; + return (GSS_S_FAILURE); + } + + if (res.major_status != GSS_S_COMPLETE + && res.major_status != GSS_S_CONTINUE_NEEDED) { + *minor_status = res.minor_status; + xdr_free((xdrproc_t) xdr_accept_sec_context_res, &res); + return (res.major_status); + } + + *minor_status = res.minor_status; + + if (!ctx) { + ctx = kgss_create_context(res.mech_type); + if (!ctx) { + xdr_free((xdrproc_t) xdr_accept_sec_context_res, &res); + *minor_status = 0; + return (GSS_S_BAD_MECH); + } + } + *context_handle = ctx; + + ctx->handle = res.ctx; + name = malloc(sizeof(struct _gss_name_t), M_GSSAPI, M_WAITOK); + name->handle = res.src_name; + if (src_name) { + *src_name = name; + } else { + OM_uint32 junk; + gss_release_name(&junk, &name); + } + if (mech_type) + *mech_type = KGSS_MECH_TYPE(ctx); + kgss_copy_buffer(&res.output_token, output_token); + if (ret_flags) + *ret_flags = res.ret_flags; + if (time_rec) + *time_rec = res.time_rec; + cred = malloc(sizeof(struct _gss_cred_id_t), M_GSSAPI, M_WAITOK); + cred->handle = res.delegated_cred_handle; + if (delegated_cred_handle) { + *delegated_cred_handle = cred; + } else { + OM_uint32 junk; + gss_release_cred(&junk, &cred); + } + + xdr_free((xdrproc_t) xdr_accept_sec_context_res, &res); + + /* + * If the context establishment is complete, export it from + * userland and hand the result (which includes key material + * etc.) to the kernel implementation. + */ + if (res.major_status == GSS_S_COMPLETE) + res.major_status = kgss_transfer_context(ctx); + + return (res.major_status); +} Added: head/sys/kgssapi/gss_acquire_cred.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/kgssapi/gss_acquire_cred.c Mon Nov 3 10:38:00 2008 (r184588) @@ -0,0 +1,105 @@ +/*- + * Copyright (c) 2008 Isilon Inc http://www.isilon.com/ + * Authors: Doug Rabson + * Developed with Red Inc: Alfred Perlstein + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include + +#include +#include + +#include "gssd.h" + +OM_uint32 +gss_acquire_cred(OM_uint32 *minor_status, + const gss_name_t desired_name, + OM_uint32 time_req, + const gss_OID_set desired_mechs, + gss_cred_usage_t cred_usage, + gss_cred_id_t *output_cred_handle, + gss_OID_set *actual_mechs, + OM_uint32 *time_rec) +{ + OM_uint32 major_status; + struct acquire_cred_res res; + struct acquire_cred_args args; + enum clnt_stat stat; + gss_cred_id_t cred; + int i; + + if (!kgss_gssd_handle) + return (GSS_S_FAILURE); + + args.uid = curthread->td_ucred->cr_uid; + if (desired_name) + args.desired_name = desired_name->handle; + else + args.desired_name = 0; + args.time_req = time_req; + args.desired_mechs = desired_mechs; + args.cred_usage = cred_usage; + + bzero(&res, sizeof(res)); + stat = gssd_acquire_cred_1(&args, &res, kgss_gssd_handle); + if (stat != RPC_SUCCESS) { + *minor_status = stat; + return (GSS_S_FAILURE); + } + + if (res.major_status != GSS_S_COMPLETE) { + *minor_status = res.minor_status; *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From dfr at FreeBSD.org Mon Nov 3 02:39:36 2008 From: dfr at FreeBSD.org (Doug Rabson) Date: Mon Nov 3 02:39:43 2008 Subject: svn commit: r184589 - in head/sys: compat/freebsd32 kern sys Message-ID: <200811031039.mA3AdZ0A064467@svn.freebsd.org> Author: dfr Date: Mon Nov 3 10:39:35 2008 New Revision: 184589 URL: http://svn.freebsd.org/changeset/base/184589 Log: Regen. Modified: head/sys/compat/freebsd32/freebsd32_proto.h head/sys/compat/freebsd32/freebsd32_syscall.h head/sys/compat/freebsd32/freebsd32_syscalls.c head/sys/compat/freebsd32/freebsd32_sysent.c head/sys/kern/init_sysent.c head/sys/kern/syscalls.c head/sys/kern/systrace_args.c head/sys/sys/syscall.h head/sys/sys/syscall.mk head/sys/sys/sysproto.h Modified: head/sys/compat/freebsd32/freebsd32_proto.h ============================================================================== --- head/sys/compat/freebsd32/freebsd32_proto.h Mon Nov 3 10:38:00 2008 (r184588) +++ head/sys/compat/freebsd32/freebsd32_proto.h Mon Nov 3 10:39:35 2008 (r184589) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 184183 2008-10-22 21:55:48Z jhb + * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 184588 2008-11-03 10:38:00Z dfr */ #ifndef _FREEBSD32_SYSPROTO_H_ Modified: head/sys/compat/freebsd32/freebsd32_syscall.h ============================================================================== --- head/sys/compat/freebsd32/freebsd32_syscall.h Mon Nov 3 10:38:00 2008 (r184588) +++ head/sys/compat/freebsd32/freebsd32_syscall.h Mon Nov 3 10:39:35 2008 (r184589) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 184183 2008-10-22 21:55:48Z jhb + * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 184588 2008-11-03 10:38:00Z dfr */ #define FREEBSD32_SYS_syscall 0 @@ -356,4 +356,4 @@ #define FREEBSD32_SYS_symlinkat 502 #define FREEBSD32_SYS_unlinkat 503 #define FREEBSD32_SYS_posix_openpt 504 -#define FREEBSD32_SYS_MAXSYSCALL 505 +#define FREEBSD32_SYS_MAXSYSCALL 506 Modified: head/sys/compat/freebsd32/freebsd32_syscalls.c ============================================================================== --- head/sys/compat/freebsd32/freebsd32_syscalls.c Mon Nov 3 10:38:00 2008 (r184588) +++ head/sys/compat/freebsd32/freebsd32_syscalls.c Mon Nov 3 10:39:35 2008 (r184589) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 184183 2008-10-22 21:55:48Z jhb + * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 184588 2008-11-03 10:38:00Z dfr */ const char *freebsd32_syscallnames[] = { @@ -512,4 +512,5 @@ const char *freebsd32_syscallnames[] = { "symlinkat", /* 502 = symlinkat */ "unlinkat", /* 503 = unlinkat */ "posix_openpt", /* 504 = posix_openpt */ + "#505", /* 505 = gssd_syscall */ }; Modified: head/sys/compat/freebsd32/freebsd32_sysent.c ============================================================================== --- head/sys/compat/freebsd32/freebsd32_sysent.c Mon Nov 3 10:38:00 2008 (r184588) +++ head/sys/compat/freebsd32/freebsd32_sysent.c Mon Nov 3 10:39:35 2008 (r184589) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 184183 2008-10-22 21:55:48Z jhb + * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 184588 2008-11-03 10:38:00Z dfr */ #include "opt_compat.h" @@ -543,4 +543,5 @@ struct sysent freebsd32_sysent[] = { { AS(symlinkat_args), (sy_call_t *)symlinkat, AUE_SYMLINKAT, NULL, 0, 0 }, /* 502 = symlinkat */ { AS(unlinkat_args), (sy_call_t *)unlinkat, AUE_UNLINKAT, NULL, 0, 0 }, /* 503 = unlinkat */ { AS(posix_openpt_args), (sy_call_t *)posix_openpt, AUE_POSIX_OPENPT, NULL, 0, 0 }, /* 504 = posix_openpt */ + { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 505 = gssd_syscall */ }; Modified: head/sys/kern/init_sysent.c ============================================================================== --- head/sys/kern/init_sysent.c Mon Nov 3 10:38:00 2008 (r184588) +++ head/sys/kern/init_sysent.c Mon Nov 3 10:39:35 2008 (r184589) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/kern/syscalls.master 183361 2008-09-25 20:07:42Z jhb + * created from FreeBSD: head/sys/kern/syscalls.master 184588 2008-11-03 10:38:00Z dfr */ #include "opt_compat.h" @@ -533,4 +533,5 @@ struct sysent sysent[] = { { AS(symlinkat_args), (sy_call_t *)symlinkat, AUE_SYMLINKAT, NULL, 0, 0 }, /* 502 = symlinkat */ { AS(unlinkat_args), (sy_call_t *)unlinkat, AUE_UNLINKAT, NULL, 0, 0 }, /* 503 = unlinkat */ { AS(posix_openpt_args), (sy_call_t *)posix_openpt, AUE_POSIX_OPENPT, NULL, 0, 0 }, /* 504 = posix_openpt */ + { AS(gssd_syscall_args), (sy_call_t *)lkmressys, AUE_NULL, NULL, 0, 0 }, /* 505 = gssd_syscall */ }; Modified: head/sys/kern/syscalls.c ============================================================================== --- head/sys/kern/syscalls.c Mon Nov 3 10:38:00 2008 (r184588) +++ head/sys/kern/syscalls.c Mon Nov 3 10:39:35 2008 (r184589) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/kern/syscalls.master 183361 2008-09-25 20:07:42Z jhb + * created from FreeBSD: head/sys/kern/syscalls.master 184588 2008-11-03 10:38:00Z dfr */ const char *syscallnames[] = { @@ -512,4 +512,5 @@ const char *syscallnames[] = { "symlinkat", /* 502 = symlinkat */ "unlinkat", /* 503 = unlinkat */ "posix_openpt", /* 504 = posix_openpt */ + "gssd_syscall", /* 505 = gssd_syscall */ }; Modified: head/sys/kern/systrace_args.c ============================================================================== --- head/sys/kern/systrace_args.c Mon Nov 3 10:38:00 2008 (r184588) +++ head/sys/kern/systrace_args.c Mon Nov 3 10:39:35 2008 (r184589) @@ -3056,6 +3056,13 @@ systrace_args(int sysnum, void *params, *n_args = 1; break; } + /* gssd_syscall */ + case 505: { + struct gssd_syscall_args *p = params; + uarg[0] = (intptr_t) p->path; /* char * */ + *n_args = 1; + break; + } default: *n_args = 0; break; @@ -8112,6 +8119,16 @@ systrace_setargdesc(int sysnum, int ndx, break; }; break; + /* gssd_syscall */ + case 505: + switch(ndx) { + case 0: + p = "char *"; + break; + default: + break; + }; + break; default: break; }; Modified: head/sys/sys/syscall.h ============================================================================== --- head/sys/sys/syscall.h Mon Nov 3 10:38:00 2008 (r184588) +++ head/sys/sys/syscall.h Mon Nov 3 10:39:35 2008 (r184589) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/kern/syscalls.master 183361 2008-09-25 20:07:42Z jhb + * created from FreeBSD: head/sys/kern/syscalls.master 184588 2008-11-03 10:38:00Z dfr */ #define SYS_syscall 0 @@ -420,4 +420,5 @@ #define SYS_symlinkat 502 #define SYS_unlinkat 503 #define SYS_posix_openpt 504 -#define SYS_MAXSYSCALL 505 +#define SYS_gssd_syscall 505 +#define SYS_MAXSYSCALL 506 Modified: head/sys/sys/syscall.mk ============================================================================== --- head/sys/sys/syscall.mk Mon Nov 3 10:38:00 2008 (r184588) +++ head/sys/sys/syscall.mk Mon Nov 3 10:39:35 2008 (r184589) @@ -1,7 +1,7 @@ # FreeBSD system call names. # DO NOT EDIT-- this file is automatically generated. # $FreeBSD$ -# created from FreeBSD: head/sys/kern/syscalls.master 183361 2008-09-25 20:07:42Z jhb +# created from FreeBSD: head/sys/kern/syscalls.master 184588 2008-11-03 10:38:00Z dfr MIASM = \ syscall.o \ exit.o \ @@ -368,4 +368,5 @@ MIASM = \ renameat.o \ symlinkat.o \ unlinkat.o \ - posix_openpt.o + posix_openpt.o \ + gssd_syscall.o Modified: head/sys/sys/sysproto.h ============================================================================== --- head/sys/sys/sysproto.h Mon Nov 3 10:38:00 2008 (r184588) +++ head/sys/sys/sysproto.h Mon Nov 3 10:39:35 2008 (r184589) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/kern/syscalls.master 183361 2008-09-25 20:07:42Z jhb + * created from FreeBSD: head/sys/kern/syscalls.master 184588 2008-11-03 10:38:00Z dfr */ #ifndef _SYS_SYSPROTO_H_ @@ -1633,6 +1633,9 @@ struct unlinkat_args { struct posix_openpt_args { char flags_l_[PADL_(int)]; int flags; char flags_r_[PADR_(int)]; }; +struct gssd_syscall_args { + char path_l_[PADL_(char *)]; char * path; char path_r_[PADR_(char *)]; +}; int nosys(struct thread *, struct nosys_args *); void sys_exit(struct thread *, struct sys_exit_args *); int fork(struct thread *, struct fork_args *); @@ -1989,6 +1992,7 @@ int renameat(struct thread *, struct ren int symlinkat(struct thread *, struct symlinkat_args *); int unlinkat(struct thread *, struct unlinkat_args *); int posix_openpt(struct thread *, struct posix_openpt_args *); +int gssd_syscall(struct thread *, struct gssd_syscall_args *); #ifdef COMPAT_43 @@ -2570,6 +2574,7 @@ int freebsd4_sigreturn(struct thread *, #define SYS_AUE_symlinkat AUE_SYMLINKAT #define SYS_AUE_unlinkat AUE_UNLINKAT #define SYS_AUE_posix_openpt AUE_POSIX_OPENPT +#define SYS_AUE_gssd_syscall AUE_NULL #undef PAD_ #undef PADL_ From des at des.no Mon Nov 3 05:15:42 2008 From: des at des.no (=?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?=) Date: Mon Nov 3 05:15:50 2008 Subject: svn commit: r184509 - head/share/man/man9 In-Reply-To: <20081101212937.D12448@delplex.bde.org> (Bruce Evans's message of "Sat, 1 Nov 2008 22:05:41 +1100 (EST)") References: <200810311447.m9VElFtp083250@svn.freebsd.org> <20081101212937.D12448@delplex.bde.org> Message-ID: <867i7lq7b7.fsf@ds4.des.no> Bruce Evans writes: > Robert Watson writes: > > In style(9) examples of err() and errx(), use sysexits(3) errors > > rather than returning 1. > style(9) was correct. Using sysexits(3) is a style bug in most cases > [...] I agree. If we must use symbolic names, I suggest we just follow the standard, cf. ISO/IEC 9899:1999 ?7.20.4.3: If the value of status is zero or EXIT_SUCCESS, an implementation- defined form of the status successful termination is returned. If the value of status is EXIT_FAILURE, an implementation-defined form of the status unsuccessful termination is returned. Otherwise the status returned is implementation-defined. Note that our defines EXIT_FAILURE to 1. DES -- Dag-Erling Sm?rgrav - des@des.no From simon at FreeBSD.org Mon Nov 3 05:48:39 2008 From: simon at FreeBSD.org (Simon L. Nielsen) Date: Mon Nov 3 05:48:46 2008 Subject: svn commit: r184588 - in head: etc/gss etc/rc.d include/rpc lib/libc/sys lib/libc/xdr lib/librpcsec_gss sbin/mount_nfs sys/compat/freebsd32 sys/conf sys/fs/unionfs sys/kern sys/kgssapi sys/kgssapi/... In-Reply-To: <200811031038.mA3Ac0UR064387@svn.freebsd.org> References: <200811031038.mA3Ac0UR064387@svn.freebsd.org> Message-ID: <20081103134838.GB1207@arthur.nitro.dk> On 2008.11.03 10:38:00 +0000, Doug Rabson wrote: > Author: dfr > Date: Mon Nov 3 10:38:00 2008 > New Revision: 184588 > URL: http://svn.freebsd.org/changeset/base/184588 > > Log: > Implement support for RPCSEC_GSS authentication to both the NFS client > and server. This replaces the RPC implementation of the NFS client and Cool, thanks! Which NFS Servers have you tested this against, or more specifically do, you think I should be able to get this working against an NetApp NFS Filer which supports Kerberos 5 for NFS? Or am I mixing things up so that's something else? -- Simon L. Nielsen From kib at FreeBSD.org Mon Nov 3 06:08:09 2008 From: kib at FreeBSD.org (Konstantin Belousov) Date: Mon Nov 3 06:08:15 2008 Subject: svn commit: r184590 - in stable/7/sys: . kern ufs/ffs Message-ID: <200811031408.mA3E89Bx068087@svn.freebsd.org> Author: kib Date: Mon Nov 3 14:08:08 2008 New Revision: 184590 URL: http://svn.freebsd.org/changeset/base/184590 Log: MFC r184074: Assert that v_holdcnt is non-zero before entering lockmgr in vn_lock and ffs_lock. This cannot catch situations where holdcnt is incremented not by curthread, but I think it is useful. Approved by: re (kensmith) Modified: stable/7/sys/ (props changed) stable/7/sys/kern/vfs_vnops.c stable/7/sys/ufs/ffs/ffs_vnops.c Modified: stable/7/sys/kern/vfs_vnops.c ============================================================================== --- stable/7/sys/kern/vfs_vnops.c Mon Nov 3 10:39:35 2008 (r184589) +++ stable/7/sys/kern/vfs_vnops.c Mon Nov 3 14:08:08 2008 (r184590) @@ -800,6 +800,10 @@ _vn_lock(struct vnode *vp, int flags, st do { if ((flags & LK_INTERLOCK) == 0) VI_LOCK(vp); +#ifdef DEBUG_VFS_LOCKS + KASSERT(vp->v_holdcnt != 0, + ("vn_lock %p: zero hold count", vp)); +#endif if ((flags & LK_NOWAIT || (flags & LK_TYPE_MASK) == 0) && vp->v_iflag & VI_DOOMED) { VI_UNLOCK(vp); Modified: stable/7/sys/ufs/ffs/ffs_vnops.c ============================================================================== --- stable/7/sys/ufs/ffs/ffs_vnops.c Mon Nov 3 10:39:35 2008 (r184589) +++ stable/7/sys/ufs/ffs/ffs_vnops.c Mon Nov 3 14:08:08 2008 (r184590) @@ -369,6 +369,10 @@ ffs_lock(ap) VI_LOCK(vp); flags |= LK_INTERLOCK; } +#ifdef DEBUG_VFS_LOCKS + KASSERT(vp->v_holdcnt != 0, + ("ffs_lock %p: zero hold count", vp)); +#endif lkp = vp->v_vnlock; result = _lockmgr(lkp, flags, VI_MTX(vp), ap->a_td, ap->a_file, ap->a_line); if (lkp == vp->v_vnlock || result != 0) From kib at FreeBSD.org Mon Nov 3 06:11:06 2008 From: kib at FreeBSD.org (Konstantin Belousov) Date: Mon Nov 3 06:11:17 2008 Subject: svn commit: r184591 - in stable/7/sys: . kern Message-ID: <200811031411.mA3EB6t4068217@svn.freebsd.org> Author: kib Date: Mon Nov 3 14:11:06 2008 New Revision: 184591 URL: http://svn.freebsd.org/changeset/base/184591 Log: In vfs_busy(), lockmgr() cannot legitimately sleep, because code checked MNTK_UNMOUNT before, and mnt_mtx is used as interlock. vfs_busy() always tries to obtain a shared lock on mnt_lock, the other user is unmount who tries to drain it, setting MNTK_UNMOUNT before. Approved by: re (kensmith) Modified: stable/7/sys/ (props changed) stable/7/sys/kern/vfs_subr.c Modified: stable/7/sys/kern/vfs_subr.c ============================================================================== --- stable/7/sys/kern/vfs_subr.c Mon Nov 3 14:08:08 2008 (r184590) +++ stable/7/sys/kern/vfs_subr.c Mon Nov 3 14:11:06 2008 (r184591) @@ -361,7 +361,7 @@ vfs_busy(struct mount *mp, int flags, st } if (interlkp) mtx_unlock(interlkp); - lkflags = LK_SHARED | LK_INTERLOCK; + lkflags = LK_SHARED | LK_INTERLOCK | LK_NOWAIT; if (lockmgr(&mp->mnt_lock, lkflags, MNT_MTX(mp), td)) panic("vfs_busy: unexpected lock failure"); return (0); From rwatson at FreeBSD.org Mon Nov 3 06:23:16 2008 From: rwatson at FreeBSD.org (Robert Watson) Date: Mon Nov 3 06:23:27 2008 Subject: svn commit: r184592 - head/sys/netsmb Message-ID: <200811031423.mA3ENGoY068456@svn.freebsd.org> Author: rwatson Date: Mon Nov 3 14:23:15 2008 New Revision: 184592 URL: http://svn.freebsd.org/changeset/base/184592 Log: Implement device cloning for /dev/nsmb, the netsmb control pseudo-device. The smb library in userspace already knows how to deal with this type of cloning. This also corrects a leak in which the netsmb kernel module could not be unloaded if device nodes had been stat'd but not open'd. Discussed with: kib Modified: head/sys/netsmb/smb_dev.c Modified: head/sys/netsmb/smb_dev.c ============================================================================== --- head/sys/netsmb/smb_dev.c Mon Nov 3 14:11:06 2008 (r184591) +++ head/sys/netsmb/smb_dev.c Mon Nov 3 14:23:15 2008 (r184592) @@ -89,28 +89,38 @@ int smb_dev_queue(struct smb_dev *ndp, s static struct cdevsw nsmb_cdevsw = { .d_version = D_VERSION, - .d_flags = D_NEEDGIANT, + .d_flags = D_NEEDGIANT | D_NEEDMINOR, .d_open = nsmb_dev_open, .d_close = nsmb_dev_close, .d_ioctl = nsmb_dev_ioctl, .d_name = NSMB_NAME }; -static eventhandler_tag nsmb_dev_tag; +static eventhandler_tag nsmb_dev_tag; +static struct clonedevs *nsmb_clones; static void nsmb_dev_clone(void *arg, struct ucred *cred, char *name, int namelen, struct cdev **dev) { - int u; + int i, u; if (*dev != NULL) return; - if (dev_stdclone(name, NULL, NSMB_NAME, &u) != 1) + + if (strcmp(name, NSMB_NAME) == 0) + u = -1; + else if (dev_stdclone(name, NULL, NSMB_NAME, &u) != 1) return; - *dev = make_dev(&nsmb_cdevsw, u, 0, 0, 0600, - NSMB_NAME"%d", u); - dev_ref(*dev); + i = clone_create(&nsmb_clones, &nsmb_cdevsw, &u, dev, 0); + if (i) { + *dev = make_dev(&nsmb_cdevsw, u, UID_ROOT, GID_WHEEL, 0600, + "%s%d", NSMB_NAME, u); + if (*dev != NULL) { + dev_ref(*dev); + (*dev)->si_flags |= SI_CHEAPCLONE; + } + } } static int @@ -340,6 +350,7 @@ nsmb_dev_load(module_t mod, int cmd, voi smb_sm_done(); break; } + clone_setup(&nsmb_clones); nsmb_dev_tag = EVENTHANDLER_REGISTER(dev_clone, nsmb_dev_clone, 0, 1000); printf("netsmb_dev: loaded\n"); break; @@ -350,6 +361,7 @@ nsmb_dev_load(module_t mod, int cmd, voi break; EVENTHANDLER_DEREGISTER(dev_clone, nsmb_dev_tag); drain_dev_clone_events(); + clone_cleanup(&nsmb_clones); destroy_dev_drain(&nsmb_cdevsw); printf("netsmb_dev: unloaded\n"); break; From kib at FreeBSD.org Mon Nov 3 06:35:43 2008 From: kib at FreeBSD.org (Konstantin Belousov) Date: Mon Nov 3 06:35:49 2008 Subject: svn commit: r184593 - in stable/7/sys: . ufs/ufs Message-ID: <200811031435.mA3EZhUC068702@svn.freebsd.org> Author: kib Date: Mon Nov 3 14:35:43 2008 New Revision: 184593 URL: http://svn.freebsd.org/changeset/base/184593 Log: MFC r184408: Provide an explanation for getinoquota() call in the ufs_access vop. Approved by: re (kensmith) Modified: stable/7/sys/ (props changed) stable/7/sys/ufs/ufs/ufs_vnops.c Modified: stable/7/sys/ufs/ufs/ufs_vnops.c ============================================================================== --- stable/7/sys/ufs/ufs/ufs_vnops.c Mon Nov 3 14:23:15 2008 (r184592) +++ stable/7/sys/ufs/ufs/ufs_vnops.c Mon Nov 3 14:35:43 2008 (r184593) @@ -330,7 +330,18 @@ ufs_access(ap) if (vp->v_mount->mnt_flag & MNT_RDONLY) return (EROFS); #ifdef QUOTA + /* + * Inode is accounted in the quotas only if struct + * dquot is attached to it. VOP_ACCESS() is called + * from vn_open_cred() and provides a convenient + * point to call getinoquota(). + */ if (VOP_ISLOCKED(vp, ap->a_td) != LK_EXCLUSIVE) { + + /* + * Upgrade vnode lock, since getinoquota() + * requires exclusive lock to modify inode. + */ relocked = 1; vhold(vp); vn_lock(vp, LK_UPGRADE | LK_RETRY, ap->a_td); From dfr at rabson.org Mon Nov 3 06:43:18 2008 From: dfr at rabson.org (Doug Rabson) Date: Mon Nov 3 06:43:31 2008 Subject: svn commit: r184588 - in head: etc/gss etc/rc.d include/rpc lib/libc/sys lib/libc/xdr lib/librpcsec_gss sbin/mount_nfs sys/compat/freebsd32 sys/conf sys/fs/unionfs sys/kern sys/kgssapi sys/kgssapi/... In-Reply-To: <20081103134838.GB1207@arthur.nitro.dk> References: <200811031038.mA3Ac0UR064387@svn.freebsd.org> <20081103134838.GB1207@arthur.nitro.dk> Message-ID: <3272BA7B-7D58-4448-A402-DC25D3C3655C@rabson.org> On 3 Nov 2008, at 13:48, Simon L. Nielsen wrote: > On 2008.11.03 10:38:00 +0000, Doug Rabson wrote: >> Author: dfr >> Date: Mon Nov 3 10:38:00 2008 >> New Revision: 184588 >> URL: http://svn.freebsd.org/changeset/base/184588 >> >> Log: >> Implement support for RPCSEC_GSS authentication to both the NFS >> client >> and server. This replaces the RPC implementation of the NFS client >> and > > Cool, thanks! > > Which NFS Servers have you tested this against, or more specifically > do, you think I should be able to get this working against an NetApp > NFS Filer which supports Kerberos 5 for NFS? Or am I mixing things up > so that's something else? I've tested this with Solaris, Mac OS X and Linux. The NetApp filer will be using the same protocol but I haven't actually tested with a NetApp. I look forward to any success or failure reports with interest :) From imp at FreeBSD.org Mon Nov 3 07:38:45 2008 From: imp at FreeBSD.org (Warner Losh) Date: Mon Nov 3 07:38:57 2008 Subject: svn commit: r184594 - head/sys/dev/pci Message-ID: <200811031538.mA3Fcj6L069856@svn.freebsd.org> Author: imp Date: Mon Nov 3 15:38:45 2008 New Revision: 184594 URL: http://svn.freebsd.org/changeset/base/184594 Log: Nit: Add a few leading zeros to make this match other mask constants in this file. Also to make sure that I got other ASI constants right. Modified: head/sys/dev/pci/pcireg.h Modified: head/sys/dev/pci/pcireg.h ============================================================================== --- head/sys/dev/pci/pcireg.h Mon Nov 3 14:35:43 2008 (r184593) +++ head/sys/dev/pci/pcireg.h Mon Nov 3 15:38:45 2008 (r184594) @@ -133,7 +133,7 @@ #define PCIM_BAR_IO_RESERVED 0x00000002 #define PCIM_BAR_IO_BASE 0xfffffffc #define PCIR_CIS 0x28 -#define PCIM_CIS_ASI_MASK 0x7 +#define PCIM_CIS_ASI_MASK 0x00000007 #define PCIM_CIS_ASI_CONFIG 0 #define PCIM_CIS_ASI_BAR0 1 #define PCIM_CIS_ASI_BAR1 2 From jkim at FreeBSD.org Mon Nov 3 07:51:09 2008 From: jkim at FreeBSD.org (Jung-uk Kim) Date: Mon Nov 3 07:51:21 2008 Subject: svn commit: r184558 - head/sys/dev/acpica/Osd In-Reply-To: <200811021250.mA2CoGs1038957@svn.freebsd.org> References: <200811021250.mA2CoGs1038957@svn.freebsd.org> Message-ID: <200811031050.48765.jkim@FreeBSD.org> On Sunday 02 November 2008 07:50 am, Alexander Motin wrote: > Author: mav > Date: Sun Nov 2 12:50:16 2008 > New Revision: 184558 > URL: http://svn.freebsd.org/changeset/base/184558 > > Log: > As soon as we have several threads per process now, it is not > correct to use process ID as ACPI thread ID. Concurrent requests > with equal thread IDs broke ACPI mutexes operation causing > unpredictable errors including AE_AML_MUTEX_NOT_ACQUIRED that I > have seen. > > Use kernel thread ID instead of process ID for ACPI thread. Sorry but this patch is incorrect, i.e., td_tid is not unique. You have to use curthread or (p_pid, td_tid) pair. Unfortunately, even if you correct this problem, you also have to correct ACPI_THREAD_ID definition, which is in the vendor code. That's why it wasn't done yet and it is more complicated than you think, i.e., ACPI-CA assumes sizeof(ACPI_THREAD_ID) == sizeof(int), etc. Please see the related ACPI-CA bugs: http://www.acpica.org/bugzilla/show_bug.cgi?id=719 http://www.acpica.org/bugzilla/show_bug.cgi?id=732 In fact, I have been maintaining patchsets with the fix here: http://people.freebsd.org/~jkim/acpica-import-.diff.gz Please revert this commit until we resolve these issues with the vendor first. Thanks! Jung-uk Kim From jkim at FreeBSD.org Mon Nov 3 08:27:27 2008 From: jkim at FreeBSD.org (Jung-uk Kim) Date: Mon Nov 3 08:27:32 2008 Subject: svn commit: r184558 - head/sys/dev/acpica/Osd In-Reply-To: <490F21FC.1020508@FreeBSD.org> References: <200811021250.mA2CoGs1038957@svn.freebsd.org> <200811031050.48765.jkim@FreeBSD.org> <490F21FC.1020508@FreeBSD.org> Message-ID: <200811031127.14928.jkim@FreeBSD.org> On Monday 03 November 2008 11:08 am, Alexander Motin wrote: > Jung-uk Kim wrote: > > On Sunday 02 November 2008 07:50 am, Alexander Motin wrote: > >> Author: mav > >> Date: Sun Nov 2 12:50:16 2008 > >> New Revision: 184558 > >> URL: http://svn.freebsd.org/changeset/base/184558 > >> > >> Log: > >> As soon as we have several threads per process now, it is not > >> correct to use process ID as ACPI thread ID. Concurrent requests > >> with equal thread IDs broke ACPI mutexes operation causing > >> unpredictable errors including AE_AML_MUTEX_NOT_ACQUIRED that I > >> have seen. > >> > >> Use kernel thread ID instead of process ID for ACPI thread. > > > > Sorry but this patch is incorrect, i.e., td_tid is not unique. > > You have to use curthread or (p_pid, td_tid) pair. > > Unfortunately, even if you correct this problem, you also have to > > correct ACPI_THREAD_ID definition, which is in the vendor code. > > That's why it wasn't done yet and it is more complicated than you > > think, i.e., ACPI-CA assumes sizeof(ACPI_THREAD_ID) == > > sizeof(int), etc. Please see the related ACPI-CA bugs: > > I'm also sorry, but that is what I see: > typedef __int32_t __lwpid_t; /* Thread ID (a.k.a. LWP) > */ ... > td->td_tid = alloc_unr(tid_unrhdr); > ... > tid_unrhdr = new_unrhdr(PID_MAX + 2, INT_MAX, &tid_lock); > > So what have I missed, where is the problem? Why td_tid is not > unique and where is the size problem? td_tid is unique for a process, i.e., it is used to identify thread with a same pid, if I am not totally mistaken. If you want a true unique tid, you have to use struct thread *. Jung-uk Kim From trasz at FreeBSD.org Mon Nov 3 08:36:23 2008 From: trasz at FreeBSD.org (Edward Tomasz Napierala) Date: Mon Nov 3 08:36:30 2008 Subject: svn commit: r184595 - head/sys/fs/coda Message-ID: <200811031636.mA3GaNVG070993@svn.freebsd.org> Author: trasz Date: Mon Nov 3 16:36:23 2008 New Revision: 184595 URL: http://svn.freebsd.org/changeset/base/184595 Log: Fix few missed accmode changes in coda. Approved by: rwatson (mentor) Modified: head/sys/fs/coda/cnode.h head/sys/fs/coda/coda_subr.c head/sys/fs/coda/coda_venus.c Modified: head/sys/fs/coda/cnode.h ============================================================================== --- head/sys/fs/coda/cnode.h Mon Nov 3 15:38:45 2008 (r184594) +++ head/sys/fs/coda/cnode.h Mon Nov 3 16:36:23 2008 (r184595) @@ -102,7 +102,7 @@ struct cnode { char *c_symlink; /* pointer to symbolic link */ u_short c_symlen; /* length of symbolic link */ uid_t c_cached_uid; /* cached uid */ - mode_t c_cached_mode; /* cached access mode */ + accmode_t c_cached_mode; /* cached access mode */ struct cnode *c_next; /* links if on FreeBSD machine */ }; #define VTOC(vp) ((struct cnode *)(vp)->v_data) Modified: head/sys/fs/coda/coda_subr.c ============================================================================== --- head/sys/fs/coda/coda_subr.c Mon Nov 3 15:38:45 2008 (r184594) +++ head/sys/fs/coda/coda_subr.c Mon Nov 3 16:36:23 2008 (r184595) @@ -195,7 +195,7 @@ coda_acccache_purge(struct mount *mnt) CODADEBUG(CODA_FLUSH, myprintf(("acccache " "purge fid %s uid %d mode 0x%x\n", coda_f2s(&cp->c_fid), cp->c_cached_uid, - cp->c_cached_mode));); + (int)cp->c_cached_mode));); cp->c_flags &= ~C_ACCCACHE; } } @@ -223,7 +223,7 @@ coda_acccache_purgeuser(struct mount *mn CODADEBUG(CODA_PURGEUSER, myprintf(( "acccache purgeuser fid %s uid %d mode " "0x%x\n", coda_f2s(&cp->c_fid), - cp->c_cached_uid, cp->c_cached_mode));); + cp->c_cached_uid, (int)cp->c_cached_mode));); cp->c_flags &= ~C_ACCCACHE; } } Modified: head/sys/fs/coda/coda_venus.c ============================================================================== --- head/sys/fs/coda/coda_venus.c Mon Nov 3 15:38:45 2008 (r184594) +++ head/sys/fs/coda/coda_venus.c Mon Nov 3 16:36:23 2008 (r184595) @@ -347,7 +347,7 @@ venus_setattr(void *mdp, CodaFid *fid, s } int -venus_access(void *mdp, CodaFid *fid, int mode, struct ucred *cred, +venus_access(void *mdp, CodaFid *fid, accmode_t accmode, struct ucred *cred, struct proc *p) { DECL_NO_OUT(coda_access); /* sets Isize & Osize */ @@ -362,8 +362,10 @@ venus_access(void *mdp, CodaFid *fid, in /* * NOTE: FreeBSD and Venus internals use the "data" in the low 3 * bits. Hence, the conversion. + * + * XXX: We cast accmode_t variable into an int. */ - inp->flags = mode>>6; + inp->flags = (int)accmode>>6; error = coda_call(mdp, Isize, &Osize, (char *)inp); From mav at FreeBSD.org Mon Nov 3 09:08:32 2008 From: mav at FreeBSD.org (Alexander Motin) Date: Mon Nov 3 09:08:38 2008 Subject: svn commit: r184558 - head/sys/dev/acpica/Osd In-Reply-To: <200811031050.48765.jkim@FreeBSD.org> References: <200811021250.mA2CoGs1038957@svn.freebsd.org> <200811031050.48765.jkim@FreeBSD.org> Message-ID: <490F21FC.1020508@FreeBSD.org> Jung-uk Kim wrote: > On Sunday 02 November 2008 07:50 am, Alexander Motin wrote: >> Author: mav >> Date: Sun Nov 2 12:50:16 2008 >> New Revision: 184558 >> URL: http://svn.freebsd.org/changeset/base/184558 >> >> Log: >> As soon as we have several threads per process now, it is not >> correct to use process ID as ACPI thread ID. Concurrent requests >> with equal thread IDs broke ACPI mutexes operation causing >> unpredictable errors including AE_AML_MUTEX_NOT_ACQUIRED that I >> have seen. >> >> Use kernel thread ID instead of process ID for ACPI thread. > > Sorry but this patch is incorrect, i.e., td_tid is not unique. You > have to use curthread or (p_pid, td_tid) pair. Unfortunately, even > if you correct this problem, you also have to correct ACPI_THREAD_ID > definition, which is in the vendor code. That's why it wasn't done > yet and it is more complicated than you think, i.e., ACPI-CA assumes > sizeof(ACPI_THREAD_ID) == sizeof(int), etc. Please see the related > ACPI-CA bugs: I'm also sorry, but that is what I see: typedef __int32_t __lwpid_t; /* Thread ID (a.k.a. LWP) */ ... td->td_tid = alloc_unr(tid_unrhdr); ... tid_unrhdr = new_unrhdr(PID_MAX + 2, INT_MAX, &tid_lock); So what have I missed, where is the problem? Why td_tid is not unique and where is the size problem? -- Alexander Motin From jkim at FreeBSD.org Mon Nov 3 09:27:02 2008 From: jkim at FreeBSD.org (Jung-uk Kim) Date: Mon Nov 3 09:27:08 2008 Subject: svn commit: r184558 - head/sys/dev/acpica/Osd In-Reply-To: <490F21FC.1020508@FreeBSD.org> References: <200811021250.mA2CoGs1038957@svn.freebsd.org> <200811031050.48765.jkim@FreeBSD.org> <490F21FC.1020508@FreeBSD.org> Message-ID: <200811031226.46956.jkim@FreeBSD.org> On Monday 03 November 2008 11:08 am, Alexander Motin wrote: > Jung-uk Kim wrote: > > On Sunday 02 November 2008 07:50 am, Alexander Motin wrote: > >> Author: mav > >> Date: Sun Nov 2 12:50:16 2008 > >> New Revision: 184558 > >> URL: http://svn.freebsd.org/changeset/base/184558 > >> > >> Log: > >> As soon as we have several threads per process now, it is not > >> correct to use process ID as ACPI thread ID. Concurrent requests > >> with equal thread IDs broke ACPI mutexes operation causing > >> unpredictable errors including AE_AML_MUTEX_NOT_ACQUIRED that I > >> have seen. > >> > >> Use kernel thread ID instead of process ID for ACPI thread. > > > > Sorry but this patch is incorrect, i.e., td_tid is not unique. > > You have to use curthread or (p_pid, td_tid) pair. > > Unfortunately, even if you correct this problem, you also have to > > correct ACPI_THREAD_ID definition, which is in the vendor code. > > That's why it wasn't done yet and it is more complicated than you > > think, i.e., ACPI-CA assumes sizeof(ACPI_THREAD_ID) == > > sizeof(int), etc. Please see the related ACPI-CA bugs: > > I'm also sorry, but that is what I see: > typedef __int32_t __lwpid_t; /* Thread ID (a.k.a. LWP) > */ ... > td->td_tid = alloc_unr(tid_unrhdr); > ... > tid_unrhdr = new_unrhdr(PID_MAX + 2, INT_MAX, &tid_lock); > > So what have I missed, where is the problem? Why td_tid is not > unique and where is the size problem? On top of that: /* Returning 0 is not allowed. */ return (curthread->td_tid + 1); may actually return 0 because it can be INT_MAX. :-) Jung-uk Kim From jkim at FreeBSD.org Mon Nov 3 09:36:31 2008 From: jkim at FreeBSD.org (Jung-uk Kim) Date: Mon Nov 3 09:36:37 2008 Subject: svn commit: r184558 - head/sys/dev/acpica/Osd In-Reply-To: <200811031226.46956.jkim@FreeBSD.org> References: <200811021250.mA2CoGs1038957@svn.freebsd.org> <490F21FC.1020508@FreeBSD.org> <200811031226.46956.jkim@FreeBSD.org> Message-ID: <200811031236.18143.jkim@FreeBSD.org> On Monday 03 November 2008 12:26 pm, Jung-uk Kim wrote: > On top of that: > > /* Returning 0 is not allowed. */ > return (curthread->td_tid + 1); > > may actually return 0 because it can be INT_MAX. :-) Sorry, it was just my stupidity. I meant td_tid itself cannot be 0, so + 1 should be removed. :-( Jung-uk Kim From mav at FreeBSD.org Mon Nov 3 09:36:45 2008 From: mav at FreeBSD.org (Alexander Motin) Date: Mon Nov 3 09:36:51 2008 Subject: svn commit: r184558 - head/sys/dev/acpica/Osd In-Reply-To: <200811031226.46956.jkim@FreeBSD.org> References: <200811021250.mA2CoGs1038957@svn.freebsd.org> <200811031050.48765.jkim@FreeBSD.org> <490F21FC.1020508@FreeBSD.org> <200811031226.46956.jkim@FreeBSD.org> Message-ID: <490F36A8.70601@FreeBSD.org> Jung-uk Kim wrote: >> I'm also sorry, but that is what I see: >> typedef __int32_t __lwpid_t; /* Thread ID (a.k.a. LWP) >> */ ... >> td->td_tid = alloc_unr(tid_unrhdr); >> ... >> tid_unrhdr = new_unrhdr(PID_MAX + 2, INT_MAX, &tid_lock); >> >> So what have I missed, where is the problem? Why td_tid is not >> unique and where is the size problem? > > On top of that: > > /* Returning 0 is not allowed. */ > return (curthread->td_tid + 1); > > may actually return 0 because it can be INT_MAX. :-) No, maximum is positive overflow. :) Actually "+ 1" is probably not needed here as system assigns thread IDs are above process IDs and ID 0 is already busy. :) PS: More arguments sent privately. -- Alexander Motin From peterjeremy at optushome.com.au Mon Nov 3 09:56:02 2008 From: peterjeremy at optushome.com.au (Peter Jeremy) Date: Mon Nov 3 09:56:08 2008 Subject: svn commit: r184471 - in head/bin: cat cp In-Reply-To: <9bbcef730811021534gb114db9x16a2d6c9a3ecee8b@mail.gmail.com> References: <200810301405.m9UE5wwZ053250@svn.freebsd.org> <877i7pdzva.fsf@kobe.laptop> <9bbcef730811021534gb114db9x16a2d6c9a3ecee8b@mail.gmail.com> Message-ID: <20081103075818.GK99398@server.vk2pj.dyndns.org> On 2008-Nov-03 00:34:47 +0100, Ivan Voras wrote: >2008/10/31 Giorgos Keramidas : >The difference between the best and the worst is 247 context switches >(total, not per second). > >> It looks like it's probably worth pushing the limit up to 8 MB when we >> have lots of memory :) > >Yes, it's an improvement, but who will ever notice? :) Note that you will eventually hit a limit and start getting worse performace: Once the buffer size exceeds the available free RAM then cp/cat will start eating into inactive pages or (worse) active pages for other processes. -- Peter Jeremy Please excuse any delays as the result of my ISP's inability to implement an MTA that is either RFC2821-compliant or matches their claimed behaviour. -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 195 bytes Desc: not available Url : http://lists.freebsd.org/pipermail/svn-src-all/attachments/20081103/384b83bf/attachment.pgp From keramida at freebsd.org Mon Nov 3 10:05:46 2008 From: keramida at freebsd.org (Giorgos Keramidas) Date: Mon Nov 3 10:05:52 2008 Subject: svn commit: r184471 - in head/bin: cat cp In-Reply-To: <20081103075818.GK99398@server.vk2pj.dyndns.org> (Peter Jeremy's message of "Mon, 3 Nov 2008 18:58:18 +1100") References: <200810301405.m9UE5wwZ053250@svn.freebsd.org> <877i7pdzva.fsf@kobe.laptop> <9bbcef730811021534gb114db9x16a2d6c9a3ecee8b@mail.gmail.com> <20081103075818.GK99398@server.vk2pj.dyndns.org> Message-ID: <87y700it1w.fsf@kobe.laptop> On Mon, 3 Nov 2008 18:58:18 +1100, Peter Jeremy wrote: > On 2008-Nov-03 00:34:47 +0100, Ivan Voras wrote: >>2008/10/31 Giorgos Keramidas : >>The difference between the best and the worst is 247 context switches >>(total, not per second). >> >>> It looks like it's probably worth pushing the limit up to 8 MB when we >>> have lots of memory :) >> >>Yes, it's an improvement, but who will ever notice? :) > > Note that you will eventually hit a limit and start getting worse > performace: Once the buffer size exceeds the available free RAM > then cp/cat will start eating into inactive pages or (worse) active > pages for other processes. Yes, that's a possibility. Ivan is right that shaving 1-2 hundred more context _total_ context switches may be a small gain for the extra cost in buffer memory :) From joerg at britannica.bec.de Mon Nov 3 10:26:54 2008 From: joerg at britannica.bec.de (Joerg Sonnenberger) Date: Mon Nov 3 10:27:00 2008 Subject: svn commit: r184471 - in head/bin: cat cp In-Reply-To: <9bbcef730811021534gb114db9x16a2d6c9a3ecee8b@mail.gmail.com> References: <200810301405.m9UE5wwZ053250@svn.freebsd.org> <877i7pdzva.fsf@kobe.laptop> <9bbcef730811021534gb114db9x16a2d6c9a3ecee8b@mail.gmail.com> Message-ID: <20081103180705.GA437@britannica.bec.de> On Mon, Nov 03, 2008 at 12:34:47AM +0100, Ivan Voras wrote: > > It looks like it's probably worth pushing the limit up to 8 MB when we > > have lots of memory :) > > Yes, it's an improvement, but who will ever notice? :) Is even the improvement from 64KB to 1MB even measurable? I mean on anything but a VAX... Joerg From mav at FreeBSD.org Mon Nov 3 10:28:13 2008 From: mav at FreeBSD.org (Alexander Motin) Date: Mon Nov 3 10:28:19 2008 Subject: svn commit: r184596 - head/sys/dev/acpica/Osd Message-ID: <200811031828.mA3ISC84073057@svn.freebsd.org> Author: mav Date: Mon Nov 3 18:28:12 2008 New Revision: 184596 URL: http://svn.freebsd.org/changeset/base/184596 Log: Remove " + 1". Thread ID can't be zero anyway while increment may give owerflow. Modified: head/sys/dev/acpica/Osd/OsdSchedule.c Modified: head/sys/dev/acpica/Osd/OsdSchedule.c ============================================================================== --- head/sys/dev/acpica/Osd/OsdSchedule.c Mon Nov 3 16:36:23 2008 (r184595) +++ head/sys/dev/acpica/Osd/OsdSchedule.c Mon Nov 3 18:28:12 2008 (r184596) @@ -191,5 +191,5 @@ AcpiOsGetThreadId(void) /* XXX do not add ACPI_FUNCTION_TRACE here, results in recursive call. */ /* Returning 0 is not allowed. */ - return (curthread->td_tid + 1); + return (curthread->td_tid); } From jkim at FreeBSD.org Mon Nov 3 10:40:26 2008 From: jkim at FreeBSD.org (Jung-uk Kim) Date: Mon Nov 3 10:40:33 2008 Subject: svn commit: r184596 - head/sys/dev/acpica/Osd In-Reply-To: <200811031828.mA3ISC84073057@svn.freebsd.org> References: <200811031828.mA3ISC84073057@svn.freebsd.org> Message-ID: <200811031340.12072.jkim@FreeBSD.org> On Monday 03 November 2008 01:28 pm, Alexander Motin wrote: > Author: mav > Date: Mon Nov 3 18:28:12 2008 > New Revision: 184596 > URL: http://svn.freebsd.org/changeset/base/184596 > > Log: > Remove " + 1". > Thread ID can't be zero anyway while increment may give owerflow. > > Modified: > head/sys/dev/acpica/Osd/OsdSchedule.c > > Modified: head/sys/dev/acpica/Osd/OsdSchedule.c > =================================================================== >=========== --- head/sys/dev/acpica/Osd/OsdSchedule.c Mon Nov 3 > 16:36:23 2008 (r184595) +++ > head/sys/dev/acpica/Osd/OsdSchedule.c Mon Nov 3 18:28:12 > 2008 (r184596) @@ -191,5 +191,5 @@ AcpiOsGetThreadId(void) > /* XXX do not add ACPI_FUNCTION_TRACE here, results in > recursive call. */ > > /* Returning 0 is not allowed. */ > - return (curthread->td_tid + 1); > + return (curthread->td_tid); > } Thanks! Jung-uk Kim From jhb at freebsd.org Mon Nov 3 10:45:58 2008 From: jhb at freebsd.org (John Baldwin) Date: Mon Nov 3 10:50:03 2008 Subject: svn commit: r184558 - head/sys/dev/acpica/Osd In-Reply-To: <200811021250.mA2CoGs1038957@svn.freebsd.org> References: <200811021250.mA2CoGs1038957@svn.freebsd.org> Message-ID: <200811031248.24713.jhb@freebsd.org> On Sunday 02 November 2008 07:50:16 am Alexander Motin wrote: > Author: mav > Date: Sun Nov 2 12:50:16 2008 > New Revision: 184558 > URL: http://svn.freebsd.org/changeset/base/184558 > > Log: > As soon as we have several threads per process now, it is not correct to > use process ID as ACPI thread ID. Concurrent requests with equal thread > IDs broke ACPI mutexes operation causing unpredictable errors including > AE_AML_MUTEX_NOT_ACQUIRED that I have seen. > > Use kernel thread ID instead of process ID for ACPI thread. > > Modified: > head/sys/dev/acpica/Osd/OsdSchedule.c > > Modified: head/sys/dev/acpica/Osd/OsdSchedule.c > ============================================================================== > --- head/sys/dev/acpica/Osd/OsdSchedule.c Sun Nov 2 11:49:19 2008 (r184557) > +++ head/sys/dev/acpica/Osd/OsdSchedule.c Sun Nov 2 12:50:16 2008 (r184558) > @@ -187,13 +187,9 @@ AcpiOsStall(UINT32 Microseconds) > ACPI_THREAD_ID > AcpiOsGetThreadId(void) > { > - struct proc *p; > > /* XXX do not add ACPI_FUNCTION_TRACE here, results in recursive call. */ > > - p = curproc; > - KASSERT(p != NULL, ("%s: curproc is NULL!", __func__)); > - > /* Returning 0 is not allowed. */ > - return (p->p_pid + 1); > + return (curthread->td_tid + 1); > } You don't need the '+ 1' or comment now. TIDs are never 0. -- John Baldwin From jhb at freebsd.org Mon Nov 3 10:46:04 2008 From: jhb at freebsd.org (John Baldwin) Date: Mon Nov 3 10:50:11 2008 Subject: svn commit: r184568 - head/sys/netsmb In-Reply-To: <200811022022.mA2KMOCC047394@svn.freebsd.org> References: <200811022022.mA2KMOCC047394@svn.freebsd.org> Message-ID: <200811031251.32904.jhb@freebsd.org> On Sunday 02 November 2008 03:22:24 pm Robert Watson wrote: > Author: rwatson > Date: Sun Nov 2 20:22:24 2008 > New Revision: 184568 > URL: http://svn.freebsd.org/changeset/base/184568 > > Log: > smb_vc_put() requires that the passed vcp be locked, so lock it before > dropping the connection when the requested service isn't available, or > we may try to release a lock that isn't locked. > > This prevents an assertion failure when trying to mount a non-present > share using smbfs with INVARIANTS; a lock order reversal warning that > immediately follows is not yet fixed. > > Reported by: attilio > MFC after: 3 days > > Modified: > head/sys/netsmb/smb_conn.c > > Modified: head/sys/netsmb/smb_conn.c > ============================================================================== > --- head/sys/netsmb/smb_conn.c Sun Nov 2 19:48:15 2008 (r184567) > +++ head/sys/netsmb/smb_conn.c Sun Nov 2 20:22:24 2008 (r184568) > @@ -218,8 +218,10 @@ out: > smb_sm_unlockvclist(td); > if (error == 0) > *vcpp = vcp; > - else if (vcp) > + else if (vcp) { > + smb_vc_lock(vcp, LK_EXCLUSIVE, scred->scr_td); > smb_vc_put(vcp, scred); > + } > return error; > } Can't you just do 'smb_vc_rele()' to avoid pointlessly acquiring the lock only to drop it again? Just as with vput/vrele for vnodes, smb_XX_rele() drops the reference count and smb_xx_put() is equivalent to 'smb_XX_rele() + lockmgr(LK_RELEASE)' -- John Baldwin From jhb at freebsd.org Mon Nov 3 10:46:12 2008 From: jhb at freebsd.org (John Baldwin) Date: Mon Nov 3 10:50:37 2008 Subject: svn commit: r184251 - in head/sys: conf dev/cfi sys In-Reply-To: <863aidgk4y.fsf@ds4.des.no> References: <200810250618.m9P6ICWl023370@svn.freebsd.org> <863aidgk4y.fsf@ds4.des.no> Message-ID: <200811031301.07841.jhb@freebsd.org> On Friday 31 October 2008 05:59:41 am Dag-Erling Sm?rgrav wrote: > Marcel Moolenaar writes: > > Log: > > Add a driver for flash memory that implements to the Common Flash > > Memory Interface (CFI). The flash memory can be read and written > > to through /dev/cfi# and an ioctl() exists so processes can read > > the query information. > > The driver supports the AMD and Intel command set, though only > > the AMD command has been tested. > > > > Obtained from: Juniper Networks, Inc. > > You may want to *carefully* review the license on this code. It appears to be a standard 3-clause BSD license? -- John Baldwin From jhb at freebsd.org Mon Nov 3 10:46:16 2008 From: jhb at freebsd.org (John Baldwin) Date: Mon Nov 3 10:50:37 2008 Subject: svn commit: r184509 - head/share/man/man9 In-Reply-To: <867i7lq7b7.fsf@ds4.des.no> References: <200810311447.m9VElFtp083250@svn.freebsd.org> <20081101212937.D12448@delplex.bde.org> <867i7lq7b7.fsf@ds4.des.no> Message-ID: <200811031444.00816.jhb@freebsd.org> On Monday 03 November 2008 08:15:40 am Dag-Erling Sm?rgrav wrote: > Bruce Evans writes: > > Robert Watson writes: > > > In style(9) examples of err() and errx(), use sysexits(3) errors > > > rather than returning 1. > > style(9) was correct. Using sysexits(3) is a style bug in most cases > > [...] > > I agree. If we must use symbolic names, I suggest we just follow the > standard, cf. ISO/IEC 9899:1999 ?7.20.4.3: > > If the value of status is zero or EXIT_SUCCESS, an implementation- > defined form of the status successful termination is returned. If the > value of status is EXIT_FAILURE, an implementation-defined form of the > status unsuccessful termination is returned. Otherwise the status > returned is implementation-defined. > > Note that our defines EXIT_FAILURE to 1. I agree as well. I always use 'err(1,...)' or 'errx(1,...)'. -- John Baldwin From jhb at freebsd.org Mon Nov 3 10:46:21 2008 From: jhb at freebsd.org (John Baldwin) Date: Mon Nov 3 10:50:49 2008 Subject: svn commit: r184558 - head/sys/dev/acpica/Osd In-Reply-To: <200811031127.14928.jkim@FreeBSD.org> References: <200811021250.mA2CoGs1038957@svn.freebsd.org> <490F21FC.1020508@FreeBSD.org> <200811031127.14928.jkim@FreeBSD.org> Message-ID: <200811031445.33762.jhb@freebsd.org> On Monday 03 November 2008 11:27:13 am Jung-uk Kim wrote: > On Monday 03 November 2008 11:08 am, Alexander Motin wrote: > > Jung-uk Kim wrote: > > > On Sunday 02 November 2008 07:50 am, Alexander Motin wrote: > > >> Author: mav > > >> Date: Sun Nov 2 12:50:16 2008 > > >> New Revision: 184558 > > >> URL: http://svn.freebsd.org/changeset/base/184558 > > >> > > >> Log: > > >> As soon as we have several threads per process now, it is not > > >> correct to use process ID as ACPI thread ID. Concurrent requests > > >> with equal thread IDs broke ACPI mutexes operation causing > > >> unpredictable errors including AE_AML_MUTEX_NOT_ACQUIRED that I > > >> have seen. > > >> > > >> Use kernel thread ID instead of process ID for ACPI thread. > > > > > > Sorry but this patch is incorrect, i.e., td_tid is not unique. > > > You have to use curthread or (p_pid, td_tid) pair. > > > Unfortunately, even if you correct this problem, you also have to > > > correct ACPI_THREAD_ID definition, which is in the vendor code. > > > That's why it wasn't done yet and it is more complicated than you > > > think, i.e., ACPI-CA assumes sizeof(ACPI_THREAD_ID) == > > > sizeof(int), etc. Please see the related ACPI-CA bugs: > > > > I'm also sorry, but that is what I see: > > typedef __int32_t __lwpid_t; /* Thread ID (a.k.a. LWP) > > */ ... > > td->td_tid = alloc_unr(tid_unrhdr); > > ... > > tid_unrhdr = new_unrhdr(PID_MAX + 2, INT_MAX, &tid_lock); > > > > So what have I missed, where is the problem? Why td_tid is not > > unique and where is the size problem? > > td_tid is unique for a process, i.e., it is used to identify thread > with a same pid, if I am not totally mistaken. If you want a true > unique tid, you have to use struct thread *. No, td_tid is globally unique. -- John Baldwin From wb at freebie.xs4all.nl Mon Nov 3 10:47:22 2008 From: wb at freebie.xs4all.nl (Wilko Bulte) Date: Mon Nov 3 10:51:04 2008 Subject: svn commit: r184588 - in head: etc/gss etc/rc.d include/rpc lib/libc/sys lib/libc/xdr lib/librpcsec_gss sbin/mount_nfs sys/compat/freebsd32 sys/conf sys/fs/unionfs sys/kern sys/kgssapi sys/kgssapi/... In-Reply-To: <3272BA7B-7D58-4448-A402-DC25D3C3655C@rabson.org> References: <200811031038.mA3Ac0UR064387@svn.freebsd.org> <20081103134838.GB1207@arthur.nitro.dk> <3272BA7B-7D58-4448-A402-DC25D3C3655C@rabson.org> Message-ID: <20081103184717.GE1279@freebie.xs4all.nl> Quoting Doug Rabson, who wrote on Mon, Nov 03, 2008 at 02:43:16PM +0000 .. > > On 3 Nov 2008, at 13:48, Simon L. Nielsen wrote: > >> On 2008.11.03 10:38:00 +0000, Doug Rabson wrote: >>> Author: dfr >>> Date: Mon Nov 3 10:38:00 2008 >>> New Revision: 184588 >>> URL: http://svn.freebsd.org/changeset/base/184588 >>> >>> Log: >>> Implement support for RPCSEC_GSS authentication to both the NFS client >>> and server. This replaces the RPC implementation of the NFS client and >> >> Cool, thanks! >> >> Which NFS Servers have you tested this against, or more specifically >> do, you think I should be able to get this working against an NetApp >> NFS Filer which supports Kerberos 5 for NFS? Or am I mixing things up >> so that's something else? > > I've tested this with Solaris, Mac OS X and Linux. The NetApp filer will be > using the same protocol but I haven't actually tested with a NetApp. I look > forward to any success or failure reports with interest :) Something tells me I know which NetApp Simon has in mind :) From jhb at FreeBSD.org Mon Nov 3 11:33:21 2008 From: jhb at FreeBSD.org (John Baldwin) Date: Mon Nov 3 11:33:26 2008 Subject: svn commit: r184597 - head/sys/kern Message-ID: <200811031933.mA3JXKWY074264@svn.freebsd.org> Author: jhb Date: Mon Nov 3 19:33:20 2008 New Revision: 184597 URL: http://svn.freebsd.org/changeset/base/184597 Log: A few style nits. Modified: head/sys/kern/vfs_lookup.c Modified: head/sys/kern/vfs_lookup.c ============================================================================== --- head/sys/kern/vfs_lookup.c Mon Nov 3 18:28:12 2008 (r184596) +++ head/sys/kern/vfs_lookup.c Mon Nov 3 19:33:20 2008 (r184597) @@ -331,12 +331,13 @@ namei(struct nameidata *ndp) static int compute_cn_lkflags(struct mount *mp, int lkflags) { + if (mp == NULL || ((lkflags & LK_SHARED) && !(mp->mnt_kern_flag & MNTK_LOOKUP_SHARED))) { lkflags &= ~LK_SHARED; lkflags |= LK_EXCLUSIVE; } - return lkflags; + return (lkflags); } /* From jhb at FreeBSD.org Mon Nov 3 11:57:41 2008 From: jhb at FreeBSD.org (John Baldwin) Date: Mon Nov 3 11:57:52 2008 Subject: svn commit: r184598 - head/sys/tools Message-ID: <200811031957.mA3Jvew9074690@svn.freebsd.org> Author: jhb Date: Mon Nov 3 19:57:40 2008 New Revision: 184598 URL: http://svn.freebsd.org/changeset/base/184598 Log: Remove some unused and broken code that attempted to not invoke locking asserts on NULL vnode pointers. All the vnode assertion routines already check for NULL vnode pointers. Modified: head/sys/tools/vnode_if.awk Modified: head/sys/tools/vnode_if.awk ============================================================================== --- head/sys/tools/vnode_if.awk Mon Nov 3 19:33:20 2008 (r184597) +++ head/sys/tools/vnode_if.awk Mon Nov 3 19:57:40 2008 (r184598) @@ -71,9 +71,6 @@ function add_debug_code(name, arg, pos, else star = ""; if (lockdata[name, arg, pos] && (lockdata[name, arg, pos] != "-")) { - if (arg ~ /^\*/) { - printc(ind"if ("substr(arg, 2)" != NULL) {"); - } printc(ind"ASSERT_VI_UNLOCKED("star"a->a_"arg", \""uname"\");"); # Add assertions for locking if (lockdata[name, arg, pos] == "L") @@ -85,9 +82,6 @@ function add_debug_code(name, arg, pos, else if (0) { # XXX More checks! } - if (arg ~ /^\*/) { - printc("ind}"); - } } } From attilio at FreeBSD.org Mon Nov 3 12:00:35 2008 From: attilio at FreeBSD.org (Attilio Rao) Date: Mon Nov 3 12:01:09 2008 Subject: svn commit: r184599 - in head/sys: kern sys Message-ID: <200811032000.mA3K0Zok074801@svn.freebsd.org> Author: attilio Date: Mon Nov 3 20:00:35 2008 New Revision: 184599 URL: http://svn.freebsd.org/changeset/base/184599 Log: Remove the mnt_holdcnt and mnt_holdcntwaiters because they are useless. Really, the concept of holdcnt in the struct mount is rappresented by the mnt_ref (which prevents the type-stable structure from being "recycled) handled through vfs_ref() and vfs_rel(). On this optic, switch the holdcnt acquisition into an emulated vfs_ref() (and subsequent release into vfs_rel()). Discussed with: kib Tested by: pho Modified: head/sys/kern/vfs_mount.c head/sys/kern/vfs_subr.c head/sys/sys/mount.h Modified: head/sys/kern/vfs_mount.c ============================================================================== --- head/sys/kern/vfs_mount.c Mon Nov 3 19:57:40 2008 (r184598) +++ head/sys/kern/vfs_mount.c Mon Nov 3 20:00:35 2008 (r184599) @@ -509,16 +509,6 @@ vfs_mount_destroy(struct mount *mp) MNT_ILOCK(mp); while (mp->mnt_ref) msleep(mp, MNT_MTX(mp), PVFS, "mntref", 0); - if (mp->mnt_holdcnt != 0) { - printf("Waiting for mount point to be unheld\n"); - while (mp->mnt_holdcnt != 0) { - mp->mnt_holdcntwaiters++; - msleep(&mp->mnt_holdcnt, MNT_MTX(mp), - PZERO, "mntdestroy", 0); - mp->mnt_holdcntwaiters--; - } - printf("mount point unheld\n"); - } if (mp->mnt_writeopcount > 0) { printf("Waiting for mount point write ops\n"); while (mp->mnt_writeopcount > 0) { @@ -2062,7 +2052,7 @@ __mnt_vnode_first(struct vnode **mvp, st *mvp = NULL; return (NULL); } - mp->mnt_holdcnt++; + MNT_REF(mp); MNT_IUNLOCK(mp); *mvp = (struct vnode *) malloc(sizeof(struct vnode), M_VNODE_MARKER, @@ -2080,9 +2070,7 @@ __mnt_vnode_first(struct vnode **mvp, st free(*mvp, M_VNODE_MARKER); MNT_ILOCK(mp); *mvp = NULL; - mp->mnt_holdcnt--; - if (mp->mnt_holdcnt == 0 && mp->mnt_holdcntwaiters != 0) - wakeup(&mp->mnt_holdcnt); + MNT_REL(mp); return (NULL); } (*mvp)->v_mount = mp; @@ -2106,10 +2094,7 @@ __mnt_vnode_markerfree(struct vnode **mv free(*mvp, M_VNODE_MARKER); MNT_ILOCK(mp); *mvp = NULL; - - mp->mnt_holdcnt--; - if (mp->mnt_holdcnt == 0 && mp->mnt_holdcntwaiters != 0) - wakeup(&mp->mnt_holdcnt); + MNT_REL(mp); } Modified: head/sys/kern/vfs_subr.c ============================================================================== --- head/sys/kern/vfs_subr.c Mon Nov 3 19:57:40 2008 (r184598) +++ head/sys/kern/vfs_subr.c Mon Nov 3 20:00:35 2008 (r184599) @@ -2838,8 +2838,6 @@ DB_SHOW_COMMAND(mount, db_show_mount) db_printf(" mnt_maxsymlinklen = %d\n", mp->mnt_maxsymlinklen); db_printf(" mnt_iosize_max = %d\n", mp->mnt_iosize_max); db_printf(" mnt_hashseed = %u\n", mp->mnt_hashseed); - db_printf(" mnt_holdcnt = %d\n", mp->mnt_holdcnt); - db_printf(" mnt_holdcntwaiters = %d\n", mp->mnt_holdcntwaiters); db_printf(" mnt_secondary_writes = %d\n", mp->mnt_secondary_writes); db_printf(" mnt_secondary_accwrites = %d\n", mp->mnt_secondary_accwrites); Modified: head/sys/sys/mount.h ============================================================================== --- head/sys/sys/mount.h Mon Nov 3 19:57:40 2008 (r184598) +++ head/sys/sys/mount.h Mon Nov 3 20:00:35 2008 (r184599) @@ -174,8 +174,6 @@ struct mount { struct label *mnt_label; /* MAC label for the fs */ u_int mnt_hashseed; /* Random seed for vfs_hash */ int mnt_lockref; /* (i) Lock reference count */ - int mnt_holdcnt; /* hold count */ - int mnt_holdcntwaiters; /* waits on hold count */ int mnt_secondary_writes; /* (i) # of secondary writes */ int mnt_secondary_accwrites;/* (i) secondary wr. starts */ struct thread *mnt_susp_owner; /* (i) thread owning suspension */ From imp at bsdimp.com Mon Nov 3 12:26:07 2008 From: imp at bsdimp.com (M. Warner Losh) Date: Mon Nov 3 12:26:14 2008 Subject: svn commit: r184251 - in head/sys: conf dev/cfi sys In-Reply-To: <200811031301.07841.jhb@freebsd.org> References: <200810250618.m9P6ICWl023370@svn.freebsd.org> <863aidgk4y.fsf@ds4.des.no> <200811031301.07841.jhb@freebsd.org> Message-ID: <20081103.132512.-1476795190.imp@bsdimp.com> In message: <200811031301.07841.jhb@freebsd.org> John Baldwin writes: : On Friday 31 October 2008 05:59:41 am Dag-Erling Sm?rgrav wrote: : > Marcel Moolenaar writes: : > > Log: : > > Add a driver for flash memory that implements to the Common Flash : > > Memory Interface (CFI). The flash memory can be read and written : > > to through /dev/cfi# and an ioctl() exists so processes can read : > > the query information. : > > The driver supports the AMD and Intel command set, though only : > > the AMD command has been tested. : > > : > > Obtained from: Juniper Networks, Inc. : > : > You may want to *carefully* review the license on this code. : : It appears to be a standard 3-clause BSD license? Whose name is in the disclaimer? Warner From jhb at FreeBSD.org Mon Nov 3 12:31:01 2008 From: jhb at FreeBSD.org (John Baldwin) Date: Mon Nov 3 12:31:07 2008 Subject: svn commit: r184600 - head/sys/kern Message-ID: <200811032031.mA3KV0vv075357@svn.freebsd.org> Author: jhb Date: Mon Nov 3 20:31:00 2008 New Revision: 184600 URL: http://svn.freebsd.org/changeset/base/184600 Log: Use shared vnode locks instead of exclusive vnode locks for the access(), chdir(), chroot(), eaccess(), fpathconf(), fstat(), fstatfs(), lseek() (when figuring out the current size of the file in the SEEK_END case), pathconf(), readlink(), and statfs() system calls. Submitted by: ups (mostly) Tested by: pho MFC after: 1 month Modified: head/sys/kern/kern_descrip.c head/sys/kern/vfs_syscalls.c head/sys/kern/vfs_vnops.c Modified: head/sys/kern/kern_descrip.c ============================================================================== --- head/sys/kern/kern_descrip.c Mon Nov 3 20:00:35 2008 (r184599) +++ head/sys/kern/kern_descrip.c Mon Nov 3 20:31:00 2008 (r184600) @@ -1241,7 +1241,7 @@ fpathconf(struct thread *td, struct fpat if (vp != NULL) { int vfslocked; vfslocked = VFS_LOCK_GIANT(vp->v_mount); - vn_lock(vp, LK_EXCLUSIVE | LK_RETRY); + vn_lock(vp, LK_SHARED | LK_RETRY); error = VOP_PATHCONF(vp, uap->name, td->td_retval); VOP_UNLOCK(vp, 0); VFS_UNLOCK_GIANT(vfslocked); Modified: head/sys/kern/vfs_syscalls.c ============================================================================== --- head/sys/kern/vfs_syscalls.c Mon Nov 3 20:00:35 2008 (r184599) +++ head/sys/kern/vfs_syscalls.c Mon Nov 3 20:31:00 2008 (r184600) @@ -286,8 +286,8 @@ kern_statfs(struct thread *td, char *pat int error; struct nameidata nd; - NDINIT(&nd, LOOKUP, FOLLOW | LOCKLEAF | MPSAFE | AUDITVNODE1, - pathseg, path, td); + NDINIT(&nd, LOOKUP, FOLLOW | LOCKSHARED | LOCKLEAF | MPSAFE | + AUDITVNODE1, pathseg, path, td); error = namei(&nd); if (error) return (error); @@ -368,7 +368,7 @@ kern_fstatfs(struct thread *td, int fd, return (error); vp = fp->f_vnode; vfslocked = VFS_LOCK_GIANT(vp->v_mount); - vn_lock(vp, LK_EXCLUSIVE | LK_RETRY); + vn_lock(vp, LK_SHARED | LK_RETRY); #ifdef AUDIT AUDIT_ARG(vnode, vp, ARG_VNODE1); #endif @@ -800,8 +800,8 @@ kern_chdir(struct thread *td, char *path struct vnode *vp; int vfslocked; - NDINIT(&nd, LOOKUP, FOLLOW | LOCKLEAF | AUDITVNODE1 | MPSAFE, - pathseg, path, td); + NDINIT(&nd, LOOKUP, FOLLOW | LOCKSHARED | LOCKLEAF | AUDITVNODE1 | + MPSAFE, pathseg, path, td); if ((error = namei(&nd)) != 0) return (error); vfslocked = NDHASGIANT(&nd); @@ -886,8 +886,8 @@ chroot(td, uap) error = priv_check(td, PRIV_VFS_CHROOT); if (error) return (error); - NDINIT(&nd, LOOKUP, FOLLOW | LOCKLEAF | MPSAFE | AUDITVNODE1, - UIO_USERSPACE, uap->path, td); + NDINIT(&nd, LOOKUP, FOLLOW | LOCKSHARED | LOCKLEAF | MPSAFE | + AUDITVNODE1, UIO_USERSPACE, uap->path, td); error = namei(&nd); if (error) goto error; @@ -1938,7 +1938,7 @@ lseek(td, uap) offset += fp->f_offset; break; case L_XTND: - vn_lock(vp, LK_EXCLUSIVE | LK_RETRY); + vn_lock(vp, LK_SHARED | LK_RETRY); error = VOP_GETATTR(vp, &vattr, cred); VOP_UNLOCK(vp, 0); if (error) @@ -2125,8 +2125,8 @@ kern_accessat(struct thread *td, int fd, td->td_ucred = tmpcred; } else cred = tmpcred = td->td_ucred; - NDINIT_AT(&nd, LOOKUP, FOLLOW | LOCKLEAF | MPSAFE | AUDITVNODE1, - pathseg, path, fd, td); + NDINIT_AT(&nd, LOOKUP, FOLLOW | LOCKSHARED | LOCKLEAF | MPSAFE | + AUDITVNODE1, pathseg, path, fd, td); if ((error = namei(&nd)) != 0) goto out1; vfslocked = NDHASGIANT(&nd); @@ -2492,8 +2492,8 @@ kern_pathconf(struct thread *td, char *p struct nameidata nd; int error, vfslocked; - NDINIT(&nd, LOOKUP, FOLLOW | LOCKLEAF | MPSAFE | AUDITVNODE1, - pathseg, path, td); + NDINIT(&nd, LOOKUP, FOLLOW | LOCKSHARED | LOCKLEAF | MPSAFE | + AUDITVNODE1, pathseg, path, td); if ((error = namei(&nd)) != 0) return (error); vfslocked = NDHASGIANT(&nd); @@ -2568,8 +2568,8 @@ kern_readlinkat(struct thread *td, int f struct nameidata nd; int vfslocked; - NDINIT_AT(&nd, LOOKUP, NOFOLLOW | LOCKLEAF | MPSAFE | AUDITVNODE1, - pathseg, path, fd, td); + NDINIT_AT(&nd, LOOKUP, NOFOLLOW | LOCKSHARED | LOCKLEAF | MPSAFE | + AUDITVNODE1, pathseg, path, fd, td); if ((error = namei(&nd)) != 0) return (error); Modified: head/sys/kern/vfs_vnops.c ============================================================================== --- head/sys/kern/vfs_vnops.c Mon Nov 3 20:00:35 2008 (r184599) +++ head/sys/kern/vfs_vnops.c Mon Nov 3 20:31:00 2008 (r184600) @@ -673,7 +673,7 @@ vn_statfile(fp, sb, active_cred, td) int error; vfslocked = VFS_LOCK_GIANT(vp->v_mount); - vn_lock(vp, LK_EXCLUSIVE | LK_RETRY); + vn_lock(vp, LK_SHARED | LK_RETRY); error = vn_stat(vp, sb, active_cred, fp->f_cred, td); VOP_UNLOCK(vp, 0); VFS_UNLOCK_GIANT(vfslocked); From jhb at freebsd.org Mon Nov 3 13:04:17 2008 From: jhb at freebsd.org (John Baldwin) Date: Mon Nov 3 13:04:24 2008 Subject: svn commit: r184251 - in head/sys: conf dev/cfi sys In-Reply-To: <20081103.132512.-1476795190.imp@bsdimp.com> References: <200810250618.m9P6ICWl023370@svn.freebsd.org> <200811031301.07841.jhb@freebsd.org> <20081103.132512.-1476795190.imp@bsdimp.com> Message-ID: <200811031703.42653.jhb@freebsd.org> On Monday 03 November 2008 03:25:12 pm M. Warner Losh wrote: > In message: <200811031301.07841.jhb@freebsd.org> > John Baldwin writes: > : On Friday 31 October 2008 05:59:41 am Dag-Erling Sm?rgrav wrote: > : > Marcel Moolenaar writes: > : > > Log: > : > > Add a driver for flash memory that implements to the Common Flash > : > > Memory Interface (CFI). The flash memory can be read and written > : > > to through /dev/cfi# and an ioctl() exists so processes can read > : > > the query information. > : > > The driver supports the AMD and Intel command set, though only > : > > the AMD command has been tested. > : > > > : > > Obtained from: Juniper Networks, Inc. > : > > : > You may want to *carefully* review the license on this code. > : > : It appears to be a standard 3-clause BSD license? > > Whose name is in the disclaimer? If the problem is "AUTHOR" vs "AUTHOR AND CONTRIBUTORS" then it would perhaps be more useful to all involved to actually state one's concerns instead of vague hand-waving and suggestions of evil. -- John Baldwin From jhb at FreeBSD.org Mon Nov 3 13:17:04 2008 From: jhb at FreeBSD.org (John Baldwin) Date: Mon Nov 3 13:17:16 2008 Subject: svn commit: r184601 - head/sys/kern Message-ID: <200811032117.mA3LH25r076250@svn.freebsd.org> Author: jhb Date: Mon Nov 3 21:17:02 2008 New Revision: 184601 URL: http://svn.freebsd.org/changeset/base/184601 Log: Adjust the license statement to more closely match a standard 3-clause BSD license. MFC after: 3 days Modified: head/sys/kern/subr_smp.c Modified: head/sys/kern/subr_smp.c ============================================================================== --- head/sys/kern/subr_smp.c Mon Nov 3 20:31:00 2008 (r184600) +++ head/sys/kern/subr_smp.c Mon Nov 3 21:17:02 2008 (r184601) @@ -1,6 +1,6 @@ /*- - * Copyright (c) 2001 - * John Baldwin . All rights reserved. + * Copyright (c) 2001, John Baldwin . + * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -10,21 +10,21 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * 4. Neither the name of the author nor the names of any co-contributors + * 3. Neither the name of the author nor the names of any co-contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * - * THIS SOFTWARE IS PROVIDED BY JOHN BALDWIN AND CONTRIBUTORS ``AS IS'' AND + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL JOHN BALDWIN OR THE VOICES IN HIS HEAD - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF - * THE POSSIBILITY OF SUCH DAMAGE. + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. */ /* From jasone at FreeBSD.org Mon Nov 3 13:17:18 2008 From: jasone at FreeBSD.org (Jason Evans) Date: Mon Nov 3 13:17:42 2008 Subject: svn commit: r184602 - head/lib/libc/stdlib Message-ID: <200811032117.mA3LHIab076290@svn.freebsd.org> Author: jasone Date: Mon Nov 3 21:17:18 2008 New Revision: 184602 URL: http://svn.freebsd.org/changeset/base/184602 Log: Revert to preferring mmap(2) over sbrk(2) when mapping memory, due to potential extreme contention in the kernel for multi-threaded applications on SMP systems. Reported by: kris Modified: head/lib/libc/stdlib/malloc.3 head/lib/libc/stdlib/malloc.c Modified: head/lib/libc/stdlib/malloc.3 ============================================================================== --- head/lib/libc/stdlib/malloc.3 Mon Nov 3 21:17:02 2008 (r184601) +++ head/lib/libc/stdlib/malloc.3 Mon Nov 3 21:17:18 2008 (r184602) @@ -255,7 +255,7 @@ If both the .Dq D and .Dq M -options are enabled, the allocator prefers the DSS over anonymous mappings, +options are enabled, the allocator prefers anonymous mappings over the DSS, but allocation only fails if memory cannot be acquired via either method. If neither option is enabled, then the .Dq M Modified: head/lib/libc/stdlib/malloc.c ============================================================================== --- head/lib/libc/stdlib/malloc.c Mon Nov 3 21:17:02 2008 (r184601) +++ head/lib/libc/stdlib/malloc.c Mon Nov 3 21:17:18 2008 (r184602) @@ -1536,11 +1536,6 @@ base_pages_alloc(size_t minsize) { #ifdef MALLOC_DSS - if (opt_dss) { - if (base_pages_alloc_dss(minsize) == false) - return (false); - } - if (opt_mmap && minsize != 0) #endif { @@ -1548,6 +1543,14 @@ base_pages_alloc(size_t minsize) return (false); } +#ifdef MALLOC_DSS + if (opt_dss) { + if (base_pages_alloc_dss(minsize) == false) + return (false); + } + +#endif + return (true); } @@ -1984,6 +1987,15 @@ chunk_alloc(size_t size, bool zero) assert((size & chunksize_mask) == 0); #ifdef MALLOC_DSS + if (opt_mmap) +#endif + { + ret = chunk_alloc_mmap(size); + if (ret != NULL) + goto RETURN; + } + +#ifdef MALLOC_DSS if (opt_dss) { ret = chunk_recycle_dss(size, zero); if (ret != NULL) { @@ -1994,14 +2006,7 @@ chunk_alloc(size_t size, bool zero) if (ret != NULL) goto RETURN; } - - if (opt_mmap) #endif - { - ret = chunk_alloc_mmap(size); - if (ret != NULL) - goto RETURN; - } /* All strategies for allocation failed. */ ret = NULL; From marius at FreeBSD.org Mon Nov 3 13:41:35 2008 From: marius at FreeBSD.org (Marius Strobl) Date: Mon Nov 3 13:41:42 2008 Subject: svn commit: r184603 - in stable/7/sys: . sparc64/sparc64 sun4v/sun4v Message-ID: <200811032141.mA3LfZsk076797@svn.freebsd.org> Author: marius Date: Mon Nov 3 21:41:35 2008 New Revision: 184603 URL: http://svn.freebsd.org/changeset/base/184603 Log: MFC: r184376 - In GCC 4.2 __builtin_frame_address() was fixed to include the V9 stack bias so we no longer need to add it in db_backtrace() and stack_capture() respectively. This also reverts r182168, which kludged around the resulting unaligned access. - Sync the sun4v versions of db_trace.c and stack_machdep.c with the sparc64 ones and fix some style bugs. Approved by: re (kib) Modified: stable/7/sys/ (props changed) stable/7/sys/sparc64/sparc64/db_trace.c stable/7/sys/sparc64/sparc64/stack_machdep.c stable/7/sys/sun4v/sun4v/db_trace.c stable/7/sys/sun4v/sun4v/stack_machdep.c Modified: stable/7/sys/sparc64/sparc64/db_trace.c ============================================================================== --- stable/7/sys/sparc64/sparc64/db_trace.c Mon Nov 3 21:17:18 2008 (r184602) +++ stable/7/sys/sparc64/sparc64/db_trace.c Mon Nov 3 21:41:35 2008 (r184603) @@ -276,10 +276,9 @@ db_backtrace(struct thread *td, struct f void db_trace_self(void) { - db_expr_t addr; - addr = (db_expr_t)__builtin_frame_address(1); - db_backtrace(curthread, (struct frame *)(addr + SPOFF), -1); + db_backtrace(curthread, + (struct frame *)__builtin_frame_address(1), -1); } int @@ -288,5 +287,6 @@ db_trace_thread(struct thread *td, int c struct pcb *ctx; ctx = kdb_thr_ctx(td); - return (db_backtrace(td, (struct frame*)(ctx->pcb_sp + SPOFF), count)); + return (db_backtrace(td, + (struct frame *)(ctx->pcb_sp + SPOFF), count)); } Modified: stable/7/sys/sparc64/sparc64/stack_machdep.c ============================================================================== --- stable/7/sys/sparc64/sparc64/stack_machdep.c Mon Nov 3 21:17:18 2008 (r184602) +++ stable/7/sys/sparc64/sparc64/stack_machdep.c Mon Nov 3 21:41:35 2008 (r184603) @@ -28,31 +28,24 @@ __FBSDID("$FreeBSD$"); #include -#include #include #include #include -#include -#include -#include - -#include #include #include -#include #include +static void stack_capture(struct stack *st, struct frame *fp); + static void -stack_capture(struct stack *st, uint64_t addr) +stack_capture(struct stack *st, struct frame *fp) { vm_offset_t callpc; stack_zero(st); while (1) { - addr += SPOFF; - callpc = - be64dec((void *)(addr + offsetof(struct frame, fr_pc))); + callpc = fp->fr_pc; if (!INKERNEL(callpc)) break; /* Don't bother traversing trap frames. */ @@ -63,30 +56,25 @@ stack_capture(struct stack *st, uint64_t break; if (stack_put(st, callpc) == -1) break; - addr = - be64dec((void *)(addr + offsetof(struct frame, fr_fp))); + fp = v9next_frame(fp); } } void stack_save_td(struct stack *st, struct thread *td) { - uint64_t addr; if (TD_IS_SWAPPED(td)) panic("stack_save_td: swapped"); if (TD_IS_RUNNING(td)) panic("stack_save_td: running"); - addr = td->td_pcb->pcb_sp; - stack_capture(st, addr); + stack_capture(st, (struct frame *)(td->td_pcb->pcb_sp + SPOFF)); } void stack_save(struct stack *st) { - uint64_t addr; - addr = (uint64_t)__builtin_frame_address(1); - stack_capture(st, addr); + stack_capture(st, (struct frame *)__builtin_frame_address(1)); } Modified: stable/7/sys/sun4v/sun4v/db_trace.c ============================================================================== --- stable/7/sys/sun4v/sun4v/db_trace.c Mon Nov 3 21:17:18 2008 (r184602) +++ stable/7/sys/sun4v/sun4v/db_trace.c Mon Nov 3 21:41:35 2008 (r184603) @@ -22,10 +22,11 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * - * $FreeBSD$ */ +#include +__FBSDID("$FreeBSD$"); + #include #include #include @@ -241,7 +242,6 @@ db_backtrace(struct thread *td, struct f db_addr_t pc; int trap; int user; - int quit; if (count == -1) count = 1024; @@ -249,7 +249,6 @@ db_backtrace(struct thread *td, struct f trap = 0; user = 0; npc = 0; - quit = 0; while (count-- && !user && !db_pager_quit) { pc = (db_addr_t)db_get_value((db_addr_t)&fp->fr_pc, sizeof(fp->fr_pc), FALSE); @@ -288,10 +287,9 @@ db_backtrace(struct thread *td, struct f void db_trace_self(void) { - db_expr_t addr; - addr = (db_expr_t)__builtin_frame_address(1); - db_backtrace(curthread, (struct frame *)(addr + SPOFF), -1); + db_backtrace(curthread, + (struct frame *)__builtin_frame_address(1), -1); } int @@ -300,5 +298,6 @@ db_trace_thread(struct thread *td, int c struct pcb *ctx; ctx = kdb_thr_ctx(td); - return (db_backtrace(td, (struct frame*)(ctx->pcb_sp + SPOFF), count)); + return (db_backtrace(td, + (struct frame *)(ctx->pcb_sp + SPOFF), count)); } Modified: stable/7/sys/sun4v/sun4v/stack_machdep.c ============================================================================== --- stable/7/sys/sun4v/sun4v/stack_machdep.c Mon Nov 3 21:17:18 2008 (r184602) +++ stable/7/sys/sun4v/sun4v/stack_machdep.c Mon Nov 3 21:41:35 2008 (r184603) @@ -32,54 +32,43 @@ __FBSDID("$FreeBSD$"); #include #include -#include -#include -#include - -#include #include #include -#include #include +static void stack_capture(struct stack *st, struct frame *fp); + static void -stack_capture(struct stack *st, uint64_t addr) +stack_capture(struct stack *st, struct frame *fp) { - struct frame *fp; vm_offset_t callpc; stack_zero(st); - fp = (struct frame *)(addr + SPOFF); while (1) { callpc = fp->fr_pc; if (!INKERNEL(callpc)) break; if (stack_put(st, callpc) == -1) break; - fp = (struct frame *)(fp->fr_fp + SPOFF); + fp = v9next_frame(fp); } - } void stack_save_td(struct stack *st, struct thread *td) { - uint64_t addr; if (TD_IS_SWAPPED(td)) panic("stack_save_td: swapped"); if (TD_IS_RUNNING(td)) panic("stack_save_td: running"); - addr = td->td_pcb->pcb_sp; - stack_capture(st, addr); + stack_capture(st, (struct frame *)(td->td_pcb->pcb_sp + SPOFF)); } void stack_save(struct stack *st) { - uint64_t addr; - addr = (uint64_t)__builtin_frame_address(1); - stack_capture(st, addr); + stack_capture(st, (struct frame *)__builtin_frame_address(1)); } From n_hibma at FreeBSD.org Mon Nov 3 14:05:44 2008 From: n_hibma at FreeBSD.org (Nick Hibma) Date: Mon Nov 3 14:05:56 2008 Subject: svn commit: r184604 - head/sys/dev/usb Message-ID: <200811032205.mA3M5irG077286@svn.freebsd.org> Author: n_hibma Date: Mon Nov 3 22:05:44 2008 New Revision: 184604 URL: http://svn.freebsd.org/changeset/base/184604 Log: uaa->ifaces contains pointers so set its entry to NULL not 0. Modified: head/sys/dev/usb/usb_subr.c Modified: head/sys/dev/usb/usb_subr.c ============================================================================== --- head/sys/dev/usb/usb_subr.c Mon Nov 3 21:41:35 2008 (r184603) +++ head/sys/dev/usb/usb_subr.c Mon Nov 3 22:05:44 2008 (r184604) @@ -930,7 +930,7 @@ usbd_probe_and_attach(device_t parent, u usbd_devinfo(dev, 1, devinfo); device_set_desc_copy(bdev, devinfo); if (device_probe_and_attach(bdev) == 0) { - ifaces[i] = 0; /* consumed */ + ifaces[i] = NULL; /* consumed */ found++; /* create another child for the next iface */ bdev = device_add_child(parent, NULL, -1); From n_hibma at FreeBSD.org Mon Nov 3 14:09:27 2008 From: n_hibma at FreeBSD.org (Nick Hibma) Date: Mon Nov 3 14:09:33 2008 Subject: svn commit: r184605 - head/sys/dev/usb Message-ID: <200811032209.mA3M9RhK077380@svn.freebsd.org> Author: n_hibma Date: Mon Nov 3 22:09:27 2008 New Revision: 184605 URL: http://svn.freebsd.org/changeset/base/184605 Log: Bugfix: Cut&paste error from the NetBSD code. Also: Change the initialisation of the command string to a static initialiser. Verify it against the output of umass.c when being sent a command using 'camcontrol eject da0' to a Bulk-Only device. This should make those devices work that need a SCSI eject command to switch to modem mode (Novatel 950D and others). Modified: head/sys/dev/usb/u3g.c Modified: head/sys/dev/usb/u3g.c ============================================================================== --- head/sys/dev/usb/u3g.c Mon Nov 3 22:05:44 2008 (r184604) +++ head/sys/dev/usb/u3g.c Mon Nov 3 22:09:27 2008 (r184605) @@ -458,34 +458,38 @@ u3gstub_huawei_init(struct u3gstub_softc static int u3gstub_scsi_eject(struct u3gstub_softc *sc, struct usb_attach_arg *uaa) { - unsigned char cmd[31]; + /* See definition of umass_bbb_cbw_t in sys/dev/usb/umass.c and struct + * scsi_start_stop_unit in sys/cam/scsi/scsi_all.h . + */ + unsigned char cmd[31] = { + 0x55, 0x53, 0x42, 0x43, /* 0..3: Command Block Wrapper (CBW) signature */ + 0x01, 0x00, 0x00, 0x00, /* 4..7: CBW Tag, unique 32-bit number */ + 0x00, 0x00, 0x00, 0x00, /* 8..11: CBW Transfer Length, no data here */ + 0x00, /* 12: CBW Flag: output, so 0 */ + 0x00, /* 13: CBW Lun */ + 0x06, /* 14: CBW Length */ + + 0x1b, /* 15+0: opcode: SCSI START/STOP */ + 0x00, /* 15+1: byte2: Not immediate */ + 0x00, 0x00, /* 15+2..3: reserved */ + 0x02, /* 15+4: Load/Eject command */ + 0x00, /* 15+5: control */ + 0x00, 0x00, 0x00, 0x00, /* 15+6..15: unused */ + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00 + }; + usb_interface_descriptor_t *id; usb_endpoint_descriptor_t *ed = NULL; int i; - memset(cmd, 0, sizeof(cmd)); - cmd[0] = 0x55; /* Byte 0..3: Command Block Wrapper (CBW) signature */ - cmd[1] = 0x53; - cmd[2] = 0x42; - cmd[3] = 0x43; - cmd[4] = 0x01; /* 4..7: CBW Tag, has to unique, but only a single transfer used. */ - /* 8..11: CBW Transfer Length, no data here */ - /* 12: CBW Flag: output, so 0 */ - /* 13: CBW Lun: 0 */ - /* 14: CBW Length */ - cmd[14] = 0x06; - cmd[15] = 0x1b; /* 0: SCSI START/STOP opcode */ - /* 1..3 unused */ - cmd[15+4] = 0x02; /* 4 Load/Eject command */ - /* 5: unused */ - /* Find the bulk-out endpoints */ id = usbd_get_interface_descriptor(uaa->iface); for (i = 0 ; i < id->bNumEndpoints ; i++) { ed = usbd_interface2endpoint_descriptor(uaa->iface, i); if (ed != NULL - && UE_GET_DIR(ed->bEndpointAddress) != UE_DIR_OUT + && UE_GET_DIR(ed->bEndpointAddress) == UE_DIR_OUT && (ed->bmAttributes & UE_XFERTYPE) == UE_BULK) break; } From imp at FreeBSD.org Mon Nov 3 14:43:37 2008 From: imp at FreeBSD.org (Warner Losh) Date: Mon Nov 3 14:43:44 2008 Subject: svn commit: r184606 - head/share/man/man4 Message-ID: <200811032243.mA3MhbGP078069@svn.freebsd.org> Author: imp Date: Mon Nov 3 22:43:37 2008 New Revision: 184606 URL: http://svn.freebsd.org/changeset/base/184606 Log: Use more standardized license language Approved by: Thomas Quinot Modified: head/share/man/man4/atapicam.4 Modified: head/share/man/man4/atapicam.4 ============================================================================== --- head/share/man/man4/atapicam.4 Mon Nov 3 22:09:27 2008 (r184605) +++ head/share/man/man4/atapicam.4 Mon Nov 3 22:43:37 2008 (r184606) @@ -16,7 +16,7 @@ .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR THE VOICES IN HIS HEAD +.\" ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS .\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR .\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF .\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS From christoph.mallon at gmx.de Mon Nov 3 14:49:54 2008 From: christoph.mallon at gmx.de (Christoph Mallon) Date: Mon Nov 3 14:50:00 2008 Subject: svn commit: r184605 - head/sys/dev/usb In-Reply-To: <200811032209.mA3M9RhK077380@svn.freebsd.org> References: <200811032209.mA3M9RhK077380@svn.freebsd.org> Message-ID: <490F800E.9080201@gmx.de> Hi Nick. Nick Hibma wrote: > Author: n_hibma > Date: Mon Nov 3 22:09:27 2008 > New Revision: 184605 > URL: http://svn.freebsd.org/changeset/base/184605 > > Log: > Bugfix: Cut&paste error from the NetBSD code. > > Also: Change the initialisation of the command string to a static > initialiser. Verify it against the output of umass.c when being sent a > command using 'camcontrol eject da0' to a Bulk-Only device. > > This should make those devices work that need a SCSI eject command to > switch to modem mode (Novatel 950D and others). > > Modified: > head/sys/dev/usb/u3g.c > > Modified: head/sys/dev/usb/u3g.c > ============================================================================== > --- head/sys/dev/usb/u3g.c Mon Nov 3 22:05:44 2008 (r184604) > +++ head/sys/dev/usb/u3g.c Mon Nov 3 22:09:27 2008 (r184605) > @@ -458,34 +458,38 @@ u3gstub_huawei_init(struct u3gstub_softc > static int > u3gstub_scsi_eject(struct u3gstub_softc *sc, struct usb_attach_arg *uaa) > { > - unsigned char cmd[31]; > + /* See definition of umass_bbb_cbw_t in sys/dev/usb/umass.c and struct > + * scsi_start_stop_unit in sys/cam/scsi/scsi_all.h . > + */ > + unsigned char cmd[31] = { > + 0x55, 0x53, 0x42, 0x43, /* 0..3: Command Block Wrapper (CBW) signature */ > + 0x01, 0x00, 0x00, 0x00, /* 4..7: CBW Tag, unique 32-bit number */ > + 0x00, 0x00, 0x00, 0x00, /* 8..11: CBW Transfer Length, no data here */ > + 0x00, /* 12: CBW Flag: output, so 0 */ > + 0x00, /* 13: CBW Lun */ > + 0x06, /* 14: CBW Length */ > + > + 0x1b, /* 15+0: opcode: SCSI START/STOP */ > + 0x00, /* 15+1: byte2: Not immediate */ > + 0x00, 0x00, /* 15+2..3: reserved */ > + 0x02, /* 15+4: Load/Eject command */ > + 0x00, /* 15+5: control */ > + 0x00, 0x00, 0x00, 0x00, /* 15+6..15: unused */ > + 0x00, 0x00, 0x00, 0x00, > + 0x00, 0x00 > + }; > + > usb_interface_descriptor_t *id; > usb_endpoint_descriptor_t *ed = NULL; > int i; > > - memset(cmd, 0, sizeof(cmd)); > - cmd[0] = 0x55; /* Byte 0..3: Command Block Wrapper (CBW) signature */ > - cmd[1] = 0x53; > - cmd[2] = 0x42; > - cmd[3] = 0x43; > - cmd[4] = 0x01; /* 4..7: CBW Tag, has to unique, but only a single transfer used. */ > - /* 8..11: CBW Transfer Length, no data here */ > - /* 12: CBW Flag: output, so 0 */ > - /* 13: CBW Lun: 0 */ > - /* 14: CBW Length */ > - cmd[14] = 0x06; > - cmd[15] = 0x1b; /* 0: SCSI START/STOP opcode */ > - /* 1..3 unused */ > - cmd[15+4] = 0x02; /* 4 Load/Eject command */ > - /* 5: unused */ > - > > /* Find the bulk-out endpoints */ > id = usbd_get_interface_descriptor(uaa->iface); You may want to make cmd[] static and/or const, so the compiler really just puts the bytes in the data section instead of generating code, which pretty much is the same as the assignments you just removed. GCC creates 31 consecutive movb instructions for the static initialiser, which is most probably worse than the code before Regards Christoph From joerg at britannica.bec.de Mon Nov 3 14:57:07 2008 From: joerg at britannica.bec.de (Joerg Sonnenberger) Date: Mon Nov 3 14:57:13 2008 Subject: svn commit: r184605 - head/sys/dev/usb In-Reply-To: <490F800E.9080201@gmx.de> References: <200811032209.mA3M9RhK077380@svn.freebsd.org> <490F800E.9080201@gmx.de> Message-ID: <20081103225453.GA1509@britannica.bec.de> On Mon, Nov 03, 2008 at 11:49:50PM +0100, Christoph Mallon wrote: > You may want to make cmd[] static and/or const, so the compiler really > just puts the bytes in the data section instead of generating code, > which pretty much is the same as the assignments you just removed. I didn't make it const originally as I am not sure if the USB stack will never modify the buffer. Joerg From imp at FreeBSD.org Mon Nov 3 16:20:44 2008 From: imp at FreeBSD.org (Warner Losh) Date: Mon Nov 3 16:21:03 2008 Subject: svn commit: r184607 - head/lib/libc/posix1e Message-ID: <200811040020.mA40KiJg080161@svn.freebsd.org> Author: imp Date: Tue Nov 4 00:20:43 2008 New Revision: 184607 URL: http://svn.freebsd.org/changeset/base/184607 Log: Replace the non-standard disclaimer with the standard one from /COPYRIGHT Approved by: jedgar@ Modified: head/lib/libc/posix1e/acl_add_perm.3 head/lib/libc/posix1e/acl_calc_mask.3 head/lib/libc/posix1e/acl_calc_mask.c head/lib/libc/posix1e/acl_clear_perms.3 head/lib/libc/posix1e/acl_copy.c head/lib/libc/posix1e/acl_copy_entry.3 head/lib/libc/posix1e/acl_create_entry.3 head/lib/libc/posix1e/acl_delete_entry.3 head/lib/libc/posix1e/acl_delete_perm.3 head/lib/libc/posix1e/acl_get_entry.3 head/lib/libc/posix1e/acl_get_perm_np.3 head/lib/libc/posix1e/acl_get_permset.3 head/lib/libc/posix1e/acl_get_qualifier.3 head/lib/libc/posix1e/acl_get_tag_type.3 head/lib/libc/posix1e/acl_perm.c head/lib/libc/posix1e/acl_set_permset.3 head/lib/libc/posix1e/acl_set_qualifier.3 head/lib/libc/posix1e/acl_set_tag_type.3 head/lib/libc/posix1e/acl_size.c Modified: head/lib/libc/posix1e/acl_add_perm.3 ============================================================================== --- head/lib/libc/posix1e/acl_add_perm.3 Mon Nov 3 22:43:37 2008 (r184606) +++ head/lib/libc/posix1e/acl_add_perm.3 Tue Nov 4 00:20:43 2008 (r184607) @@ -14,14 +14,14 @@ .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR THE VOICES IN HIS HEAD BE -.\" LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -.\" POSSIBILITY OF SUCH DAMAGE. +.\" ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. .\" .\" $FreeBSD$ .\" Modified: head/lib/libc/posix1e/acl_calc_mask.3 ============================================================================== --- head/lib/libc/posix1e/acl_calc_mask.3 Mon Nov 3 22:43:37 2008 (r184606) +++ head/lib/libc/posix1e/acl_calc_mask.3 Tue Nov 4 00:20:43 2008 (r184607) @@ -14,14 +14,14 @@ .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR THE VOICES IN HIS HEAD BE -.\" LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -.\" POSSIBILITY OF SUCH DAMAGE. +.\" ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. .\" .\" $FreeBSD$ .\" Modified: head/lib/libc/posix1e/acl_calc_mask.c ============================================================================== --- head/lib/libc/posix1e/acl_calc_mask.c Mon Nov 3 22:43:37 2008 (r184606) +++ head/lib/libc/posix1e/acl_calc_mask.c Tue Nov 4 00:20:43 2008 (r184607) @@ -14,14 +14,14 @@ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR THE VOICES IN HIS HEAD BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. + * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. */ #include Modified: head/lib/libc/posix1e/acl_clear_perms.3 ============================================================================== --- head/lib/libc/posix1e/acl_clear_perms.3 Mon Nov 3 22:43:37 2008 (r184606) +++ head/lib/libc/posix1e/acl_clear_perms.3 Tue Nov 4 00:20:43 2008 (r184607) @@ -14,14 +14,14 @@ .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR THE VOICES IN HIS HEAD BE -.\" LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -.\" POSSIBILITY OF SUCH DAMAGE. +.\" ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. .\" .\" $FreeBSD$ .\" Modified: head/lib/libc/posix1e/acl_copy.c ============================================================================== --- head/lib/libc/posix1e/acl_copy.c Mon Nov 3 22:43:37 2008 (r184606) +++ head/lib/libc/posix1e/acl_copy.c Tue Nov 4 00:20:43 2008 (r184607) @@ -14,14 +14,14 @@ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR THE VOICES IN HIS HEAD BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. + * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. */ #include Modified: head/lib/libc/posix1e/acl_copy_entry.3 ============================================================================== --- head/lib/libc/posix1e/acl_copy_entry.3 Mon Nov 3 22:43:37 2008 (r184606) +++ head/lib/libc/posix1e/acl_copy_entry.3 Tue Nov 4 00:20:43 2008 (r184607) @@ -14,14 +14,14 @@ .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR THE VOICES IN HIS HEAD BE -.\" LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -.\" POSSIBILITY OF SUCH DAMAGE. +.\" ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. .\" .\" $FreeBSD$ .\" Modified: head/lib/libc/posix1e/acl_create_entry.3 ============================================================================== --- head/lib/libc/posix1e/acl_create_entry.3 Mon Nov 3 22:43:37 2008 (r184606) +++ head/lib/libc/posix1e/acl_create_entry.3 Tue Nov 4 00:20:43 2008 (r184607) @@ -14,14 +14,14 @@ .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR THE VOICES IN HIS HEAD BE -.\" LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -.\" POSSIBILITY OF SUCH DAMAGE. +.\" ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. .\" .\" $FreeBSD$ .\" Modified: head/lib/libc/posix1e/acl_delete_entry.3 ============================================================================== --- head/lib/libc/posix1e/acl_delete_entry.3 Mon Nov 3 22:43:37 2008 (r184606) +++ head/lib/libc/posix1e/acl_delete_entry.3 Tue Nov 4 00:20:43 2008 (r184607) @@ -14,14 +14,14 @@ .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR THE VOICES IN HIS HEAD BE -.\" LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -.\" POSSIBILITY OF SUCH DAMAGE. +.\" ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. .\" .\" $FreeBSD$ .\" Modified: head/lib/libc/posix1e/acl_delete_perm.3 ============================================================================== --- head/lib/libc/posix1e/acl_delete_perm.3 Mon Nov 3 22:43:37 2008 (r184606) +++ head/lib/libc/posix1e/acl_delete_perm.3 Tue Nov 4 00:20:43 2008 (r184607) @@ -14,14 +14,14 @@ .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR THE VOICES IN HIS HEAD BE -.\" LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -.\" POSSIBILITY OF SUCH DAMAGE. +.\" ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. .\" .\" $FreeBSD$ .\" Modified: head/lib/libc/posix1e/acl_get_entry.3 ============================================================================== --- head/lib/libc/posix1e/acl_get_entry.3 Mon Nov 3 22:43:37 2008 (r184606) +++ head/lib/libc/posix1e/acl_get_entry.3 Tue Nov 4 00:20:43 2008 (r184607) @@ -14,14 +14,14 @@ .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR THE VOICES IN HIS HEAD BE -.\" LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -.\" POSSIBILITY OF SUCH DAMAGE. +.\" ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. .\" .\" $FreeBSD$ .\" Modified: head/lib/libc/posix1e/acl_get_perm_np.3 ============================================================================== --- head/lib/libc/posix1e/acl_get_perm_np.3 Mon Nov 3 22:43:37 2008 (r184606) +++ head/lib/libc/posix1e/acl_get_perm_np.3 Tue Nov 4 00:20:43 2008 (r184607) @@ -14,14 +14,14 @@ .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR THE VOICES IN HIS HEAD BE -.\" LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -.\" POSSIBILITY OF SUCH DAMAGE. +.\" ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. .\" .\" $FreeBSD$ .\" Modified: head/lib/libc/posix1e/acl_get_permset.3 ============================================================================== --- head/lib/libc/posix1e/acl_get_permset.3 Mon Nov 3 22:43:37 2008 (r184606) +++ head/lib/libc/posix1e/acl_get_permset.3 Tue Nov 4 00:20:43 2008 (r184607) @@ -14,14 +14,14 @@ .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR THE VOICES IN HIS HEAD BE -.\" LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -.\" POSSIBILITY OF SUCH DAMAGE. +.\" ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. .\" .\" $FreeBSD$ .\" Modified: head/lib/libc/posix1e/acl_get_qualifier.3 ============================================================================== --- head/lib/libc/posix1e/acl_get_qualifier.3 Mon Nov 3 22:43:37 2008 (r184606) +++ head/lib/libc/posix1e/acl_get_qualifier.3 Tue Nov 4 00:20:43 2008 (r184607) @@ -14,14 +14,14 @@ .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR THE VOICES IN HIS HEAD BE -.\" LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -.\" POSSIBILITY OF SUCH DAMAGE. +.\" ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. .\" .\" $FreeBSD$ .\" Modified: head/lib/libc/posix1e/acl_get_tag_type.3 ============================================================================== --- head/lib/libc/posix1e/acl_get_tag_type.3 Mon Nov 3 22:43:37 2008 (r184606) +++ head/lib/libc/posix1e/acl_get_tag_type.3 Tue Nov 4 00:20:43 2008 (r184607) @@ -14,14 +14,14 @@ .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR THE VOICES IN HIS HEAD BE -.\" LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -.\" POSSIBILITY OF SUCH DAMAGE. +.\" ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. .\" .\" $FreeBSD$ .\" Modified: head/lib/libc/posix1e/acl_perm.c ============================================================================== --- head/lib/libc/posix1e/acl_perm.c Mon Nov 3 22:43:37 2008 (r184606) +++ head/lib/libc/posix1e/acl_perm.c Tue Nov 4 00:20:43 2008 (r184607) @@ -14,14 +14,14 @@ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR THE VOICES IN HIS HEAD BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. + * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. */ #include Modified: head/lib/libc/posix1e/acl_set_permset.3 ============================================================================== --- head/lib/libc/posix1e/acl_set_permset.3 Mon Nov 3 22:43:37 2008 (r184606) +++ head/lib/libc/posix1e/acl_set_permset.3 Tue Nov 4 00:20:43 2008 (r184607) @@ -14,14 +14,14 @@ .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR THE VOICES IN HIS HEAD BE -.\" LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -.\" POSSIBILITY OF SUCH DAMAGE. +.\" ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. .\" .\" $FreeBSD$ .\" Modified: head/lib/libc/posix1e/acl_set_qualifier.3 ============================================================================== --- head/lib/libc/posix1e/acl_set_qualifier.3 Mon Nov 3 22:43:37 2008 (r184606) +++ head/lib/libc/posix1e/acl_set_qualifier.3 Tue Nov 4 00:20:43 2008 (r184607) @@ -14,14 +14,14 @@ .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR THE VOICES IN HIS HEAD BE -.\" LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -.\" POSSIBILITY OF SUCH DAMAGE. +.\" ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. .\" .\" $FreeBSD$ .\" Modified: head/lib/libc/posix1e/acl_set_tag_type.3 ============================================================================== --- head/lib/libc/posix1e/acl_set_tag_type.3 Mon Nov 3 22:43:37 2008 (r184606) +++ head/lib/libc/posix1e/acl_set_tag_type.3 Tue Nov 4 00:20:43 2008 (r184607) @@ -14,14 +14,14 @@ .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR THE VOICES IN HIS HEAD BE -.\" LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -.\" POSSIBILITY OF SUCH DAMAGE. +.\" ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. .\" .\" $FreeBSD$ .\" Modified: head/lib/libc/posix1e/acl_size.c ============================================================================== --- head/lib/libc/posix1e/acl_size.c Mon Nov 3 22:43:37 2008 (r184606) +++ head/lib/libc/posix1e/acl_size.c Tue Nov 4 00:20:43 2008 (r184607) @@ -14,14 +14,14 @@ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR THE VOICES IN HIS HEAD BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. + * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. */ #include From alfred at FreeBSD.org Mon Nov 3 17:45:51 2008 From: alfred at FreeBSD.org (Alfred Perlstein) Date: Mon Nov 3 17:45:58 2008 Subject: svn commit: r184608 - svnadmin/conf Message-ID: <200811040145.mA41jpNF082604@svn.freebsd.org> Author: alfred Date: Tue Nov 4 01:45:49 2008 New Revision: 184608 URL: http://svn.freebsd.org/changeset/base/184608 Log: unlimit my commit size check for usb2 import. Modified: svnadmin/conf/sizelimit.conf Modified: svnadmin/conf/sizelimit.conf ============================================================================== --- svnadmin/conf/sizelimit.conf Tue Nov 4 00:20:43 2008 (r184607) +++ svnadmin/conf/sizelimit.conf Tue Nov 4 01:45:49 2008 (r184608) @@ -17,3 +17,4 @@ #peter 3141592 #grog #kan +alfred 30240000 From alfred at FreeBSD.org Mon Nov 3 18:31:04 2008 From: alfred at FreeBSD.org (Alfred Perlstein) Date: Mon Nov 3 18:31:12 2008 Subject: svn commit: r184610 - in head: lib/libusb20 share/man/man4 sys/conf sys/dev/sound/pcm sys/dev/usb2 sys/dev/usb2/bluetooth sys/dev/usb2/controller sys/dev/usb2/core sys/dev/usb2/ethernet sys/dev/usb... Message-ID: <200811040231.mA42V4EQ083516@svn.freebsd.org> Author: alfred Date: Tue Nov 4 02:31:03 2008 New Revision: 184610 URL: http://svn.freebsd.org/changeset/base/184610 Log: Bring in USB4BSD, Hans Petter Selasky rework of the USB stack that includes significant features and SMP safety. This commit includes a more or less complete rewrite of the *BSD USB stack, including Host Controller and Device Controller drivers and updating all existing USB drivers to use the new USB API: 1) A brief feature list: - A new and mutex enabled USB API. - Many USB drivers are now running Giant free. - Linux USB kernel compatibility layer. - New UGEN backend and libusb library, finally solves the "driver unloading" problem. The new BSD licensed libusb20 library is fully compatible with libusb-0.1.12 from sourceforge. - New "usbconfig" utility, for easy configuration of USB. - Full support for Split transactions, which means you can use your full speed USB audio device on a high speed USB HUB. - Full support for HS ISOC transactions, which makes writing drivers for various HS webcams possible, for example. - Full support for USB on embedded platforms, mostly cache flushing and buffer invalidating stuff. - Safer parsing of USB descriptors. - Autodetect of annoying USB install disks. - Support for USB device side mode, also called USB gadget mode, using the same API like the USB host side. In other words the new USB stack is symmetric with regard to host and device side. - Support for USB transfers like I/O vectors, means more throughput and less interrupts. - ... see the FreeBSD quarterly status reports under "USB project" 2) To enable the driver in the default kernel build: 2.a) Remove all existing USB device options from your kernel config file. 2.b) Add the following USB device options to your kernel configuration file: # USB core support device usb2_core # USB controller support device usb2_controller device usb2_controller_ehci device usb2_controller_ohci device usb2_controller_uhci # USB mass storage support device usb2_storage device usb2_storage_mass # USB ethernet support, requires miibus device usb2_ethernet device usb2_ethernet_aue device usb2_ethernet_axe device usb2_ethernet_cdce device usb2_ethernet_cue device usb2_ethernet_kue device usb2_ethernet_rue device usb2_ethernet_dav # USB wireless LAN support device usb2_wlan device usb2_wlan_rum device usb2_wlan_ral device usb2_wlan_zyd # USB serial device support device usb2_serial device usb2_serial_ark device usb2_serial_bsa device usb2_serial_bser device usb2_serial_chcom device usb2_serial_cycom device usb2_serial_foma device usb2_serial_ftdi device usb2_serial_gensa device usb2_serial_ipaq device usb2_serial_lpt device usb2_serial_mct device usb2_serial_modem device usb2_serial_moscom device usb2_serial_plcom device usb2_serial_visor device usb2_serial_vscom # USB bluetooth support device usb2_bluetooth device usb2_bluetooth_ng # USB input device support device usb2_input device usb2_input_hid device usb2_input_kbd device usb2_input_ms # USB sound and MIDI device support device usb2_sound 2) To enable the driver at runtime: 2.a) Unload all existing USB modules. If USB is compiled into the kernel then you might have to build a new kernel. 2.b) Load the "usb2_xxx.ko" modules under /boot/kernel having the same base name like the kernel device option. Submitted by: Hans Petter Selasky hselasky at c2i dot net Reviewed by: imp, alfred Added: head/lib/libusb20/ head/lib/libusb20/Makefile (contents, props changed) head/lib/libusb20/libusb20.3 (contents, props changed) head/lib/libusb20/libusb20.c (contents, props changed) head/lib/libusb20/libusb20.h (contents, props changed) head/lib/libusb20/libusb20_compat01.c (contents, props changed) head/lib/libusb20/libusb20_compat01.h (contents, props changed) head/lib/libusb20/libusb20_compat10.c (contents, props changed) head/lib/libusb20/libusb20_compat10.h (contents, props changed) head/lib/libusb20/libusb20_desc.c (contents, props changed) head/lib/libusb20/libusb20_desc.h (contents, props changed) head/lib/libusb20/libusb20_int.h (contents, props changed) head/lib/libusb20/libusb20_ugen20.c (contents, props changed) head/share/man/man4/usb2_bluetooth.4 (contents, props changed) head/share/man/man4/usb2_controller.4 (contents, props changed) head/share/man/man4/usb2_core.4 (contents, props changed) head/share/man/man4/usb2_ethernet.4 (contents, props changed) head/share/man/man4/usb2_image.4 (contents, props changed) head/share/man/man4/usb2_input.4 (contents, props changed) head/share/man/man4/usb2_misc.4 (contents, props changed) head/share/man/man4/usb2_ndis.4 (contents, props changed) head/share/man/man4/usb2_quirk.4 (contents, props changed) head/share/man/man4/usb2_serial.4 (contents, props changed) head/share/man/man4/usb2_sound.4 (contents, props changed) head/share/man/man4/usb2_storage.4 (contents, props changed) head/share/man/man4/usb2_template.4 (contents, props changed) head/share/man/man4/usb2_wlan.4 (contents, props changed) head/sys/dev/usb2/ head/sys/dev/usb2/bluetooth/ head/sys/dev/usb2/bluetooth/TODO.TXT (contents, props changed) head/sys/dev/usb2/bluetooth/ng_ubt2.c (contents, props changed) head/sys/dev/usb2/bluetooth/ng_ubt2_var.h (contents, props changed) head/sys/dev/usb2/bluetooth/ubtbcmfw2.c (contents, props changed) head/sys/dev/usb2/bluetooth/usb2_bluetooth.c (contents, props changed) head/sys/dev/usb2/bluetooth/usb2_bluetooth.h (contents, props changed) head/sys/dev/usb2/controller/ head/sys/dev/usb2/controller/at91dci.c (contents, props changed) head/sys/dev/usb2/controller/at91dci.h (contents, props changed) head/sys/dev/usb2/controller/at91dci_atmelarm.c (contents, props changed) head/sys/dev/usb2/controller/ehci2.c (contents, props changed) head/sys/dev/usb2/controller/ehci2.h (contents, props changed) head/sys/dev/usb2/controller/ehci2_pci.c (contents, props changed) head/sys/dev/usb2/controller/musb2_otg.c (contents, props changed) head/sys/dev/usb2/controller/musb2_otg.h (contents, props changed) head/sys/dev/usb2/controller/musb2_otg_atmelarm.c (contents, props changed) head/sys/dev/usb2/controller/ohci2.c (contents, props changed) head/sys/dev/usb2/controller/ohci2.h (contents, props changed) head/sys/dev/usb2/controller/ohci2_atmelarm.c (contents, props changed) head/sys/dev/usb2/controller/ohci2_pci.c (contents, props changed) head/sys/dev/usb2/controller/uhci2.c (contents, props changed) head/sys/dev/usb2/controller/uhci2.h (contents, props changed) head/sys/dev/usb2/controller/uhci2_pci.c (contents, props changed) head/sys/dev/usb2/controller/usb2_bus.h (contents, props changed) head/sys/dev/usb2/controller/usb2_controller.c (contents, props changed) head/sys/dev/usb2/controller/usb2_controller.h (contents, props changed) head/sys/dev/usb2/controller/usb2_pci.h (contents, props changed) head/sys/dev/usb2/controller/uss820dci.c (contents, props changed) head/sys/dev/usb2/controller/uss820dci.h (contents, props changed) head/sys/dev/usb2/controller/uss820dci_atmelarm.c (contents, props changed) head/sys/dev/usb2/controller/uss820dci_pccard.c (contents, props changed) head/sys/dev/usb2/core/ head/sys/dev/usb2/core/README.TXT (contents, props changed) head/sys/dev/usb2/core/usb2_busdma.c (contents, props changed) head/sys/dev/usb2/core/usb2_busdma.h (contents, props changed) head/sys/dev/usb2/core/usb2_compat_linux.c (contents, props changed) head/sys/dev/usb2/core/usb2_compat_linux.h (contents, props changed) head/sys/dev/usb2/core/usb2_config_td.c (contents, props changed) head/sys/dev/usb2/core/usb2_config_td.h (contents, props changed) head/sys/dev/usb2/core/usb2_core.c (contents, props changed) head/sys/dev/usb2/core/usb2_core.h (contents, props changed) head/sys/dev/usb2/core/usb2_debug.c (contents, props changed) head/sys/dev/usb2/core/usb2_debug.h (contents, props changed) head/sys/dev/usb2/core/usb2_dev.c (contents, props changed) head/sys/dev/usb2/core/usb2_dev.h (contents, props changed) head/sys/dev/usb2/core/usb2_device.c (contents, props changed) head/sys/dev/usb2/core/usb2_device.h (contents, props changed) head/sys/dev/usb2/core/usb2_dynamic.c (contents, props changed) head/sys/dev/usb2/core/usb2_dynamic.h (contents, props changed) head/sys/dev/usb2/core/usb2_error.c (contents, props changed) head/sys/dev/usb2/core/usb2_generic.c (contents, props changed) head/sys/dev/usb2/core/usb2_generic.h (contents, props changed) head/sys/dev/usb2/core/usb2_handle_request.c (contents, props changed) head/sys/dev/usb2/core/usb2_handle_request.h (contents, props changed) head/sys/dev/usb2/core/usb2_hid.c (contents, props changed) head/sys/dev/usb2/core/usb2_hid.h (contents, props changed) head/sys/dev/usb2/core/usb2_hub.c (contents, props changed) head/sys/dev/usb2/core/usb2_hub.h (contents, props changed) head/sys/dev/usb2/core/usb2_if.m (contents, props changed) head/sys/dev/usb2/core/usb2_lookup.c (contents, props changed) head/sys/dev/usb2/core/usb2_lookup.h (contents, props changed) head/sys/dev/usb2/core/usb2_mbuf.c (contents, props changed) head/sys/dev/usb2/core/usb2_mbuf.h (contents, props changed) head/sys/dev/usb2/core/usb2_msctest.c (contents, props changed) head/sys/dev/usb2/core/usb2_msctest.h (contents, props changed) head/sys/dev/usb2/core/usb2_parse.c (contents, props changed) head/sys/dev/usb2/core/usb2_parse.h (contents, props changed) head/sys/dev/usb2/core/usb2_process.c (contents, props changed) head/sys/dev/usb2/core/usb2_process.h (contents, props changed) head/sys/dev/usb2/core/usb2_request.c (contents, props changed) head/sys/dev/usb2/core/usb2_request.h (contents, props changed) head/sys/dev/usb2/core/usb2_sw_transfer.c (contents, props changed) head/sys/dev/usb2/core/usb2_sw_transfer.h (contents, props changed) head/sys/dev/usb2/core/usb2_transfer.c (contents, props changed) head/sys/dev/usb2/core/usb2_transfer.h (contents, props changed) head/sys/dev/usb2/core/usb2_util.c (contents, props changed) head/sys/dev/usb2/core/usb2_util.h (contents, props changed) head/sys/dev/usb2/core/usbdevs (contents, props changed) head/sys/dev/usb2/ethernet/ head/sys/dev/usb2/ethernet/if_aue2.c (contents, props changed) head/sys/dev/usb2/ethernet/if_aue2_reg.h (contents, props changed) head/sys/dev/usb2/ethernet/if_axe2.c (contents, props changed) head/sys/dev/usb2/ethernet/if_axe2_reg.h (contents, props changed) head/sys/dev/usb2/ethernet/if_cdce2.c (contents, props changed) head/sys/dev/usb2/ethernet/if_cdce2_reg.h (contents, props changed) head/sys/dev/usb2/ethernet/if_cue2.c (contents, props changed) head/sys/dev/usb2/ethernet/if_cue2_reg.h (contents, props changed) head/sys/dev/usb2/ethernet/if_kue2.c (contents, props changed) head/sys/dev/usb2/ethernet/if_kue2_fw.h (contents, props changed) head/sys/dev/usb2/ethernet/if_kue2_reg.h (contents, props changed) head/sys/dev/usb2/ethernet/if_rue2.c (contents, props changed) head/sys/dev/usb2/ethernet/if_rue2_reg.h (contents, props changed) head/sys/dev/usb2/ethernet/if_udav2.c (contents, props changed) head/sys/dev/usb2/ethernet/if_udav2_reg.h (contents, props changed) head/sys/dev/usb2/ethernet/usb2_ethernet.c (contents, props changed) head/sys/dev/usb2/ethernet/usb2_ethernet.h (contents, props changed) head/sys/dev/usb2/image/ head/sys/dev/usb2/image/usb2_image.c (contents, props changed) head/sys/dev/usb2/image/usb2_image.h (contents, props changed) head/sys/dev/usb2/image/uscanner2.c (contents, props changed) head/sys/dev/usb2/include/ head/sys/dev/usb2/include/Makefile (contents, props changed) head/sys/dev/usb2/include/ufm2_ioctl.h (contents, props changed) head/sys/dev/usb2/include/urio2_ioctl.h (contents, props changed) head/sys/dev/usb2/include/usb2_cdc.h (contents, props changed) head/sys/dev/usb2/include/usb2_defs.h (contents, props changed) head/sys/dev/usb2/include/usb2_devid.h (contents, props changed) head/sys/dev/usb2/include/usb2_devtable.h (contents, props changed) head/sys/dev/usb2/include/usb2_endian.h (contents, props changed) head/sys/dev/usb2/include/usb2_error.h (contents, props changed) head/sys/dev/usb2/include/usb2_hid.h (contents, props changed) head/sys/dev/usb2/include/usb2_ioctl.h (contents, props changed) head/sys/dev/usb2/include/usb2_mfunc.h (contents, props changed) head/sys/dev/usb2/include/usb2_revision.h (contents, props changed) head/sys/dev/usb2/include/usb2_standard.h (contents, props changed) head/sys/dev/usb2/input/ head/sys/dev/usb2/input/uhid2.c (contents, props changed) head/sys/dev/usb2/input/ukbd2.c (contents, props changed) head/sys/dev/usb2/input/ums2.c (contents, props changed) head/sys/dev/usb2/input/usb2_input.c (contents, props changed) head/sys/dev/usb2/input/usb2_input.h (contents, props changed) head/sys/dev/usb2/input/usb2_rdesc.h (contents, props changed) head/sys/dev/usb2/misc/ head/sys/dev/usb2/misc/udbp2.c (contents, props changed) head/sys/dev/usb2/misc/udbp2.h (contents, props changed) head/sys/dev/usb2/misc/ufm2.c (contents, props changed) head/sys/dev/usb2/misc/usb2_misc.c (contents, props changed) head/sys/dev/usb2/misc/usb2_misc.h (contents, props changed) head/sys/dev/usb2/ndis/ head/sys/dev/usb2/ndis/if_ndis_usb2.c (contents, props changed) head/sys/dev/usb2/ndis/usb2_ndis.c (contents, props changed) head/sys/dev/usb2/ndis/usb2_ndis.h (contents, props changed) head/sys/dev/usb2/quirk/ head/sys/dev/usb2/quirk/usb2_quirk.c (contents, props changed) head/sys/dev/usb2/quirk/usb2_quirk.h (contents, props changed) head/sys/dev/usb2/serial/ head/sys/dev/usb2/serial/uark2.c (contents, props changed) head/sys/dev/usb2/serial/ubsa2.c (contents, props changed) head/sys/dev/usb2/serial/ubser2.c (contents, props changed) head/sys/dev/usb2/serial/uchcom2.c (contents, props changed) head/sys/dev/usb2/serial/ucycom2.c (contents, props changed) head/sys/dev/usb2/serial/ufoma2.c (contents, props changed) head/sys/dev/usb2/serial/uftdi2.c (contents, props changed) head/sys/dev/usb2/serial/uftdi2_reg.h (contents, props changed) head/sys/dev/usb2/serial/ugensa2.c (contents, props changed) head/sys/dev/usb2/serial/uipaq2.c (contents, props changed) head/sys/dev/usb2/serial/ulpt2.c (contents, props changed) head/sys/dev/usb2/serial/umct2.c (contents, props changed) head/sys/dev/usb2/serial/umodem2.c (contents, props changed) head/sys/dev/usb2/serial/umoscom2.c (contents, props changed) head/sys/dev/usb2/serial/uplcom2.c (contents, props changed) head/sys/dev/usb2/serial/usb2_serial.c (contents, props changed) head/sys/dev/usb2/serial/usb2_serial.h (contents, props changed) head/sys/dev/usb2/serial/uvisor2.c (contents, props changed) head/sys/dev/usb2/serial/uvscom2.c (contents, props changed) head/sys/dev/usb2/sound/ head/sys/dev/usb2/sound/uaudio2.c (contents, props changed) head/sys/dev/usb2/sound/uaudio2.h (contents, props changed) head/sys/dev/usb2/sound/uaudio2_pcm.c (contents, props changed) head/sys/dev/usb2/sound/uaudio2_reg.h (contents, props changed) head/sys/dev/usb2/sound/usb2_sound.c (contents, props changed) head/sys/dev/usb2/sound/usb2_sound.h (contents, props changed) head/sys/dev/usb2/storage/ head/sys/dev/usb2/storage/ata-usb2.c (contents, props changed) head/sys/dev/usb2/storage/umass2.c (contents, props changed) head/sys/dev/usb2/storage/urio2.c (contents, props changed) head/sys/dev/usb2/storage/usb2_storage.c (contents, props changed) head/sys/dev/usb2/storage/usb2_storage.h (contents, props changed) head/sys/dev/usb2/storage/ustorage2_fs.c (contents, props changed) head/sys/dev/usb2/template/ head/sys/dev/usb2/template/usb2_template.c (contents, props changed) head/sys/dev/usb2/template/usb2_template.h (contents, props changed) head/sys/dev/usb2/template/usb2_template_cdce.c (contents, props changed) head/sys/dev/usb2/template/usb2_template_msc.c (contents, props changed) head/sys/dev/usb2/template/usb2_template_mtp.c (contents, props changed) head/sys/dev/usb2/wlan/ head/sys/dev/usb2/wlan/if_rum2.c (contents, props changed) head/sys/dev/usb2/wlan/if_rum2_fw.h (contents, props changed) head/sys/dev/usb2/wlan/if_rum2_reg.h (contents, props changed) head/sys/dev/usb2/wlan/if_rum2_var.h (contents, props changed) head/sys/dev/usb2/wlan/if_ural2.c (contents, props changed) head/sys/dev/usb2/wlan/if_ural2_reg.h (contents, props changed) head/sys/dev/usb2/wlan/if_ural2_var.h (contents, props changed) head/sys/dev/usb2/wlan/if_zyd2.c (contents, props changed) head/sys/dev/usb2/wlan/if_zyd2_fw.h (contents, props changed) head/sys/dev/usb2/wlan/if_zyd2_reg.h (contents, props changed) head/sys/dev/usb2/wlan/usb2_wlan.c (contents, props changed) head/sys/dev/usb2/wlan/usb2_wlan.h (contents, props changed) head/sys/modules/usb2/ head/sys/modules/usb2/Makefile (contents, props changed) head/sys/modules/usb2/bluetooth/ head/sys/modules/usb2/bluetooth/Makefile (contents, props changed) head/sys/modules/usb2/bluetooth_fw/ head/sys/modules/usb2/bluetooth_fw/Makefile (contents, props changed) head/sys/modules/usb2/bluetooth_ng/ head/sys/modules/usb2/bluetooth_ng/Makefile (contents, props changed) head/sys/modules/usb2/controller/ head/sys/modules/usb2/controller/Makefile (contents, props changed) head/sys/modules/usb2/controller_at91dci/ head/sys/modules/usb2/controller_at91dci/Makefile (contents, props changed) head/sys/modules/usb2/controller_ehci/ head/sys/modules/usb2/controller_ehci/Makefile (contents, props changed) head/sys/modules/usb2/controller_musb/ head/sys/modules/usb2/controller_musb/Makefile (contents, props changed) head/sys/modules/usb2/controller_ohci/ head/sys/modules/usb2/controller_ohci/Makefile (contents, props changed) head/sys/modules/usb2/controller_uhci/ head/sys/modules/usb2/controller_uhci/Makefile (contents, props changed) head/sys/modules/usb2/controller_uss820dci/ head/sys/modules/usb2/controller_uss820dci/Makefile (contents, props changed) head/sys/modules/usb2/core/ head/sys/modules/usb2/core/Makefile (contents, props changed) head/sys/modules/usb2/ethernet/ head/sys/modules/usb2/ethernet/Makefile (contents, props changed) head/sys/modules/usb2/ethernet_aue/ head/sys/modules/usb2/ethernet_aue/Makefile (contents, props changed) head/sys/modules/usb2/ethernet_axe/ head/sys/modules/usb2/ethernet_axe/Makefile (contents, props changed) head/sys/modules/usb2/ethernet_cdce/ head/sys/modules/usb2/ethernet_cdce/Makefile (contents, props changed) head/sys/modules/usb2/ethernet_cue/ head/sys/modules/usb2/ethernet_cue/Makefile (contents, props changed) head/sys/modules/usb2/ethernet_dav/ head/sys/modules/usb2/ethernet_dav/Makefile (contents, props changed) head/sys/modules/usb2/ethernet_kue/ head/sys/modules/usb2/ethernet_kue/Makefile (contents, props changed) head/sys/modules/usb2/ethernet_rue/ head/sys/modules/usb2/ethernet_rue/Makefile (contents, props changed) head/sys/modules/usb2/image/ head/sys/modules/usb2/image/Makefile (contents, props changed) head/sys/modules/usb2/input/ head/sys/modules/usb2/input/Makefile (contents, props changed) head/sys/modules/usb2/input_hid/ head/sys/modules/usb2/input_hid/Makefile (contents, props changed) head/sys/modules/usb2/input_kbd/ head/sys/modules/usb2/input_kbd/Makefile (contents, props changed) head/sys/modules/usb2/input_ms/ head/sys/modules/usb2/input_ms/Makefile (contents, props changed) head/sys/modules/usb2/misc/ head/sys/modules/usb2/misc/Makefile (contents, props changed) head/sys/modules/usb2/misc_dbp/ head/sys/modules/usb2/misc_dbp/Makefile (contents, props changed) head/sys/modules/usb2/misc_fm/ head/sys/modules/usb2/misc_fm/Makefile (contents, props changed) head/sys/modules/usb2/ndis/ head/sys/modules/usb2/ndis/Makefile (contents, props changed) head/sys/modules/usb2/quirk/ head/sys/modules/usb2/quirk/Makefile (contents, props changed) head/sys/modules/usb2/scanner/ head/sys/modules/usb2/scanner/Makefile (contents, props changed) head/sys/modules/usb2/serial/ head/sys/modules/usb2/serial/Makefile (contents, props changed) head/sys/modules/usb2/serial_ark/ head/sys/modules/usb2/serial_ark/Makefile (contents, props changed) head/sys/modules/usb2/serial_bsa/ head/sys/modules/usb2/serial_bsa/Makefile (contents, props changed) head/sys/modules/usb2/serial_bser/ head/sys/modules/usb2/serial_bser/Makefile (contents, props changed) head/sys/modules/usb2/serial_chcom/ head/sys/modules/usb2/serial_chcom/Makefile (contents, props changed) head/sys/modules/usb2/serial_cycom/ head/sys/modules/usb2/serial_cycom/Makefile (contents, props changed) head/sys/modules/usb2/serial_foma/ head/sys/modules/usb2/serial_foma/Makefile (contents, props changed) head/sys/modules/usb2/serial_ftdi/ head/sys/modules/usb2/serial_ftdi/Makefile (contents, props changed) head/sys/modules/usb2/serial_gensa/ head/sys/modules/usb2/serial_gensa/Makefile (contents, props changed) head/sys/modules/usb2/serial_ipaq/ head/sys/modules/usb2/serial_ipaq/Makefile (contents, props changed) head/sys/modules/usb2/serial_lpt/ head/sys/modules/usb2/serial_lpt/Makefile (contents, props changed) head/sys/modules/usb2/serial_mct/ head/sys/modules/usb2/serial_mct/Makefile (contents, props changed) head/sys/modules/usb2/serial_modem/ head/sys/modules/usb2/serial_modem/Makefile (contents, props changed) head/sys/modules/usb2/serial_moscom/ head/sys/modules/usb2/serial_moscom/Makefile (contents, props changed) head/sys/modules/usb2/serial_plcom/ head/sys/modules/usb2/serial_plcom/Makefile (contents, props changed) head/sys/modules/usb2/serial_visor/ head/sys/modules/usb2/serial_visor/Makefile (contents, props changed) head/sys/modules/usb2/serial_vscom/ head/sys/modules/usb2/serial_vscom/Makefile (contents, props changed) head/sys/modules/usb2/sound/ head/sys/modules/usb2/sound/Makefile (contents, props changed) head/sys/modules/usb2/storage/ head/sys/modules/usb2/storage/Makefile (contents, props changed) head/sys/modules/usb2/storage_ata/ head/sys/modules/usb2/storage_ata/Makefile (contents, props changed) head/sys/modules/usb2/storage_fs/ head/sys/modules/usb2/storage_fs/Makefile (contents, props changed) head/sys/modules/usb2/storage_mass/ head/sys/modules/usb2/storage_mass/Makefile (contents, props changed) head/sys/modules/usb2/storage_rio/ head/sys/modules/usb2/storage_rio/Makefile (contents, props changed) head/sys/modules/usb2/template/ head/sys/modules/usb2/template/Makefile (contents, props changed) head/sys/modules/usb2/wlan/ head/sys/modules/usb2/wlan/Makefile (contents, props changed) head/sys/modules/usb2/wlan_ral/ head/sys/modules/usb2/wlan_ral/Makefile (contents, props changed) head/sys/modules/usb2/wlan_rum/ head/sys/modules/usb2/wlan_rum/Makefile (contents, props changed) head/sys/modules/usb2/wlan_zyd/ head/sys/modules/usb2/wlan_zyd/Makefile (contents, props changed) head/usr.sbin/usbconfig/ head/usr.sbin/usbconfig/Makefile (contents, props changed) head/usr.sbin/usbconfig/dump.c (contents, props changed) head/usr.sbin/usbconfig/dump.h (contents, props changed) head/usr.sbin/usbconfig/usbconfig.8 (contents, props changed) head/usr.sbin/usbconfig/usbconfig.c (contents, props changed) Modified: head/sys/conf/files head/sys/dev/sound/pcm/channel.c head/sys/dev/sound/pcm/channel.h head/sys/dev/sound/pcm/mixer.c head/sys/dev/sound/pcm/mixer.h head/sys/modules/Makefile Added: head/lib/libusb20/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libusb20/Makefile Tue Nov 4 02:31:03 2008 (r184610) @@ -0,0 +1,24 @@ +# +# $FreeBSD$ +# +# Makefile for the FreeBSD specific LibUSB 2.0 +# + +LIB= usb20 +SHLIB_MAJOR= 1 +SHLIB_MINOR= 0 +SRCS= libusb20.c +SRCS+= libusb20_desc.c +SRCS+= libusb20_ugen20.c +SRCS+= libusb20_compat01.c +SRCS+= libusb20_compat10.c +INCS+= libusb20.h +INCS+= libusb20_desc.h +INCS+= libusb20_compat01.h +INCS+= libusb20_compat10.h +MAN= libusb20.3 +MKLINT= no +NOGCCERROR= + +.include + Added: head/lib/libusb20/libusb20.3 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libusb20/libusb20.3 Tue Nov 4 02:31:03 2008 (r184610) @@ -0,0 +1,893 @@ +.\" +.\" Copyright (c) 2008 Hans Petter Selasky +.\" +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" $FreeBSD$ +.\" +.Dd Oct 23, 2008 +.Dt LIBUSB20 3 +.Os +.Sh NAME +.Nm libusb20 +. +.Nd "USB access library" +. +. +.Sh LIBRARY +. +. +USB access library (libusb20 -lusb20) +. +. +. +.Sh SYNOPSIS +. +. +.In libusb20.h +. +. +.Sh DESCRIPTION +. +The +.Nm +library implements functions to be able to easily access and control +USB through the USB file system interface. +. +. +.Sh USB TRANSFER OPERATIONS +. +.Pp +. +.Fn libusb20_tr_close +This function will release all kernel resources associated with an USB +.Fa xfer . +. +This function returns zero upon success. +. +Non-zero return values indicate a LIBUSB20_ERROR value. +. +.Pp +. +.Fn libusb20_tr_open +This function will allocate kernel resources like +.Fa MaxBufSize +and +.Fa MaxFrameCount +associated with an USB +.Fa xfer +and bind the transfer to the specified +.Fa ep_no . +. +This function returns zero upon success. +. +Non-zero return values indicate a LIBUSB20_ERROR value. +. +.Pp +. +.Fn libusb20_tr_get_pointer +This function will return a pointer to the allocated USB transfer according to the +.Fa pdev +and +.Fa tr_index +arguments. +. +This function returns NULL in case of failure. +. +.Pp +. +.Fn libusb20_tr_get_time_complete +This function will return the completion time of an USB transfer in +millisecond units. This function is most useful for isochronous USB +transfers when doing echo cancelling. +. +.Pp +. +.Fn libusb20_tr_get_actual_frames +This function will return the actual number of USB frames after an USB +transfer completed. A value of zero means that no data was transferred. +. +.Pp +. +.Fn libusb20_tr_get_actual_length +This function will return the sum of the actual length for all +transferred USB frames for the given USB transfer. +. +.Pp +. +.Fn libusb20_tr_get_max_frames +This function will return the maximum number of USB frames that were +allocated when an USB transfer was setup for the given USB transfer. +. +.Pp +. +.Fn libusb20_tr_get_max_packet_length +This function will return the maximum packet length in bytes +associated with the given USB transfer. +. +The packet length can be used round up buffer sizes so that short USB +packets are avoided for proxy buffers. +. +. +.Pp +. +.Fn libusb20_tr_get_max_total_length +This function will return the maximum value for the length sum of all +USB frames associated with an USB transfer. +. +.Pp +. +.Fn libusb20_tr_get_status +This function will return the status of an USB transfer. +. +Status values are defined by a set of LIBUSB20_TRANSFER_XXX enums. +. +.Pp +. +.Fn libusb20_tr_pending +This function will return non-zero if the given USB transfer is +pending for completion. +. +Else this function returns zero. +. +.Pp +. +.Fn libusb20_tr_callback_wrapper +This is an internal function used to wrap asynchronous USB callbacks. +. +.Pp +. +.Fn libusb20_tr_clear_stall_sync +This is an internal function used to synchronously clear the stall on +the given USB transfer. +. +Please see the USB specification for more information on stall +clearing. +. +If the given USB transfer is pending when this function is called, the +USB transfer will complete with an error after that this function has +been called. +. +.Pp +. +.Fn libusb20_tr_drain +This function will stop the given USB transfer and will not return +until the USB transfer has been stopped in hardware. +. +.Pp +. +.Fn libusb20_tr_set_buffer +This function is used to set the +.Fa buffer +pointer for the given USB transfer and +.Fa fr_index . +. +Typically the frame index is zero. +. +. +.Pp +. +.Fn libusb20_tr_set_callback +This function is used to set the USB callback for asynchronous USB +transfers. +. +The callback type is defined by libusb20_tr_callback_t. +. +.Pp +. +.Fn libusb20_tr_set_flags +This function is used to set various USB flags for the given USB transfer. +.Bl -tag +.It LIBUSB20_TRANSFER_SINGLE_SHORT_NOT_OK +Report a short frame as error. +.It LIBUSB20_TRANSFER_MULTI_SHORT_NOT_OK +Multiple short frames are not allowed. +.It LIBUSB20_TRANSFER_FORCE_SHORT +All transmitted frames are short terminated. +.It LIBUSB20_TRANSFER_DO_CLEAR_STALL +Will do a clear-stall before starting the transfer. +.El +. +.Pp +. +.Fn libusb20_tr_set_length +This function sets the length of a given USB transfer and frame index. +. +.Pp +. +.Fn libusb20_tr_set_priv_sc0 +This function sets private driver pointer number zero. +. +.Pp +. +.Fn libusb20_tr_set_priv_sc1 +This function sets private driver pointer number one. +. +.Pp +. +.Fn libusb20_tr_set_timeout +This function sets the timeout for the given USB transfer. +. +A timeout value of zero means no timeout. +. +The timeout is given in milliseconds. +. +.Pp +. +.Fn libusb20_tr_set_total_frames +This function sets the total number of frames that should be executed when the USB transfer is submitted. +. +The total number of USB frames must be less than the maximum number of USB frames associated with the given USB transfer. +. +.Pp +. +.Fn libusb20_tr_setup_bulk +This function is a helper function for setting up a single frame USB BULK transfer. +. +.Pp +. +.Fn libusb20_tr_setup_control +This function is a helper function for setting up a single or dual +frame USB CONTROL transfer depending on the control transfer length. +. +.Pp +. +.Fn libusb20_tr_setup_intr +This function is a helper function for setting up a single frame USB INTERRUPT transfer. +. +.Pp +. +.Fn libusb20_tr_setup_isoc +This function is a helper function for setting up a multi frame USB ISOCHRONOUS transfer. +. +.Pp +. +.Fn libusb20_tr_start +This function will get the USB transfer started, if not already +started. +. +This function will not get the transfer queued in hardware. +. +This function is non-blocking. +. +.Pp +. +.Fn libusb20_tr_stop +This function will get the USB transfer stopped, if not already stopped. +. +This function is non-blocking, which means that the actual stop can +happen after the return of this function. +. +.Pp +. +.Fn libusb20_tr_submit +This function will get the USB transfer queued in hardware. +. +. +.Pp +. +.Fn libusb20_tr_get_priv_sc0 +This function returns private driver pointer number zero associated +with an USB transfer. +. +. +.Pp +. +.Fn libusb20_tr_get_priv_sc1 +This function returns private driver pointer number one associated +with an USB transfer. +. +. +.Sh USB DEVICE OPERATIONS +. +.Pp +. +.Fn libusb20_dev_get_backend_name +This function returns a zero terminated string describing the backend used. +. +.Pp +. +.Fn libusb20_dev_get_desc +This function returns a zero terminated string describing the given USB device. +. +.Pp +. +.Fn libusb20_dev_claim_interface +This function will try to claim the given USB interface given by +.Fa iface_index . +This function returns zero on success else a LIBUSB20_ERROR value is +returned. +. +.Pp +. +.Fn libusb20_dev_close +This function will close the given USB device. +. +This function returns zero on success else a LIBUSB20_ERROR value is +returned. +. +.Pp +. +.Fn libusb20_dev_detach_kernel_driver +This function will try to detach the kernel driver for the USB interface given by +.Fa iface_index . +. +This function returns zero on success else a LIBUSB20_ERROR value is +returned. +. +.Pp +. +.Fn libusb20_dev_set_config_index +This function will try to set the configuration index on an USB +device. +. +The first configuration index is zero. +. +The un-configure index is 255. +. +This function returns zero on success else a LIBUSB20_ERROR value is returned. +. +.Pp +. +.Fn libusb20_dev_get_debug +This function returns the debug level of an USB device. +. +.Pp +. +.Fn libusb20_dev_get_fd +This function returns the file descriptor of the given USB device. +. +A negative value is returned when no file descriptor is present. +. +The file descriptor can be used for polling purposes. +. +.Pp +. +.Fn libusb20_dev_kernel_driver_active +This function returns a non-zero value if a kernel driver is active on +the given USB interface. +. +Else zero is returned. +. +.Pp +. +.Fn libusb20_dev_open +This function opens an USB device so that setting up USB transfers +becomes possible. +. +The number of USB transfers can be zero which means only control +transfers are allowed. +. +This function returns zero on success else a LIBUSB20_ERROR value is +returned. +. +A return value of LIBUSB20_ERROR_BUSY means that the device is already +opened. +. +.Pp +. +.Fn libusb20_dev_process +This function is called to sync kernel USB transfers with userland USB +transfers. +. +This function returns zero on success else a LIBUSB20_ERROR value is +returned typically indicating that the given USB device has been +detached. +. +.Pp +. +.Fn libusb20_dev_release_interface +This function will try to release a claimed USB interface for the specified USB device. +. +This function returns zero on success else a LIBUSB20_ERROR value is +returned. +. +.Pp +. +.Fn libusb20_dev_request_sync +This function will perform a synchronous control request on the given +USB device. +. +Before this call will succeed the USB device must be opened. +. +.Fa setup +is a pointer to a decoded and host endian SETUP packet. +.Fa data +is a pointer to a data transfer buffer associated with the control transaction. This argument can be NULL. +.Fa pactlen +is a pointer to a variable that will hold the actual transfer length after the control transaction is complete. +.Fa timeout +is the transaction timeout given in milliseconds. +A timeout of zero means no timeout. +.Fa flags +is used to specify transaction flags, for example LIBUSB20_TRANSFER_SINGLE_SHORT_NOT_OK. +. +This function returns zero on success else a LIBUSB20_ERROR value is +returned. +. +.Pp +. +.Fn libusb20_dev_req_string_sync +This function will synchronously request an USB string by language ID +and string index into the given buffer limited by a maximum length. +. +This function returns zero on success else a LIBUSB20_ERROR value is +returned. +. +.Pp +. +.Fn libusb20_dev_req_string_simple_sync +This function will synchronously request an USB string using the +default language ID and convert the string into ASCII before storing +the string into the given buffer limited by a maximum length which +includes the terminating zero. +. +This function returns zero on success else a LIBUSB20_ERROR value is +returned. +. +. +.Pp +. +.Fn libusb20_dev_reset +This function will try to BUS reset the given USB device and restore +the last set USB configuration. +. +This function returns zero on success else a LIBUSB20_ERROR value is +returned. +. +.Pp +. +.Fn libusb20_dev_set_power_mode +This function sets the power mode of the USB device. +. +Valid power modes: +.Bl -tag +.It LIBUSB20_POWER_OFF +.It LIBUSB20_POWER_ON +.It LIBUSB20_POWER_SAVE +.It LIBUSB20_POWER_SUSPEND +.It LIBUSB20_POWER_RESUME +.El +. +This function returns zero on success else a LIBUSB20_ERROR value is +returned. +. +.Pp +. +.Fn libusb20_dev_get_power_mode +This function returns the currently selected power mode for the given +USB device. +. +.Pp +. +.Fn libusb20_dev_set_alt_index +This function will try to set the given alternate index for the given +USB interface index. +. +This function returns zero on success else a LIBUSB20_ERROR value is +returned. +. +.Pp +. +.Fn libusb20_dev_set_owner +This function will set the ownership of the given USB device. +. +This function returns zero on success else a LIBUSB20_ERROR value is +returned. +. +.Pp +. +.Fn libusb20_dev_set_perm +This function will set the permissions of the given USB device. +. +This function returns zero on success else a LIBUSB20_ERROR value is +returned. +. +.Pp +. +.Fn libusb20_dev_set_iface_owner +This function will set the ownership of the given USB interface. +. +This function returns zero on success else a LIBUSB20_ERROR value is +returned. +. +.Pp +. +.Fn libusb20_dev_set_iface_perm +This function will set the permissions of the given USB interface. +. +This function returns zero on success else a LIBUSB20_ERROR value is +returned. +. +.Pp +. +.Fn libusb20_dev_get_owner +This function will retrieve the current USB device ownership. +. +This function returns zero on success else a LIBUSB20_ERROR value is +returned. +. +.Pp +. +.Fn libusb20_dev_get_perm +This function will retrieve the current USB device permissions. +. +This function returns zero on success else a LIBUSB20_ERROR value is +returned. +. +.Pp +. +.Fn libusb20_dev_get_iface_owner +This function will retrieve the current USB interface ownership for +the given USB interface. +. +This function returns zero on success else a LIBUSB20_ERROR value is +returned. +. +.Pp +. +.Fn libusb20_dev_get_iface_perm +This function will retrieve the current USB interface permissions for +the given USB interface. +. +This function returns zero on success else a LIBUSB20_ERROR value is +returned. +. +.Pp +. +.Fn libusb20_dev_get_device_desc +This function returns a pointer to the decoded and host endian version +of the device descriptor. +. +The USB device need not be opened when calling this function. +. +.Pp +. +.Fn libusb20_dev_alloc_config +This function will read out and decode the USB config descriptor for +the given USB device and config index. This function returns a pointer +to the decoded configuration which must eventually be passed to +free(). NULL is returned in case of failure. +. +.Pp +. +.Fn libusb20_dev_alloc(void) +This is an internal function to allocate a new USB device. +. +.Pp +. +.Fn libusb20_dev_get_address +This function returns the internal and not necessarily the real +hardware address of the given USB device. +. +.Pp +. +.Fn libusb20_dev_get_bus_number +This function return the internal bus number which the given USB +device belongs to. +. +.Pp +. +.Fn libusb20_dev_get_mode +This function returns the current operation mode of the USB entity. +. +Valid return values are: +.Bl -tag +.It LIBUSB20_MODE_HOST +.It LIBUSB20_MODE_DEVICE +.El +. +.Pp +. +.Fn libusb20_dev_get_speed +This function returns the current speed of the given USB device. +. +.Bl -tag +.It LIBUSB20_SPEED_UNKNOWN +.It LIBUSB20_SPEED_LOW +.It LIBUSB20_SPEED_FULL +.It LIBUSB20_SPEED_HIGH +.It LIBUSB20_SPEED_VARIABLE +.It LIBUSB20_SPEED_SUPER +.El +. +.Pp +. +.Fn libusb20_dev_get_config_index +This function returns the currently select config index for the given +USB device. +. +.Pp +. +.Fn libusb20_dev_free +This function will free the given USB device and all associated USB +transfers. +. +.Pp +. +.Fn libusb20_dev_set_debug +This function will set the debug level for the given USB device. +. +.Pp +. +.Fn libusb20_dev_wait_process +This function will wait until a pending USB transfer has completed on +the given USB device. +. +A timeout value can be specified which is passed on to the +.Xr 2 poll +function. +. +.Sh USB BUS OPERATIONS +. +.Fn libusb20_bus_set_owner +This function will set the ownership for the given USB bus. +. +This function returns zero on success else a LIBUSB20_ERROR value is +returned. +. +.Pp +. +.Fn libusb20_bus_set_perm +This function will set the permissions for the given USB bus. +. +This function returns zero on success else a LIBUSB20_ERROR value is +returned. +. +.Pp +. +.Fn libusb20_bus_get_owner +This function will retrieve the ownership for the given USB bus. +. +This function returns zero on success else a LIBUSB20_ERROR value is +returned. +. +.Pp +. +.Fn libusb20_bus_get_perm +This function will retrieve the permissions for the given USB bus. +. +This function returns zero on success else a LIBUSB20_ERROR value is +returned. +. +. +.Sh USB BACKEND OPERATIONS +. +.Fn libusb20_be_get_dev_quirk +This function will return the device quirk according to +.Fa index +into the libusb20_quirk structure pointed to by +.Fa pq . +This function returns zero on success else a LIBUSB20_ERROR value is +returned. +. +If the given quirk does not exist LIBUSB20_ERROR_NOT_FOUND is +returned. +. +.Pp +. +.Fn libusb20_be_get_quirk_name +This function will return the quirk name according to +.Fa index +into the libusb20_quirk structure pointed to by +.Fa pq . +This function returns zero on success else a LIBUSB20_ERROR value is +returned. +. +If the given quirk does not exist LIBUSB20_ERROR_NOT_FOUND is +returned. +. +.Pp +. +.Fn libusb20_be_add_dev_quirk +This function will add the libusb20_quirk structure pointed to by the +.Fa pq +argument into the device quirk list. +. +This function returns zero on success else a LIBUSB20_ERROR value is +returned. +. +If the given quirk cannot be added LIBUSB20_ERROR_NO_MEM is +returned. +. +.Pp +. +.Fn libusb20_be_remove_dev_quirk +This function will remove the quirk matching the libusb20_quirk structure pointed to by the +.Fa pq +argument from the device quirk list. +. +This function returns zero on success else a LIBUSB20_ERROR value is +returned. +. +If the given quirk does not exist LIBUSB20_ERROR_NOT_FOUND is +returned. +. +.Pp +. +.Fn libusb20_be_set_owner +This function will set the ownership for the given backend. +. +This function returns zero on success else a LIBUSB20_ERROR value is +returned. +. +.Pp +. +.Fn libusb20_be_set_perm +This function will set the permissions for the given backend. +. +This function returns zero on success else a LIBUSB20_ERROR value is +returned. +. +.Pp +. +.Fn libusb20_be_get_owner +This function will retrieve the ownership of the given backend. +. +This function returns zero on success else a LIBUSB20_ERROR value is +returned. +. +.Pp +. +.Fn libusb20_be_get_perm +This function will retrieve the permissions of the given backend. +. +. +This function returns zero on success else a LIBUSB20_ERROR value is +returned. +. +.Pp +. +.Fn libusb20_be_alloc +This is an internal function to allocate a USB backend. +. +.Pp +.Fn libusb20_be_alloc_default +.Fn libusb20_be_alloc_freebsd +.Fn libusb20_be_alloc_linux +These functions are used to allocate a specific USB backend or the +operating system default USB backend. Allocating a backend is a way to +scan for currently present USB devices. +. +.Pp +. +.Fn libusb20_be_device_foreach +This function is used to iterate USB devices present in a USB backend. +. +The starting value of +.Fa pdev +is NULL. +. +This function returns the next USB device in the list. +. +If NULL is returned the end of the USB device list has been reached. +. +.Pp +. +.Fn libusb20_be_dequeue_device +This function will dequeue the given USB device pointer from the +backend USB device list. +. +Dequeued USB devices will not be freed when the backend is freed. +. +.Pp +. +.Fn libusb20_be_enqueue_device +This function will enqueue the given USB device pointer in the backend USB device list. +. +Enqueued USB devices will get freed when the backend is freed. +. +.Pp +. +.Fn libusb20_be_free +This function will free the given backend and all USB devices in its device list. +. +. +.Sh USB DESCRIPTOR PARSING +. +.Fn libusb20_me_get_1 +This function will return a byte at the given byte offset of a message +entity. +. +This function is safe against invalid offsets. +. +.Pp +. +.Fn libusb20_me_get_2 +This function will return a little endian 16-bit value at the given byte offset of a message +entity. +. +This function is safe against invalid offsets. +. +.Pp +. +.Fn libusb20_me_encode +This function will encode a so-called *DECODED structure into binary +format. +. +The total encoded length that will fit in the given buffer is +returned. +. +If the buffer pointer is NULL no data will be written to the buffer +location. +. +.Pp +. +.Fn libusb20_me_decode +This function will decode a binary structure into a so-called *DECODED +structure. +. +The total decoded length is returned. +. +The buffer pointer cannot be NULL. +. +. +.Sh LIBUSB VERSION 0.1 COMPATIBILITY +. +.Fn usb_open +.Fn usb_close +.Fn usb_get_string +.Fn usb_get_string_simple +.Fn usb_get_descriptor_by_endpoint +.Fn usb_get_descriptor +.Fn usb_parse_descriptor +.Fn usb_parse_configuration +.Fn usb_destroy_configuration +.Fn usb_fetch_and_parse_descriptors +.Fn usb_bulk_write +.Fn usb_bulk_read +.Fn usb_interrupt_write +.Fn usb_interrupt_read +.Fn usb_control_msg +.Fn usb_set_configuration +.Fn usb_claim_interface +.Fn usb_release_interface +.Fn usb_set_altinterface +.Fn usb_resetep +.Fn usb_clear_halt +.Fn usb_reset +.Fn usb_strerror +.Fn usb_init +.Fn usb_set_debug +.Fn usb_find_busses +.Fn usb_find_devices +.Fn usb_device +.Fn usb_get_busses +These functions are compliant with LibUSB version 0.1.12. +. +.Sh FILES +. +. +/dev/usb +.Sh SEE ALSO +.Xr usb2_core 4 , +.Xr usbconfig 8 +. +. +.Sh HISTORY +. +. +Some parts of the +.Nm +API derives from the libusb project at sourceforge. Added: head/lib/libusb20/libusb20.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libusb20/libusb20.c Tue Nov 4 02:31:03 2008 (r184610) @@ -0,0 +1,1245 @@ +/* $FreeBSD$ */ +/*- + * Copyright (c) 2008 Hans Petter Selasky. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +#include +#include +#include +#include +#include + +#include "libusb20.h" +#include "libusb20_desc.h" +#include "libusb20_int.h" + +static int +dummy_int(void) +{ + return (LIBUSB20_ERROR_NOT_SUPPORTED); +} + +static void +dummy_void(void) +{ + return; +} + +static void +dummy_callback(struct libusb20_transfer *xfer) +{ + ; /* style fix */ + switch (libusb20_tr_get_status(xfer)) { + case LIBUSB20_TRANSFER_START: + libusb20_tr_submit(xfer); + break; + default: + /* complete or error */ + break; + } + return; +} + +#define dummy_get_config_desc_full (void *)dummy_int +#define dummy_get_config_index (void *)dummy_int +#define dummy_set_config_index (void *)dummy_int +#define dummy_claim_interface (void *)dummy_int +#define dummy_release_interface (void *)dummy_int +#define dummy_set_alt_index (void *)dummy_int +#define dummy_reset_device (void *)dummy_int +#define dummy_set_power_mode (void *)dummy_int +#define dummy_get_power_mode (void *)dummy_int +#define dummy_kernel_driver_active (void *)dummy_int *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From alfred at FreeBSD.org Mon Nov 3 18:36:19 2008 From: alfred at FreeBSD.org (Alfred Perlstein) Date: Mon Nov 3 18:36:26 2008 Subject: svn commit: r184611 - svnadmin/conf Message-ID: <200811040236.mA42aJJP083706@svn.freebsd.org> Author: alfred Date: Tue Nov 4 02:36:18 2008 New Revision: 184611 URL: http://svn.freebsd.org/changeset/base/184611 Log: all done with usb2 commit! Modified: svnadmin/conf/sizelimit.conf Modified: svnadmin/conf/sizelimit.conf ============================================================================== --- svnadmin/conf/sizelimit.conf Tue Nov 4 02:31:03 2008 (r184610) +++ svnadmin/conf/sizelimit.conf Tue Nov 4 02:36:18 2008 (r184611) @@ -17,4 +17,3 @@ #peter 3141592 #grog #kan -alfred 30240000 From alfred at FreeBSD.org Mon Nov 3 19:42:01 2008 From: alfred at FreeBSD.org (Alfred Perlstein) Date: Mon Nov 3 19:42:08 2008 Subject: svn commit: r184612 - head/sys/conf Message-ID: <200811040342.mA43g1lZ085235@svn.freebsd.org> Author: alfred Date: Tue Nov 4 03:42:01 2008 New Revision: 184612 URL: http://svn.freebsd.org/changeset/base/184612 Log: add usb2_if.m to mfiles to unbreak build of modules. Modified: head/sys/conf/kmod.mk Modified: head/sys/conf/kmod.mk ============================================================================== --- head/sys/conf/kmod.mk Tue Nov 4 02:36:18 2008 (r184611) +++ head/sys/conf/kmod.mk Tue Nov 4 03:42:01 2008 (r184612) @@ -331,6 +331,7 @@ MFILES?= dev/acpica/acpi_if.m dev/agp/ag dev/sound/pcm/feeder_if.m dev/sound/pcm/mixer_if.m \ dev/sound/midi/mpu_if.m dev/sound/midi/mpufoi_if.m \ dev/sound/midi/synth_if.m dev/usb/usb_if.m isa/isa_if.m \ + dev/usb2/core/usb2_if.m \ kern/bus_if.m kern/clock_if.m \ kern/cpufreq_if.m kern/device_if.m kern/serdev_if.m \ libkern/iconv_converter_if.m opencrypto/cryptodev_if.m \ From des at des.no Tue Nov 4 01:15:17 2008 From: des at des.no (=?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?=) Date: Tue Nov 4 01:15:28 2008 Subject: svn commit: r184251 - in head/sys: conf dev/cfi sys In-Reply-To: <200811031703.42653.jhb@freebsd.org> (John Baldwin's message of "Mon, 3 Nov 2008 17:03:42 -0500") References: <200810250618.m9P6ICWl023370@svn.freebsd.org> <200811031301.07841.jhb@freebsd.org> <20081103.132512.-1476795190.imp@bsdimp.com> <200811031703.42653.jhb@freebsd.org> Message-ID: <86tzanq2cc.fsf@ds4.des.no> John Baldwin writes: > M. Warner Losh writes: > > Whose name is in the disclaimer? > If the problem is "AUTHOR" vs "AUTHOR AND CONTRIBUTORS" then it would perhaps > be more useful to all involved to actually state one's concerns instead of > vague hand-waving and suggestions of evil. Actually, it says "Bill Paul and the voices in his head".. DES -- Dag-Erling Sm?rgrav - des@des.no From christoph.mallon at gmx.de Tue Nov 4 01:28:15 2008 From: christoph.mallon at gmx.de (Christoph Mallon) Date: Tue Nov 4 01:28:22 2008 Subject: svn commit: r184605 - head/sys/dev/usb In-Reply-To: <20081103225453.GA1509@britannica.bec.de> References: <200811032209.mA3M9RhK077380@svn.freebsd.org> <490F800E.9080201@gmx.de> <20081103225453.GA1509@britannica.bec.de> Message-ID: <491015AB.7070508@gmx.de> Joerg Sonnenberger wrote: > On Mon, Nov 03, 2008 at 11:49:50PM +0100, Christoph Mallon wrote: >> You may want to make cmd[] static and/or const, so the compiler really >> just puts the bytes in the data section instead of generating code, >> which pretty much is the same as the assignments you just removed. > > I didn't make it const originally as I am not sure if the USB stack will > never modify the buffer. GCC generates 31 movb instructions to initialise the array on entry of the function. Every movb is 5 Bytes long (opcode + mod r/m + sib + offset + immediate). 31 * 5 = 155 Bytes. It is only sensible to use static initialisation for a local array, which contains lots of zeroes, if it can be made static or const (GCC is clever enough to turn a const array into a static one). Yes, GCC could be more clever and use movl instead of movb, but it isn't. Christoph From keramida at ceid.upatras.gr Tue Nov 4 01:46:59 2008 From: keramida at ceid.upatras.gr (Giorgos Keramidas) Date: Tue Nov 4 01:47:06 2008 Subject: svn commit: r184610 - in head: lib/libusb20 share/man/man4 sys/conf sys/dev/sound/pcm sys/dev/usb2 sys/dev/usb2/bluetooth sys/dev/usb2/controller sys/dev/usb2/core sys/dev/usb2/ethernet sys/dev/usb... In-Reply-To: <200811040231.mA42V4EQ083516@svn.freebsd.org> (Alfred Perlstein's message of "Tue, 4 Nov 2008 02:31:04 +0000 (UTC)") References: <200811040231.mA42V4EQ083516@svn.freebsd.org> Message-ID: <87bpwv6diz.fsf@kobe.laptop> On Tue, 4 Nov 2008 02:31:04 +0000 (UTC), Alfred Perlstein wrote: > Author: alfred > Date: Tue Nov 4 02:31:03 2008 > New Revision: 184610 > URL: http://svn.freebsd.org/changeset/base/184610 > > Log: > Bring in USB4BSD, Hans Petter Selasky rework of the USB stack > that includes significant features and SMP safety. The tinderbox complains about `if_zyd2.c' on i386/pc98 and powerpc; we may have to commit something like: %%% --- if_zyd2.c.orig 2008-11-04 11:25:45.000000000 +0200 +++ if_zyd2.c 2008-11-04 11:31:24.000000000 +0200 @@ -378,6 +378,7 @@ struct zyd_softc *sc = xfer->priv_sc; struct zyd_cmd *cmd = &sc->sc_intr_ibuf; uint32_t actlen; + uint16_t code; switch (USB_GET_STATE(xfer)) { case USB_ST_TRANSFERRED: @@ -392,14 +393,14 @@ usb2_copy_out(xfer->frbuffers, 0, &sc->sc_intr_ibuf, actlen); - switch (cmd->code) { - case htole16(ZYD_NOTIF_RETRYSTATUS): + code = le16toh(cmd->code); + switch (code) { + case ZYD_NOTIF_RETRYSTATUS: goto handle_notif_retrystatus; - case htole16(ZYD_NOTIF_IORD): + case ZYD_NOTIF_IORD: goto handle_notif_iord; default: - DPRINTFN(2, "unknown indication: 0x%04x\n", - le16toh(cmd->code)); + DPRINTFN(2, "unknown indication: 0x%04x\n", code); } /* fallthrough */ %%% From ed at FreeBSD.org Tue Nov 4 02:58:02 2008 From: ed at FreeBSD.org (Ed Schouten) Date: Tue Nov 4 02:58:09 2008 Subject: svn commit: r184621 - head/sys/kern Message-ID: <200811041058.mA4Aw22W093656@svn.freebsd.org> Author: ed Date: Tue Nov 4 10:58:02 2008 New Revision: 184621 URL: http://svn.freebsd.org/changeset/base/184621 Log: Remove redundant return value tests. There is no need to test whether the return value is non-zero here. Just return the error number directly. Modified: head/sys/kern/tty_pts.c Modified: head/sys/kern/tty_pts.c ============================================================================== --- head/sys/kern/tty_pts.c Tue Nov 4 06:34:01 2008 (r184620) +++ head/sys/kern/tty_pts.c Tue Nov 4 10:58:02 2008 (r184621) @@ -701,13 +701,8 @@ posix_openpt(struct thread *td, struct p static int ptmx_fdopen(struct cdev *dev, int fflags, struct thread *td, struct file *fp) { - int error; - error = pts_alloc(fflags & (FREAD|FWRITE), td, fp); - if (error != 0) - return (error); - - return (0); + return (pts_alloc(fflags & (FREAD|FWRITE), td, fp)); } static struct cdevsw ptmx_cdevsw = { From rpaulo at FreeBSD.org Tue Nov 4 03:52:50 2008 From: rpaulo at FreeBSD.org (Rui Paulo) Date: Tue Nov 4 03:52:57 2008 Subject: svn commit: r184625 - in head: etc sys/dev/acpi_support Message-ID: <200811041152.mA4BqoPb095612@svn.freebsd.org> Author: rpaulo Date: Tue Nov 4 11:52:50 2008 New Revision: 184625 URL: http://svn.freebsd.org/changeset/base/184625 Log: Add support for Asus A8Sr notebooks. PR: 128553 Submitted by: Eygene Ryabinkin Reviewed by: philip MFC after: 2 months Modified: head/etc/devd.conf head/sys/dev/acpi_support/acpi_asus.c Modified: head/etc/devd.conf ============================================================================== --- head/etc/devd.conf Tue Nov 4 11:31:09 2008 (r184624) +++ head/etc/devd.conf Tue Nov 4 11:52:50 2008 (r184625) @@ -255,6 +255,28 @@ notify 10 { action "/etc/rc.resume acpi $notify"; }; +# The next blocks enable volume hotkeys that can be found on the Asus laptops +notify 0 { + match "system" "ACPI"; + match "subsystem" "ASUS"; + match "notify" "0x32"; + action "mixer 0"; +}; + +notify 0 { + match "system" "ACPI"; + match "subsystem"i "ASUS"; + match "notify" "0x31"; + action "mixer vol -10"; +}; + +notify 0 { + match "system" "ACPI"; + match "subsystem" "ASUS"; + match "notify" "0x30"; + action "mixer vol +10"; +}; + # The next blocks enable volume hotkeys that can be found on the Asus EeePC # The four keys above the keyboard notify 0x1a through to 0x1d respectively notify 0 { Modified: head/sys/dev/acpi_support/acpi_asus.c ============================================================================== --- head/sys/dev/acpi_support/acpi_asus.c Tue Nov 4 11:31:09 2008 (r184624) +++ head/sys/dev/acpi_support/acpi_asus.c Tue Nov 4 11:52:50 2008 (r184625) @@ -93,6 +93,9 @@ struct acpi_asus_model { char *wlan_set; void (*n_func)(ACPI_HANDLE, UINT32, void *); + + char *lcdd; + void (*lcdd_n_func)(ACPI_HANDLE, UINT32, void *); }; struct acpi_asus_led { @@ -113,6 +116,7 @@ struct acpi_asus_led { struct acpi_asus_softc { device_t dev; ACPI_HANDLE handle; + ACPI_HANDLE lcdd_handle; struct acpi_asus_model *model; struct sysctl_ctx_list sysctl_ctx; @@ -133,6 +137,9 @@ struct acpi_asus_softc { int s_wlan; }; +static void acpi_asus_lcdd_notify(ACPI_HANDLE h, UINT32 notify, + void *context); + /* * We can identify Asus laptops from the string they return * as a result of calling the ATK0100 'INIT' method. @@ -205,6 +212,20 @@ static struct acpi_asus_model acpi_asus_ .disp_set = "SDSP" }, { + .name = "A8SR", + .bled_set = "BLED", + .mled_set = "MLED", + .wled_set = "WLED", + .lcd_get = NULL, + .lcd_set = "\\_SB.PCI0.SBRG.EC0._Q10", + .brn_get = "GPLV", + .brn_set = "SPLV", + .disp_get = "\\_SB.PCI0.P0P1.VGA.GETD", + .disp_set = "SDSP", + .lcdd = "\\_SB.PCI0.P0P1.VGA.LCDD", + .lcdd_n_func = acpi_asus_lcdd_notify + }, + { .name = "D1x", .mled_set = "MLED", .lcd_get = "\\GP11", @@ -762,6 +783,22 @@ acpi_asus_attach(device_t dev) AcpiInstallNotifyHandler(sc->handle, ACPI_SYSTEM_NOTIFY, sc->model->n_func, dev); + /* Find and hook the 'LCDD' object */ + if (sc->model->lcdd != NULL && sc->model->lcdd_n_func != NULL) { + ACPI_STATUS res; + + sc->lcdd_handle = NULL; + res = AcpiGetHandle((sc->model->lcdd[0] == '\\' ? + NULL : sc->handle), sc->model->lcdd, &(sc->lcdd_handle)); + if (ACPI_SUCCESS(res)) { + AcpiInstallNotifyHandler((sc->lcdd_handle), + ACPI_DEVICE_NOTIFY, sc->model->lcdd_n_func, dev); + } else { + printf("%s: unable to find LCD device '%s'\n", + __func__, sc->model->lcdd); + } + } + return (0); } @@ -796,6 +833,13 @@ acpi_asus_detach(device_t dev) /* Remove notify handler */ AcpiRemoveNotifyHandler(sc->handle, ACPI_SYSTEM_NOTIFY, acpi_asus_notify); + + if (sc->lcdd_handle) { + KASSERT(sc->model->lcdd_n_func != NULL, + ("model->lcdd_n_func is NULL, but lcdd_handle is non-zero")); + AcpiRemoveNotifyHandler((sc->lcdd_handle), + ACPI_DEVICE_NOTIFY, sc->model->lcdd_n_func); + } /* Free sysctl tree */ sysctl_ctx_free(&sc->sysctl_ctx); @@ -1165,6 +1209,12 @@ acpi_asus_notify(ACPI_HANDLE h, UINT32 n } else if (notify == 0x34) { sc->s_lcd = 0; ACPI_VPRINT(sc->dev, acpi_sc, "LCD turned off\n"); + } else if (notify == 0x86) { + acpi_asus_sysctl_set(sc, ACPI_ASUS_METHOD_BRN, sc->s_brn-1); + ACPI_VPRINT(sc->dev, acpi_sc, "Brightness decreased\n"); + } else if (notify == 0x87) { + acpi_asus_sysctl_set(sc, ACPI_ASUS_METHOD_BRN, sc->s_brn+1); + ACPI_VPRINT(sc->dev, acpi_sc, "Brightness increased\n"); } else { /* Notify devd(8) */ acpi_UserNotify("ASUS", h, notify); @@ -1173,6 +1223,31 @@ acpi_asus_notify(ACPI_HANDLE h, UINT32 n } static void +acpi_asus_lcdd_notify(ACPI_HANDLE h, UINT32 notify, void *context) +{ + struct acpi_asus_softc *sc; + struct acpi_softc *acpi_sc; + + ACPI_FUNCTION_TRACE((char *)(uintptr_t)__func__); + + sc = device_get_softc((device_t)context); + acpi_sc = acpi_device_get_parent_softc(sc->dev); + + ACPI_SERIAL_BEGIN(asus); + switch (notify) { + case 0x87: + acpi_asus_sysctl_set(sc, ACPI_ASUS_METHOD_BRN, sc->s_brn-1); + ACPI_VPRINT(sc->dev, acpi_sc, "Brightness decreased\n"); + break; + case 0x86: + acpi_asus_sysctl_set(sc, ACPI_ASUS_METHOD_BRN, sc->s_brn+1); + ACPI_VPRINT(sc->dev, acpi_sc, "Brightness increased\n"); + break; + } + ACPI_SERIAL_END(asus); +} + +static void acpi_asus_eeepc_notify(ACPI_HANDLE h, UINT32 notify, void *context) { struct acpi_asus_softc *sc; From trasz at FreeBSD.org Tue Nov 4 04:30:31 2008 From: trasz at FreeBSD.org (Edward Tomasz Napierala) Date: Tue Nov 4 04:30:42 2008 Subject: svn commit: r184629 - head/sys/ufs/ufs Message-ID: <200811041230.mA4CUVPV096568@svn.freebsd.org> Author: trasz Date: Tue Nov 4 12:30:31 2008 New Revision: 184629 URL: http://svn.freebsd.org/changeset/base/184629 Log: In UFS, when reading EA that contains ACL fails for some reason, include inode number and filesystem name, so the administrator can fix the problem. Approved by: rwatson (mentor) Modified: head/sys/ufs/ufs/ufs_acl.c Modified: head/sys/ufs/ufs/ufs_acl.c ============================================================================== --- head/sys/ufs/ufs/ufs_acl.c Tue Nov 4 12:03:55 2008 (r184628) +++ head/sys/ufs/ufs/ufs_acl.c Tue Nov 4 12:30:31 2008 (r184629) @@ -53,6 +53,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #ifdef UFS_ACL @@ -217,7 +218,8 @@ ufs_getacl(ap) * are unsafe. */ printf("ufs_getacl(): Loaded invalid ACL (" - "%d bytes)\n", len); + "%d bytes), inumber %d on %s\n", len, + ip->i_number, ip->i_fs->fs_fsmnt); return (EPERM); } ufs_sync_acl_from_inode(ip, ap->a_aclp); @@ -262,7 +264,8 @@ ufs_getacl(ap) * protections are unsafe. */ printf("ufs_getacl(): Loaded invalid ACL (" - "%d bytes)\n", len); + "%d bytes), inumber %d on %s\n", len, + ip->i_number, ip->i_fs->fs_fsmnt); return (EPERM); } break; From des at FreeBSD.org Tue Nov 4 05:49:54 2008 From: des at FreeBSD.org (Dag-Erling Smorgrav) Date: Tue Nov 4 05:50:00 2008 Subject: svn commit: r184633 - head/lib/libutil Message-ID: <200811041349.mA4DnsrB098250@svn.freebsd.org> Author: des Date: Tue Nov 4 13:49:53 2008 New Revision: 184633 URL: http://svn.freebsd.org/changeset/base/184633 Log: Avoid assigning a const char * to a char *. MFC after: 3 weeks Modified: head/lib/libutil/login_cap.c head/lib/libutil/login_class.c Modified: head/lib/libutil/login_cap.c ============================================================================== --- head/lib/libutil/login_cap.c Tue Nov 4 13:49:18 2008 (r184632) +++ head/lib/libutil/login_cap.c Tue Nov 4 13:49:53 2008 (r184633) @@ -61,6 +61,8 @@ static char * internal_string = NULL; static size_t internal_arraysz = 0; static const char ** internal_array = NULL; +static char path_login_conf[] = _PATH_LOGIN_CONF; + static char * allocstr(const char *str) { @@ -215,15 +217,14 @@ login_getclassbyname(char const *name, c if (dir && snprintf(userpath, MAXPATHLEN, "%s/%s", dir, _FILE_LOGIN_CONF) < MAXPATHLEN) { - login_dbarray[i] = userpath; if (_secure_path(userpath, pwd->pw_uid, pwd->pw_gid) != -1) - i++; /* only use 'secure' data */ + login_dbarray[i++] = userpath; } /* * XXX: Why to add the system database if the class is `me'? */ - if (_secure_path(_PATH_LOGIN_CONF, 0, 0) != -1) - login_dbarray[i++] = _PATH_LOGIN_CONF; + if (_secure_path(path_login_conf, 0, 0) != -1) + login_dbarray[i++] = path_login_conf; login_dbarray[i] = NULL; memset(lc, 0, sizeof(login_cap_t)); Modified: head/lib/libutil/login_class.c ============================================================================== --- head/lib/libutil/login_class.c Tue Nov 4 13:49:18 2008 (r184632) +++ head/lib/libutil/login_class.c Tue Nov 4 13:49:53 2008 (r184633) @@ -142,14 +142,13 @@ substvar(const char * var, const struct int tildes = 0; int dollas = 0; char *p; + const char *q; if (pwd != NULL) { - /* Count the number of ~'s in var to substitute */ - for (p = (char *)var; (p = strchr(p, '~')) != NULL; p++) - ++tildes; - /* Count the number of $'s in var to substitute */ - for (p = (char *)var; (p = strchr(p, '$')) != NULL; p++) - ++dollas; + for (q = var; *q != '\0'; ++q) { + tildes += (*q == '~'); + dollas += (*q == '$'); + } } np = malloc(strlen(var) + (dollas * nlen) From des at FreeBSD.org Tue Nov 4 05:50:51 2008 From: des at FreeBSD.org (Dag-Erling Smorgrav) Date: Tue Nov 4 05:50:58 2008 Subject: svn commit: r184634 - head/lib/libutil Message-ID: <200811041350.mA4DooH5098318@svn.freebsd.org> Author: des Date: Tue Nov 4 13:50:50 2008 New Revision: 184634 URL: http://svn.freebsd.org/changeset/base/184634 Log: Add missing header. Modified: head/lib/libutil/pty.c Modified: head/lib/libutil/pty.c ============================================================================== --- head/lib/libutil/pty.c Tue Nov 4 13:49:53 2008 (r184633) +++ head/lib/libutil/pty.c Tue Nov 4 13:50:50 2008 (r184634) @@ -47,6 +47,7 @@ static char sccsid[] = "@(#)pty.c 8.3 (B #include #include #include +#include int openpty(int *amaster, int *aslave, char *name, struct termios *termp, From des at FreeBSD.org Tue Nov 4 05:51:16 2008 From: des at FreeBSD.org (Dag-Erling Smorgrav) Date: Tue Nov 4 05:51:31 2008 Subject: svn commit: r184635 - head/lib/libutil Message-ID: <200811041351.mA4DpFM1098364@svn.freebsd.org> Author: des Date: Tue Nov 4 13:51:15 2008 New Revision: 184635 URL: http://svn.freebsd.org/changeset/base/184635 Log: libutil now builds at WARNS level 6. MFC after: 3 weeks Modified: head/lib/libutil/Makefile Modified: head/lib/libutil/Makefile ============================================================================== --- head/lib/libutil/Makefile Tue Nov 4 13:50:50 2008 (r184634) +++ head/lib/libutil/Makefile Tue Nov 4 13:51:15 2008 (r184635) @@ -15,6 +15,8 @@ SRCS= _secure_path.c auth.c gr_util.c ex stub.c trimdomain.c uucplock.c INCS= libutil.h login_cap.h +WARNS?= 6 + CFLAGS+= -DLIBC_SCCS .if ${MK_INET6_SUPPORT} != "no" From des at FreeBSD.org Tue Nov 4 06:17:50 2008 From: des at FreeBSD.org (Dag-Erling Smorgrav) Date: Tue Nov 4 06:17:56 2008 Subject: svn commit: r184638 - head/libexec/rpc.rquotad Message-ID: <200811041417.mA4EHodx099029@svn.freebsd.org> Author: des Date: Tue Nov 4 14:17:49 2008 New Revision: 184638 URL: http://svn.freebsd.org/changeset/base/184638 Log: Whitespace and style fixes, build at WARNS level 6. MFC after: 3 weeks Modified: head/libexec/rpc.rquotad/Makefile head/libexec/rpc.rquotad/rquotad.c Modified: head/libexec/rpc.rquotad/Makefile ============================================================================== --- head/libexec/rpc.rquotad/Makefile Tue Nov 4 13:55:55 2008 (r184637) +++ head/libexec/rpc.rquotad/Makefile Tue Nov 4 14:17:49 2008 (r184638) @@ -4,6 +4,8 @@ PROG = rpc.rquotad SRCS = rquotad.c MAN = rpc.rquotad.8 +WARNS ?= 6 + DPADD= ${LIBRPCSVC} LDADD= -lrpcsvc Modified: head/libexec/rpc.rquotad/rquotad.c ============================================================================== --- head/libexec/rpc.rquotad/rquotad.c Tue Nov 4 13:55:55 2008 (r184637) +++ head/libexec/rpc.rquotad/rquotad.c Tue Nov 4 14:17:49 2008 (r184638) @@ -1,39 +1,35 @@ /* * by Manuel Bouyer (bouyer@ensta.fr) - * + * * There is no copyright, you can use it as you want. */ -#ifndef lint -static const char rcsid[] = - "$FreeBSD$"; -#endif /* not lint */ +#include +__FBSDID("$FreeBSD$"); #include -#include #include #include #include #include -#include + +#include +#include +#include +#include +#include #include #include #include #include #include +#include #include #include #include -#include - #include - -#include -#include -#include -#include -#include +#include void rquota_service(struct svc_req *request, SVCXPRT *transp); void sendquota(struct svc_req *request, SVCXPRT *transp); @@ -56,15 +52,17 @@ struct fs_stat *fs_begin = NULL; int from_inetd = 1; -void +static void cleanup(int sig) { + + (void) sig; (void) rpcb_unset(RQUOTAPROG, RQUOTAVERS, NULL); exit(0); } int -main(int argc, char *argv[]) +main(void) { SVCXPRT *transp; int ok; @@ -101,19 +99,22 @@ main(int argc, char *argv[]) ok = svc_create(rquota_service, RQUOTAPROG, RQUOTAVERS, "udp"); if (!ok) { - syslog(LOG_ERR, "unable to register (RQUOTAPROG, RQUOTAVERS, %s)", (!from_inetd)?"udp":"(inetd)"); + syslog(LOG_ERR, + "unable to register (RQUOTAPROG, RQUOTAVERS, %s)", + from_inetd ? "(inetd)" : "udp"); exit(1); } - initfs(); /* init the fs_stat list */ + initfs(); svc_run(); syslog(LOG_ERR, "svc_run returned"); exit(1); } -void +void rquota_service(struct svc_req *request, SVCXPRT *transp) { + switch (request->rq_proc) { case NULLPROC: (void)svc_sendreply(transp, (xdrproc_t)xdr_void, (char *)NULL); @@ -133,7 +134,7 @@ rquota_service(struct svc_req *request, } /* read quota for the specified id, and send it */ -void +void sendquota(struct svc_req *request, SVCXPRT *transp) { struct getquota_args getq_args; @@ -183,7 +184,7 @@ sendquota(struct svc_req *request, SVCXP } } -void +void printerr_reply(SVCXPRT *transp) /* when a reply to a request failed */ { char name[INET6_ADDRSTRLEN]; @@ -203,7 +204,7 @@ printerr_reply(SVCXPRT *transp) /* when } /* initialise the fs_tab list from entries in /etc/fstab */ -void +void initfs(void) { struct fs_stat *fs_current = NULL; @@ -222,10 +223,12 @@ initfs(void) fs_current = (struct fs_stat *) malloc(sizeof(struct fs_stat)); fs_current->fs_next = fs_next; /* next element */ - fs_current->fs_file = malloc(sizeof(char) * (strlen(fs->fs_file) + 1)); + fs_current->fs_file = + malloc(sizeof(char) * (strlen(fs->fs_file) + 1)); strcpy(fs_current->fs_file, fs->fs_file); - fs_current->qfpathname = malloc(sizeof(char) * (strlen(qfpathname) + 1)); + fs_current->qfpathname = + malloc(sizeof(char) * (strlen(qfpathname) + 1)); strcpy(fs_current->qfpathname, qfpathname); stat(fs_current->fs_file, &st); @@ -242,7 +245,7 @@ initfs(void) * Return 0 if fail, 1 otherwise */ int -getfsquota(long id, char *path, struct dqblk *dqblk) +getfsquota(long id, char *path, struct dqblk *dqblk) { struct stat st_path; struct fs_stat *fs; @@ -301,8 +304,8 @@ hasquota(struct fstab *fs, char **qfnam { static char initname, usrname[100]; static char buf[BUFSIZ]; - char *opt, *cp; - char *qfextension[] = INITQFNAMES; + char *opt, *cp; + const char *qfextension[] = INITQFNAMES; if (!initname) { sprintf(usrname, "%s%s", qfextension[USRQUOTA], QUOTAFILENAME); @@ -321,7 +324,8 @@ hasquota(struct fstab *fs, char **qfnam *qfnamep = cp; return (1); } - sprintf(buf, "%s/%s.%s", fs->fs_file, QUOTAFILENAME, qfextension[USRQUOTA]); + sprintf(buf, "%s/%s.%s", fs->fs_file, QUOTAFILENAME, + qfextension[USRQUOTA]); *qfnamep = buf; return (1); } From kib at FreeBSD.org Tue Nov 4 07:56:45 2008 From: kib at FreeBSD.org (Konstantin Belousov) Date: Tue Nov 4 07:57:06 2008 Subject: svn commit: r184641 - in stable/7/sys: . kern Message-ID: <200811041556.mA4FuijN001109@svn.freebsd.org> Author: kib Date: Tue Nov 4 15:56:44 2008 New Revision: 184641 URL: http://svn.freebsd.org/changeset/base/184641 Log: MFC r184409: Protect check for v_pollinfo == NULL and assignment of the newly allocated vpollinfo with vnode interlock. Fully initialize vpollinfo before putting pointer to it into vp->v_pollinfo. Approved by: re (kensmith) Modified: stable/7/sys/ (props changed) stable/7/sys/kern/vfs_subr.c Modified: stable/7/sys/kern/vfs_subr.c ============================================================================== --- stable/7/sys/kern/vfs_subr.c Tue Nov 4 15:47:06 2008 (r184640) +++ stable/7/sys/kern/vfs_subr.c Tue Nov 4 15:56:44 2008 (r184641) @@ -109,7 +109,7 @@ static void vgonel(struct vnode *); static void vfs_knllock(void *arg); static void vfs_knlunlock(void *arg); static int vfs_knllocked(void *arg); - +static void destroy_vpollinfo(struct vpollinfo *vi); /* * Enable Giant pushdown based on whether or not the vm is mpsafe in this @@ -815,11 +815,8 @@ vdestroy(struct vnode *vp) #ifdef MAC mac_destroy_vnode(vp); #endif - if (vp->v_pollinfo != NULL) { - knlist_destroy(&vp->v_pollinfo->vpi_selinfo.si_note); - mtx_destroy(&vp->v_pollinfo->vpi_lock); - uma_zfree(vnodepoll_zone, vp->v_pollinfo); - } + if (vp->v_pollinfo != NULL) + destroy_vpollinfo(vp->v_pollinfo); #ifdef INVARIANTS /* XXX Elsewhere we can detect an already freed vnode via NULL v_op. */ vp->v_op = NULL; @@ -3050,6 +3047,14 @@ vbusy(struct vnode *vp) mtx_unlock(&vnode_free_list_mtx); } +static void +destroy_vpollinfo(struct vpollinfo *vi) +{ + knlist_destroy(&vi->vpi_selinfo.si_note); + mtx_destroy(&vi->vpi_lock); + uma_zfree(vnodepoll_zone, vi); +} + /* * Initalize per-vnode helper structure to hold poll-related state. */ @@ -3058,15 +3063,20 @@ v_addpollinfo(struct vnode *vp) { struct vpollinfo *vi; + if (vp->v_pollinfo != NULL) + return; vi = uma_zalloc(vnodepoll_zone, M_WAITOK); + mtx_init(&vi->vpi_lock, "vnode pollinfo", NULL, MTX_DEF); + knlist_init(&vi->vpi_selinfo.si_note, vp, vfs_knllock, + vfs_knlunlock, vfs_knllocked); + VI_LOCK(vp); if (vp->v_pollinfo != NULL) { - uma_zfree(vnodepoll_zone, vi); + VI_UNLOCK(vp); + destroy_vpollinfo(vi); return; } vp->v_pollinfo = vi; - mtx_init(&vp->v_pollinfo->vpi_lock, "vnode pollinfo", NULL, MTX_DEF); - knlist_init(&vp->v_pollinfo->vpi_selinfo.si_note, vp, vfs_knllock, - vfs_knlunlock, vfs_knllocked); + VI_UNLOCK(vp); } /* @@ -3081,8 +3091,7 @@ int vn_pollrecord(struct vnode *vp, struct thread *td, int events) { - if (vp->v_pollinfo == NULL) - v_addpollinfo(vp); + v_addpollinfo(vp); mtx_lock(&vp->v_pollinfo->vpi_lock); if (vp->v_pollinfo->vpi_revents & events) { /* @@ -3917,8 +3926,7 @@ vfs_kqfilter(struct vop_kqfilter_args *a kn->kn_hook = (caddr_t)vp; - if (vp->v_pollinfo == NULL) - v_addpollinfo(vp); + v_addpollinfo(vp); if (vp->v_pollinfo == NULL) return (ENOMEM); knl = &vp->v_pollinfo->vpi_selinfo.si_note; From scottl at samsco.org Tue Nov 4 08:03:40 2008 From: scottl at samsco.org (Scott Long) Date: Tue Nov 4 08:03:46 2008 Subject: svn commit: r184641 - in stable/7/sys: . kern In-Reply-To: <200811041556.mA4FuijN001109@svn.freebsd.org> References: <200811041556.mA4FuijN001109@svn.freebsd.org> Message-ID: <49107254.9070307@samsco.org> In stable branches, and especially during release cycles, would it be possible to annotate whether changes like this fix known panics or user-visible bugs? Scott Konstantin Belousov wrote: > Author: kib > Date: Tue Nov 4 15:56:44 2008 > New Revision: 184641 > URL: http://svn.freebsd.org/changeset/base/184641 > > Log: > MFC r184409: > Protect check for v_pollinfo == NULL and assignment of the newly allocated > vpollinfo with vnode interlock. Fully initialize vpollinfo before putting > pointer to it into vp->v_pollinfo. > > Approved by: re (kensmith) > > Modified: > stable/7/sys/ (props changed) > stable/7/sys/kern/vfs_subr.c > > Modified: stable/7/sys/kern/vfs_subr.c > ============================================================================== > --- stable/7/sys/kern/vfs_subr.c Tue Nov 4 15:47:06 2008 (r184640) > +++ stable/7/sys/kern/vfs_subr.c Tue Nov 4 15:56:44 2008 (r184641) > @@ -109,7 +109,7 @@ static void vgonel(struct vnode *); > static void vfs_knllock(void *arg); > static void vfs_knlunlock(void *arg); > static int vfs_knllocked(void *arg); > - > +static void destroy_vpollinfo(struct vpollinfo *vi); > > /* > * Enable Giant pushdown based on whether or not the vm is mpsafe in this > @@ -815,11 +815,8 @@ vdestroy(struct vnode *vp) > #ifdef MAC > mac_destroy_vnode(vp); > #endif > - if (vp->v_pollinfo != NULL) { > - knlist_destroy(&vp->v_pollinfo->vpi_selinfo.si_note); > - mtx_destroy(&vp->v_pollinfo->vpi_lock); > - uma_zfree(vnodepoll_zone, vp->v_pollinfo); > - } > + if (vp->v_pollinfo != NULL) > + destroy_vpollinfo(vp->v_pollinfo); > #ifdef INVARIANTS > /* XXX Elsewhere we can detect an already freed vnode via NULL v_op. */ > vp->v_op = NULL; > @@ -3050,6 +3047,14 @@ vbusy(struct vnode *vp) > mtx_unlock(&vnode_free_list_mtx); > } > > +static void > +destroy_vpollinfo(struct vpollinfo *vi) > +{ > + knlist_destroy(&vi->vpi_selinfo.si_note); > + mtx_destroy(&vi->vpi_lock); > + uma_zfree(vnodepoll_zone, vi); > +} > + > /* > * Initalize per-vnode helper structure to hold poll-related state. > */ > @@ -3058,15 +3063,20 @@ v_addpollinfo(struct vnode *vp) > { > struct vpollinfo *vi; > > + if (vp->v_pollinfo != NULL) > + return; > vi = uma_zalloc(vnodepoll_zone, M_WAITOK); > + mtx_init(&vi->vpi_lock, "vnode pollinfo", NULL, MTX_DEF); > + knlist_init(&vi->vpi_selinfo.si_note, vp, vfs_knllock, > + vfs_knlunlock, vfs_knllocked); > + VI_LOCK(vp); > if (vp->v_pollinfo != NULL) { > - uma_zfree(vnodepoll_zone, vi); > + VI_UNLOCK(vp); > + destroy_vpollinfo(vi); > return; > } > vp->v_pollinfo = vi; > - mtx_init(&vp->v_pollinfo->vpi_lock, "vnode pollinfo", NULL, MTX_DEF); > - knlist_init(&vp->v_pollinfo->vpi_selinfo.si_note, vp, vfs_knllock, > - vfs_knlunlock, vfs_knllocked); > + VI_UNLOCK(vp); > } > > /* > @@ -3081,8 +3091,7 @@ int > vn_pollrecord(struct vnode *vp, struct thread *td, int events) > { > > - if (vp->v_pollinfo == NULL) > - v_addpollinfo(vp); > + v_addpollinfo(vp); > mtx_lock(&vp->v_pollinfo->vpi_lock); > if (vp->v_pollinfo->vpi_revents & events) { > /* > @@ -3917,8 +3926,7 @@ vfs_kqfilter(struct vop_kqfilter_args *a > > kn->kn_hook = (caddr_t)vp; > > - if (vp->v_pollinfo == NULL) > - v_addpollinfo(vp); > + v_addpollinfo(vp); > if (vp->v_pollinfo == NULL) > return (ENOMEM); > knl = &vp->v_pollinfo->vpi_selinfo.si_note; From thompsa at FreeBSD.org Tue Nov 4 08:08:50 2008 From: thompsa at FreeBSD.org (Andrew Thompson) Date: Tue Nov 4 08:08:56 2008 Subject: svn commit: r184625 - in head: etc sys/dev/acpi_support In-Reply-To: <200811041152.mA4BqoPb095612@svn.freebsd.org> References: <200811041152.mA4BqoPb095612@svn.freebsd.org> Message-ID: <20081104160841.GF93540@citylink.fud.org.nz> On Tue, Nov 04, 2008 at 11:52:50AM +0000, Rui Paulo wrote: > Author: rpaulo > Date: Tue Nov 4 11:52:50 2008 > New Revision: 184625 > URL: http://svn.freebsd.org/changeset/base/184625 > > Log: > Add support for Asus A8Sr notebooks. > > PR: 128553 > Submitted by: Eygene Ryabinkin > Reviewed by: philip > MFC after: 2 months > > Modified: > head/etc/devd.conf > head/sys/dev/acpi_support/acpi_asus.c We could almost do with a /etc/devd.conf.d/ directory to drop in hardware specific event files. Andrew From dfr at FreeBSD.org Tue Nov 4 08:43:03 2008 From: dfr at FreeBSD.org (Doug Rabson) Date: Tue Nov 4 08:43:14 2008 Subject: svn commit: r184643 - head/sys/nfsserver Message-ID: <200811041643.mA4Gh2Sm002167@svn.freebsd.org> Author: dfr Date: Tue Nov 4 16:43:02 2008 New Revision: 184643 URL: http://svn.freebsd.org/changeset/base/184643 Log: Include . Modified: head/sys/nfsserver/nfs_srvkrpc.c Modified: head/sys/nfsserver/nfs_srvkrpc.c ============================================================================== --- head/sys/nfsserver/nfs_srvkrpc.c Tue Nov 4 16:22:14 2008 (r184642) +++ head/sys/nfsserver/nfs_srvkrpc.c Tue Nov 4 16:43:02 2008 (r184643) @@ -60,6 +60,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include From kostikbel at gmail.com Tue Nov 4 08:59:59 2008 From: kostikbel at gmail.com (Kostik Belousov) Date: Tue Nov 4 09:00:07 2008 Subject: svn commit: r184641 - in stable/7/sys: . kern In-Reply-To: <49107254.9070307@samsco.org> References: <200811041556.mA4FuijN001109@svn.freebsd.org> <49107254.9070307@samsco.org> Message-ID: <20081104165951.GQ18100@deviant.kiev.zoral.com.ua> On Tue, Nov 04, 2008 at 09:03:32AM -0700, Scott Long wrote: > In stable branches, and especially during release cycles, would it be > possible to annotate whether changes like this fix known panics or > user-visible bugs? I thought that description of the change made it obvious. Access to the partially initialized structure is sure reason for a bad behaviour, panic in this particular case. It is slightly more involved in this case, because other thread was able to overwrite pointer to fully initialized structure put by current thread. This is what prevented by vnode interlock region. > > Scott > > > Konstantin Belousov wrote: > >Author: kib > >Date: Tue Nov 4 15:56:44 2008 > >New Revision: 184641 > >URL: http://svn.freebsd.org/changeset/base/184641 > > > >Log: > > MFC r184409: > > Protect check for v_pollinfo == NULL and assignment of the newly > > allocated > > vpollinfo with vnode interlock. Fully initialize vpollinfo before putting > > pointer to it into vp->v_pollinfo. > > > > Approved by: re (kensmith) > > > >Modified: > > stable/7/sys/ (props changed) > > stable/7/sys/kern/vfs_subr.c > > > >Modified: stable/7/sys/kern/vfs_subr.c > >============================================================================== > >--- stable/7/sys/kern/vfs_subr.c Tue Nov 4 15:47:06 2008 (r184640) > >+++ stable/7/sys/kern/vfs_subr.c Tue Nov 4 15:56:44 2008 (r184641) > >@@ -109,7 +109,7 @@ static void vgonel(struct vnode *); > > static void vfs_knllock(void *arg); > > static void vfs_knlunlock(void *arg); > > static int vfs_knllocked(void *arg); > >- > >+static void destroy_vpollinfo(struct vpollinfo *vi); > > > > /* > > * Enable Giant pushdown based on whether or not the vm is mpsafe in this > >@@ -815,11 +815,8 @@ vdestroy(struct vnode *vp) > > #ifdef MAC > > mac_destroy_vnode(vp); > > #endif > >- if (vp->v_pollinfo != NULL) { > >- knlist_destroy(&vp->v_pollinfo->vpi_selinfo.si_note); > >- mtx_destroy(&vp->v_pollinfo->vpi_lock); > >- uma_zfree(vnodepoll_zone, vp->v_pollinfo); > >- } > >+ if (vp->v_pollinfo != NULL) > >+ destroy_vpollinfo(vp->v_pollinfo); > > #ifdef INVARIANTS > > /* XXX Elsewhere we can detect an already freed vnode via NULL v_op. > > */ > > vp->v_op = NULL; > >@@ -3050,6 +3047,14 @@ vbusy(struct vnode *vp) > > mtx_unlock(&vnode_free_list_mtx); > > } > > > >+static void > >+destroy_vpollinfo(struct vpollinfo *vi) > >+{ > >+ knlist_destroy(&vi->vpi_selinfo.si_note); > >+ mtx_destroy(&vi->vpi_lock); > >+ uma_zfree(vnodepoll_zone, vi); > >+} > >+ > > /* > > * Initalize per-vnode helper structure to hold poll-related state. > > */ > >@@ -3058,15 +3063,20 @@ v_addpollinfo(struct vnode *vp) > > { > > struct vpollinfo *vi; > > > >+ if (vp->v_pollinfo != NULL) > >+ return; > > vi = uma_zalloc(vnodepoll_zone, M_WAITOK); > >+ mtx_init(&vi->vpi_lock, "vnode pollinfo", NULL, MTX_DEF); > >+ knlist_init(&vi->vpi_selinfo.si_note, vp, vfs_knllock, > >+ vfs_knlunlock, vfs_knllocked); > >+ VI_LOCK(vp); > > if (vp->v_pollinfo != NULL) { > >- uma_zfree(vnodepoll_zone, vi); > >+ VI_UNLOCK(vp); > >+ destroy_vpollinfo(vi); > > return; > > } > > vp->v_pollinfo = vi; > >- mtx_init(&vp->v_pollinfo->vpi_lock, "vnode pollinfo", NULL, MTX_DEF); > >- knlist_init(&vp->v_pollinfo->vpi_selinfo.si_note, vp, vfs_knllock, > >- vfs_knlunlock, vfs_knllocked); > >+ VI_UNLOCK(vp); > > } > > > > /* > >@@ -3081,8 +3091,7 @@ int > > vn_pollrecord(struct vnode *vp, struct thread *td, int events) > > { > > > >- if (vp->v_pollinfo == NULL) > >- v_addpollinfo(vp); > >+ v_addpollinfo(vp); > > mtx_lock(&vp->v_pollinfo->vpi_lock); > > if (vp->v_pollinfo->vpi_revents & events) { > > /* > >@@ -3917,8 +3926,7 @@ vfs_kqfilter(struct vop_kqfilter_args *a > > > > kn->kn_hook = (caddr_t)vp; > > > >- if (vp->v_pollinfo == NULL) > >- v_addpollinfo(vp); > >+ v_addpollinfo(vp); > > if (vp->v_pollinfo == NULL) > > return (ENOMEM); > > knl = &vp->v_pollinfo->vpi_selinfo.si_note; -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 195 bytes Desc: not available Url : http://lists.freebsd.org/pipermail/svn-src-all/attachments/20081104/df2c71ab/attachment.pgp From ndenev at gmail.com Tue Nov 4 09:08:35 2008 From: ndenev at gmail.com (Nikolay Denev) Date: Tue Nov 4 09:08:42 2008 Subject: svn commit: r184625 - in head: etc sys/dev/acpi_support In-Reply-To: <20081104160841.GF93540@citylink.fud.org.nz> References: <200811041152.mA4BqoPb095612@svn.freebsd.org> <20081104160841.GF93540@citylink.fud.org.nz> Message-ID: <9EB5C9C2-EAE3-4508-80A0-A29E69B62D4F@gmail.com> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 4 Nov, 2008, at 18:08 , Andrew Thompson wrote: > On Tue, Nov 04, 2008 at 11:52:50AM +0000, Rui Paulo wrote: >> Author: rpaulo >> Date: Tue Nov 4 11:52:50 2008 >> New Revision: 184625 >> URL: http://svn.freebsd.org/changeset/base/184625 >> >> Log: >> Add support for Asus A8Sr notebooks. >> >> PR: 128553 >> Submitted by: Eygene Ryabinkin >> Reviewed by: philip >> MFC after: 2 months >> >> Modified: >> head/etc/devd.conf >> head/sys/dev/acpi_support/acpi_asus.c > > We could almost do with a /etc/devd.conf.d/ directory to drop in > hardware specific event files. > > > Andrew > This is exactly what I was thinking yesterday, because the devd.conf seems to continue to grow. Maybe use it only as a placeholder for includes, which can be located in /dev/devd/ or /etc/devd.conf.d/ ? And probably the events can be separated further in different files, based on the event types i.e. device, ACPI , IFNET, ZFS - -- Regards, Nikolay Denev -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.9 (Darwin) iEYEARECAAYFAkkQeygACgkQHNAJ/fLbfrnvIQCffwgbmH7y3zcQ6ftbIvsUnXIr y2oAoKJ2BbffaLRcKOjZkD9C1KJl09JA =JHSw -----END PGP SIGNATURE----- From jhb at freebsd.org Tue Nov 4 09:11:03 2008 From: jhb at freebsd.org (John Baldwin) Date: Tue Nov 4 09:11:09 2008 Subject: svn commit: r184251 - in head/sys: conf dev/cfi sys In-Reply-To: <86tzanq2cc.fsf@ds4.des.no> References: <200810250618.m9P6ICWl023370@svn.freebsd.org> <200811031703.42653.jhb@freebsd.org> <86tzanq2cc.fsf@ds4.des.no> Message-ID: <200811041116.09950.jhb@freebsd.org> On Tuesday 04 November 2008 04:15:15 am Dag-Erling Sm?rgrav wrote: > John Baldwin writes: > > M. Warner Losh writes: > > > Whose name is in the disclaimer? > > If the problem is "AUTHOR" vs "AUTHOR AND CONTRIBUTORS" then it would perhaps > > be more useful to all involved to actually state one's concerns instead of > > vague hand-waving and suggestions of evil. > > Actually, it says "Bill Paul and the voices in his head".. It turns out only sys/cfictl.h has that. All the files in sys/dev/cfi/ (which is what I had checked since they were "first" in the commit message) are fine. -- John Baldwin From keramida at FreeBSD.org Tue Nov 4 10:02:36 2008 From: keramida at FreeBSD.org (Giorgos Keramidas) Date: Tue Nov 4 10:02:42 2008 Subject: svn commit: r184645 - head/usr.bin/vmstat Message-ID: <200811041802.mA4I2aVk003708@svn.freebsd.org> Author: keramida (doc committer) Date: Tue Nov 4 18:02:35 2008 New Revision: 184645 URL: http://svn.freebsd.org/changeset/base/184645 Log: Repeat vmstat header after window.rows instead of a hardcoded 20. Use ioctl() to get the window size in vmstat(8), and force a new header to be prepended to the output every time the current window size changes. Change the number of lines before each header to the current lines of the terminal when the terminal is resized, so that the full terminal length can be used for output lines. Inspired by: svn change 175562 (same feature for iostat) Reviewed by: ru (who fixed some of my bugs too) MFC after: 1 week Modified: head/usr.bin/vmstat/vmstat.c Modified: head/usr.bin/vmstat/vmstat.c ============================================================================== --- head/usr.bin/vmstat/vmstat.c Tue Nov 4 16:45:17 2008 (r184644) +++ head/usr.bin/vmstat/vmstat.c Tue Nov 4 18:02:35 2008 (r184645) @@ -133,7 +133,10 @@ static devstat_select_mode select_mode; static struct vmmeter sum, osum; -static int winlines = 20; +#define VMSTAT_DEFAULT_LINES 20 /* Default number of `winlines'. */ +volatile sig_atomic_t wresized; /* Tty resized, when non-zero. */ +static int winlines = VMSTAT_DEFAULT_LINES; /* Current number of tty rows. */ + static int aflag; static int nflag; static int Pflag; @@ -162,6 +165,8 @@ static void kread(int, void *, size_t); static void kreado(int, void *, size_t, size_t); static char *kgetstr(const char *); static void needhdr(int); +static void needresize(int); +static void doresize(void); static void printhdr(int, u_long); static void usage(void); @@ -277,8 +282,6 @@ main(int argc, char *argv[]) errx(1, "Cannot use -P with crash dumps"); if (todo & VMSTAT) { - struct winsize winsize; - /* * Make sure that the userland devstat version matches the * kernel devstat version. If not, exit and print a @@ -289,11 +292,6 @@ main(int argc, char *argv[]) argv = getdrivedata(argv); - winsize.ws_row = 0; - (void) ioctl(STDOUT_FILENO, TIOCGWINSZ, (char *)&winsize); - if (winsize.ws_row > 0) - winlines = winsize.ws_row; - } #define BACKWARD_COMPATIBILITY @@ -578,8 +576,27 @@ dovmstat(unsigned int interval, int reps uptime = getuptime(); halfuptime = uptime / 2; + + /* + * If the user stops the program (control-Z) and then resumes it, + * print out the header again. + */ (void)signal(SIGCONT, needhdr); + /* + * If our standard output is a tty, then install a SIGWINCH handler + * and set wresized so that our first iteration through the main + * iostat loop will peek at the terminal's current rows to find out + * how many lines can fit in a screenful of output. + */ + if (isatty(fileno(stdout)) != 0) { + wresized = 1; + (void)signal(SIGWINCH, needresize); + } else { + wresized = 0; + winlines = VMSTAT_DEFAULT_LINES; + } + if (kd != NULL) { if (namelist[X_STATHZ].n_type != 0 && namelist[X_STATHZ].n_value != 0) @@ -758,7 +775,9 @@ printhdr(int ncpus, u_long cpumask) printf("\n"); } else printf(" us sy id\n"); - hdrcnt = winlines - 2; + if (wresized != 0) + doresize(); + hdrcnt = winlines; } /* @@ -771,6 +790,47 @@ needhdr(int dummy __unused) hdrcnt = 1; } +/* + * When the terminal is resized, force an update of the maximum number of rows + * printed between each header repetition. Then force a new header to be + * prepended to the next output. + */ +void +needresize(int signo) +{ + + wresized = 1; + hdrcnt = 1; +} + +/* + * Update the global `winlines' count of terminal rows. + */ +void +doresize(void) +{ + int status; + struct winsize w; + + for (;;) { + status = ioctl(fileno(stdout), TIOCGWINSZ, &w); + if (status == -1 && errno == EINTR) + continue; + else if (status == -1) + err(1, "ioctl"); + if (w.ws_row > 3) + winlines = w.ws_row - 3; + else + winlines = VMSTAT_DEFAULT_LINES; + break; + } + + /* + * Inhibit doresize() calls until we are rescheduled by SIGWINCH. + */ + wresized = 0; +} + #ifdef notyet static void dotimes(void) From keramida at FreeBSD.org Tue Nov 4 10:20:54 2008 From: keramida at FreeBSD.org (Giorgos Keramidas) Date: Tue Nov 4 10:21:06 2008 Subject: svn commit: r184646 - head/usr.bin/vmstat Message-ID: <200811041820.mA4IKsUg004108@svn.freebsd.org> Author: keramida (doc committer) Date: Tue Nov 4 18:20:54 2008 New Revision: 184646 URL: http://svn.freebsd.org/changeset/base/184646 Log: Fix comment typo that managed to sneak in when I copy pasted some comments & code from iostat. Modified: head/usr.bin/vmstat/vmstat.c Modified: head/usr.bin/vmstat/vmstat.c ============================================================================== --- head/usr.bin/vmstat/vmstat.c Tue Nov 4 18:02:35 2008 (r184645) +++ head/usr.bin/vmstat/vmstat.c Tue Nov 4 18:20:54 2008 (r184646) @@ -586,7 +586,7 @@ dovmstat(unsigned int interval, int reps /* * If our standard output is a tty, then install a SIGWINCH handler * and set wresized so that our first iteration through the main - * iostat loop will peek at the terminal's current rows to find out + * vmstat loop will peek at the terminal's current rows to find out * how many lines can fit in a screenful of output. */ if (isatty(fileno(stdout)) != 0) { From jhb at FreeBSD.org Tue Nov 4 10:53:33 2008 From: jhb at FreeBSD.org (John Baldwin) Date: Tue Nov 4 10:53:45 2008 Subject: svn commit: r184649 - head/sys/compat/linprocfs Message-ID: <200811041853.mA4IrXIV004781@svn.freebsd.org> Author: jhb Date: Tue Nov 4 18:53:33 2008 New Revision: 184649 URL: http://svn.freebsd.org/changeset/base/184649 Log: Don't leak a reference on the /compat/linux vnode everytime the linprocfs 'mtab' file is read. MFC after: 1 month Modified: head/sys/compat/linprocfs/linprocfs.c Modified: head/sys/compat/linprocfs/linprocfs.c ============================================================================== --- head/sys/compat/linprocfs/linprocfs.c Tue Nov 4 18:38:48 2008 (r184648) +++ head/sys/compat/linprocfs/linprocfs.c Tue Nov 4 18:53:33 2008 (r184649) @@ -318,11 +318,13 @@ linprocfs_domtab(PFS_FILL_ARGS) NDINIT(&nd, LOOKUP, FOLLOW | MPSAFE, UIO_SYSSPACE, linux_emul_path, td); flep = NULL; error = namei(&nd); - VFS_UNLOCK_GIANT(NDHASGIANT(&nd)); - if (error != 0 || vn_fullpath(td, nd.ni_vp, &dlep, &flep) != 0) - lep = linux_emul_path; - else - lep = dlep; + lep = linux_emul_path; + if (error == 0) { + if (vn_fullpath(td, nd.ni_vp, &dlep, &flep) != 0) + lep = dlep; + vrele(nd.ni_vp); + VFS_UNLOCK_GIANT(NDHASGIANT(&nd)); + } lep_len = strlen(lep); mtx_lock(&mountlist_mtx); From jhb at FreeBSD.org Tue Nov 4 10:54:45 2008 From: jhb at FreeBSD.org (John Baldwin) Date: Tue Nov 4 10:54:51 2008 Subject: svn commit: r184650 - head/sys/fs/unionfs Message-ID: <200811041854.mA4IsiuL004838@svn.freebsd.org> Author: jhb Date: Tue Nov 4 18:54:44 2008 New Revision: 184650 URL: http://svn.freebsd.org/changeset/base/184650 Log: Don't pass WANTPARENT to the pathname lookup of the mount point for a unionfs mount just so we can immediately drop the reference on the parent directory vnode without using it. Modified: head/sys/fs/unionfs/union_vfsops.c Modified: head/sys/fs/unionfs/union_vfsops.c ============================================================================== --- head/sys/fs/unionfs/union_vfsops.c Tue Nov 4 18:53:33 2008 (r184649) +++ head/sys/fs/unionfs/union_vfsops.c Tue Nov 4 18:54:44 2008 (r184650) @@ -268,7 +268,7 @@ unionfs_domount(struct mount *mp, struct /* * Find upper node */ - NDINIT(ndp, LOOKUP, FOLLOW | WANTPARENT | LOCKLEAF, UIO_SYSSPACE, target, td); + NDINIT(ndp, LOOKUP, FOLLOW | LOCKLEAF, UIO_SYSSPACE, target, td); if ((error = namei(ndp))) return (error); @@ -278,9 +278,6 @@ unionfs_domount(struct mount *mp, struct lowerrootvp = mp->mnt_vnodecovered; upperrootvp = ndp->ni_vp; - vrele(ndp->ni_dvp); - ndp->ni_dvp = NULLVP; - /* create unionfs_mount */ ump = (struct unionfs_mount *)malloc(sizeof(struct unionfs_mount), M_UNIONFSMNT, M_WAITOK | M_ZERO); From jhb at FreeBSD.org Tue Nov 4 10:56:12 2008 From: jhb at FreeBSD.org (John Baldwin) Date: Tue Nov 4 10:56:24 2008 Subject: svn commit: r184651 - head/sys/ufs/ufs Message-ID: <200811041856.mA4IuCli004914@svn.freebsd.org> Author: jhb Date: Tue Nov 4 18:56:12 2008 New Revision: 184651 URL: http://svn.freebsd.org/changeset/base/184651 Log: Quiet a WITNESS warning with the dirhash sx locks by setting the DUPOK flag. Specifically, if two threads race to create a dirhash for a directory, then one might already have created a private dirhash structure (and locked it) when it realizes the directory now has a structure and tries to lock that one. Modified: head/sys/ufs/ufs/ufs_dirhash.c Modified: head/sys/ufs/ufs/ufs_dirhash.c ============================================================================== --- head/sys/ufs/ufs/ufs_dirhash.c Tue Nov 4 18:54:44 2008 (r184650) +++ head/sys/ufs/ufs/ufs_dirhash.c Tue Nov 4 18:56:12 2008 (r184651) @@ -181,7 +181,16 @@ ufsdirhash_create(struct inode *ip) if (ndh == NULL) return (NULL); refcount_init(&ndh->dh_refcount, 1); - sx_init(&ndh->dh_lock, "dirhash"); + + /* + * The DUPOK is to prevent warnings from the + * sx_slock() a few lines down which is safe + * since the duplicate lock in that case is + * the one for this dirhash we are creating + * now which has no external references until + * after this function returns. + */ + sx_init_flags(&ndh->dh_lock, "dirhash", SX_DUPOK); sx_xlock(&ndh->dh_lock); } /* From jhb at FreeBSD.org Tue Nov 4 11:04:01 2008 From: jhb at FreeBSD.org (John Baldwin) Date: Tue Nov 4 11:04:08 2008 Subject: svn commit: r184652 - in head/sys: dev/hwpmc fs/procfs kern Message-ID: <200811041904.mA4J41dL005103@svn.freebsd.org> Author: jhb Date: Tue Nov 4 19:04:01 2008 New Revision: 184652 URL: http://svn.freebsd.org/changeset/base/184652 Log: Remove unnecessary locking around vn_fullpath(). The vnode lock for the vnode in question does not need to be held. All the data structures used during the name lookup are protected by the global name cache lock. Instead, the caller merely needs to ensure a reference is held on the vnode (such as vhold()) to keep it from being freed. In the case of procfs' /file entry, grab the process lock while we gain a new reference (via vhold()) on p_textvp to fully close races with execve(2). For the kern.proc.vmmap sysctl handler, use a shared vnode lock around the call to VOP_GETATTR() rather than an exclusive lock. MFC after: 1 month Modified: head/sys/dev/hwpmc/hwpmc_mod.c head/sys/fs/procfs/procfs.c head/sys/fs/procfs/procfs_map.c head/sys/kern/kern_descrip.c head/sys/kern/kern_proc.c Modified: head/sys/dev/hwpmc/hwpmc_mod.c ============================================================================== --- head/sys/dev/hwpmc/hwpmc_mod.c Tue Nov 4 18:56:12 2008 (r184651) +++ head/sys/dev/hwpmc/hwpmc_mod.c Tue Nov 4 19:04:01 2008 (r184652) @@ -680,9 +680,7 @@ pmc_getfilename(struct vnode *v, char ** *fullpath = "unknown"; *freepath = NULL; - vn_lock(v, LK_CANRECURSE | LK_EXCLUSIVE | LK_RETRY); vn_fullpath(curthread, v, fullpath, freepath); - VOP_UNLOCK(v, 0); } /* Modified: head/sys/fs/procfs/procfs.c ============================================================================== --- head/sys/fs/procfs/procfs.c Tue Nov 4 18:56:12 2008 (r184651) +++ head/sys/fs/procfs/procfs.c Tue Nov 4 19:04:01 2008 (r184652) @@ -70,17 +70,13 @@ procfs_doprocfile(PFS_FILL_ARGS) char *fullpath = "unknown"; char *freepath = NULL; struct vnode *textvp; - int err; + PROC_LOCK(p); textvp = p->p_textvp; - VI_LOCK(textvp); - vholdl(textvp); - err = vn_lock(textvp, LK_EXCLUSIVE | LK_INTERLOCK); - vdrop(textvp); - if (err) - return (err); + vhold(textvp); + PROC_UNLOCK(p); vn_fullpath(td, textvp, &fullpath, &freepath); - VOP_UNLOCK(textvp, 0); + vdrop(textvp); sbuf_printf(sb, "%s", fullpath); if (freepath) free(freepath, M_TEMP); Modified: head/sys/fs/procfs/procfs_map.c ============================================================================== --- head/sys/fs/procfs/procfs_map.c Tue Nov 4 18:56:12 2008 (r184651) +++ head/sys/fs/procfs/procfs_map.c Tue Nov 4 19:04:01 2008 (r184652) @@ -175,10 +175,9 @@ procfs_doprocmap(PFS_FILL_ARGS) shadow_count = obj->shadow_count; VM_OBJECT_UNLOCK(obj); if (vp != NULL) { - vfslocked = VFS_LOCK_GIANT(vp->v_mount); - vn_lock(vp, LK_EXCLUSIVE | LK_RETRY); vn_fullpath(td, vp, &fullpath, &freepath); - vput(vp); + vfslocked = VFS_LOCK_GIANT(vp->v_mount); + vrele(vp); VFS_UNLOCK_GIANT(vfslocked); } } else { Modified: head/sys/kern/kern_descrip.c ============================================================================== --- head/sys/kern/kern_descrip.c Tue Nov 4 18:56:12 2008 (r184651) +++ head/sys/kern/kern_descrip.c Tue Nov 4 19:04:01 2008 (r184652) @@ -2537,10 +2537,9 @@ export_vnode_for_sysctl(struct vnode *vp freepath = NULL; fullpath = "-"; FILEDESC_SUNLOCK(fdp); - vfslocked = VFS_LOCK_GIANT(vp->v_mount); - vn_lock(vp, LK_EXCLUSIVE | LK_RETRY); vn_fullpath(curthread, vp, &fullpath, &freepath); - vput(vp); + vfslocked = VFS_LOCK_GIANT(vp->v_mount); + vrele(vp); VFS_UNLOCK_GIANT(vfslocked); strlcpy(kif->kf_path, fullpath, sizeof(kif->kf_path)); if (freepath != NULL) @@ -2708,10 +2707,9 @@ sysctl_kern_proc_filedesc(SYSCTL_HANDLER freepath = NULL; fullpath = "-"; FILEDESC_SUNLOCK(fdp); - vfslocked = VFS_LOCK_GIANT(vp->v_mount); - vn_lock(vp, LK_EXCLUSIVE | LK_RETRY); vn_fullpath(curthread, vp, &fullpath, &freepath); - vput(vp); + vfslocked = VFS_LOCK_GIANT(vp->v_mount); + vrele(vp); VFS_UNLOCK_GIANT(vfslocked); strlcpy(kif->kf_path, fullpath, sizeof(kif->kf_path)); Modified: head/sys/kern/kern_proc.c ============================================================================== --- head/sys/kern/kern_proc.c Tue Nov 4 18:56:12 2008 (r184651) +++ head/sys/kern/kern_proc.c Tue Nov 4 19:04:01 2008 (r184652) @@ -1440,11 +1440,11 @@ sysctl_kern_proc_vmmap(SYSCTL_HANDLER_AR kve->kve_shadow_count = obj->shadow_count; VM_OBJECT_UNLOCK(obj); if (vp != NULL) { - vfslocked = VFS_LOCK_GIANT(vp->v_mount); - vn_lock(vp, LK_EXCLUSIVE | LK_RETRY); vn_fullpath(curthread, vp, &fullpath, &freepath); cred = curthread->td_ucred; + vfslocked = VFS_LOCK_GIANT(vp->v_mount); + vn_lock(vp, LK_SHARED | LK_RETRY); if (VOP_GETATTR(vp, &va, cred) == 0) { kve->kve_fileid = va.va_fileid; kve->kve_fsid = va.va_fsid; From jhb at FreeBSD.org Tue Nov 4 11:13:54 2008 From: jhb at FreeBSD.org (John Baldwin) Date: Tue Nov 4 11:14:00 2008 Subject: svn commit: r184653 - head/sys/kern Message-ID: <200811041913.mA4JDrle005314@svn.freebsd.org> Author: jhb Date: Tue Nov 4 19:13:53 2008 New Revision: 184653 URL: http://svn.freebsd.org/changeset/base/184653 Log: Don't bother calling setrunnable() and clearing the sleeping flag in sleepq_resume_thread() if the thread isn't asleep. Modified: head/sys/kern/subr_sleepqueue.c Modified: head/sys/kern/subr_sleepqueue.c ============================================================================== --- head/sys/kern/subr_sleepqueue.c Tue Nov 4 19:04:01 2008 (r184652) +++ head/sys/kern/subr_sleepqueue.c Tue Nov 4 19:13:53 2008 (r184653) @@ -680,22 +680,25 @@ sleepq_resume_thread(struct sleepqueue * td->td_wchan = NULL; td->td_flags &= ~TDF_SINTR; - /* - * Note that thread td might not be sleeping if it is running - * sleepq_catch_signals() on another CPU or is blocked on - * its proc lock to check signals. It doesn't hurt to clear - * the sleeping flag if it isn't set though, so we just always - * do it. However, we can't assert that it is set. - */ CTR3(KTR_PROC, "sleepq_wakeup: thread %p (pid %ld, %s)", (void *)td, (long)td->td_proc->p_pid, td->td_name); - TD_CLR_SLEEPING(td); /* Adjust priority if requested. */ MPASS(pri == 0 || (pri >= PRI_MIN && pri <= PRI_MAX)); if (pri != 0 && td->td_priority > pri) sched_prio(td, pri); - return (setrunnable(td)); + + /* + * Note that thread td might not be sleeping if it is running + * sleepq_catch_signals() on another CPU or is blocked on its + * proc lock to check signals. There's no need to mark the + * thread runnable in that case. + */ + if (TD_IS_SLEEPING(td)) { + TD_CLR_SLEEPING(td); + return (setrunnable(td)); + } + return (0); } #ifdef INVARIANTS From mlaier at FreeBSD.org Tue Nov 4 11:17:32 2008 From: mlaier at FreeBSD.org (Max Laier) Date: Tue Nov 4 11:17:38 2008 Subject: svn commit: r184654 - head/usr.bin/du Message-ID: <200811041917.mA4JHW5V005444@svn.freebsd.org> Author: mlaier Date: Tue Nov 4 19:17:32 2008 New Revision: 184654 URL: http://svn.freebsd.org/changeset/base/184654 Log: style(9): mostly avoiding line wrap by not indenting cases. No obj change. Modified: head/usr.bin/du/du.c Modified: head/usr.bin/du/du.c ============================================================================== --- head/usr.bin/du/du.c Tue Nov 4 19:13:53 2008 (r184653) +++ head/usr.bin/du/du.c Tue Nov 4 19:17:32 2008 (r184654) @@ -85,7 +85,7 @@ main(int argc, char *argv[]) { FTS *fts; FTSENT *p; - off_t savednumber = 0; + off_t savednumber; long blocksize; int ftsoptions; int listall; @@ -102,75 +102,77 @@ main(int argc, char *argv[]) save = argv; ftsoptions = 0; + savednumber = 0; depth = INT_MAX; SLIST_INIT(&ignores); while ((ch = getopt(argc, argv, "HI:LPasd:chklmnrx")) != -1) switch (ch) { - case 'H': - Hflag = 1; - break; - case 'I': - ignoreadd(optarg); - break; - case 'L': - if (Pflag) - usage(); - Lflag = 1; - break; - case 'P': - if (Lflag) - usage(); - Pflag = 1; - break; - case 'a': - aflag = 1; - break; - case 's': - sflag = 1; - break; - case 'd': - dflag = 1; - errno = 0; - depth = atoi(optarg); - if (errno == ERANGE || depth < 0) { - warnx("invalid argument to option d: %s", optarg); - usage(); - } - break; - case 'c': - cflag = 1; - break; - case 'h': - if (setenv("BLOCKSIZE", "512", 1) == -1) - warn( - "setenv: cannot set BLOCKSIZE=512"); - hflag = 1; - break; - case 'k': - hflag = 0; - if (setenv("BLOCKSIZE", "1024", 1) == -1) - warn("setenv: cannot set BLOCKSIZE=1024"); - break; - case 'l': - lflag = 1; - break; - case 'm': - hflag = 0; - if (setenv("BLOCKSIZE", "1048576", 1) == -1) - warn("setenv: cannot set BLOCKSIZE=1048576"); - break; - case 'n': - nodumpflag = 1; - break; - case 'r': /* Compatibility. */ - break; - case 'x': - ftsoptions |= FTS_XDEV; - break; - case '?': - default: + case 'H': + Hflag = 1; + break; + case 'I': + ignoreadd(optarg); + break; + case 'L': + if (Pflag) + usage(); + Lflag = 1; + break; + case 'P': + if (Lflag) + usage(); + Pflag = 1; + break; + case 'a': + aflag = 1; + break; + case 's': + sflag = 1; + break; + case 'd': + dflag = 1; + errno = 0; + depth = atoi(optarg); + if (errno == ERANGE || depth < 0) { + warnx("invalid argument to option d: %s", + optarg); usage(); + } + break; + case 'c': + cflag = 1; + break; + case 'h': + if (setenv("BLOCKSIZE", "512", 1) == -1) + warn("setenv: cannot set BLOCKSIZE=512"); + hflag = 1; + break; + case 'k': + hflag = 0; + if (setenv("BLOCKSIZE", "1024", 1) == -1) + warn("setenv: cannot set BLOCKSIZE=1024"); + break; + case 'l': + lflag = 1; + break; + case 'm': + hflag = 0; + if (setenv("BLOCKSIZE", "1048576", 1) == -1) + warn("setenv: cannot set BLOCKSIZE=1048576"); + break; + case 'n': + nodumpflag = 1; + break; + case 'r': /* Compatibility. */ + break; + case 'x': + ftsoptions |= FTS_XDEV; + break; + case '?': + default: + usage(); + /* NOTREACHED */ } argc -= optind; @@ -222,7 +224,7 @@ main(int argc, char *argv[]) argv[1] = NULL; } - (void) getbsize(¬used, &blocksize); + (void)getbsize(¬used, &blocksize); blocksize /= 512; rval = 0; @@ -232,57 +234,60 @@ main(int argc, char *argv[]) while ((p = fts_read(fts)) != NULL) { switch (p->fts_info) { - case FTS_D: /* Ignore. */ - if (ignorep(p)) - fts_set(fts, p, FTS_SKIP); - break; - case FTS_DP: - if (ignorep(p)) - break; - - p->fts_parent->fts_bignum += - p->fts_bignum += p->fts_statp->st_blocks; - - if (p->fts_level <= depth) { - if (hflag) { - (void) prthumanval(howmany(p->fts_bignum, blocksize)); - (void) printf("\t%s\n", p->fts_path); - } else { - (void) printf("%jd\t%s\n", - (intmax_t)howmany(p->fts_bignum, blocksize), - p->fts_path); - } + case FTS_D: /* Ignore. */ + if (ignorep(p)) + fts_set(fts, p, FTS_SKIP); + break; + case FTS_DP: + if (ignorep(p)) + break; + + p->fts_parent->fts_bignum += p->fts_bignum += + p->fts_statp->st_blocks; + + if (p->fts_level <= depth) { + if (hflag) { + prthumanval(howmany(p->fts_bignum, + blocksize)); + (void)printf("\t%s\n", p->fts_path); + } else { + (void)printf("%jd\t%s\n", + (intmax_t)howmany(p->fts_bignum, + blocksize), p->fts_path); } - break; - case FTS_DC: /* Ignore. */ - break; - case FTS_DNR: /* Warn, continue. */ - case FTS_ERR: - case FTS_NS: - warnx("%s: %s", p->fts_path, strerror(p->fts_errno)); - rval = 1; - break; - default: - if (ignorep(p)) - break; - - if (lflag == 0 && - p->fts_statp->st_nlink > 1 && linkchk(p)) - break; - - if (listall || p->fts_level == 0) { - if (hflag) { - (void) prthumanval(howmany(p->fts_statp->st_blocks, - blocksize)); - (void) printf("\t%s\n", p->fts_path); - } else { - (void) printf("%jd\t%s\n", - (intmax_t)howmany(p->fts_statp->st_blocks, blocksize), - p->fts_path); - } + } + break; + case FTS_DC: /* Ignore. */ + break; + case FTS_DNR: /* Warn, continue. */ + case FTS_ERR: + case FTS_NS: + warnx("%s: %s", p->fts_path, strerror(p->fts_errno)); + rval = 1; + break; + default: + if (ignorep(p)) + break; + + if (lflag == 0 && p->fts_statp->st_nlink > 1 && + linkchk(p)) + break; + + if (listall || p->fts_level == 0) { + if (hflag) { + prthumanval(howmany( + p->fts_statp->st_blocks, + blocksize)); + (void)printf("\t%s\n", p->fts_path); + } else { + (void)printf("%jd\t%s\n", + (intmax_t)howmany( + p->fts_statp->st_blocks, + blocksize), p->fts_path); } + } - p->fts_parent->fts_bignum += p->fts_statp->st_blocks; + p->fts_parent->fts_bignum += p->fts_statp->st_blocks; } savednumber = p->fts_parent->fts_bignum; } @@ -292,10 +297,11 @@ main(int argc, char *argv[]) if (cflag) { if (hflag) { - (void) prthumanval(howmany(savednumber, blocksize)); - (void) printf("\ttotal\n"); + prthumanval(howmany(savednumber, blocksize)); + (void)printf("\ttotal\n"); } else { - (void) printf("%jd\ttotal\n", (intmax_t)howmany(savednumber, blocksize)); + (void)printf("%jd\ttotal\n", (intmax_t)howmany( + savednumber, blocksize)); } } @@ -348,7 +354,8 @@ linkchk(FTSENT *p) free_list = le->next; free(le); } - new_buckets = malloc(new_size * sizeof(new_buckets[0])); + new_buckets = malloc(new_size * + sizeof(new_buckets[0])); } if (new_buckets == NULL) { From remko at FreeBSD.org Tue Nov 4 11:20:19 2008 From: remko at FreeBSD.org (Remko Lodder) Date: Tue Nov 4 11:20:31 2008 Subject: svn commit: r184655 - head/share/misc Message-ID: <200811041920.mA4JKJkc005551@svn.freebsd.org> Author: remko Date: Tue Nov 4 19:20:19 2008 New Revision: 184655 URL: http://svn.freebsd.org/changeset/base/184655 Log: Add Rene Ladan, as well as my relationship towards Rene. Modified: head/share/misc/committers-doc.dot Modified: head/share/misc/committers-doc.dot ============================================================================== --- head/share/misc/committers-doc.dot Tue Nov 4 19:17:32 2008 (r184654) +++ head/share/misc/committers-doc.dot Tue Nov 4 19:20:19 2008 (r184655) @@ -66,6 +66,7 @@ nik [label="Nik Clayton\nnik@FreeBSD.org pav [label="Pav Lucistnik\npav@FreeBSD.org\n2005/08/12"] pgj [label="Gabor Pali\npgj@FreeBSD.org\n2008/04/21"] remko [label="Remko Lodder\nremko@FreeBSD.org\n2004/10/16"] +rene [label="Rene Ladan\nrene@FreeBSD.org\n2008/11/03"] roam [label="Peter Pentchev\nroam@FreeBSD.org\n2003/02/14"] simon [label="Simon L. Nielsen\nsimon@FreeBSD.org\n2003/07/20"] trhodes [label="Tom Rhodes\ntrhodes@FreeBSD.org\n2002/03/25"] @@ -116,6 +117,7 @@ nik -> bmah nik -> keramida remko -> jkois +remko -> rene simon -> josef simon -> remko From mlaier at FreeBSD.org Tue Nov 4 11:23:49 2008 From: mlaier at FreeBSD.org (Max Laier) Date: Tue Nov 4 11:23:56 2008 Subject: svn commit: r184656 - head/usr.bin/du Message-ID: <200811041923.mA4JNnLO005697@svn.freebsd.org> Author: mlaier Date: Tue Nov 4 19:23:48 2008 New Revision: 184656 URL: http://svn.freebsd.org/changeset/base/184656 Log: Declare functions and variables static and save a few byte. This is a style(9)-change, too. Separate commit as it changes the object. Modified: head/usr.bin/du/du.c Modified: head/usr.bin/du/du.c ============================================================================== --- head/usr.bin/du/du.c Tue Nov 4 19:20:19 2008 (r184655) +++ head/usr.bin/du/du.c Tue Nov 4 19:23:48 2008 (r184656) @@ -73,12 +73,12 @@ struct ignentry { static int linkchk(FTSENT *); static void usage(void); -void prthumanval(int64_t); -void ignoreadd(const char *); -void ignoreclean(void); -int ignorep(FTSENT *); +static void prthumanval(int64_t); +static void ignoreadd(const char *); +static void ignoreclean(void); +static int ignorep(FTSENT *); -int nodumpflag = 0; +static int nodumpflag = 0; int main(int argc, char *argv[]) @@ -443,7 +443,7 @@ linkchk(FTSENT *p) return (0); } -void +static void prthumanval(int64_t bytes) { char buf[5]; @@ -465,7 +465,7 @@ usage(void) exit(EX_USAGE); } -void +static void ignoreadd(const char *mask) { struct ignentry *ign; @@ -479,7 +479,7 @@ ignoreadd(const char *mask) SLIST_INSERT_HEAD(&ignores, ign, next); } -void +static void ignoreclean(void) { struct ignentry *ign; @@ -492,7 +492,7 @@ ignoreclean(void) } } -int +static int ignorep(FTSENT *ent) { struct ignentry *ign; From rink at FreeBSD.org Tue Nov 4 11:28:19 2008 From: rink at FreeBSD.org (Rink Springer) Date: Tue Nov 4 11:28:31 2008 Subject: svn commit: r184658 - head/sys/dev/usb2/wlan Message-ID: <200811041928.mA4JSJsM005883@svn.freebsd.org> Author: rink Date: Tue Nov 4 19:28:19 2008 New Revision: 184658 URL: http://svn.freebsd.org/changeset/base/184658 Log: Fix the build (on at least powerpc) by moving the htole16() from the case(x) expression directly to the switch(x) itself. Reviewed by: imp@ Modified: head/sys/dev/usb2/wlan/if_zyd2.c Modified: head/sys/dev/usb2/wlan/if_zyd2.c ============================================================================== --- head/sys/dev/usb2/wlan/if_zyd2.c Tue Nov 4 19:26:39 2008 (r184657) +++ head/sys/dev/usb2/wlan/if_zyd2.c Tue Nov 4 19:28:19 2008 (r184658) @@ -392,10 +392,10 @@ zyd_intr_read_callback(struct usb2_xfer usb2_copy_out(xfer->frbuffers, 0, &sc->sc_intr_ibuf, actlen); - switch (cmd->code) { - case htole16(ZYD_NOTIF_RETRYSTATUS): + switch (htole16(cmd->code)) { + case ZYD_NOTIF_RETRYSTATUS: goto handle_notif_retrystatus; - case htole16(ZYD_NOTIF_IORD): + case ZYD_NOTIF_IORD: goto handle_notif_iord; default: DPRINTFN(2, "unknown indication: 0x%04x\n", From rbgarga at gmail.com Tue Nov 4 12:22:01 2008 From: rbgarga at gmail.com (Renato Botelho) Date: Tue Nov 4 12:22:07 2008 Subject: svn commit: r184625 - in head: etc sys/dev/acpi_support In-Reply-To: <200811041152.mA4BqoPb095612@svn.freebsd.org> References: <200811041152.mA4BqoPb095612@svn.freebsd.org> Message-ID: <747dc8f30811041156qe2b710ape595c5671bc0ddf5@mail.gmail.com> On Tue, Nov 4, 2008 at 9:52 AM, Rui Paulo wrote: > Author: rpaulo > Date: Tue Nov 4 11:52:50 2008 > New Revision: 184625 > URL: http://svn.freebsd.org/changeset/base/184625 > > Log: > Add support for Asus A8Sr notebooks. > > PR: 128553 > Submitted by: Eygene Ryabinkin > Reviewed by: philip > MFC after: 2 months > > Modified: > head/etc/devd.conf > head/sys/dev/acpi_support/acpi_asus.c > > Modified: head/etc/devd.conf > ============================================================================== > --- head/etc/devd.conf Tue Nov 4 11:31:09 2008 (r184624) > +++ head/etc/devd.conf Tue Nov 4 11:52:50 2008 (r184625) > @@ -255,6 +255,28 @@ notify 10 { > action "/etc/rc.resume acpi $notify"; > }; > > +# The next blocks enable volume hotkeys that can be found on the Asus laptops > +notify 0 { > + match "system" "ACPI"; > + match "subsystem" "ASUS"; > + match "notify" "0x32"; > + action "mixer 0"; > +}; > + > +notify 0 { > + match "system" "ACPI"; > + match "subsystem"i "ASUS"; devd.conf part is broken, you forgot a wrong "i" there -- Renato Botelho From rink at FreeBSD.org Tue Nov 4 12:57:40 2008 From: rink at FreeBSD.org (Rink Springer) Date: Tue Nov 4 12:57:51 2008 Subject: svn commit: r184659 - head/sys/dev/usb2/wlan Message-ID: <200811042057.mA4KvenY007508@svn.freebsd.org> Author: rink Date: Tue Nov 4 20:57:39 2008 New Revision: 184659 URL: http://svn.freebsd.org/changeset/base/184659 Log: Even though the previous commit was functionally equivalent with the code it replaced, it was wrong: le16toh should have been used. Note that these changes will not make the driver work on powerpc, but it should fix at least the i386/amd64 cases. Obtained from: //depot/projects/usb/src/sys/dev/usb2/wlan/if_zyd2.c#20 Noticed by: jeli, ed Modified: head/sys/dev/usb2/wlan/if_zyd2.c Modified: head/sys/dev/usb2/wlan/if_zyd2.c ============================================================================== --- head/sys/dev/usb2/wlan/if_zyd2.c Tue Nov 4 19:28:19 2008 (r184658) +++ head/sys/dev/usb2/wlan/if_zyd2.c Tue Nov 4 20:57:39 2008 (r184659) @@ -392,7 +392,7 @@ zyd_intr_read_callback(struct usb2_xfer usb2_copy_out(xfer->frbuffers, 0, &sc->sc_intr_ibuf, actlen); - switch (htole16(cmd->code)) { + switch (le16toh(cmd->code)) { case ZYD_NOTIF_RETRYSTATUS: goto handle_notif_retrystatus; case ZYD_NOTIF_IORD: From dds at aueb.gr Tue Nov 4 13:15:52 2008 From: dds at aueb.gr (Diomidis Spinellis) Date: Tue Nov 4 13:15:59 2008 Subject: svn commit: r184645 - head/usr.bin/vmstat In-Reply-To: <200811041802.mA4I2aVk003708@svn.freebsd.org> References: <200811041802.mA4I2aVk003708@svn.freebsd.org> Message-ID: On Nov 4, 2008, at 8:02 PM, Giorgos Keramidas wrote: > Author: keramida (doc committer) > Date: Tue Nov 4 18:02:35 2008 > New Revision: 184645 > URL: http://svn.freebsd.org/changeset/base/184645 > > Log: > Repeat vmstat header after window.rows instead of a hardcoded 20. > > Use ioctl() to get the window size in vmstat(8), and force a new > header to be prepended to the output every time the current window > size changes. Change the number of lines before each header to the > current lines of the terminal when the terminal is resized, so that > the full terminal length can be used for output lines. > > Inspired by: svn change 175562 (same feature for iostat) > Reviewed by: ru (who fixed some of my bugs too) Thanks! This functionality is generally useful and tricky to code in a correct way. Should we perhaps package it in a library function, so that all header-printing commands can benefit from it, without repeating the code? Diomidis Spinellis - dds@ From jhb at freebsd.org Tue Nov 4 14:09:36 2008 From: jhb at freebsd.org (John Baldwin) Date: Tue Nov 4 14:09:47 2008 Subject: svn commit: r184217 - head/sys/kern In-Reply-To: <200810240109.m9O19P1u071214@svn.freebsd.org> References: <200810240109.m9O19P1u071214@svn.freebsd.org> Message-ID: <200811041705.48043.jhb@freebsd.org> On Thursday 23 October 2008 09:09:25 pm David Xu wrote: > Author: davidxu > Date: Fri Oct 24 01:09:24 2008 > New Revision: 184217 > URL: http://svn.freebsd.org/changeset/base/184217 > > Log: > Don't rearm callout if the process is exiting, it may leak a callout > because callout_drain() only waits for running callout, but not disable > it if it is rearmed. Can you please revert this as per previous discussion? -- John Baldwin From jhb at freebsd.org Tue Nov 4 14:09:42 2008 From: jhb at freebsd.org (John Baldwin) Date: Tue Nov 4 14:09:58 2008 Subject: svn commit: r184216 - head/sys/kern In-Reply-To: <200810240103.m9O13V7f071075@svn.freebsd.org> References: <200810240103.m9O13V7f071075@svn.freebsd.org> Message-ID: <200811041707.26052.jhb@freebsd.org> On Thursday 23 October 2008 09:03:31 pm David Xu wrote: > Author: davidxu > Date: Fri Oct 24 01:03:31 2008 > New Revision: 184216 > URL: http://svn.freebsd.org/changeset/base/184216 > > Log: > partly revert revision 184199, because TDF_NEEDSIGCHK is persitent > when thread is in kernel mode, it can cause dead loop, now unlock > process lock after acquired sleep queue lock and thread lock to > avoid the problem. This means TDF_NEEDSIGCHK and TDF_NEEDSUSPCHK must > be set with process lock and thread lock being hold at same time. You can't unlock the proc lock while holding the thread_lock(). This will lead to deadlock due to the way that thread_lock() works. This is different from the rules in 6.x where you could drop a mutex while holding sched_lock. You will need to revert this. -- John Baldwin From jhb at freebsd.org Tue Nov 4 14:09:49 2008 From: jhb at freebsd.org (John Baldwin) Date: Tue Nov 4 14:10:08 2008 Subject: svn commit: r184199 - in head/sys: kern sys In-Reply-To: <200810230755.m9N7tceu051313@svn.freebsd.org> References: <200810230755.m9N7tceu051313@svn.freebsd.org> Message-ID: <200811041708.42804.jhb@freebsd.org> On Thursday 23 October 2008 03:55:38 am David Xu wrote: > Author: davidxu > Date: Thu Oct 23 07:55:38 2008 > New Revision: 184199 > URL: http://svn.freebsd.org/changeset/base/184199 > > Log: > Actually, for signal and thread suspension, extra process spin lock is > unnecessary, the normal process lock and thread lock are enough. The > spin lock is still needed for process and thread exiting to mimic > single sched_lock. With thread_lock() it is not safe to drop a mutex while holding thread_lock(). Instead, it can result in a deadlock. Peter has a test case that deadlocks due to these changes. Please revert this. -- John Baldwin From ivoras at gmail.com Tue Nov 4 14:18:24 2008 From: ivoras at gmail.com (Ivan Voras) Date: Tue Nov 4 14:18:31 2008 Subject: svn commit: r184645 - head/usr.bin/vmstat In-Reply-To: References: <200811041802.mA4I2aVk003708@svn.freebsd.org> Message-ID: <9bbcef730811041416o6eaf3033k459fb4d29c9e231a@mail.gmail.com> 2008/11/4 Diomidis Spinellis : > On Nov 4, 2008, at 8:02 PM, Giorgos Keramidas wrote: > >> Author: keramida (doc committer) >> Date: Tue Nov 4 18:02:35 2008 >> New Revision: 184645 >> URL: http://svn.freebsd.org/changeset/base/184645 >> >> Log: >> Repeat vmstat header after window.rows instead of a hardcoded 20. > Thanks! This functionality is generally useful and tricky to code in a > correct way. Any objections to http://people.freebsd.org/~ivoras/diffs/vmstat.c.patch.txt ? It uses humanize_number on interrupt, syscall and context switch counts. From ivoras at gmail.com Tue Nov 4 14:22:50 2008 From: ivoras at gmail.com (Ivan Voras) Date: Tue Nov 4 14:23:01 2008 Subject: svn commit: r184652 - in head/sys: dev/hwpmc fs/procfs kern In-Reply-To: <200811041904.mA4J41dL005103@svn.freebsd.org> References: <200811041904.mA4J41dL005103@svn.freebsd.org> Message-ID: <9bbcef730811041422x5f1e7bfco45380390c64b3b1c@mail.gmail.com> 2008/11/4 John Baldwin : > Author: jhb > Date: Tue Nov 4 19:04:01 2008 > New Revision: 184652 > URL: http://svn.freebsd.org/changeset/base/184652 > > Log: > Remove unnecessary locking around vn_fullpath(). The vnode lock for the Does this affect realpath(3)? (whose non-scalability is often reported for PHP web servers). From jhb at FreeBSD.org Tue Nov 4 14:30:24 2008 From: jhb at FreeBSD.org (John Baldwin) Date: Tue Nov 4 14:30:30 2008 Subject: svn commit: r184660 - head/sys/security/audit Message-ID: <200811042230.mA4MUOZC009344@svn.freebsd.org> Author: jhb Date: Tue Nov 4 22:30:24 2008 New Revision: 184660 URL: http://svn.freebsd.org/changeset/base/184660 Log: Don't lock the vnode around calls to vn_fullpath(). Reviewed by: csjp, rwatson Modified: head/sys/security/audit/audit_bsm_klib.c Modified: head/sys/security/audit/audit_bsm_klib.c ============================================================================== --- head/sys/security/audit/audit_bsm_klib.c Tue Nov 4 20:57:39 2008 (r184659) +++ head/sys/security/audit/audit_bsm_klib.c Tue Nov 4 22:30:24 2008 (r184660) @@ -492,7 +492,7 @@ audit_canon_path(struct thread *td, char char *rbuf, *fbuf, *copy; struct filedesc *fdp; struct sbuf sbf; - int error, cwir, locked; + int error, cwir; WITNESS_WARN(WARN_GIANTOK | WARN_SLEEPOK, NULL, "%s: at %s:%d", __func__, __FILE__, __LINE__); @@ -539,17 +539,8 @@ audit_canon_path(struct thread *td, char * in the future. */ if (rvnp != NULL) { - /* - * Although unlikely, it is possible for filesystems to define - * their own VOP_LOCK, so strictly speaking, we need to - * conditionally pickup Giant around calls to vn_lock(9) - */ - locked = VFS_LOCK_GIANT(rvnp->v_mount); - vn_lock(rvnp, LK_EXCLUSIVE | LK_RETRY); - vdrop(rvnp); error = vn_fullpath_global(td, rvnp, &rbuf, &fbuf); - VOP_UNLOCK(rvnp, 0); - VFS_UNLOCK_GIANT(locked); + vdrop(rvnp); if (error) { cpath[0] = '\0'; if (cvnp != NULL) @@ -560,12 +551,8 @@ audit_canon_path(struct thread *td, char free(fbuf, M_TEMP); } if (cvnp != NULL) { - locked = VFS_LOCK_GIANT(cvnp->v_mount); - vn_lock(cvnp, LK_EXCLUSIVE | LK_RETRY); - vdrop(cvnp); error = vn_fullpath(td, cvnp, &rbuf, &fbuf); - VOP_UNLOCK(cvnp, 0); - VFS_UNLOCK_GIANT(locked); + vdrop(cvnp); if (error) { cpath[0] = '\0'; return; From jhb at FreeBSD.org Tue Nov 4 14:31:05 2008 From: jhb at FreeBSD.org (John Baldwin) Date: Tue Nov 4 14:31:11 2008 Subject: svn commit: r184661 - in head/sys: kern security/audit Message-ID: <200811042231.mA4MV4F9009394@svn.freebsd.org> Author: jhb Date: Tue Nov 4 22:31:04 2008 New Revision: 184661 URL: http://svn.freebsd.org/changeset/base/184661 Log: Use shared vnode locks for auditing vnode arguments as auditing only does a VOP_GETATTR() which does not require an exclusive lock. Reviewed by: csjp, rwatson Modified: head/sys/kern/vfs_syscalls.c head/sys/security/audit/audit_arg.c Modified: head/sys/kern/vfs_syscalls.c ============================================================================== --- head/sys/kern/vfs_syscalls.c Tue Nov 4 22:30:24 2008 (r184660) +++ head/sys/kern/vfs_syscalls.c Tue Nov 4 22:31:04 2008 (r184661) @@ -2734,7 +2734,7 @@ fchflags(td, uap) return (error); vfslocked = VFS_LOCK_GIANT(fp->f_vnode->v_mount); #ifdef AUDIT - vn_lock(fp->f_vnode, LK_EXCLUSIVE | LK_RETRY); + vn_lock(fp->f_vnode, LK_SHARED | LK_RETRY); AUDIT_ARG(vnode, fp->f_vnode, ARG_VNODE1); VOP_UNLOCK(fp->f_vnode, 0); #endif @@ -2896,7 +2896,7 @@ fchmod(td, uap) return (error); vfslocked = VFS_LOCK_GIANT(fp->f_vnode->v_mount); #ifdef AUDIT - vn_lock(fp->f_vnode, LK_EXCLUSIVE | LK_RETRY); + vn_lock(fp->f_vnode, LK_SHARED | LK_RETRY); AUDIT_ARG(vnode, fp->f_vnode, ARG_VNODE1); VOP_UNLOCK(fp->f_vnode, 0); #endif @@ -3074,7 +3074,7 @@ fchown(td, uap) return (error); vfslocked = VFS_LOCK_GIANT(fp->f_vnode->v_mount); #ifdef AUDIT - vn_lock(fp->f_vnode, LK_EXCLUSIVE | LK_RETRY); + vn_lock(fp->f_vnode, LK_SHARED | LK_RETRY); AUDIT_ARG(vnode, fp->f_vnode, ARG_VNODE1); VOP_UNLOCK(fp->f_vnode, 0); #endif @@ -3311,7 +3311,7 @@ kern_futimes(struct thread *td, int fd, return (error); vfslocked = VFS_LOCK_GIANT(fp->f_vnode->v_mount); #ifdef AUDIT - vn_lock(fp->f_vnode, LK_EXCLUSIVE | LK_RETRY); + vn_lock(fp->f_vnode, LK_SHARED | LK_RETRY); AUDIT_ARG(vnode, fp->f_vnode, ARG_VNODE1); VOP_UNLOCK(fp->f_vnode, 0); #endif Modified: head/sys/security/audit/audit_arg.c ============================================================================== --- head/sys/security/audit/audit_arg.c Tue Nov 4 22:30:24 2008 (r184660) +++ head/sys/security/audit/audit_arg.c Tue Nov 4 22:31:04 2008 (r184661) @@ -631,7 +631,7 @@ audit_arg_file(struct proc *p, struct fi */ vp = fp->f_vnode; vfslocked = VFS_LOCK_GIANT(vp->v_mount); - vn_lock(vp, LK_EXCLUSIVE | LK_RETRY); + vn_lock(vp, LK_SHARED | LK_RETRY); audit_arg_vnode(vp, ARG_VNODE1); VOP_UNLOCK(vp, 0); VFS_UNLOCK_GIANT(vfslocked); @@ -849,7 +849,7 @@ audit_sysclose(struct thread *td, int fd vp = fp->f_vnode; vfslocked = VFS_LOCK_GIANT(vp->v_mount); - vn_lock(vp, LK_EXCLUSIVE | LK_RETRY); + vn_lock(vp, LK_SHARED | LK_RETRY); audit_arg_vnode(vp, ARG_VNODE1); VOP_UNLOCK(vp, 0); VFS_UNLOCK_GIANT(vfslocked); From marius at FreeBSD.org Tue Nov 4 14:51:57 2008 From: marius at FreeBSD.org (Marius Strobl) Date: Tue Nov 4 14:52:03 2008 Subject: svn commit: r184662 - stable/7/lib/libcam Message-ID: <200811042251.mA4MpuDS009857@svn.freebsd.org> Author: marius Date: Tue Nov 4 22:51:56 2008 New Revision: 184662 URL: http://svn.freebsd.org/changeset/base/184662 Log: MFC: r184379 Supply a valid Connect ID when issuing XPT_DEV_MATCH, which according to my reading of the CAM draft is mandatory for all CCB function calls and enforced by xptioctl() since at least r168752. Previously we happened to use 0 as the Path ID, causing the XPT_DEV_MATCH call to fail if there's no SCSI bus 0. Basically the same bug was also fixed the same way for camcontrol(8) as part of r126514. PR: 127605 Approved by: re (kib) Modified: stable/7/lib/libcam/ (props changed) stable/7/lib/libcam/camlib.c Modified: stable/7/lib/libcam/camlib.c ============================================================================== --- stable/7/lib/libcam/camlib.c Tue Nov 4 22:31:04 2008 (r184661) +++ stable/7/lib/libcam/camlib.c Tue Nov 4 22:51:56 2008 (r184662) @@ -346,6 +346,9 @@ cam_open_btl(path_id_t path_id, target_i bzero(&ccb, sizeof(union ccb)); ccb.ccb_h.func_code = XPT_DEV_MATCH; + ccb.ccb_h.path_id = CAM_XPT_PATH_ID; + ccb.ccb_h.target_id = CAM_TARGET_WILDCARD; + ccb.ccb_h.target_lun = CAM_LUN_WILDCARD; /* Setup the result buffer */ bufsize = sizeof(struct dev_match_result); From peter at wemm.org Tue Nov 4 14:51:58 2008 From: peter at wemm.org (Peter Wemm) Date: Tue Nov 4 14:52:24 2008 Subject: svn commit: r184216 - head/sys/kern In-Reply-To: <200811041707.26052.jhb@freebsd.org> References: <200810240103.m9O13V7f071075@svn.freebsd.org> <200811041707.26052.jhb@freebsd.org> Message-ID: On Tue, Nov 4, 2008 at 2:07 PM, John Baldwin wrote: > On Thursday 23 October 2008 09:03:31 pm David Xu wrote: >> Author: davidxu >> Date: Fri Oct 24 01:03:31 2008 >> New Revision: 184216 >> URL: http://svn.freebsd.org/changeset/base/184216 >> >> Log: >> partly revert revision 184199, because TDF_NEEDSIGCHK is persitent >> when thread is in kernel mode, it can cause dead loop, now unlock >> process lock after acquired sleep queue lock and thread lock to >> avoid the problem. This means TDF_NEEDSIGCHK and TDF_NEEDSUSPCHK must >> be set with process lock and thread lock being hold at same time. > > You can't unlock the proc lock while holding the thread_lock(). This will > lead to deadlock due to the way that thread_lock() works. This is different > from the rules in 6.x where you could drop a mutex while holding sched_lock. > You will need to revert this. > > -- > John Baldwin I had to back out rev 184216 and 184199 in total in order to stop my machine from dying. Compile this dumb program: http://people.freebsd.org/~peter/pth.c $ cc -pthread -o pth pth.c run in a shell while loop so that the entire thing is execed and exits repeatedly. $ while true; do date; ./pth; done On my 2-core athlon64 box at home, and the 8-core ref8-i386 in the freebsd.org cluster, this causes a lockup in mere seconds. Backing out these two changes solves it. my machine: spin lock 0xffffff00a4037000 (turnstile lock) held by 0xffffff01045746e0 (tid 100355) too long panic: spin lock held too long ref8-i386: spin lock 0xc06436c0 (sched lock 5) held by 0xd374f690 (tid 100249) too long panic: spin lock held too long -- Peter Wemm - peter@wemm.org; peter@FreeBSD.org; peter@yahoo-inc.com; KI6FJV "All of this is for nothing if we don't go to the stars" - JMS/B5 "If Java had true garbage collection, most programs would delete themselves upon execution." -- Robert Sewell From delphij at FreeBSD.org Tue Nov 4 15:03:37 2008 From: delphij at FreeBSD.org (Xin LI) Date: Tue Nov 4 15:03:48 2008 Subject: svn commit: r184663 - head/etc Message-ID: <200811042303.mA4N3apg010142@svn.freebsd.org> Author: delphij Date: Tue Nov 4 23:03:36 2008 New Revision: 184663 URL: http://svn.freebsd.org/changeset/base/184663 Log: Correct a typo that prevented my laptop from starting devd. Modified: head/etc/devd.conf Modified: head/etc/devd.conf ============================================================================== --- head/etc/devd.conf Tue Nov 4 22:51:56 2008 (r184662) +++ head/etc/devd.conf Tue Nov 4 23:03:36 2008 (r184663) @@ -265,7 +265,7 @@ notify 0 { notify 0 { match "system" "ACPI"; - match "subsystem"i "ASUS"; + match "subsystem" "ASUS"; match "notify" "0x31"; action "mixer vol -10"; }; From jhb at freebsd.org Tue Nov 4 16:48:47 2008 From: jhb at freebsd.org (John Baldwin) Date: Tue Nov 4 16:48:59 2008 Subject: svn commit: r184652 - in head/sys: dev/hwpmc fs/procfs kern In-Reply-To: <9bbcef730811041422x5f1e7bfco45380390c64b3b1c@mail.gmail.com> References: <200811041904.mA4J41dL005103@svn.freebsd.org> <9bbcef730811041422x5f1e7bfco45380390c64b3b1c@mail.gmail.com> Message-ID: <200811041750.08355.jhb@freebsd.org> On Tuesday 04 November 2008 05:22:47 pm Ivan Voras wrote: > 2008/11/4 John Baldwin : > > Author: jhb > > Date: Tue Nov 4 19:04:01 2008 > > New Revision: 184652 > > URL: http://svn.freebsd.org/changeset/base/184652 > > > > Log: > > Remove unnecessary locking around vn_fullpath(). The vnode lock for the > > Does this affect realpath(3)? (whose non-scalability is often reported > for PHP web servers). realpath(3) calls getcwd(3) (which devolves to __getcwd(2) I think) once per invocation (and that already did not lock the vnode). It then calls lstat() for each component in the path. The lstat() calls should be using shared locks (at least with the recent changes to use shared lookups for UFS in HEAD). I imagine the bottleneck is more with lstat() than getcwd(3). Neither is helped by the specific changes above. -- John Baldwin From davidxu at freebsd.org Tue Nov 4 17:35:55 2008 From: davidxu at freebsd.org (David Xu) Date: Tue Nov 4 17:36:01 2008 Subject: svn commit: r184217 - head/sys/kern In-Reply-To: <200811041705.48043.jhb@freebsd.org> References: <200810240109.m9O19P1u071214@svn.freebsd.org> <200811041705.48043.jhb@freebsd.org> Message-ID: <4910F8E7.4010805@freebsd.org> John Baldwin wrote: > On Thursday 23 October 2008 09:09:25 pm David Xu wrote: >> Author: davidxu >> Date: Fri Oct 24 01:09:24 2008 >> New Revision: 184217 >> URL: http://svn.freebsd.org/changeset/base/184217 >> >> Log: >> Don't rearm callout if the process is exiting, it may leak a callout >> because callout_drain() only waits for running callout, but not disable >> it if it is rearmed. > > Can you please revert this as per previous discussion? > I will do it, maybe I lost previous discussion ? From keramida at freebsd.org Tue Nov 4 18:31:50 2008 From: keramida at freebsd.org (Giorgos Keramidas) Date: Tue Nov 4 18:32:07 2008 Subject: svn commit: r184645 - head/usr.bin/vmstat In-Reply-To: (Diomidis Spinellis's message of "Tue, 4 Nov 2008 22:30:07 +0200") References: <200811041802.mA4I2aVk003708@svn.freebsd.org> Message-ID: <87tzamgbcp.fsf@kobe.laptop> On Tue, 4 Nov 2008 22:30:07 +0200, Diomidis Spinellis wrote: >On Nov 4, 2008, at 8:02 PM, Giorgos Keramidas wrote: >> Author: keramida (doc committer) >> Date: Tue Nov 4 18:02:35 2008 >> New Revision: 184645 >> URL: http://svn.freebsd.org/changeset/base/184645 >> >> Log: >> Repeat vmstat header after window.rows instead of a hardcoded 20. >> >> Use ioctl() to get the window size in vmstat(8), and force a new >> header to be prepended to the output every time the current window >> size changes. Change the number of lines before each header to the >> current lines of the terminal when the terminal is resized, so that >> the full terminal length can be used for output lines. >> >> Inspired by: svn change 175562 (same feature for iostat) >> Reviewed by: ru (who fixed some of my bugs too) > > Thanks! This functionality is generally useful and tricky to code in a > correct way. Should we perhaps package it in a library function, so > that all header-printing commands can benefit from it, without > repeating the code? That's what I thought when I had to write almost the same code a second time. Once is ok, twice is almost ok, but if we find it repeated all over the place a library function would definitely be nice :) One of the utilities that includes a similar `repeated output' mode that I was planning to patch next is procstat(1). Right now procstat prints the header once, and then forgets about it. When the header scrolls off the terminal it's gone for good. The code of procstat is quite different that vmstat and iostat though, so I'll have to think a bit about the best way to make a library function out of the header display code and link all three of them to the same code. From keramida at freebsd.org Tue Nov 4 18:31:55 2008 From: keramida at freebsd.org (Giorgos Keramidas) Date: Tue Nov 4 18:32:07 2008 Subject: svn commit: r184645 - head/usr.bin/vmstat In-Reply-To: <9bbcef730811041416o6eaf3033k459fb4d29c9e231a@mail.gmail.com> (Ivan Voras's message of "Tue, 4 Nov 2008 23:16:39 +0100") References: <200811041802.mA4I2aVk003708@svn.freebsd.org> <9bbcef730811041416o6eaf3033k459fb4d29c9e231a@mail.gmail.com> Message-ID: <87y6zygbjl.fsf@kobe.laptop> On Tue, 4 Nov 2008 23:16:39 +0100, "Ivan Voras" wrote: > 2008/11/4 Diomidis Spinellis : >> On Nov 4, 2008, at 8:02 PM, Giorgos Keramidas wrote: >> >>> Author: keramida (doc committer) >>> Date: Tue Nov 4 18:02:35 2008 >>> New Revision: 184645 >>> URL: http://svn.freebsd.org/changeset/base/184645 >>> >>> Log: >>> Repeat vmstat header after window.rows instead of a hardcoded 20. > >> Thanks! This functionality is generally useful and tricky to code in a >> correct way. > > Any objections to > > http://people.freebsd.org/~ivoras/diffs/vmstat.c.patch.txt ? > > It uses humanize_number on interrupt, syscall and context switch counts. It's great! I'm only a bit worried about breaking many people's scripts if we change the format to include humanized numbers by default, so I would like to see a similar patch committed but disabled by default for a while (and enabled by a command-line option like `-h'). The `-h' option seems to be the BSD equivalent of what GNU people would call `--humanized-output'. It would be nice to have vmstat and iostat display humanized numbers but let's keep the default to its traditional style and make the new output style accessible too :) From davidxu at FreeBSD.org Tue Nov 4 19:01:24 2008 From: davidxu at FreeBSD.org (David Xu) Date: Tue Nov 4 19:01:31 2008 Subject: svn commit: r184667 - in head/sys: kern sys Message-ID: <200811050301.mA531Nmk014730@svn.freebsd.org> Author: davidxu Date: Wed Nov 5 03:01:23 2008 New Revision: 184667 URL: http://svn.freebsd.org/changeset/base/184667 Log: Revert rev 184216 and 184199, due to the way the thread_lock works, it may cause a lockup. Noticed by: peter, jhb Modified: head/sys/kern/kern_sig.c head/sys/kern/kern_thr.c head/sys/kern/kern_thread.c head/sys/kern/subr_sleepqueue.c head/sys/kern/sys_process.c head/sys/sys/proc.h Modified: head/sys/kern/kern_sig.c ============================================================================== --- head/sys/kern/kern_sig.c Tue Nov 4 23:38:08 2008 (r184666) +++ head/sys/kern/kern_sig.c Wed Nov 5 03:01:23 2008 (r184667) @@ -2115,15 +2115,19 @@ tdsignal(struct proc *p, struct thread * * Otherwise, process goes back to sleep state. */ p->p_flag &= ~P_STOPPED_SIG; + PROC_SLOCK(p); if (p->p_numthreads == p->p_suspcount) { + PROC_SUNLOCK(p); p->p_flag |= P_CONTINUED; p->p_xstat = SIGCONT; PROC_LOCK(p->p_pptr); childproc_continued(p); PROC_UNLOCK(p->p_pptr); + PROC_SLOCK(p); } if (action == SIG_DFL) { thread_unsuspend(p); + PROC_SUNLOCK(p); sigqueue_delete(sigqueue, sig); goto out; } @@ -2132,12 +2136,14 @@ tdsignal(struct proc *p, struct thread * * The process wants to catch it so it needs * to run at least one thread, but which one? */ + PROC_SUNLOCK(p); goto runfast; } /* * The signal is not ignored or caught. */ thread_unsuspend(p); + PROC_SUNLOCK(p); goto out; } @@ -2161,10 +2167,12 @@ tdsignal(struct proc *p, struct thread * * It may run a bit until it hits a thread_suspend_check(). */ wakeup_swapper = 0; + PROC_SLOCK(p); thread_lock(td); if (TD_ON_SLEEPQ(td) && (td->td_flags & TDF_SINTR)) wakeup_swapper = sleepq_abort(td, intrval); thread_unlock(td); + PROC_SUNLOCK(p); if (wakeup_swapper) kick_proc0(); goto out; @@ -2185,6 +2193,7 @@ tdsignal(struct proc *p, struct thread * goto out; p->p_flag |= P_STOPPED_SIG; p->p_xstat = sig; + PROC_SLOCK(p); sig_suspend_threads(td, p, 1); if (p->p_numthreads == p->p_suspcount) { /* @@ -2195,8 +2204,10 @@ tdsignal(struct proc *p, struct thread * * should never be equal to p_suspcount. */ thread_stopped(p); + PROC_SUNLOCK(p); sigqueue_delete_proc(p, p->p_xstat); - } + } else + PROC_SUNLOCK(p); goto out; } } else { @@ -2211,8 +2222,12 @@ tdsignal(struct proc *p, struct thread * */ runfast: tdsigwakeup(td, sig, action, intrval); + PROC_SLOCK(p); thread_unsuspend(p); + PROC_SUNLOCK(p); out: + /* If we jump here, proc slock should not be owned. */ + PROC_SLOCK_ASSERT(p, MA_NOTOWNED); return (ret); } @@ -2232,6 +2247,7 @@ tdsigwakeup(struct thread *td, int sig, PROC_LOCK_ASSERT(p, MA_OWNED); prop = sigprop(sig); + PROC_SLOCK(p); thread_lock(td); /* * Bring the priority of a thread up if we want it to get @@ -2255,6 +2271,7 @@ tdsigwakeup(struct thread *td, int sig, */ if ((prop & SA_CONT) && action == SIG_DFL) { thread_unlock(td); + PROC_SUNLOCK(p); sigqueue_delete(&p->p_sigqueue, sig); /* * It may be on either list in this state. @@ -2283,6 +2300,7 @@ tdsigwakeup(struct thread *td, int sig, #endif } out: + PROC_SUNLOCK(p); thread_unlock(td); if (wakeup_swapper) kick_proc0(); @@ -2294,6 +2312,7 @@ sig_suspend_threads(struct thread *td, s struct thread *td2; PROC_LOCK_ASSERT(p, MA_OWNED); + PROC_SLOCK_ASSERT(p, MA_OWNED); FOREACH_THREAD_IN_PROC(p, td2) { thread_lock(td2); @@ -2325,9 +2344,11 @@ ptracestop(struct thread *td, int sig) td->td_dbgflags |= TDB_XSIG; td->td_xsig = sig; + PROC_SLOCK(p); while ((p->p_flag & P_TRACED) && (td->td_dbgflags & TDB_XSIG)) { if (p->p_flag & P_SINGLE_EXIT) { td->td_dbgflags &= ~TDB_XSIG; + PROC_SUNLOCK(p); return (sig); } /* @@ -2349,6 +2370,7 @@ stopme: goto stopme; } } + PROC_SUNLOCK(p); return (td->td_xsig); } @@ -2489,8 +2511,10 @@ issignal(td) &p->p_mtx.lock_object, "Catching SIGSTOP"); p->p_flag |= P_STOPPED_SIG; p->p_xstat = sig; + PROC_SLOCK(p); sig_suspend_threads(td, p, 0); thread_suspend_switch(td); + PROC_SUNLOCK(p); mtx_lock(&ps->ps_mtx); break; } else if (prop & SA_IGNORE) { @@ -2532,15 +2556,18 @@ thread_stopped(struct proc *p) int n; PROC_LOCK_ASSERT(p, MA_OWNED); + PROC_SLOCK_ASSERT(p, MA_OWNED); n = p->p_suspcount; if (p == curproc) n++; if ((p->p_flag & P_STOPPED_SIG) && (n == p->p_numthreads)) { + PROC_SUNLOCK(p); p->p_flag &= ~P_WAITED; PROC_LOCK(p->p_pptr); childproc_stopped(p, (p->p_flag & P_TRACED) ? CLD_TRAPPED : CLD_STOPPED); PROC_UNLOCK(p->p_pptr); + PROC_SLOCK(p); } } Modified: head/sys/kern/kern_thr.c ============================================================================== --- head/sys/kern/kern_thr.c Tue Nov 4 23:38:08 2008 (r184666) +++ head/sys/kern/kern_thr.c Wed Nov 5 03:01:23 2008 (r184667) @@ -286,6 +286,7 @@ thr_exit(struct thread *td, struct thr_e PROC_LOCK(p); sigqueue_flush(&td->td_sigqueue); + PROC_SLOCK(p); /* * Shutting down last thread in the proc. This will actually @@ -293,10 +294,10 @@ thr_exit(struct thread *td, struct thr_e */ if (p->p_numthreads != 1) { thread_stopped(p); - PROC_SLOCK(p); thread_exit(); /* NOTREACHED */ } + PROC_SUNLOCK(p); PROC_UNLOCK(p); return (0); } Modified: head/sys/kern/kern_thread.c ============================================================================== --- head/sys/kern/kern_thread.c Tue Nov 4 23:38:08 2008 (r184666) +++ head/sys/kern/kern_thread.c Wed Nov 5 03:01:23 2008 (r184667) @@ -543,6 +543,7 @@ thread_single(int mode) p->p_flag &= ~P_SINGLE_BOUNDARY; } p->p_flag |= P_STOPPED_SINGLE; + PROC_SLOCK(p); p->p_singlethread = td; if (mode == SINGLE_EXIT) remaining = p->p_numthreads; @@ -641,6 +642,7 @@ stopme: p->p_flag &= ~(P_STOPPED_SINGLE | P_SINGLE_EXIT); thread_unthread(td); } + PROC_SUNLOCK(p); return (0); } @@ -714,16 +716,15 @@ thread_suspend_check(int return_instead) if ((p->p_flag & P_SINGLE_EXIT) && (p->p_singlethread != td)) sigqueue_flush(&td->td_sigqueue); + PROC_SLOCK(p); thread_stopped(p); /* * If the process is waiting for us to exit, * this thread should just suicide. * Assumes that P_SINGLE_EXIT implies P_STOPPED_SINGLE. */ - if ((p->p_flag & P_SINGLE_EXIT) && (p->p_singlethread != td)) { - PROC_SLOCK(p); + if ((p->p_flag & P_SINGLE_EXIT) && (p->p_singlethread != td)) thread_exit(); - } if (P_SHOULDSTOP(p) == P_STOPPED_SINGLE) { if (p->p_numthreads == p->p_suspcount + 1) { thread_lock(p->p_singlethread); @@ -734,8 +735,8 @@ thread_suspend_check(int return_instead) kick_proc0(); } } - thread_lock(td); PROC_UNLOCK(p); + thread_lock(td); /* * When a thread suspends, it just * gets taken off all queues. @@ -745,6 +746,7 @@ thread_suspend_check(int return_instead) p->p_boundary_count++; td->td_flags |= TDF_BOUNDARY; } + PROC_SUNLOCK(p); mi_switch(SW_INVOL | SWT_SUSPEND, NULL); if (return_instead == 0) td->td_flags &= ~TDF_BOUNDARY; @@ -764,22 +766,25 @@ thread_suspend_switch(struct thread *td) p = td->td_proc; KASSERT(!TD_IS_SUSPENDED(td), ("already suspended")); PROC_LOCK_ASSERT(p, MA_OWNED); + PROC_SLOCK_ASSERT(p, MA_OWNED); /* * We implement thread_suspend_one in stages here to avoid * dropping the proc lock while the thread lock is owned. */ thread_stopped(p); p->p_suspcount++; - thread_lock(td); PROC_UNLOCK(p); + thread_lock(td); td->td_flags &= ~TDF_NEEDSUSPCHK; TD_SET_SUSPENDED(td); sched_sleep(td, 0); + PROC_SUNLOCK(p); DROP_GIANT(); mi_switch(SW_VOL | SWT_SUSPEND, NULL); thread_unlock(td); PICKUP_GIANT(); PROC_LOCK(p); + PROC_SLOCK(p); } void @@ -787,6 +792,7 @@ thread_suspend_one(struct thread *td) { struct proc *p = td->td_proc; + PROC_SLOCK_ASSERT(p, MA_OWNED); THREAD_LOCK_ASSERT(td, MA_OWNED); KASSERT(!TD_IS_SUSPENDED(td), ("already suspended")); p->p_suspcount++; @@ -800,6 +806,7 @@ thread_unsuspend_one(struct thread *td) { struct proc *p = td->td_proc; + PROC_SLOCK_ASSERT(p, MA_OWNED); THREAD_LOCK_ASSERT(td, MA_OWNED); KASSERT(TD_IS_SUSPENDED(td), ("Thread not suspended")); TD_CLR_SUSPENDED(td); @@ -817,6 +824,7 @@ thread_unsuspend(struct proc *p) int wakeup_swapper; PROC_LOCK_ASSERT(p, MA_OWNED); + PROC_SLOCK_ASSERT(p, MA_OWNED); wakeup_swapper = 0; if (!P_SHOULDSTOP(p)) { FOREACH_THREAD_IN_PROC(p, td) { @@ -855,6 +863,7 @@ thread_single_end(void) p = td->td_proc; PROC_LOCK_ASSERT(p, MA_OWNED); p->p_flag &= ~(P_STOPPED_SINGLE | P_SINGLE_EXIT | P_SINGLE_BOUNDARY); + PROC_SLOCK(p); p->p_singlethread = NULL; wakeup_swapper = 0; /* @@ -872,6 +881,7 @@ thread_single_end(void) thread_unlock(td); } } + PROC_SUNLOCK(p); if (wakeup_swapper) kick_proc0(); } Modified: head/sys/kern/subr_sleepqueue.c ============================================================================== --- head/sys/kern/subr_sleepqueue.c Tue Nov 4 23:38:08 2008 (r184666) +++ head/sys/kern/subr_sleepqueue.c Wed Nov 5 03:01:23 2008 (r184667) @@ -395,7 +395,6 @@ sleepq_catch_signals(void *wchan, int pr sleepq_switch(wchan, pri); return (0); } - thread_unlock(td); mtx_unlock_spin(&sc->sc_lock); CTR3(KTR_PROC, "sleepq catching signals: thread %p (pid %ld, %s)", @@ -415,15 +414,16 @@ sleepq_catch_signals(void *wchan, int pr ret = ERESTART; mtx_unlock(&ps->ps_mtx); } - + /* + * Lock the per-process spinlock prior to dropping the PROC_LOCK + * to avoid a signal delivery race. PROC_LOCK, PROC_SLOCK, and + * thread_lock() are currently held in tdsignal(). + */ + PROC_SLOCK(p); mtx_lock_spin(&sc->sc_lock); - thread_lock(td); PROC_UNLOCK(p); - if (ret == 0) { - sleepq_switch(wchan, pri); - return (0); - } - + thread_lock(td); + PROC_SUNLOCK(p); /* * There were pending signals and this thread is still * on the sleep queue, remove it from the sleep queue. Modified: head/sys/kern/sys_process.c ============================================================================== --- head/sys/kern/sys_process.c Tue Nov 4 23:38:08 2008 (r184666) +++ head/sys/kern/sys_process.c Wed Nov 5 03:01:23 2008 (r184667) @@ -795,8 +795,10 @@ kern_ptrace(struct thread *td, int req, * you should use PT_SUSPEND to suspend it before * continuing process. */ + PROC_SLOCK(p); p->p_flag &= ~(P_STOPPED_TRACE|P_STOPPED_SIG|P_WAITED); thread_unsuspend(p); + PROC_SUNLOCK(p); } else { if (data) psignal(p, data); Modified: head/sys/sys/proc.h ============================================================================== --- head/sys/sys/proc.h Tue Nov 4 23:38:08 2008 (r184666) +++ head/sys/sys/proc.h Wed Nov 5 03:01:23 2008 (r184667) @@ -500,8 +500,8 @@ struct proc { u_char p_pfsflags; /* (c) Procfs flags. */ struct nlminfo *p_nlminfo; /* (?) Only used by/for lockd. */ struct kaioinfo *p_aioinfo; /* (c) ASYNC I/O info. */ - struct thread *p_singlethread;/* (c) If single threading this is it */ - int p_suspcount; /* (c) Num threads in suspended mode. */ + struct thread *p_singlethread;/* (c + j) If single threading this is it */ + int p_suspcount; /* (j) Num threads in suspended mode. */ struct thread *p_xthread; /* (c) Trap thread */ int p_boundary_count;/* (c) Num threads at user boundary */ int p_pendingcnt; /* how many signals are pending */ From unixmania at gmail.com Tue Nov 4 19:45:40 2008 From: unixmania at gmail.com (Carlos A. M. dos Santos) Date: Tue Nov 4 19:45:47 2008 Subject: svn commit: r184605 - head/sys/dev/usb In-Reply-To: <20081103225453.GA1509@britannica.bec.de> References: <200811032209.mA3M9RhK077380@svn.freebsd.org> <490F800E.9080201@gmx.de> <20081103225453.GA1509@britannica.bec.de> Message-ID: On Mon, Nov 3, 2008 at 8:54 PM, Joerg Sonnenberger wrote: > On Mon, Nov 03, 2008 at 11:49:50PM +0100, Christoph Mallon wrote: >> You may want to make cmd[] static and/or const, so the compiler really >> just puts the bytes in the data section instead of generating code, >> which pretty much is the same as the assignments you just removed. > > I didn't make it const originally as I am not sure if the USB stack will > never modify the buffer. You may want to have a const array and memcpy it to cmd before calling usbd_transfer(). This will be smaller, though not much faster. -- cd /usr/ports/sysutils/life make clean From imp at bsdimp.com Tue Nov 4 20:29:15 2008 From: imp at bsdimp.com (M. Warner Losh) Date: Tue Nov 4 20:29:22 2008 Subject: svn commit: r184625 - in head: etc sys/dev/acpi_support In-Reply-To: <20081104160841.GF93540@citylink.fud.org.nz> References: <200811041152.mA4BqoPb095612@svn.freebsd.org> <20081104160841.GF93540@citylink.fud.org.nz> Message-ID: <20081104.212850.1585998941.imp@bsdimp.com> In message: <20081104160841.GF93540@citylink.fud.org.nz> Andrew Thompson writes: : On Tue, Nov 04, 2008 at 11:52:50AM +0000, Rui Paulo wrote: : > Author: rpaulo : > Date: Tue Nov 4 11:52:50 2008 : > New Revision: 184625 : > URL: http://svn.freebsd.org/changeset/base/184625 : > : > Log: : > Add support for Asus A8Sr notebooks. : > : > PR: 128553 : > Submitted by: Eygene Ryabinkin : > Reviewed by: philip : > MFC after: 2 months : > : > Modified: : > head/etc/devd.conf : > head/sys/dev/acpi_support/acpi_asus.c : : We could almost do with a /etc/devd.conf.d/ directory to drop in : hardware specific event files. devd already supports this concept... All files in a directory already are parsed and merged... Warner From kientzle at FreeBSD.org Tue Nov 4 21:26:12 2008 From: kientzle at FreeBSD.org (Tim Kientzle) Date: Tue Nov 4 21:26:19 2008 Subject: svn commit: r184668 - head/usr.bin/tar/test Message-ID: <200811050526.mA55QBk4017410@svn.freebsd.org> Author: kientzle Date: Wed Nov 5 05:26:11 2008 New Revision: 184668 URL: http://svn.freebsd.org/changeset/base/184668 Log: Fix compile warnings building on amd64. This is modified slightly from Jaakko's original patch: I have misgivings about the portability of the 'z' printf modifier so opted to cast the arguments to (int) instead. PR: bin/128561 Submitted by: Jaakko Heinonen MFC after: 30 days Modified: head/usr.bin/tar/test/main.c Modified: head/usr.bin/tar/test/main.c ============================================================================== --- head/usr.bin/tar/test/main.c Wed Nov 5 03:01:23 2008 (r184667) +++ head/usr.bin/tar/test/main.c Wed Nov 5 05:26:11 2008 (r184668) @@ -324,10 +324,10 @@ test_assert_equal_string(const char *fil file, line); fprintf(stderr, " %s = ", e1); strdump(v1); - fprintf(stderr, " (length %d)\n", v1 == NULL ? 0 : strlen(v1)); + fprintf(stderr, " (length %d)\n", v1 == NULL ? 0 : (int)strlen(v1)); fprintf(stderr, " %s = ", e2); strdump(v2); - fprintf(stderr, " (length %d)\n", v2 == NULL ? 0 : strlen(v2)); + fprintf(stderr, " (length %d)\n", v2 == NULL ? 0 : (int)strlen(v2)); report_failure(extra); return (0); } @@ -402,7 +402,7 @@ hexdump(const char *p, const char *ref, char sep; for(i=0; i < l; i+=16) { - fprintf(stderr, "%04x", i + offset); + fprintf(stderr, "%04x", (int)(i + offset)); sep = ' '; for (j = 0; j < 16 && i + j < l; j++) { if (ref != NULL && p[i + j] != ref[i + j]) @@ -494,7 +494,8 @@ test_assert_empty_file(const char *f1fmt if (fd < 0) { fprintf(stderr, " Unable to open %s\n", f1); } else { - s = sizeof(buff) < st.st_size ? sizeof(buff) : st.st_size; + s = (sizeof(buff) < (size_t)st.st_size) ? + (ssize_t)sizeof(buff) : (ssize_t)st.st_size; s = read(fd, buff, s); hexdump(buff, NULL, s, 0); } From delphij at delphij.net Tue Nov 4 21:48:46 2008 From: delphij at delphij.net (Xin LI) Date: Tue Nov 4 21:48:53 2008 Subject: svn commit: r184668 - head/usr.bin/tar/test In-Reply-To: <200811050526.mA55QBk4017410@svn.freebsd.org> References: <200811050526.mA55QBk4017410@svn.freebsd.org> Message-ID: <491133B1.9050208@delphij.net> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Tim Kientzle wrote: > Author: kientzle > Date: Wed Nov 5 05:26:11 2008 > New Revision: 184668 > URL: http://svn.freebsd.org/changeset/base/184668 > > Log: > Fix compile warnings building on amd64. This is modified slightly > from Jaakko's original patch: I have misgivings about the portability > of the 'z' printf modifier so opted to cast the arguments to (int) > instead. > > PR: bin/128561 > Submitted by: Jaakko Heinonen > MFC after: 30 days > [...] > @@ -494,7 +494,8 @@ test_assert_empty_file(const char *f1fmt > if (fd < 0) { > fprintf(stderr, " Unable to open %s\n", f1); > } else { > - s = sizeof(buff) < st.st_size ? sizeof(buff) : st.st_size; > + s = (sizeof(buff) < (size_t)st.st_size) ? > + (ssize_t)sizeof(buff) : (ssize_t)st.st_size; I'm more or less concerned about this - st_size is off_t, is it safe to cast it to size_t when comparing here? > s = read(fd, buff, s); > hexdump(buff, NULL, s, 0); > } > - -- Xin LI http://www.delphij.net/ FreeBSD - The Power to Serve! -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.9 (FreeBSD) iEYEARECAAYFAkkRM7AACgkQi+vbBBjt66D/YwCgqm9Do0SwckV4Da86gEyU4Yk8 AXMAni2tF+SzEObjliVy1z03irw7Qd6g =M8sh -----END PGP SIGNATURE----- From kientzle at FreeBSD.org Tue Nov 4 22:40:53 2008 From: kientzle at FreeBSD.org (Tim Kientzle) Date: Tue Nov 4 22:41:01 2008 Subject: svn commit: r184669 - head/usr.bin/tar/test Message-ID: <200811050640.mA56erap018745@svn.freebsd.org> Author: kientzle Date: Wed Nov 5 06:40:53 2008 New Revision: 184669 URL: http://svn.freebsd.org/changeset/base/184669 Log: When comparing, cast to the larger size, off_t in this case. Once we know which one is smaller, then we cast to the smaller size. Thanks to Xin Li (delphij@) Pointy hat: /me Modified: head/usr.bin/tar/test/main.c Modified: head/usr.bin/tar/test/main.c ============================================================================== --- head/usr.bin/tar/test/main.c Wed Nov 5 05:26:11 2008 (r184668) +++ head/usr.bin/tar/test/main.c Wed Nov 5 06:40:53 2008 (r184669) @@ -494,7 +494,7 @@ test_assert_empty_file(const char *f1fmt if (fd < 0) { fprintf(stderr, " Unable to open %s\n", f1); } else { - s = (sizeof(buff) < (size_t)st.st_size) ? + s = ((off_t)sizeof(buff) < st.st_size) ? (ssize_t)sizeof(buff) : (ssize_t)st.st_size; s = read(fd, buff, s); hexdump(buff, NULL, s, 0); From tim at kientzle.com Tue Nov 4 23:06:31 2008 From: tim at kientzle.com (Tim Kientzle) Date: Tue Nov 4 23:06:37 2008 Subject: svn commit: r184668 - head/usr.bin/tar/test In-Reply-To: <491133B1.9050208@delphij.net> References: <200811050526.mA55QBk4017410@svn.freebsd.org> <491133B1.9050208@delphij.net> Message-ID: <4911402F.2000305@kientzle.com> Xin LI wrote: >>Author: kientzle >>Date: Wed Nov 5 05:26:11 2008 >>New Revision: 184668 >>URL: http://svn.freebsd.org/changeset/base/184668 >> >> >[...] > > >>@@ -494,7 +494,8 @@ test_assert_empty_file(const char *f1fmt >> if (fd < 0) { >> fprintf(stderr, " Unable to open %s\n", f1); >> } else { >>- s = sizeof(buff) < st.st_size ? sizeof(buff) : st.st_size; >>+ s = (sizeof(buff) < (size_t)st.st_size) ? >>+ (ssize_t)sizeof(buff) : (ssize_t)st.st_size; >> >> > >I'm more or less concerned about this - st_size is off_t, is it safe to >cast it to size_t when comparing here? > > Thanks. I've fixed this. Tim From dds at aueb.gr Tue Nov 4 23:41:57 2008 From: dds at aueb.gr (Diomidis Spinellis) Date: Tue Nov 4 23:42:03 2008 Subject: svn commit: r184645 - head/usr.bin/vmstat In-Reply-To: <87tzamgbcp.fsf@kobe.laptop> References: <200811041802.mA4I2aVk003708@svn.freebsd.org> <87tzamgbcp.fsf@kobe.laptop> Message-ID: <49114E16.1090808@aueb.gr> Giorgos Keramidas wrote: > On Tue, 4 Nov 2008 22:30:07 +0200, Diomidis Spinellis wrote: >> On Nov 4, 2008, at 8:02 PM, Giorgos Keramidas wrote: >>> Author: keramida (doc committer) >>> Date: Tue Nov 4 18:02:35 2008 >>> New Revision: 184645 >>> URL: http://svn.freebsd.org/changeset/base/184645 >>> >>> Log: >>> Repeat vmstat header after window.rows instead of a hardcoded 20. >>> >>> Use ioctl() to get the window size in vmstat(8), and force a new >>> header to be prepended to the output every time the current window >>> size changes. Change the number of lines before each header to the >>> current lines of the terminal when the terminal is resized, so that >>> the full terminal length can be used for output lines. >>> >>> Inspired by: svn change 175562 (same feature for iostat) >>> Reviewed by: ru (who fixed some of my bugs too) >> Thanks! This functionality is generally useful and tricky to code in a >> correct way. Should we perhaps package it in a library function, so >> that all header-printing commands can benefit from it, without >> repeating the code? > > That's what I thought when I had to write almost the same code a second > time. Once is ok, twice is almost ok, but if we find it repeated all > over the place a library function would definitely be nice :) > > One of the utilities that includes a similar `repeated output' mode that > I was planning to patch next is procstat(1). Right now procstat prints > the header once, and then forgets about it. When the header scrolls off > the terminal it's gone for good. > > The code of procstat is quite different that vmstat and iostat though, > so I'll have to think a bit about the best way to make a library > function out of the header display code and link all three of them to > the same code. > And let us not forget netstat and nfsstat (both seem to use a hard-coded terminal size). Let me remark (without actually suggesting that we go down that road) that the old-school Unix approach to this problem might be to create a separate program that would add a specified header to its input. From maxim at FreeBSD.org Wed Nov 5 01:27:14 2008 From: maxim at FreeBSD.org (Maxim Konovalov) Date: Wed Nov 5 01:27:20 2008 Subject: svn commit: r184671 - head/sbin/bsdlabel Message-ID: <200811050927.mA59RDFQ021753@svn.freebsd.org> Author: maxim Date: Wed Nov 5 09:27:13 2008 New Revision: 184671 URL: http://svn.freebsd.org/changeset/base/184671 Log: o Replace Xr to gpt(8) which is gone by gpart(8). Modified: head/sbin/bsdlabel/bsdlabel.8 Modified: head/sbin/bsdlabel/bsdlabel.8 ============================================================================== --- head/sbin/bsdlabel/bsdlabel.8 Wed Nov 5 09:03:46 2008 (r184670) +++ head/sbin/bsdlabel/bsdlabel.8 Wed Nov 5 09:27:13 2008 (r184671) @@ -497,5 +497,5 @@ are not generally compatible. .Xr disktab 5 , .Xr boot0cfg 8 , .Xr fdisk 8 , -.Xr gpt 8 , +.Xr gpart 8 , .Xr newfs 8 From maxim at FreeBSD.org Wed Nov 5 01:28:31 2008 From: maxim at FreeBSD.org (Maxim Konovalov) Date: Wed Nov 5 01:28:37 2008 Subject: svn commit: r184672 - head/sbin/bsdlabel Message-ID: <200811050928.mA59SVPW021813@svn.freebsd.org> Author: maxim Date: Wed Nov 5 09:28:30 2008 New Revision: 184672 URL: http://svn.freebsd.org/changeset/base/184672 Log: o One more s/gpt/gpart/. Modified: head/sbin/bsdlabel/bsdlabel.8 Modified: head/sbin/bsdlabel/bsdlabel.8 ============================================================================== --- head/sbin/bsdlabel/bsdlabel.8 Wed Nov 5 09:27:13 2008 (r184671) +++ head/sbin/bsdlabel/bsdlabel.8 Wed Nov 5 09:28:30 2008 (r184672) @@ -481,7 +481,7 @@ to store the number of sectors, labels are restricted to a maximum of 2^32-1 sectors. This usually means 2TB of disk space. Larger disks should be partitioned using another method such as -.Xr gpt 8 . +.Xr gpart 8 . .Pp The various .Bx Ns s From keramida at FreeBSD.org Wed Nov 5 01:42:06 2008 From: keramida at FreeBSD.org (Giorgos Keramidas) Date: Wed Nov 5 01:42:16 2008 Subject: svn commit: r184673 - head/usr.sbin/gssd Message-ID: <200811050942.mA59g55n022074@svn.freebsd.org> Author: keramida (doc committer) Date: Wed Nov 5 09:42:05 2008 New Revision: 184673 URL: http://svn.freebsd.org/changeset/base/184673 Log: Tiny typo fix and remove 'example' from a "real" manpage. Modified: head/usr.sbin/gssd/gssd.8 Modified: head/usr.sbin/gssd/gssd.8 ============================================================================== --- head/usr.sbin/gssd/gssd.8 Wed Nov 5 09:28:30 2008 (r184672) +++ head/usr.sbin/gssd/gssd.8 Wed Nov 5 09:42:05 2008 (r184673) @@ -27,7 +27,7 @@ .\" .\" Note: The date here should be updated whenever a non-trivial .\" change is made to the manual page. -.Dd August 25, 2008 +.Dd November 5, 2008 .Dt GSSD 8 .Os .Sh NAME @@ -47,7 +47,7 @@ The options are as follows: Run in debug mode. In this mode, .Nm -will not for when it starts. +will not fork when it starts. .El .Sh FILES .Bl -tag -width ".Pa /etc/krb5.keytab" -compact @@ -62,7 +62,7 @@ by kernel GSS-API services. .Sh HISTORY The .Nm -manual page example first appeared in +manual page first appeared in .Fx 8.0 . .Sh AUTHORS This From keramida at freebsd.org Wed Nov 5 01:44:07 2008 From: keramida at freebsd.org (Giorgos Keramidas) Date: Wed Nov 5 01:44:12 2008 Subject: svn commit: r184588 - in head: etc/gss etc/rc.d include/rpc lib/libc/sys lib/libc/xdr lib/librpcsec_gss sbin/mount_nfs sys/compat/freebsd32 sys/conf sys/fs/unionfs sys/kern sys/kgssapi sys/kgssapi/... In-Reply-To: <200811031038.mA3Ac0UR064387@svn.freebsd.org> (Doug Rabson's message of "Mon, 3 Nov 2008 10:38:00 +0000 (UTC)") References: <200811031038.mA3Ac0UR064387@svn.freebsd.org> Message-ID: <87ljvyecdf.fsf@kobe.laptop> On Mon, 3 Nov 2008 10:38:00 +0000 (UTC), Doug Rabson wrote: > Added: > head/etc/rc.d/gssd (contents, props changed) Hi Doug, rc-stuff complains that gssd_enable isn't set "properly", because it isn't set at all. Does the following look ok? %%% diff -r e55b74172f0f etc/defaults/rc.conf --- a/etc/defaults/rc.conf Wed Nov 05 08:53:01 2008 +0200 +++ b/etc/defaults/rc.conf Wed Nov 05 11:43:13 2008 +0200 @@ -265,6 +265,9 @@ kpasswdd_server_enable="NO" # Run kpasswdd (or NO) kpasswdd_server="/usr/libexec/kpasswdd" # path to kerberos 5 passwd daemon +gssd_enable="NO" # Run the gssd daemon (or NO). +gssd_flags="" # Flags for gssd. + rwhod_enable="NO" # Run the rwho daemon (or NO). rwhod_flags="" # Flags for rwhod rarpd_enable="NO" # Run rarpd (or NO). %%% From dfr at rabson.org Wed Nov 5 02:05:40 2008 From: dfr at rabson.org (Doug Rabson) Date: Wed Nov 5 02:05:45 2008 Subject: svn commit: r184588 - in head: etc/gss etc/rc.d include/rpc lib/libc/sys lib/libc/xdr lib/librpcsec_gss sbin/mount_nfs sys/compat/freebsd32 sys/conf sys/fs/unionfs sys/kern sys/kgssapi sys/kgssapi/... In-Reply-To: <87ljvyecdf.fsf@kobe.laptop> References: <200811031038.mA3Ac0UR064387@svn.freebsd.org> <87ljvyecdf.fsf@kobe.laptop> Message-ID: On 5 Nov 2008, at 09:43, Giorgos Keramidas wrote: > On Mon, 3 Nov 2008 10:38:00 +0000 (UTC), Doug Rabson > wrote: >> Added: >> head/etc/rc.d/gssd (contents, props changed) > > Hi Doug, > > rc-stuff complains that gssd_enable isn't set "properly", because it > isn't set at all. Does the following look ok? This looks perfect :) From keramida at FreeBSD.org Wed Nov 5 02:20:34 2008 From: keramida at FreeBSD.org (Giorgos Keramidas) Date: Wed Nov 5 02:20:40 2008 Subject: svn commit: r184675 - head/etc/defaults Message-ID: <200811051020.mA5AKYdJ022856@svn.freebsd.org> Author: keramida (doc committer) Date: Wed Nov 5 10:20:33 2008 New Revision: 184675 URL: http://svn.freebsd.org/changeset/base/184675 Log: Add defaults for /etc/rc.d/gssd Approved by: dfr Modified: head/etc/defaults/rc.conf Modified: head/etc/defaults/rc.conf ============================================================================== --- head/etc/defaults/rc.conf Wed Nov 5 09:55:53 2008 (r184674) +++ head/etc/defaults/rc.conf Wed Nov 5 10:20:33 2008 (r184675) @@ -265,6 +265,9 @@ kadmind5_server="/usr/libexec/kadmind" # kpasswdd_server_enable="NO" # Run kpasswdd (or NO) kpasswdd_server="/usr/libexec/kpasswdd" # path to kerberos 5 passwd daemon +gssd_enable="NO" # Run the gssd daemon (or NO). +gssd_flags="" # Flags for gssd. + rwhod_enable="NO" # Run the rwho daemon (or NO). rwhod_flags="" # Flags for rwhod rarpd_enable="NO" # Run rarpd (or NO). From des at FreeBSD.org Wed Nov 5 02:45:39 2008 From: des at FreeBSD.org (Dag-Erling Smorgrav) Date: Wed Nov 5 02:45:51 2008 Subject: svn commit: r184676 - head/lib/libutil Message-ID: <200811051045.mA5AjdBl024690@svn.freebsd.org> Author: des Date: Wed Nov 5 10:45:39 2008 New Revision: 184676 URL: http://svn.freebsd.org/changeset/base/184676 Log: Disconnect gr_util.c from the build. It isn't documented or used anywhere in the tree, and due to unsafe pointer arithmetic, it will most likely crash on architectures with strict alignment requirements. Modified: head/lib/libutil/Makefile Modified: head/lib/libutil/Makefile ============================================================================== --- head/lib/libutil/Makefile Wed Nov 5 10:20:33 2008 (r184675) +++ head/lib/libutil/Makefile Wed Nov 5 10:45:39 2008 (r184676) @@ -8,7 +8,7 @@ SHLIBDIR?= /lib LIB= util SHLIB_MAJOR= 7 -SRCS= _secure_path.c auth.c gr_util.c expand_number.c flopen.c fparseln.c \ +SRCS= _secure_path.c auth.c expand_number.c flopen.c fparseln.c \ hexdump.c humanize_number.c kld.c login.c login_auth.c login_cap.c \ login_class.c login_crypt.c login_ok.c login_times.c login_tty.c \ logout.c logwtmp.c pidfile.c property.c pty.c pw_util.c realhostname.c \ From des at FreeBSD.org Wed Nov 5 03:06:10 2008 From: des at FreeBSD.org (Dag-Erling Smorgrav) Date: Wed Nov 5 03:06:22 2008 Subject: svn commit: r184677 - head/lib/libutil Message-ID: <200811051106.mA5B6AIU025128@svn.freebsd.org> Author: des Date: Wed Nov 5 11:06:10 2008 New Revision: 184677 URL: http://svn.freebsd.org/changeset/base/184677 Log: Comment out WARNS. There are too many alignment issues in libutil. Modified: head/lib/libutil/Makefile Modified: head/lib/libutil/Makefile ============================================================================== --- head/lib/libutil/Makefile Wed Nov 5 10:45:39 2008 (r184676) +++ head/lib/libutil/Makefile Wed Nov 5 11:06:10 2008 (r184677) @@ -15,7 +15,7 @@ SRCS= _secure_path.c auth.c expand_numbe stub.c trimdomain.c uucplock.c INCS= libutil.h login_cap.h -WARNS?= 6 +#WARNS?= 6 CFLAGS+= -DLIBC_SCCS From bz at FreeBSD.org Wed Nov 5 03:37:26 2008 From: bz at FreeBSD.org (Bjoern A. Zeeb) Date: Wed Nov 5 03:37:37 2008 Subject: svn commit: r184678 - head/sys/net Message-ID: <200811051137.mA5BbQ8S025701@svn.freebsd.org> Author: bz Date: Wed Nov 5 11:37:26 2008 New Revision: 184678 URL: http://svn.freebsd.org/changeset/base/184678 Log: Do only define the variable if either INET or INET6 is defined. To prevent it from compiling without INET and INET6 we should put an explicit #error in there like we have in other files, but not rely on an unused variable. MFC after: 2 months Modified: head/sys/net/if_gif.c Modified: head/sys/net/if_gif.c ============================================================================== --- head/sys/net/if_gif.c Wed Nov 5 11:06:10 2008 (r184677) +++ head/sys/net/if_gif.c Wed Nov 5 11:37:26 2008 (r184678) @@ -207,7 +207,9 @@ static void gif_clone_destroy(ifp) struct ifnet *ifp; { +#if defined(INET) || defined(INET6) int err; +#endif struct gif_softc *sc = ifp->if_softc; mtx_lock(&gif_mtx); From bz at FreeBSD.org Wed Nov 5 03:39:46 2008 From: bz at FreeBSD.org (Bjoern A. Zeeb) Date: Wed Nov 5 03:39:58 2008 Subject: svn commit: r184679 - head/sys/net Message-ID: <200811051139.mA5Bdkts025795@svn.freebsd.org> Author: bz Date: Wed Nov 5 11:39:46 2008 New Revision: 184679 URL: http://svn.freebsd.org/changeset/base/184679 Log: Make tun(4) compile without INET. MFC after: 2 months Modified: head/sys/net/if_tun.c Modified: head/sys/net/if_tun.c ============================================================================== --- head/sys/net/if_tun.c Wed Nov 5 11:37:26 2008 (r184678) +++ head/sys/net/if_tun.c Wed Nov 5 11:39:46 2008 (r184679) @@ -494,8 +494,10 @@ tunclose(struct cdev *dev, int foo, int static int tuninit(struct ifnet *ifp) { +#ifdef INET struct tun_softc *tp = ifp->if_softc; struct ifaddr *ifa; +#endif int error = 0; TUNDEBUG(ifp, "tuninit\n"); From bz at FreeBSD.org Wed Nov 5 03:43:01 2008 From: bz at FreeBSD.org (Bjoern A. Zeeb) Date: Wed Nov 5 03:43:12 2008 Subject: svn commit: r184680 - head/sys/net Message-ID: <200811051143.mA5Bh1Fd025887@svn.freebsd.org> Author: bz Date: Wed Nov 5 11:43:01 2008 New Revision: 184680 URL: http://svn.freebsd.org/changeset/base/184680 Log: Make compile without INET. MFC after: 2 months Modified: head/sys/net/if_arcsubr.c Modified: head/sys/net/if_arcsubr.c ============================================================================== --- head/sys/net/if_arcsubr.c Wed Nov 5 11:39:46 2008 (r184679) +++ head/sys/net/if_arcsubr.c Wed Nov 5 11:43:01 2008 (r184680) @@ -758,7 +758,9 @@ arc_resolvemulti(struct ifnet *ifp, stru struct sockaddr *sa) { struct sockaddr_dl *sdl; +#ifdef INET struct sockaddr_in *sin; +#endif #ifdef INET6 struct sockaddr_in6 *sin6; #endif From bz at FreeBSD.org Wed Nov 5 03:54:56 2008 From: bz at FreeBSD.org (Bjoern A. Zeeb) Date: Wed Nov 5 03:55:02 2008 Subject: svn commit: r184681 - head/sys/net Message-ID: <200811051154.mA5Bsurw026117@svn.freebsd.org> Author: bz Date: Wed Nov 5 11:54:56 2008 New Revision: 184681 URL: http://svn.freebsd.org/changeset/base/184681 Log: Hide the IPv4 init function if the kernel is compiled without INET. It is not used in that case and would not compile. Modified: head/sys/net/radix_mpath.c Modified: head/sys/net/radix_mpath.c ============================================================================== --- head/sys/net/radix_mpath.c Wed Nov 5 11:43:01 2008 (r184680) +++ head/sys/net/radix_mpath.c Wed Nov 5 11:54:56 2008 (r184681) @@ -36,6 +36,7 @@ #include __FBSDID("$FreeBSD$"); +#include "opt_inet.h" #include "opt_inet6.h" #include @@ -308,6 +309,7 @@ rtalloc_mpath_fib(struct route *ro, u_in extern int in6_inithead(void **head, int off); extern int in_inithead(void **head, int off); +#ifdef INET int rn4_mpath_inithead(void **head, int off) { @@ -321,6 +323,7 @@ rn4_mpath_inithead(void **head, int off) } else return 0; } +#endif #ifdef INET6 int From bz at FreeBSD.org Wed Nov 5 04:02:26 2008 From: bz at FreeBSD.org (Bjoern A. Zeeb) Date: Wed Nov 5 04:02:31 2008 Subject: svn commit: r184682 - head/sys/net Message-ID: <200811051202.mA5C2PdK026302@svn.freebsd.org> Author: bz Date: Wed Nov 5 12:02:25 2008 New Revision: 184682 URL: http://svn.freebsd.org/changeset/base/184682 Log: Make compile without INET. The change is modelled after the way it was done for (without) INET6. MFC after: 2 months Modified: head/sys/net/if_spppsubr.c Modified: head/sys/net/if_spppsubr.c ============================================================================== --- head/sys/net/if_spppsubr.c Wed Nov 5 11:54:56 2008 (r184681) +++ head/sys/net/if_spppsubr.c Wed Nov 5 12:02:25 2008 (r184682) @@ -372,8 +372,10 @@ static void sppp_chap_scr(struct sppp *s static const char *sppp_auth_type_name(u_short proto, u_char type); static const char *sppp_cp_type_name(u_char type); +#ifdef INET static const char *sppp_dotted_quad(u_long addr); static const char *sppp_ipcp_opt_name(u_char opt); +#endif #ifdef INET6 static const char *sppp_ipv6cp_opt_name(u_char opt); #endif @@ -388,7 +390,9 @@ static void sppp_phase_network(struct sp static void sppp_print_bytes(const u_char *p, u_short len); static void sppp_print_string(const char *p, u_short len); static void sppp_qflush(struct ifqueue *ifq); +#ifdef INET static void sppp_set_ip_addr(struct sppp *sp, u_long src); +#endif #ifdef INET6 static void sppp_get_ip6_addrs(struct sppp *sp, struct in6_addr *src, struct in6_addr *dst, struct in6_addr *srcmask); @@ -523,9 +527,11 @@ sppp_input(struct ifnet *ifp, struct mbu struct ppp_header *h; int isr = -1; struct sppp *sp = IFP2SP(ifp); + int debug, do_account = 0; +#ifdef INET + int hlen, vjlen; u_char *iphdr; - int hlen, vjlen, do_account = 0; - int debug; +#endif SPPP_LOCK(sp); debug = ifp->if_flags & IFF_DEBUG; @@ -800,7 +806,9 @@ sppp_output(struct ifnet *ifp, struct mb struct ppp_header *h; struct ifqueue *ifq = NULL; int s, error, rv = 0; +#ifdef INET int ipproto = PPP_IP; +#endif int debug = ifp->if_flags & IFF_DEBUG; s = splimp(); @@ -2884,6 +2892,7 @@ sppp_lcp_check_and_close(struct sppp *sp *--------------------------------------------------------------------------* */ +#ifdef INET static void sppp_ipcp_init(struct sppp *sp) { @@ -3362,6 +3371,78 @@ sppp_ipcp_scr(struct sppp *sp) sp->confid[IDX_IPCP] = ++sp->pp_seq[IDX_IPCP]; sppp_cp_send(sp, PPP_IPCP, CONF_REQ, sp->confid[IDX_IPCP], i, &opt); } +#else /* !INET */ +static void +sppp_ipcp_init(struct sppp *sp) +{ +} + +static void +sppp_ipcp_up(struct sppp *sp) +{ +} + +static void +sppp_ipcp_down(struct sppp *sp) +{ +} + +static void +sppp_ipcp_open(struct sppp *sp) +{ +} + +static void +sppp_ipcp_close(struct sppp *sp) +{ +} + +static void +sppp_ipcp_TO(void *cookie) +{ +} + +static int +sppp_ipcp_RCR(struct sppp *sp, struct lcp_header *h, int len) +{ + return (0); +} + +static void +sppp_ipcp_RCN_rej(struct sppp *sp, struct lcp_header *h, int len) +{ +} + +static void +sppp_ipcp_RCN_nak(struct sppp *sp, struct lcp_header *h, int len) +{ +} + +static void +sppp_ipcp_tlu(struct sppp *sp) +{ +} + +static void +sppp_ipcp_tld(struct sppp *sp) +{ +} + +static void +sppp_ipcp_tls(struct sppp *sp) +{ +} + +static void +sppp_ipcp_tlf(struct sppp *sp) +{ +} + +static void +sppp_ipcp_scr(struct sppp *sp) +{ +} +#endif /* *--------------------------------------------------------------------------* @@ -4869,6 +4950,7 @@ sppp_get_ip_addrs(struct sppp *sp, u_lon if (src) *src = ntohl(ssrc); } +#ifdef INET /* * Set my IP address. Must be called at splimp. */ @@ -4922,6 +5004,7 @@ sppp_set_ip_addr(struct sppp *sp, u_long } } } +#endif #ifdef INET6 /* @@ -5292,6 +5375,7 @@ sppp_lcp_opt_name(u_char opt) return buf; } +#ifdef INET static const char * sppp_ipcp_opt_name(u_char opt) { @@ -5304,6 +5388,7 @@ sppp_ipcp_opt_name(u_char opt) snprintf (buf, sizeof(buf), "ipcp/0x%x", opt); return buf; } +#endif #ifdef INET6 static const char * @@ -5389,6 +5474,7 @@ sppp_print_string(const char *p, u_short } } +#ifdef INET static const char * sppp_dotted_quad(u_long addr) { @@ -5400,6 +5486,7 @@ sppp_dotted_quad(u_long addr) (int)(addr & 0xff)); return s; } +#endif static int sppp_strnlen(u_char *p, int max) From des at FreeBSD.org Wed Nov 5 04:13:11 2008 From: des at FreeBSD.org (Dag-Erling Smorgrav) Date: Wed Nov 5 04:13:22 2008 Subject: svn commit: r184683 - head/lib/libutil Message-ID: <200811051213.mA5CDA36026521@svn.freebsd.org> Author: des Date: Wed Nov 5 12:13:10 2008 New Revision: 184683 URL: http://svn.freebsd.org/changeset/base/184683 Log: Like many other functions that handle sockaddrs, realhostname_sa() takes a struct sockaddr * that it casts internally to the appropriate type based on sa_family. However, struct sockaddr has very lax alignment requirements, which causes the compiler to complain when you cast a struct sockaddr * to, say, a struct sockaddr_in6 *. I find it reasonable to assume that the pointer we received is in fact correctly aligned. Therefore, we can work around the compiler warnings by casting to void * before casting to the desired type. For readability's sake, this is done with macros. The same technique should prove useful in other parts of the tree that deal with socket addresses. MFC after: 3 weeks Modified: head/lib/libutil/realhostname.c Modified: head/lib/libutil/realhostname.c ============================================================================== --- head/lib/libutil/realhostname.c Wed Nov 5 12:02:25 2008 (r184682) +++ head/lib/libutil/realhostname.c Wed Nov 5 12:13:10 2008 (r184683) @@ -83,6 +83,18 @@ realhostname(char *host, size_t hsize, c return result; } +/* + * struct sockaddr has very lax alignment requirements, since all its + * members are char or equivalent. This is a problem when trying to + * dereference a struct sockaddr_in6 * that was passed in as a struct + * sockaddr *. Although we know (or trust) that the passed-in struct was + * properly aligned, the compiler doesn't, and (rightly) complains. These + * macros perform the cast in a way that the compiler will accept. + */ +#define SOCKADDR_IN6(p) ((struct sockaddr_in6 *)(void *)(p)) +#define SOCKADDR_IN(p) ((struct sockaddr_in *)(void *)(p)) +#define SOCKINET(p) ((struct sockinet *)(void *)(p)) + int realhostname_sa(char *host, size_t hsize, struct sockaddr *addr, int addrlen) { @@ -96,10 +108,10 @@ realhostname_sa(char *host, size_t hsize /* IPv4 mapped IPv6 addr consideraton, specified in rfc2373. */ if (addr->sa_family == AF_INET6 && addrlen == sizeof(struct sockaddr_in6) && - IN6_IS_ADDR_V4MAPPED(&((struct sockaddr_in6 *)addr)->sin6_addr)) { + IN6_IS_ADDR_V4MAPPED(&SOCKADDR_IN6(addr)->sin6_addr)) { struct sockaddr_in6 *sin6; - sin6 = (struct sockaddr_in6 *)addr; + sin6 = SOCKADDR_IN6(addr); memset(&lsin, 0, sizeof(lsin)); lsin.sin_len = sizeof(struct sockaddr_in); @@ -142,15 +154,16 @@ realhostname_sa(char *host, size_t hsize } if (sa->sa_len == addrlen && sa->sa_family == addr->sa_family) { - ((struct sockinet *)sa)->si_port = ((struct sockinet *)addr)->si_port; + SOCKINET(sa)->si_port = SOCKINET(addr)->si_port; #ifdef INET6 /* * XXX: sin6_socpe_id may not been * filled by DNS */ if (sa->sa_family == AF_INET6 && - ((struct sockaddr_in6 *)sa)->sin6_scope_id == 0) - ((struct sockaddr_in6 *)sa)->sin6_scope_id = ((struct sockaddr_in6 *)addr)->sin6_scope_id; + SOCKADDR_IN6(sa)->sin6_scope_id == 0) + SOCKADDR_IN6(sa)->sin6_scope_id = + SOCKADDR_IN6(addr)->sin6_scope_id; #endif if (!memcmp(sa, addr, sa->sa_len)) { result = HOSTNAME_FOUND; From kib at FreeBSD.org Wed Nov 5 04:28:45 2008 From: kib at FreeBSD.org (Konstantin Belousov) Date: Wed Nov 5 04:28:52 2008 Subject: svn commit: r184684 - stable/7/libexec/rtld-elf Message-ID: <200811051228.mA5CSjSf026889@svn.freebsd.org> Author: kib Date: Wed Nov 5 12:28:44 2008 New Revision: 184684 URL: http://svn.freebsd.org/changeset/base/184684 Log: MFC r183737 (by kan): Allow strong symbols to override weak ones for lookups done through dlsym with RTLD_NEXT/RTLD_SELF handles. Allow symbols from ld-elf.so to be located this way too. Approved by: re (kensmith), kan Modified: stable/7/libexec/rtld-elf/ (props changed) stable/7/libexec/rtld-elf/rtld.c Modified: stable/7/libexec/rtld-elf/rtld.c ============================================================================== --- stable/7/libexec/rtld-elf/rtld.c Wed Nov 5 12:13:10 2008 (r184683) +++ stable/7/libexec/rtld-elf/rtld.c Wed Nov 5 12:28:44 2008 (r184684) @@ -1891,7 +1891,7 @@ do_dlsym(void *handle, const char *name, { DoneList donelist; const Obj_Entry *obj, *defobj; - const Elf_Sym *def; + const Elf_Sym *def, *symp; unsigned long hash; int lockstate; @@ -1917,9 +1917,26 @@ do_dlsym(void *handle, const char *name, if (handle == RTLD_NEXT) obj = obj->next; for (; obj != NULL; obj = obj->next) { - if ((def = symlook_obj(name, hash, obj, ve, flags)) != NULL) { - defobj = obj; - break; + if ((symp = symlook_obj(name, hash, obj, ve, flags)) != NULL) { + if (def == NULL || ELF_ST_BIND(symp->st_info) != STB_WEAK) { + def = symp; + defobj = obj; + if (ELF_ST_BIND(def->st_info) != STB_WEAK) + break; + } + } + } + /* + * Search the dynamic linker itself, and possibly resolve the + * symbol from there. This is how the application links to + * dynamic linker services such as dlopen. Only the values listed + * in the "exports" array can be resolved from the dynamic linker. + */ + if (def == NULL || ELF_ST_BIND(def->st_info) == STB_WEAK) { + symp = symlook_obj(name, hash, &obj_rtld, ve, flags); + if (symp != NULL && is_exported(symp)) { + def = symp; + defobj = &obj_rtld; } } } else { From des at des.no Wed Nov 5 04:29:58 2008 From: des at des.no (=?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?=) Date: Wed Nov 5 04:30:09 2008 Subject: svn commit: r184610 - in head: lib/libusb20 share/man/man4 sys/conf sys/dev/sound/pcm sys/dev/usb2 sys/dev/usb2/bluetooth sys/dev/usb2/controller sys/dev/usb2/core sys/dev/usb2/ethernet sys/dev/usb... In-Reply-To: <200811040231.mA42V4EQ083516@svn.freebsd.org> (Alfred Perlstein's message of "Tue, 4 Nov 2008 02:31:04 +0000 (UTC)") References: <200811040231.mA42V4EQ083516@svn.freebsd.org> Message-ID: <86skq6gxtn.fsf@ds4.des.no> It looks like whoever wrote this went out of their way to find new and creative ways to break just about every style rule we have. DES -- Dag-Erling Sm?rgrav - des@des.no From kib at FreeBSD.org Wed Nov 5 04:32:43 2008 From: kib at FreeBSD.org (Konstantin Belousov) Date: Wed Nov 5 04:32:49 2008 Subject: svn commit: r184685 - stable/7/libexec/rtld-elf Message-ID: <200811051232.mA5CWgbB027010@svn.freebsd.org> Author: kib Date: Wed Nov 5 12:32:42 2008 New Revision: 184685 URL: http://svn.freebsd.org/changeset/base/184685 Log: MFC r182698 (by kan): Make sure internal rtld malloc routines are not called from unlocked contexts as rtld's malloc is not thread safe and is only supposed to be called with exclusive bind lock already held. Approved by: re (kensmith), kan Modified: stable/7/libexec/rtld-elf/ (props changed) stable/7/libexec/rtld-elf/rtld.c Modified: stable/7/libexec/rtld-elf/rtld.c ============================================================================== --- stable/7/libexec/rtld-elf/rtld.c Wed Nov 5 12:28:44 2008 (r184684) +++ stable/7/libexec/rtld-elf/rtld.c Wed Nov 5 12:32:42 2008 (r184685) @@ -106,8 +106,8 @@ static int load_needed_objects(Obj_Entry static int load_preload_objects(void); static Obj_Entry *load_object(const char *, const Obj_Entry *); static Obj_Entry *obj_from_addr(const void *); -static void objlist_call_fini(Objlist *); -static void objlist_call_init(Objlist *); +static void objlist_call_fini(Objlist *, int *lockstate); +static void objlist_call_init(Objlist *, int *lockstate); static void objlist_clear(Objlist *); static Objlist_Entry *objlist_find(Objlist *, const Obj_Entry *); static void objlist_init(Objlist *); @@ -512,8 +512,8 @@ _rtld(Elf_Addr *sp, func_ptr_type *exit_ r_debug_state(NULL, &obj_main->linkmap); /* say hello to gdb! */ - objlist_call_init(&initlist); lockstate = wlock_acquire(rtld_bind_lock); + objlist_call_init(&initlist, &lockstate); objlist_clear(&initlist); wlock_release(rtld_bind_lock, lockstate); @@ -1433,7 +1433,7 @@ obj_from_addr(const void *addr) * non-NULL fini functions. */ static void -objlist_call_fini(Objlist *list) +objlist_call_fini(Objlist *list, int *lockstate) { Objlist_Entry *elm; char *saved_msg; @@ -1443,6 +1443,7 @@ objlist_call_fini(Objlist *list) * call into the dynamic linker and overwrite it. */ saved_msg = errmsg_save(); + wlock_release(rtld_bind_lock, *lockstate); STAILQ_FOREACH(elm, list, link) { if (elm->obj->refcount == 0) { dbg("calling fini function for %s at %p", elm->obj->path, @@ -1452,6 +1453,7 @@ objlist_call_fini(Objlist *list) call_initfini_pointer(elm->obj, elm->obj->fini); } } + *lockstate = wlock_acquire(rtld_bind_lock); errmsg_restore(saved_msg); } @@ -1461,7 +1463,7 @@ objlist_call_fini(Objlist *list) * functions. */ static void -objlist_call_init(Objlist *list) +objlist_call_init(Objlist *list, int *lockstate) { Objlist_Entry *elm; char *saved_msg; @@ -1471,6 +1473,7 @@ objlist_call_init(Objlist *list) * call into the dynamic linker and overwrite it. */ saved_msg = errmsg_save(); + wlock_release(rtld_bind_lock, *lockstate); STAILQ_FOREACH(elm, list, link) { dbg("calling init function for %s at %p", elm->obj->path, (void *)elm->obj->init); @@ -1478,6 +1481,7 @@ objlist_call_init(Objlist *list) elm->obj->path); call_initfini_pointer(elm->obj, elm->obj->init); } + *lockstate = wlock_acquire(rtld_bind_lock); errmsg_restore(saved_msg); } @@ -1638,15 +1642,18 @@ static void rtld_exit(void) { Obj_Entry *obj; + int lockstate; + lockstate = wlock_acquire(rtld_bind_lock); dbg("rtld_exit()"); /* Clear all the reference counts so the fini functions will be called. */ for (obj = obj_list; obj != NULL; obj = obj->next) obj->refcount = 0; - objlist_call_fini(&list_fini); + objlist_call_fini(&list_fini, &lockstate); /* No need to remove the items from the list, since we are exiting. */ if (!libmap_disable) lm_fini(); + wlock_release(rtld_bind_lock, lockstate); } static void * @@ -1760,11 +1767,9 @@ dlclose(void *handle) if (root->refcount == 0) { /* * The object is no longer referenced, so we must unload it. - * First, call the fini functions with no locks held. + * First, call the fini functions. */ - wlock_release(rtld_bind_lock, lockstate); - objlist_call_fini(&list_fini); - lockstate = wlock_acquire(rtld_bind_lock); + objlist_call_fini(&list_fini, &lockstate); objlist_remove_unref(&list_fini); /* Finish cleaning up the newly-unreferenced objects. */ @@ -1872,10 +1877,8 @@ dlopen(const char *name, int mode) name); GDB_STATE(RT_CONSISTENT,obj ? &obj->linkmap : NULL); - /* Call the init functions with no locks held. */ - wlock_release(rtld_bind_lock, lockstate); - objlist_call_init(&initlist); - lockstate = wlock_acquire(rtld_bind_lock); + /* Call the init functions. */ + objlist_call_init(&initlist, &lockstate); objlist_clear(&initlist); wlock_release(rtld_bind_lock, lockstate); return obj; From danger at FreeBSD.org Wed Nov 5 06:14:32 2008 From: danger at FreeBSD.org (Daniel Gerzo) Date: Wed Nov 5 06:14:38 2008 Subject: svn commit: r184686 - in stable/7/usr.sbin/portsnap: . portsnap Message-ID: <200811051414.mA5EEVVv028839@svn.freebsd.org> Author: danger (doc committer) Date: Wed Nov 5 14:14:31 2008 New Revision: 184686 URL: http://svn.freebsd.org/changeset/base/184686 Log: MFC rev. 183041: - remove superfluous word PR: docs/127401 Submitted by: Mick Charles Beaver Approved by: re@ (blackend) Modified: stable/7/usr.sbin/portsnap/ (props changed) stable/7/usr.sbin/portsnap/portsnap/portsnap.8 Modified: stable/7/usr.sbin/portsnap/portsnap/portsnap.8 ============================================================================== --- stable/7/usr.sbin/portsnap/portsnap/portsnap.8 Wed Nov 5 12:32:42 2008 (r184685) +++ stable/7/usr.sbin/portsnap/portsnap/portsnap.8 Wed Nov 5 14:14:31 2008 (r184686) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd August 13, 2005 +.Dd September 15, 2008 .Dt PORTSNAP 8 .Os FreeBSD .Sh NAME @@ -60,7 +60,7 @@ Store working files (e.g.\& downloaded u .Pa /var/db/portsnap , or as given in the configuration file.) .It Fl f Ar conffile -Read the configuration from from +Read the configuration from .Ar conffile . (default: .Pa /etc/portsnap.conf ) From danger at FreeBSD.org Wed Nov 5 06:15:22 2008 From: danger at FreeBSD.org (Daniel Gerzo) Date: Wed Nov 5 06:15:28 2008 Subject: svn commit: r184687 - in stable/6/usr.sbin/portsnap: . portsnap Message-ID: <200811051415.mA5EFMVm028895@svn.freebsd.org> Author: danger (doc committer) Date: Wed Nov 5 14:15:22 2008 New Revision: 184687 URL: http://svn.freebsd.org/changeset/base/184687 Log: MFC rev. 183041: - remove superfluous word PR: docs/127401 Submitted by: Mick Charles Beaver Approved by: re@ (blackend) Modified: stable/6/usr.sbin/portsnap/ (props changed) stable/6/usr.sbin/portsnap/portsnap/portsnap.8 Modified: stable/6/usr.sbin/portsnap/portsnap/portsnap.8 ============================================================================== --- stable/6/usr.sbin/portsnap/portsnap/portsnap.8 Wed Nov 5 14:14:31 2008 (r184686) +++ stable/6/usr.sbin/portsnap/portsnap/portsnap.8 Wed Nov 5 14:15:22 2008 (r184687) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd August 13, 2005 +.Dd September 15, 2008 .Dt PORTSNAP 8 .Os FreeBSD .Sh NAME @@ -60,7 +60,7 @@ Store working files (e.g. downloaded upd .Pa /var/db/portsnap , or as given in the configuration file.) .It Fl f Ar conffile -Read the configuration from from +Read the configuration from .Ar conffile . (default: .Pa /etc/portsnap.conf ) From danger at FreeBSD.org Wed Nov 5 06:15:53 2008 From: danger at FreeBSD.org (Daniel Gerzo) Date: Wed Nov 5 06:15:59 2008 Subject: svn commit: r184688 - in releng/6.4/usr.sbin/portsnap: . portsnap Message-ID: <200811051415.mA5EFrRq028938@svn.freebsd.org> Author: danger (doc committer) Date: Wed Nov 5 14:15:53 2008 New Revision: 184688 URL: http://svn.freebsd.org/changeset/base/184688 Log: MFC rev. 183041: - remove superfluous word PR: docs/127401 Submitted by: Mick Charles Beaver Approved by: re@ (blackend) Modified: releng/6.4/usr.sbin/portsnap/ (props changed) releng/6.4/usr.sbin/portsnap/portsnap/portsnap.8 Modified: releng/6.4/usr.sbin/portsnap/portsnap/portsnap.8 ============================================================================== --- releng/6.4/usr.sbin/portsnap/portsnap/portsnap.8 Wed Nov 5 14:15:22 2008 (r184687) +++ releng/6.4/usr.sbin/portsnap/portsnap/portsnap.8 Wed Nov 5 14:15:53 2008 (r184688) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd August 13, 2005 +.Dd September 15, 2008 .Dt PORTSNAP 8 .Os FreeBSD .Sh NAME @@ -60,7 +60,7 @@ Store working files (e.g. downloaded upd .Pa /var/db/portsnap , or as given in the configuration file.) .It Fl f Ar conffile -Read the configuration from from +Read the configuration from .Ar conffile . (default: .Pa /etc/portsnap.conf ) From ed at FreeBSD.org Wed Nov 5 07:04:04 2008 From: ed at FreeBSD.org (Ed Schouten) Date: Wed Nov 5 07:04:16 2008 Subject: svn commit: r184689 - in head: share/man/man4 sys/conf sys/dev/snp sys/modules sys/modules/snp Message-ID: <200811051504.mA5F44tx029900@svn.freebsd.org> Author: ed Date: Wed Nov 5 15:04:03 2008 New Revision: 184689 URL: http://svn.freebsd.org/changeset/base/184689 Log: Reintroduce the snp(4) driver. Because the TTY hooks interface was not finished when I imported the MPSAFE TTY layer, I had to disconnect the snp(4) driver. This snp(4) implementation has been sitting in my P4 branch for some time now. Unfortunately it still doesn't use the same error handling as snp(4) (returning codes through FIONREAD), but it should already be usable. I'm committing this to SVN, hoping someone else could polish off its rough edges. It's always better than having a broken driver sitting in the tree. Modified: head/share/man/man4/snp.4 head/sys/conf/NOTES head/sys/dev/snp/snp.c head/sys/modules/Makefile head/sys/modules/snp/Makefile Modified: head/share/man/man4/snp.4 ============================================================================== --- head/share/man/man4/snp.4 Wed Nov 5 14:15:53 2008 (r184688) +++ head/share/man/man4/snp.4 Wed Nov 5 15:04:03 2008 (r184689) @@ -1,7 +1,7 @@ .\" .\" $FreeBSD$ .\" -.Dd September 18, 2005 +.Dd November 5, 2008 .Dt SNP 4 .Os .Sh NAME @@ -77,11 +77,23 @@ The .Nm device first appeared in .Fx 2.1 . +In +.Fx 8.0 +the +.Nm +driver was rewritten to work with the replaced TTY subsystem. .Sh AUTHORS -.An Ugen J.S. Antsilevich Aq ugen@NetVision.net.il +The author of the current implementation is +.An Ed Schouten Aq ed@FreeBSD.org . +Previous versions of +.Nm +were based on code written by +.An Ugen J.S. Antsilevich Aq ugen@NetVision.net.il . .Sh BUGS -Caveat emptor! -This manual page is horribly stale and wildly inaccurate in some places. -.Pp -While in line mode, user input cannot be seen. -No signals may be sent to the observed tty. +This version of +.Nm +does not return proper error codes when calling +.Dv FIONREAD . +It also does not allow +.Dv SNPSTTY +to detach itself from the TTY. Modified: head/sys/conf/NOTES ============================================================================== --- head/sys/conf/NOTES Wed Nov 5 14:15:53 2008 (r184688) +++ head/sys/conf/NOTES Wed Nov 5 15:04:03 2008 (r184689) @@ -1278,6 +1278,7 @@ options SES_ENABLE_PASSTHROUGH device pty #BSD-style compatibility pseudo ttys device nmdm #back-to-back tty devices device md #Memory/malloc disk +device snp #Snoop device - to look at pty/vty/etc.. device ccd #Concatenated disk driver device firmware #firmware(9) support Modified: head/sys/dev/snp/snp.c ============================================================================== --- head/sys/dev/snp/snp.c Wed Nov 5 14:15:53 2008 (r184688) +++ head/sys/dev/snp/snp.c Wed Nov 5 15:04:03 2008 (r184689) @@ -1,638 +1,352 @@ /*- - * Copyright (c) 1995 Ugen J.S.Antsilevich + * Copyright (c) 2008 Ed Schouten + * All rights reserved. * - * Redistribution and use in source forms, with and without modification, - * are permitted provided that this entire comment appears intact. - * - * Redistribution in binary form may occur without any restrictions. - * Obviously, it would be nice if you gave credit where credit is due - * but requiring it would be too onerous. - * - * This software is provided ``AS IS'' without any warranties of any kind. - * - * Snoop stuff. + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. */ #include __FBSDID("$FreeBSD$"); #include -#include +#include #include #include -#include -#include -#include -#include #include +#include #include -#include +#include #include +#include +#include +#include #include -#include -#include - -static l_close_t snplclose; -static l_write_t snplwrite; -static d_open_t snpopen; -static d_read_t snpread; -static d_write_t snpwrite; -static d_ioctl_t snpioctl; -static d_poll_t snppoll; - -static struct cdevsw snp_cdevsw = { - .d_version = D_VERSION, - .d_flags = D_PSEUDO | D_NEEDGIANT, - .d_open = snpopen, - .d_read = snpread, - .d_write = snpwrite, - .d_ioctl = snpioctl, - .d_poll = snppoll, - .d_name = "snp", -}; -static struct linesw snpdisc = { - .l_open = tty_open, - .l_close = snplclose, - .l_read = ttread, - .l_write = snplwrite, - .l_ioctl = l_nullioctl, - .l_rint = ttyinput, - .l_start = ttstart, - .l_modem = ttymodem -}; +static struct cdev *snp_dev; +/* XXX: should be mtx, but TTY can be locked by Giant. */ +static struct sx snp_register_lock; +SX_SYSINIT(snp_register_lock, &snp_register_lock, + "tty snoop registration"); +static MALLOC_DEFINE(M_SNP, "snp", "tty snoop device"); /* - * This is the main snoop per-device structure. + * There is no need to have a big input buffer. In most typical setups, + * we won't inject much data into the TTY, because users can't type + * really fast. */ -struct snoop { - LIST_ENTRY(snoop) snp_list; /* List glue. */ - struct cdev *snp_target; /* Target tty device. */ - struct tty *snp_tty; /* Target tty pointer. */ - u_long snp_len; /* Possible length. */ - u_long snp_base; /* Data base. */ - u_long snp_blen; /* Used length. */ - caddr_t snp_buf; /* Allocation pointer. */ - int snp_flags; /* Flags. */ - struct selinfo snp_sel; /* Select info. */ - int snp_olddisc; /* Old line discipline. */ -}; - +#define SNP_INPUT_BUFSIZE 16 /* - * Possible flags. + * The output buffer has to be really big. Right now we don't support + * any form of flow control, which means we lost any data we can't + * accept. We set the output buffer size to about twice the size of a + * pseudo-terminal/virtual console's output buffer. */ -#define SNOOP_ASYNC 0x0002 -#define SNOOP_OPEN 0x0004 -#define SNOOP_RWAIT 0x0008 -#define SNOOP_OFLOW 0x0010 -#define SNOOP_DOWN 0x0020 +#define SNP_OUTPUT_BUFSIZE 16384 -/* - * Other constants. - */ -#define SNOOP_MINLEN (4*1024) /* This should be power of 2. - * 4K tested to be the minimum - * for which on normal tty - * usage there is no need to - * allocate more. - */ -#define SNOOP_MAXLEN (64*1024) /* This one also,64K enough - * If we grow more,something - * really bad in this world.. - */ +static d_open_t snp_open; +static d_read_t snp_read; +static d_write_t snp_write; +static d_ioctl_t snp_ioctl; +static d_poll_t snp_poll; -static MALLOC_DEFINE(M_SNP, "snp", "Snoop device data"); -/* - * The number of the "snoop" line discipline. This gets determined at - * module load time. - */ -static int snooplinedisc; -static struct cdev *snoopdev; +static struct cdevsw snp_cdevsw = { + .d_version = D_VERSION, + .d_open = snp_open, + .d_read = snp_read, + .d_write = snp_write, + .d_ioctl = snp_ioctl, + .d_poll = snp_poll, + .d_name = "snp", +}; -static LIST_HEAD(, snoop) snp_sclist = LIST_HEAD_INITIALIZER(&snp_sclist); +static th_getc_capture_t snp_getc_capture; -static struct tty *snpdevtotty(struct cdev *dev); -static void snp_detach(void *arg); -static int snp_down(struct snoop *snp); -static int snp_in(struct snoop *snp, char *buf, int n); -static int snp_modevent(module_t mod, int what, void *arg); -static struct snoop *ttytosnp(struct tty *); +static struct ttyhook snp_hook = { + .th_getc_capture = snp_getc_capture, +}; -static struct snoop * -ttytosnp(struct tty *tp) -{ - struct snoop *snp; - - LIST_FOREACH(snp, &snp_sclist, snp_list) { - if (snp->snp_tty == tp) - return (snp); - } - return (NULL); -} +/* + * Per-instance structure. + * + * List of locks + * (r) locked by snp_register_lock on assignment + * (t) locked by tty_lock + */ +struct snp_softc { + struct tty *snp_tty; /* (r) TTY we're snooping. */ + struct ttyoutq snp_outq; /* (t) Output queue. */ + struct cv snp_outwait; /* (t) Output wait queue. */ + struct selinfo snp_outpoll; /* (t) Output polling. */ +}; -static int -snplclose(struct tty *tp, int flag) +static void +snp_dtor(void *data) { - struct snoop *snp; - int error; - - snp = ttytosnp(tp); - error = snp_down(snp); - if (error != 0) - return (error); - error = ttylclose(tp, flag); - return (error); -} + struct snp_softc *ss = data; + struct tty *tp; -static int -snplwrite(struct tty *tp, struct uio *uio, int flag) -{ - struct iovec iov; - struct uio uio2; - struct snoop *snp; - int error, ilen; - char *ibuf; - - error = 0; - ibuf = NULL; - snp = ttytosnp(tp); - while (uio->uio_resid > 0) { - ilen = imin(512, uio->uio_resid); - ibuf = malloc(ilen, M_SNP, M_WAITOK); - error = uiomove(ibuf, ilen, uio); - if (error != 0) - break; - snp_in(snp, ibuf, ilen); - /* Hackish, but probably the least of all evils. */ - iov.iov_base = ibuf; - iov.iov_len = ilen; - uio2.uio_iov = &iov; - uio2.uio_iovcnt = 1; - uio2.uio_offset = 0; - uio2.uio_resid = ilen; - uio2.uio_segflg = UIO_SYSSPACE; - uio2.uio_rw = UIO_WRITE; - uio2.uio_td = uio->uio_td; - error = ttwrite(tp, &uio2, flag); - if (error != 0) - break; - free(ibuf, M_SNP); - ibuf = NULL; + tp = ss->snp_tty; + if (tp != NULL) { + tty_lock(tp); + ttyoutq_free(&ss->snp_outq); + ttyhook_unregister(tp); } - if (ibuf != NULL) - free(ibuf, M_SNP); - return (error); -} - -static struct tty * -snpdevtotty(struct cdev *dev) -{ - struct cdevsw *cdp; - struct tty *tp; - cdp = dev_refthread(dev); - if (cdp == NULL) - return (NULL); - if (!(cdp->d_flags & D_TTY)) - tp = NULL; - else - tp = dev->si_tty; - dev_relthread(dev); - return (tp); + cv_destroy(&ss->snp_outwait); + free(ss, M_SNP); } -#define SNP_INPUT_BUF 5 /* This is even too much, the maximal - * interactive mode write is 3 bytes - * length for function keys... - */ +/* + * Snoop device node routines. + */ static int -snpwrite(struct cdev *dev, struct uio *uio, int flag) +snp_open(struct cdev *dev, int flag, int mode, struct thread *td) { - struct snoop *snp; - struct tty *tp; - int error, i, len; - unsigned char c[SNP_INPUT_BUF]; + struct snp_softc *ss; - error = devfs_get_cdevpriv((void **)&snp); - if (error != 0) - return (error); + /* Allocate per-snoop data. */ + ss = malloc(sizeof(struct snp_softc), M_SNP, M_WAITOK|M_ZERO); + ttyoutq_init(&ss->snp_outq); + cv_init(&ss->snp_outwait, "snp out"); - tp = snp->snp_tty; - if (tp == NULL) - return (EIO); - if ((tp->t_state & TS_SNOOP) && tp->t_line == snooplinedisc) - goto tty_input; + devfs_set_cdevpriv(ss, snp_dtor); - printf("snp: attempt to write to bad tty\n"); - return (EIO); - -tty_input: - if (!(tp->t_state & TS_ISOPEN)) - return (EIO); - - while (uio->uio_resid > 0) { - len = imin(uio->uio_resid, SNP_INPUT_BUF); - if ((error = uiomove(c, len, uio)) != 0) - return (error); - for (i=0; i < len; i++) { - if (ttyinput(c[i], tp)) - return (EIO); - } - } return (0); } - static int -snpread(struct cdev *dev, struct uio *uio, int flag) +snp_read(struct cdev *dev, struct uio *uio, int flag) { - struct snoop *snp; - int error, len, n, nblen, s; - caddr_t from; - char *nbuf; + int error, oresid = uio->uio_resid; + struct snp_softc *ss; + struct tty *tp; + + if (uio->uio_resid == 0) + return (0); - error = devfs_get_cdevpriv((void **)&snp); + error = devfs_get_cdevpriv((void **)&ss); if (error != 0) return (error); - - KASSERT(snp->snp_len + snp->snp_base <= snp->snp_blen, - ("snoop buffer error")); - - if (snp->snp_tty == NULL) + + tp = ss->snp_tty; + if (tp == NULL || tty_gone(tp)) return (EIO); - snp->snp_flags &= ~SNOOP_RWAIT; + tty_lock(tp); + for (;;) { + error = ttyoutq_read_uio(&ss->snp_outq, tp, uio); + if (error != 0 || uio->uio_resid != oresid) + break; - do { - if (snp->snp_len == 0) { - if (flag & O_NONBLOCK) - return (EWOULDBLOCK); - snp->snp_flags |= SNOOP_RWAIT; - error = tsleep(snp, (PZERO + 1) | PCATCH, - "snprd", 0); - if (error != 0) - return (error); + /* Wait for more data. */ + if (flag & O_NONBLOCK) { + error = EWOULDBLOCK; + break; } - } while (snp->snp_len == 0); - - n = snp->snp_len; - - error = 0; - while (snp->snp_len > 0 && uio->uio_resid > 0 && error == 0) { - len = min((unsigned)uio->uio_resid, snp->snp_len); - from = (caddr_t)(snp->snp_buf + snp->snp_base); - if (len == 0) + error = cv_wait_sig(&ss->snp_outwait, tp->t_mtx); + if (error != 0) + break; + if (tty_gone(tp)) { + error = EIO; break; - - error = uiomove(from, len, uio); - snp->snp_base += len; - snp->snp_len -= len; - } - if ((snp->snp_flags & SNOOP_OFLOW) && (n < snp->snp_len)) { - snp->snp_flags &= ~SNOOP_OFLOW; - } - s = spltty(); - nblen = snp->snp_blen; - if (((nblen / 2) >= SNOOP_MINLEN) && (nblen / 2) >= snp->snp_len) { - while (nblen / 2 >= snp->snp_len && nblen / 2 >= SNOOP_MINLEN) - nblen = nblen / 2; - if ((nbuf = malloc(nblen, M_SNP, M_NOWAIT)) != NULL) { - bcopy(snp->snp_buf + snp->snp_base, nbuf, snp->snp_len); - free(snp->snp_buf, M_SNP); - snp->snp_buf = nbuf; - snp->snp_blen = nblen; - snp->snp_base = 0; } } - splx(s); + tty_unlock(tp); return (error); } static int -snp_in(struct snoop *snp, char *buf, int n) +snp_write(struct cdev *dev, struct uio *uio, int flag) { - int s_free, s_tail; - int s, len, nblen; - caddr_t from, to; - char *nbuf; + struct snp_softc *ss; + struct tty *tp; + int error, len, i; + char in[SNP_INPUT_BUFSIZE]; + + error = devfs_get_cdevpriv((void **)&ss); + if (error != 0) + return (error); + + tp = ss->snp_tty; + if (tp == NULL || tty_gone(tp)) + return (EIO); - KASSERT(n >= 0, ("negative snoop char count")); + while (uio->uio_resid > 0) { + /* Read new data. */ + len = imin(uio->uio_resid, sizeof in); + error = uiomove(in, len, uio); + if (error != 0) + return (error); - if (n == 0) - return (0); + tty_lock(tp); - if (snp->snp_flags & SNOOP_DOWN) { - printf("snp: more data to down interface\n"); - return (0); - } + /* Driver could have abandoned the TTY in the mean time. */ + if (tty_gone(tp)) { + tty_unlock(tp); + return (ENXIO); + } - if (snp->snp_flags & SNOOP_OFLOW) { - printf("snp: buffer overflow\n"); /* - * On overflow we just repeat the standart close - * procedure...yes , this is waste of space but.. Then next - * read from device will fail if one would recall he is - * snooping and retry... + * Deliver data to the TTY. Ignore errors for now, + * because we shouldn't bail out when we're running + * close to the watermarks. */ - - return (snp_down(snp)); - } - s_tail = snp->snp_blen - (snp->snp_len + snp->snp_base); - s_free = snp->snp_blen - snp->snp_len; - - - if (n > s_free) { - s = spltty(); - nblen = snp->snp_blen; - while ((n > s_free) && ((nblen * 2) <= SNOOP_MAXLEN)) { - nblen = snp->snp_blen * 2; - s_free = nblen - (snp->snp_len + snp->snp_base); - } - if ((n <= s_free) && (nbuf = malloc(nblen, M_SNP, M_NOWAIT))) { - bcopy(snp->snp_buf + snp->snp_base, nbuf, snp->snp_len); - free(snp->snp_buf, M_SNP); - snp->snp_buf = nbuf; - snp->snp_blen = nblen; - snp->snp_base = 0; + if (ttydisc_can_bypass(tp)) { + ttydisc_rint_bypass(tp, in, len); } else { - snp->snp_flags |= SNOOP_OFLOW; - if (snp->snp_flags & SNOOP_RWAIT) { - snp->snp_flags &= ~SNOOP_RWAIT; - wakeup(snp); - } - splx(s); - return (0); + for (i = 0; i < len; i++) + ttydisc_rint(tp, in[i], 0); } - splx(s); - } - if (n > s_tail) { - from = (caddr_t)(snp->snp_buf + snp->snp_base); - to = (caddr_t)(snp->snp_buf); - len = snp->snp_len; - bcopy(from, to, len); - snp->snp_base = 0; - } - to = (caddr_t)(snp->snp_buf + snp->snp_base + snp->snp_len); - bcopy(buf, to, n); - snp->snp_len += n; - - if (snp->snp_flags & SNOOP_RWAIT) { - snp->snp_flags &= ~SNOOP_RWAIT; - wakeup(snp); - } - selwakeuppri(&snp->snp_sel, PZERO + 1); - - return (n); -} - -static void -snp_dtor(void *data) -{ - struct snoop *snp = data; - - snp->snp_blen = 0; - LIST_REMOVE(snp, snp_list); - free(snp->snp_buf, M_SNP); - snp->snp_flags &= ~SNOOP_OPEN; - snp_detach(snp); -} - -static int -snpopen(struct cdev *dev, int flag, int mode, struct thread *td) -{ - struct snoop *snp; - int error; - - snp = malloc(sizeof(*snp), M_SNP, M_WAITOK | M_ZERO); - error = devfs_set_cdevpriv(snp, snp_dtor); - if (error != 0) { - free(snp, M_SNP); - return (error); - } - - /* - * We intentionally do not OR flags with SNOOP_OPEN, but set them so - * all previous settings (especially SNOOP_OFLOW) will be cleared. - */ - snp->snp_flags = SNOOP_OPEN; - - snp->snp_buf = malloc(SNOOP_MINLEN, M_SNP, M_WAITOK); - snp->snp_blen = SNOOP_MINLEN; - snp->snp_base = 0; - snp->snp_len = 0; - - /* - * snp_tty == NULL is for inactive snoop devices. - */ - snp->snp_tty = NULL; - snp->snp_target = NULL; - - LIST_INSERT_HEAD(&snp_sclist, snp, snp_list); - return (0); -} - - -static void -snp_detach(void *arg) -{ - struct snoop *snp; - struct tty *tp; - - snp = (struct snoop *)arg; - snp->snp_base = 0; - snp->snp_len = 0; - - /* - * If line disc. changed we do not touch this pointer, SLIP/PPP will - * change it anyway. - */ - tp = snp->snp_tty; - if (tp == NULL) - goto detach_notty; - - if ((tp->t_state & TS_SNOOP) && tp->t_line == snooplinedisc) { - tp->t_state &= ~TS_SNOOP; - tp->t_line = snp->snp_olddisc; - } else - printf("snp: bad attached tty data\n"); - - snp->snp_tty = NULL; - snp->snp_target = NULL; - -detach_notty: - selwakeuppri(&snp->snp_sel, PZERO + 1); - if ((snp->snp_flags & SNOOP_OPEN) == 0) - free(snp, M_SNP); -} - -static int -snp_down(struct snoop *snp) -{ - if (snp->snp_blen != SNOOP_MINLEN) { - free(snp->snp_buf, M_SNP); - snp->snp_buf = malloc(SNOOP_MINLEN, M_SNP, M_WAITOK); - snp->snp_blen = SNOOP_MINLEN; + ttydisc_rint_done(tp); + tty_unlock(tp); } - snp->snp_flags |= SNOOP_DOWN; - snp_detach(snp); return (0); } static int -snpioctl(struct cdev *dev, u_long cmd, caddr_t data, int flags, +snp_ioctl(struct cdev *dev, u_long cmd, caddr_t data, int flags, struct thread *td) { - struct snoop *snp; + struct snp_softc *ss; struct tty *tp; - struct cdev *tdev; - struct file *fp; - int error, s; + int error; - error = devfs_get_cdevpriv((void **)&snp); + error = devfs_get_cdevpriv((void **)&ss); if (error != 0) return (error); switch (cmd) { case SNPSTTY: - s = *(int *)data; - if (s < 0) - return (snp_down(snp)); - - if (fget(td, s, &fp) != 0) - return (EINVAL); - if (fp->f_type != DTYPE_VNODE || - fp->f_vnode->v_type != VCHR || - fp->f_vnode->v_rdev == NULL) { - fdrop(fp, td); - return (EINVAL); - } - tdev = fp->f_vnode->v_rdev; - fdrop(fp, td); - - if (snp->snp_tty != NULL) - return (EBUSY); - - tp = snpdevtotty(tdev); - if (!tp) - return (EINVAL); - if (tp->t_state & TS_SNOOP) + /* Bind TTY to snoop instance. */ + sx_xlock(&snp_register_lock); + if (ss->snp_tty != NULL) { + sx_xunlock(&snp_register_lock); return (EBUSY); + } + error = ttyhook_register(&ss->snp_tty, td, *(int *)data, + &snp_hook, ss); + sx_xunlock(&snp_register_lock); + if (error != 0) + return (error); - s = spltty(); - tp->t_state |= TS_SNOOP; - snp->snp_olddisc = tp->t_line; - tp->t_line = snooplinedisc; - snp->snp_tty = tp; - snp->snp_target = tdev; - - /* - * Clean overflow and down flags - - * we'll have a chance to get them in the future :))) - */ - snp->snp_flags &= ~SNOOP_OFLOW; - snp->snp_flags &= ~SNOOP_DOWN; - splx(s); - break; + /* Now that went okay, allocate a buffer for the queue. */ + tp = ss->snp_tty; + tty_lock(tp); + ttyoutq_setsize(&ss->snp_outq, tp, SNP_OUTPUT_BUFSIZE); + tty_unlock(tp); + return (0); case SNPGTTY: - /* - * We keep snp_target field specially to make - * SNPGTTY happy, else we can't know what is device - * major/minor for tty. - */ - *((dev_t *)data) = dev2udev(snp->snp_target); - break; - - case FIONBIO: - break; - - case FIOASYNC: - if (*(int *)data) - snp->snp_flags |= SNOOP_ASYNC; + /* Obtain device number of associated TTY. */ + if (ss->snp_tty == NULL) + *(dev_t *)data = NODEV; else - snp->snp_flags &= ~SNOOP_ASYNC; - break; - + *(dev_t *)data = tty_udev(ss->snp_tty); + return (0); case FIONREAD: - s = spltty(); - if (snp->snp_tty != NULL) - *(int *)data = snp->snp_len; - else - if (snp->snp_flags & SNOOP_DOWN) { - if (snp->snp_flags & SNOOP_OFLOW) - *(int *)data = SNP_OFLOW; - else - *(int *)data = SNP_TTYCLOSE; - } else { - *(int *)data = SNP_DETACH; - } - splx(s); - break; - + tp = ss->snp_tty; + if (tp != NULL) { + tty_lock(tp); + *(int *)data = ttyoutq_bytesused(&ss->snp_outq); + tty_unlock(tp); + } else { + *(int *)data = 0; + } + return (0); default: return (ENOTTY); } - return (0); } static int -snppoll(struct cdev *dev, int events, struct thread *td) +snp_poll(struct cdev *dev, int events, struct thread *td) { - struct snoop *snp; + struct snp_softc *ss; + struct tty *tp; int revents; - if (devfs_get_cdevpriv((void **)&snp) != 0) + if (devfs_get_cdevpriv((void **)&ss) != 0) return (events & (POLLHUP|POLLIN|POLLRDNORM|POLLOUT|POLLWRNORM)); revents = 0; - /* - * If snoop is down, we don't want to poll() forever so we return 1. - * Caller should see if we down via FIONREAD ioctl(). The last should - * return -1 to indicate down state. - */ + if (events & (POLLIN | POLLRDNORM)) { - if (snp->snp_flags & SNOOP_DOWN || snp->snp_len > 0) - revents |= events & (POLLIN | POLLRDNORM); - else - selrecord(td, &snp->snp_sel); + tp = ss->snp_tty; + if (tp != NULL) { + tty_lock(tp); + if (ttyoutq_bytesused(&ss->snp_outq) > 0) + revents |= events & (POLLIN | POLLRDNORM); + tty_unlock(tp); + } } + + if (revents == 0) + selrecord(td, &ss->snp_outpoll); + return (revents); } +/* + * TTY hook events. + */ + static int snp_modevent(module_t mod, int type, void *data) { switch (type) { case MOD_LOAD: - snooplinedisc = ldisc_register(LDISC_LOAD, &snpdisc); - snoopdev = make_dev(&snp_cdevsw, 0, UID_ROOT, GID_WHEEL, - 0600, "snp"); - /* For compatibility */ - make_dev_alias(snoopdev, "snp0"); - break; + snp_dev = make_dev(&snp_cdevsw, 0, + UID_ROOT, GID_WHEEL, 0600, "snp"); + return (0); case MOD_UNLOAD: - if (!LIST_EMPTY(&snp_sclist)) - return (EBUSY); - destroy_dev(snoopdev); - ldisc_deregister(snooplinedisc); - break; + /* XXX: Make existing users leave. */ + destroy_dev(snp_dev); + return (0); default: return (EOPNOTSUPP); - break; } - return (0); +} + +static void +snp_getc_capture(struct tty *tp, const void *buf, size_t len) +{ + struct snp_softc *ss = ttyhook_softc(tp); + + ttyoutq_write(&ss->snp_outq, buf, len); + + cv_broadcast(&ss->snp_outwait); + selwakeup(&ss->snp_outpoll); } static moduledata_t snp_mod = { - "snp", - snp_modevent, - NULL + "snp", + snp_modevent, + NULL }; + DECLARE_MODULE(snp, snp_mod, SI_SUB_DRIVERS, SI_ORDER_MIDDLE); Modified: head/sys/modules/Makefile ============================================================================== --- head/sys/modules/Makefile Wed Nov 5 14:15:53 2008 (r184688) +++ head/sys/modules/Makefile Wed Nov 5 15:04:03 2008 (r184689) @@ -252,6 +252,7 @@ SUBDIR= ${_3dfx} \ ${_smbfs} \ sn \ ${_snc} \ + snp \ ${_sound} \ ${_speaker} \ ${_splash} \ Modified: head/sys/modules/snp/Makefile ============================================================================== --- head/sys/modules/snp/Makefile Wed Nov 5 14:15:53 2008 (r184688) +++ head/sys/modules/snp/Makefile Wed Nov 5 15:04:03 2008 (r184689) @@ -3,6 +3,6 @@ .PATH: ${.CURDIR}/../../dev/snp KMOD= snp -SRCS= snp.c vnode_if.h +SRCS= snp.c .include From des at FreeBSD.org Wed Nov 5 07:07:42 2008 From: des at FreeBSD.org (Dag-Erling Smorgrav) Date: Wed Nov 5 07:07:49 2008 Subject: svn commit: r184690 - head/share/man/man9 Message-ID: <200811051507.mA5F7gO4029993@svn.freebsd.org> Author: des Date: Wed Nov 5 15:07:42 2008 New Revision: 184690 URL: http://svn.freebsd.org/changeset/base/184690 Log: Missing email address MFC after: 3 weeks Modified: head/share/man/man9/pseudofs.9 Modified: head/share/man/man9/pseudofs.9 ============================================================================== --- head/share/man/man9/pseudofs.9 Wed Nov 5 15:04:03 2008 (r184689) +++ head/share/man/man9/pseudofs.9 Wed Nov 5 15:07:42 2008 (r184690) @@ -67,4 +67,4 @@ module appeared in The .Nm module and this manual page were written by -.An Dag-Erling Sm\(/orgrav . +.An Dag-Erling Sm\(/orgrav Aq des@FreeBSD.org . From des at FreeBSD.org Wed Nov 5 07:08:10 2008 From: des at FreeBSD.org (Dag-Erling Smorgrav) Date: Wed Nov 5 07:08:16 2008 Subject: svn commit: r184691 - head/sys/compat/linprocfs Message-ID: <200811051508.mA5F89XD030040@svn.freebsd.org> Author: des Date: Wed Nov 5 15:08:09 2008 New Revision: 184691 URL: http://svn.freebsd.org/changeset/base/184691 Log: utf-8 MFC after: 3 weeks Modified: head/sys/compat/linprocfs/linprocfs.c Modified: head/sys/compat/linprocfs/linprocfs.c ============================================================================== --- head/sys/compat/linprocfs/linprocfs.c Wed Nov 5 15:07:42 2008 (r184690) +++ head/sys/compat/linprocfs/linprocfs.c Wed Nov 5 15:08:09 2008 (r184691) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2000 Dag-Erling Coïdan Smørgrav + * Copyright (c) 2000 Dag-Erling Coïdan Smørgrav * Copyright (c) 1999 Pierre Beyssac * Copyright (c) 1993 Jan-Simon Pendry * Copyright (c) 1993 From dfr at FreeBSD.org Wed Nov 5 08:24:32 2008 From: dfr at FreeBSD.org (Doug Rabson) Date: Wed Nov 5 08:24:38 2008 Subject: svn commit: r184692 - head/sys/xdr Message-ID: <200811051624.mA5GOWxF031554@svn.freebsd.org> Author: dfr Date: Wed Nov 5 16:24:31 2008 New Revision: 184692 URL: http://svn.freebsd.org/changeset/base/184692 Log: Don't return a NULL mbuf from xdrmbuf_getall. Modified: head/sys/xdr/xdr_mbuf.c Modified: head/sys/xdr/xdr_mbuf.c ============================================================================== --- head/sys/xdr/xdr_mbuf.c Wed Nov 5 15:08:09 2008 (r184691) +++ head/sys/xdr/xdr_mbuf.c Wed Nov 5 16:24:31 2008 (r184692) @@ -119,7 +119,10 @@ xdrmbuf_getall(XDR *xdrs) xdrs->x_private = NULL; } - m_adj(m, xdrs->x_handy); + if (m) + m_adj(m, xdrs->x_handy); + else + MGET(m, M_WAITOK, MT_DATA); return (m); } From dfr at FreeBSD.org Wed Nov 5 08:25:27 2008 From: dfr at FreeBSD.org (Doug Rabson) Date: Wed Nov 5 08:25:38 2008 Subject: svn commit: r184693 - head/sys/nfsserver Message-ID: <200811051625.mA5GPR5c031611@svn.freebsd.org> Author: dfr Date: Wed Nov 5 16:25:26 2008 New Revision: 184693 URL: http://svn.freebsd.org/changeset/base/184693 Log: If mountd doesn't specify a secflavor list for the mount, assume that -sec=sys is what was wanted. Modified: head/sys/nfsserver/nfs_srvsubs.c Modified: head/sys/nfsserver/nfs_srvsubs.c ============================================================================== --- head/sys/nfsserver/nfs_srvsubs.c Wed Nov 5 16:24:31 2008 (r184692) +++ head/sys/nfsserver/nfs_srvsubs.c Wed Nov 5 16:25:26 2008 (r184693) @@ -1103,6 +1103,7 @@ nfsrv_fhtovp(fhandle_t *fhp, int lockfla int credflavor; int vfslocked; int numsecflavors, *secflavors; + int authsys; int v3 = nfsd->nd_flag & ND_NFSV3; int mountreq; @@ -1123,6 +1124,15 @@ nfsrv_fhtovp(fhandle_t *fhp, int lockfla &numsecflavors, &secflavors); if (error) goto out; + if (numsecflavors == 0) { + /* + * This can happen if the system is running with an + * old mountd that doesn't pass in a secflavor list. + */ + numsecflavors = 1; + authsys = RPCAUTH_UNIX; + secflavors = &authsys; + } credflavor = nfsd->nd_credflavor; for (i = 0; i < numsecflavors; i++) { if (secflavors[i] == credflavor) From thompsa at FreeBSD.org Wed Nov 5 08:41:42 2008 From: thompsa at FreeBSD.org (Andrew Thompson) Date: Wed Nov 5 08:41:54 2008 Subject: svn commit: r184610 - in head: lib/libusb20 share/man/man4 sys/conf sys/dev/sound/pcm sys/dev/usb2 sys/dev/usb2/bluetooth sys/dev/usb2/controller sys/dev/usb2/core sys/dev/usb2/ethernet sys/dev/usb... In-Reply-To: <86skq6gxtn.fsf@ds4.des.no> References: <200811040231.mA42V4EQ083516@svn.freebsd.org> <86skq6gxtn.fsf@ds4.des.no> Message-ID: <20081105164137.GE840@citylink.fud.org.nz> On Wed, Nov 05, 2008 at 01:29:56PM +0100, Dag-Erling Sm??rgrav wrote: > It looks like whoever wrote this went out of their way to find new and > creative ways to break just about every style rule we have. I am currently working on a patch to fix a lot of this. From mav at FreeBSD.org Wed Nov 5 09:12:19 2008 From: mav at FreeBSD.org (Alexander Motin) Date: Wed Nov 5 09:12:26 2008 Subject: svn commit: r184695 - head/share/man/man4 Message-ID: <200811051712.mA5HCIP7032611@svn.freebsd.org> Author: mav Date: Wed Nov 5 17:12:18 2008 New Revision: 184695 URL: http://svn.freebsd.org/changeset/base/184695 Log: Improve driver operation example description. Modified: head/share/man/man4/snd_hda.4 Modified: head/share/man/man4/snd_hda.4 ============================================================================== --- head/share/man/man4/snd_hda.4 Wed Nov 5 16:35:13 2008 (r184694) +++ head/share/man/man4/snd_hda.4 Wed Nov 5 17:12:18 2008 (r184695) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd October 24, 2008 +.Dd November 5, 2008 .Dt SND_HDA 4 .Os .Sh NAME @@ -266,9 +266,12 @@ capabilities and jack sense status to co .Sh EXAMPLES Taking HP Compaq DX2300 with Realtek ALC888 HDA codec for example. It has two audio connectors on a front side, three audio connectors on a rear side and one -internal speaker. Codec has five stereo DACs and two ADCs, all are routable to -any pin. All codec pins are reversible. +internal speaker. According to verbose driver output and codec datasheet, +codec has five stereo DACs and two stereo ADCs, all of them are routable to +any codec pin (external connector). All codec pins are reversible. .Pp +So high codec uniformity and flexibility allow driver to configure it in many +deferent ways, depending on requested pins usage decribed by pins configuration. Driver reports such default pin configuration when verbose messages enabled: .Bd -literal hdac0: nid 20 0x01014020 as 2 seq 0 Line-out Jack jack 1 loc 1 color Green misc 0 @@ -284,9 +287,15 @@ hdac0: nid 30 0x411111f0 as 15 seq 0 hdac0: nid 31 0x411111f0 as 15 seq 0 Speaker None jack 1 loc 1 color Black misc 1 .Ed .Pp -Pins with nid 21,23,28,30 and 31 are disabled due to "None" connectivity, so -total pin count matches - six. All present pins by default are grouped into 3 -associations: +Here we can see, that the nodes with ID (nid) 25 and 27 are front pannel +connectors (Jack, loc 2), nids 20, 24 and 26 are rear pannel connectors +(Jack, loc 1) and nid 21 is a built-in speaker (Fixed, loc 25). +Pins with nids 22, 23, 28, 30 and 31 will be disabled by driver due to "None" +connectivity. So the pin count and description matches to connectors that +we have. +.Pp +Using association (as) and sequence (seq) fields values pins are grouped into +3 associations: .Bd -literal hdac0: Association 0 (1) out: hdac0: Pin nid=21 seq=0 @@ -299,10 +308,21 @@ hdac0: Pin nid=26 seq=1 hdac0: Pin nid=25 seq=15 .Ed .Pp -It means that by default pcm0 device will play to the internal speaker and -headphones jack with speaker automute on headphones connection. -Recording on pcm0 will go from two external microphones and line-in jack. -pcm1 playback will go to the Line-out jack. +Each pcm device uses two associations: one for playback and one for recording. +Associations processed and assigned to pcm devices in order of their numbers. +It means that association #0 (1) will become pcm0 device playback, using +internal speaker and headphones jack with speaker automute on headphones +connection. +Association #1 (2) will become pcm1 playback, using the Line-out jack. +Association #2 (3) will become pcm0 recording, using external microphones and +line-in jack. +.Pp +Driver provides extensive set of verbose messages to diagnose it's operation +logic and description of resulted codec configuration. +.Pp +Using device.hints it is possible to modify existing pins configuration to +create broad range of different audio setups. Here is examples of some setups +possible for the described hardware: .Ss Example 1 Setting .Bd -literal From rodrigc at FreeBSD.org Wed Nov 5 11:35:10 2008 From: rodrigc at FreeBSD.org (Craig Rodrigues) Date: Wed Nov 5 11:35:16 2008 Subject: svn commit: r184696 - in head/cddl: . contrib/opensolaris/cmd/dtrace contrib/opensolaris/cmd/dtrace/test/cmd/jdtrace contrib/opensolaris/lib/libdtrace/common Message-ID: <200811051935.mA5JZ9GB035415@svn.freebsd.org> Author: rodrigc Date: Wed Nov 5 19:35:09 2008 New Revision: 184696 URL: http://svn.freebsd.org/changeset/base/184696 Log: Merge latest DTrace changes from Perforce. Approved by: jb Modified: head/cddl/Makefile.inc head/cddl/contrib/opensolaris/cmd/dtrace/dtrace.c head/cddl/contrib/opensolaris/cmd/dtrace/test/cmd/jdtrace/exception.lst head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_link.c head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_open.c head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_proc.c head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_proc.h head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_program.c head/cddl/contrib/opensolaris/lib/libdtrace/common/dtrace.h Modified: head/cddl/Makefile.inc ============================================================================== --- head/cddl/Makefile.inc Wed Nov 5 17:12:18 2008 (r184695) +++ head/cddl/Makefile.inc Wed Nov 5 19:35:09 2008 (r184696) @@ -4,3 +4,5 @@ OPENSOLARIS_USR_DISTDIR= ${.CURDIR}/../. OPENSOLARIS_SYS_DISTDIR= ${.CURDIR}/../../../sys/cddl/contrib/opensolaris IGNORE_PRAGMA= YES + +CFLAGS+= -DNEED_SOLARIS_BOOLEAN Modified: head/cddl/contrib/opensolaris/cmd/dtrace/dtrace.c ============================================================================== --- head/cddl/contrib/opensolaris/cmd/dtrace/dtrace.c Wed Nov 5 17:12:18 2008 (r184695) +++ head/cddl/contrib/opensolaris/cmd/dtrace/dtrace.c Wed Nov 5 19:35:09 2008 (r184696) @@ -1576,7 +1576,7 @@ main(int argc, char *argv[]) if ((v = make_argv(optarg)) == NULL) fatal("failed to allocate memory"); - P = dtrace_proc_create(g_dtp, v[0], v); + P = dtrace_proc_create(g_dtp, v[0], v, NULL, NULL); if (P == NULL) dfatal(NULL); /* dtrace_errmsg() only */ Modified: head/cddl/contrib/opensolaris/cmd/dtrace/test/cmd/jdtrace/exception.lst ============================================================================== --- head/cddl/contrib/opensolaris/cmd/dtrace/test/cmd/jdtrace/exception.lst Wed Nov 5 17:12:18 2008 (r184695) +++ head/cddl/contrib/opensolaris/cmd/dtrace/test/cmd/jdtrace/exception.lst Wed Nov 5 19:35:09 2008 (r184696) @@ -23,7 +23,7 @@ # Copyright 2008 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # -#ident "%Z%%M% %I% %E% SMI" +# ident "%Z%%M% %I% %E% SMI" # Exception list: names tests that are bypassed when running in Java # mode (relative to /opt/SUNWdtrt/tst) @@ -49,6 +49,7 @@ common/usdt/tst.dlclose2.ksh common/usdt/tst.dlclose3.ksh common/usdt/tst.eliminate.ksh common/usdt/tst.enabled.ksh +common/usdt/tst.enabled2.ksh common/usdt/tst.entryreturn.ksh common/usdt/tst.fork.ksh common/usdt/tst.header.ksh Modified: head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_link.c ============================================================================== --- head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_link.c Wed Nov 5 17:12:18 2008 (r184695) +++ head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_link.c Wed Nov 5 19:35:09 2008 (r184696) @@ -868,15 +868,19 @@ dt_modtext(dtrace_hdl_t *dtp, char *p, i /* * We may have already processed this object file in an earlier linker * invocation. Check to see if the present instruction sequence matches - * the one we would install. + * the one we would install below. */ if (isenabled) { - if (ip[0] == DT_OP_CLR_O0) + if (ip[0] == DT_OP_NOP) { + (*off) += sizeof (ip[0]); return (0); + } } else { if (DT_IS_RESTORE(ip[1])) { - if (ip[0] == DT_OP_RET) + if (ip[0] == DT_OP_RET) { + (*off) += sizeof (ip[0]); return (0); + } } else if (DT_IS_MOV_O7(ip[1])) { if (DT_IS_RETL(ip[0])) return (0); @@ -910,7 +914,17 @@ dt_modtext(dtrace_hdl_t *dtp, char *p, i return (-1); } - ip[0] = DT_OP_CLR_O0; + + /* + * On SPARC, we take advantage of the fact that the first + * argument shares the same register as for the return value. + * The macro handles the work of zeroing that register so we + * don't need to do anything special here. We instrument the + * instruction in the delay slot as we'll need to modify the + * return register after that instruction has been emulated. + */ + ip[0] = DT_OP_NOP; + (*off) += sizeof (ip[0]); } else { /* * If the call is followed by a restore, it's a tail call so @@ -919,11 +933,16 @@ dt_modtext(dtrace_hdl_t *dtp, char *p, i * so change the call to a retl-like instruction that returns * to that register value + 8 (rather than the typical %o7 + * 8); the delay slot instruction is left, but should have no - * effect. Otherwise we change the call to be a nop. In the - * first and the last case we adjust the offset to land on what - * was once the delay slot of the call so we correctly get all - * the arguments as they would have been passed in a normal - * function call. + * effect. Otherwise we change the call to be a nop. We + * identify the subsequent instruction as the probe point in + * all but the leaf tail-call case to ensure that arguments to + * the probe are complete and consistent. An astute, though + * largely hypothetical, observer would note that there is the + * possibility of a false-positive probe firing if the function + * contained a branch to the instruction in the delay slot of + * the call. Fixing this would require significant in-kernel + * modifications, and isn't worth doing until we see it in the + * wild. */ if (DT_IS_RESTORE(ip[1])) { ip[0] = DT_OP_RET; Modified: head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_open.c ============================================================================== --- head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_open.c Wed Nov 5 17:12:18 2008 (r184695) +++ head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_open.c Wed Nov 5 19:35:09 2008 (r184696) @@ -115,8 +115,9 @@ #define DT_VERS_1_5 DT_VERSION_NUMBER(1, 5, 0) #define DT_VERS_1_6 DT_VERSION_NUMBER(1, 6, 0) #define DT_VERS_1_6_1 DT_VERSION_NUMBER(1, 6, 1) -#define DT_VERS_LATEST DT_VERS_1_6_1 -#define DT_VERS_STRING "Sun D 1.6.1" +#define DT_VERS_1_6_2 DT_VERSION_NUMBER(1, 6, 2) +#define DT_VERS_LATEST DT_VERS_1_6_2 +#define DT_VERS_STRING "Sun D 1.6.2" const dt_version_t _dtrace_versions[] = { DT_VERS_1_0, /* D API 1.0.0 (PSARC 2001/466) Solaris 10 FCS */ @@ -130,6 +131,7 @@ const dt_version_t _dtrace_versions[] = DT_VERS_1_5, /* D API 1.5 Solaris Express 7/07 */ DT_VERS_1_6, /* D API 1.6 */ DT_VERS_1_6_1, /* D API 1.6.1 */ + DT_VERS_1_6_2, /* D API 1.6.2 */ 0 }; Modified: head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_proc.c ============================================================================== --- head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_proc.c Wed Nov 5 17:12:18 2008 (r184695) +++ head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_proc.c Wed Nov 5 19:35:09 2008 (r184696) @@ -955,7 +955,8 @@ dt_proc_create_thread(dtrace_hdl_t *dtp, } struct ps_prochandle * -dt_proc_create(dtrace_hdl_t *dtp, const char *file, char *const *argv) +dt_proc_create(dtrace_hdl_t *dtp, const char *file, char *const *argv, + proc_child_func *pcf, void *child_arg) { dt_proc_hash_t *dph = dtp->dt_procs; dt_proc_t *dpr; @@ -981,7 +982,7 @@ dt_proc_create(dtrace_hdl_t *dtp, const #else (void) proc_clearflags(dpr->dpr_proc, PR_RLC); (void) proc_setflags(dpr->dpr_proc, PR_KLC); - if ((err = proc_create(file, argv, &dpr->dpr_proc)) != 0) + if ((err = proc_create(file, argv, pcf, child_arg, &dpr->dpr_proc)) != 0) return (dt_proc_error(dtp, dpr, "failed to execute %s: %s\n", file, strerror(err))); dpr->dpr_hdl = dtp; @@ -1183,10 +1184,11 @@ dt_proc_hash_destroy(dtrace_hdl_t *dtp) } struct ps_prochandle * -dtrace_proc_create(dtrace_hdl_t *dtp, const char *file, char *const *argv) +dtrace_proc_create(dtrace_hdl_t *dtp, const char *file, char *const *argv, + proc_child_func *pcf, void *child_arg) { dt_ident_t *idp = dt_idhash_lookup(dtp->dt_macros, "target"); - struct ps_prochandle *P = dt_proc_create(dtp, file, argv); + struct ps_prochandle *P = dt_proc_create(dtp, file, argv, pcf, child_arg); if (P != NULL && idp != NULL && idp->di_id == 0) #if defined(sun) Modified: head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_proc.h ============================================================================== --- head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_proc.h Wed Nov 5 17:12:18 2008 (r184695) +++ head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_proc.h Wed Nov 5 19:35:09 2008 (r184696) @@ -99,7 +99,7 @@ typedef struct dt_proc_hash { } dt_proc_hash_t; extern struct ps_prochandle *dt_proc_create(dtrace_hdl_t *, - const char *, char *const *); + const char *, char *const *, proc_child_func *, void *); extern struct ps_prochandle *dt_proc_grab(dtrace_hdl_t *, pid_t, int, int); extern void dt_proc_release(dtrace_hdl_t *, struct ps_prochandle *); Modified: head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_program.c ============================================================================== --- head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_program.c Wed Nov 5 17:12:18 2008 (r184695) +++ head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_program.c Wed Nov 5 19:35:09 2008 (r184696) @@ -20,7 +20,7 @@ */ /* - * Copyright 2006 Sun Microsystems, Inc. All rights reserved. + * Copyright 2008 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -436,8 +436,13 @@ dt_header_decl(dt_idhash_t *dhp, dt_iden if (fprintf(infop->dthi_out, ");\n") < 0) return (dt_set_errno(dtp, errno)); - if (fprintf(infop->dthi_out, "extern int " - "__dtraceenabled_%s___%s(void);\n", infop->dthi_pfname, fname) < 0) + if (fprintf(infop->dthi_out, + "#ifndef\t__sparc\n" + "extern int __dtraceenabled_%s___%s(void);\n" + "#else\n" + "extern int __dtraceenabled_%s___%s(long);\n" + "#endif\n", + infop->dthi_pfname, fname, infop->dthi_pfname, fname) < 0) return (dt_set_errno(dtp, errno)); return (0); @@ -499,13 +504,20 @@ dt_header_probe(dt_idhash_t *dhp, dt_ide return (dt_set_errno(dtp, errno)); if (!infop->dthi_empty) { - if (fprintf(infop->dthi_out, "#define\t%s_%s_ENABLED() \\\n", - infop->dthi_pmname, mname) < 0) - return (dt_set_errno(dtp, errno)); - - if (fprintf(infop->dthi_out, "\t__dtraceenabled_%s___%s()\n", + if (fprintf(infop->dthi_out, + "#ifndef\t__sparc\n" + "#define\t%s_%s_ENABLED() \\\n" + "\t__dtraceenabled_%s___%s()\n" + "#else\n" + "#define\t%s_%s_ENABLED() \\\n" + "\t__dtraceenabled_%s___%s(0)\n" + "#endif\n", + infop->dthi_pmname, mname, + infop->dthi_pfname, fname, + infop->dthi_pmname, mname, infop->dthi_pfname, fname) < 0) return (dt_set_errno(dtp, errno)); + } else { if (fprintf(infop->dthi_out, "#define\t%s_%s_ENABLED() (0)\n", infop->dthi_pmname, mname) < 0) Modified: head/cddl/contrib/opensolaris/lib/libdtrace/common/dtrace.h ============================================================================== --- head/cddl/contrib/opensolaris/lib/libdtrace/common/dtrace.h Wed Nov 5 17:12:18 2008 (r184695) +++ head/cddl/contrib/opensolaris/lib/libdtrace/common/dtrace.h Wed Nov 5 19:35:09 2008 (r184696) @@ -33,6 +33,7 @@ #include #include #include +#include #ifdef __cplusplus extern "C" { @@ -413,7 +414,7 @@ extern int dtrace_aggregate_walk_valvarr */ extern struct ps_prochandle *dtrace_proc_create(dtrace_hdl_t *, - const char *, char *const *); + const char *, char *const *, proc_child_func *, void *); extern struct ps_prochandle *dtrace_proc_grab(dtrace_hdl_t *, pid_t, int); extern void dtrace_proc_release(dtrace_hdl_t *, struct ps_prochandle *); From rodrigc at FreeBSD.org Wed Nov 5 11:35:44 2008 From: rodrigc at FreeBSD.org (Craig Rodrigues) Date: Wed Nov 5 11:35:50 2008 Subject: svn commit: r184697 - head/lib/libproc Message-ID: <200811051935.mA5JZh6l035466@svn.freebsd.org> Author: rodrigc Date: Wed Nov 5 19:35:43 2008 New Revision: 184697 URL: http://svn.freebsd.org/changeset/base/184697 Log: Merge latest DTrace changes from Perforce. Update libproc API to reflect new changes. Approved by: jb Modified: head/lib/libproc/libproc.h head/lib/libproc/proc_create.c Modified: head/lib/libproc/libproc.h ============================================================================== --- head/lib/libproc/libproc.h Wed Nov 5 19:35:09 2008 (r184696) +++ head/lib/libproc/libproc.h Wed Nov 5 19:35:43 2008 (r184697) @@ -33,6 +33,8 @@ struct proc_handle; +typedef void (*proc_child_func)(void *); + /* Values returned by proc_state(). */ #define PS_IDLE 1 #define PS_STOP 2 @@ -55,7 +57,8 @@ int proc_addr2sym(struct proc_handle *, int proc_attach(pid_t pid, int flags, struct proc_handle **pphdl); int proc_continue(struct proc_handle *); int proc_clearflags(struct proc_handle *, int); -int proc_create(const char *, char * const *, struct proc_handle **); +int proc_create(const char *, char * const *, proc_child_func *, void *, + struct proc_handle **); int proc_detach(struct proc_handle *); int proc_getflags(struct proc_handle *); int proc_name2sym(struct proc_handle *, const char *, const char *, GElf_Sym *); Modified: head/lib/libproc/proc_create.c ============================================================================== --- head/lib/libproc/proc_create.c Wed Nov 5 19:35:09 2008 (r184696) +++ head/lib/libproc/proc_create.c Wed Nov 5 19:35:43 2008 (r184697) @@ -90,7 +90,8 @@ proc_attach(pid_t pid, int flags, struct } int -proc_create(const char *file, char * const *argv, struct proc_handle **pphdl) +proc_create(const char *file, char * const *argv, proc_child_func *pcf, + void *child_arg, struct proc_handle **pphdl) { struct proc_handle *phdl; struct kevent kev; @@ -106,13 +107,16 @@ proc_create(const char *file, char * con return (ENOMEM); /* Fork a new process. */ - if ((pid = fork()) == -1) + if ((pid = vfork()) == -1) error = errno; else if (pid == 0) { /* The child expects to be traced. */ if (ptrace(PT_TRACE_ME, 0, 0, 0) != 0) _exit(1); + if (pcf != NULL) + (*pcf)(child_arg); + /* Execute the specified file: */ execvp(file, argv); From rodrigc at FreeBSD.org Wed Nov 5 11:39:12 2008 From: rodrigc at FreeBSD.org (Craig Rodrigues) Date: Wed Nov 5 11:39:19 2008 Subject: svn commit: r184698 - in head/sys: cddl/compat/opensolaris/kern cddl/compat/opensolaris/sys cddl/contrib/opensolaris/uts/common/dtrace cddl/dev/dtrace cddl/dev/systrace sys Message-ID: <200811051939.mA5JdBCK035580@svn.freebsd.org> Author: rodrigc Date: Wed Nov 5 19:39:11 2008 New Revision: 184698 URL: http://svn.freebsd.org/changeset/base/184698 Log: Merge latest DTrace changes from Perforce. Modified: head/sys/cddl/compat/opensolaris/kern/opensolaris_kmem.c head/sys/cddl/compat/opensolaris/sys/types.h head/sys/cddl/compat/opensolaris/sys/uio.h head/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c head/sys/cddl/contrib/opensolaris/uts/common/dtrace/fasttrap.c head/sys/cddl/dev/dtrace/dtrace_ioctl.c head/sys/cddl/dev/dtrace/dtrace_load.c head/sys/cddl/dev/dtrace/dtrace_unload.c head/sys/cddl/dev/systrace/systrace.c head/sys/sys/sysent.h Modified: head/sys/cddl/compat/opensolaris/kern/opensolaris_kmem.c ============================================================================== --- head/sys/cddl/compat/opensolaris/kern/opensolaris_kmem.c Wed Nov 5 19:35:43 2008 (r184697) +++ head/sys/cddl/compat/opensolaris/kern/opensolaris_kmem.c Wed Nov 5 19:39:11 2008 (r184698) @@ -40,6 +40,8 @@ __FBSDID("$FreeBSD$"); #include #include +#define KMEM_DEBUG + #ifdef KMEM_DEBUG #include #include @@ -93,6 +95,10 @@ void zfs_kmem_free(void *buf, size_t size __unused) { #ifdef KMEM_DEBUG + if (buf == NULL) { + printf("%s: attempt to free NULL\n",__func__); + return; + } struct kmem_item *i; buf = (u_char *)buf - sizeof(struct kmem_item); @@ -236,7 +242,8 @@ calloc(size_t n, size_t s) } #ifdef KMEM_DEBUG -static void +void kmem_show(void *); +void kmem_show(void *dummy __unused) { struct kmem_item *i; @@ -248,12 +255,10 @@ kmem_show(void *dummy __unused) printf("KMEM_DEBUG: Leaked elements:\n\n"); LIST_FOREACH(i, &kmem_items, next) { printf("address=%p\n", i); - stack_print(&i->stack); - printf("\n"); } } mtx_unlock(&kmem_items_mtx); } -SYSUNINIT(sol_kmem, SI_SUB_DRIVERS, SI_ORDER_FIRST, kmem_show, NULL); +SYSUNINIT(sol_kmem, SI_SUB_CPU, SI_ORDER_FIRST, kmem_show, NULL); #endif /* KMEM_DEBUG */ Modified: head/sys/cddl/compat/opensolaris/sys/types.h ============================================================================== --- head/sys/cddl/compat/opensolaris/sys/types.h Wed Nov 5 19:35:43 2008 (r184697) +++ head/sys/cddl/compat/opensolaris/sys/types.h Wed Nov 5 19:39:11 2008 (r184698) @@ -64,12 +64,13 @@ typedef void pathname_t; typedef int64_t rlim64_t; #else - +#ifdef NEED_SOLARIS_BOOLEAN #if defined(__XOPEN_OR_POSIX) typedef enum { _B_FALSE, _B_TRUE } boolean_t; #else typedef enum { B_FALSE, B_TRUE } boolean_t; #endif /* defined(__XOPEN_OR_POSIX) */ +#endif typedef longlong_t offset_t; typedef u_longlong_t u_offset_t; Modified: head/sys/cddl/compat/opensolaris/sys/uio.h ============================================================================== --- head/sys/cddl/compat/opensolaris/sys/uio.h Wed Nov 5 19:35:43 2008 (r184697) +++ head/sys/cddl/compat/opensolaris/sys/uio.h Wed Nov 5 19:39:11 2008 (r184698) @@ -51,6 +51,7 @@ typedef struct iovec iovec_t; #define uio_loffset uio_offset +#ifdef BUILDING_ZFS static __inline int zfs_uiomove(void *cp, size_t n, enum uio_rw dir, uio_t *uio) { @@ -59,5 +60,6 @@ zfs_uiomove(void *cp, size_t n, enum uio return (uiomove(cp, (int)n, uio)); } #define uiomove(cp, n, dir, uio) zfs_uiomove((cp), (n), (dir), (uio)) +#endif #endif /* !_OPENSOLARIS_SYS_UIO_H_ */ Modified: head/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c Wed Nov 5 19:35:43 2008 (r184697) +++ head/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c Wed Nov 5 19:39:11 2008 (r184698) @@ -3007,6 +3007,9 @@ dtrace_dif_variable(dtrace_mstate_t *mst case DIF_VAR_EXECARGS: { struct pargs *p_args = curthread->td_proc->p_args; + if (p_args == NULL) + return(0); + return (dtrace_dif_varstrz( (uintptr_t) p_args->ar_args, p_args->ar_length, state, mstate)); } @@ -10598,7 +10601,6 @@ dtrace_buffer_alloc(dtrace_buffer_t *buf /* * If there is already a buffer allocated for this CPU, it * is only possible that this is a DR event. In this case, - * the buffer size must match our specified size. */ if (buf->dtb_tomax != NULL) { ASSERT(buf->dtb_size == size); @@ -12815,11 +12817,7 @@ dtrace_state_create(struct cdev *dev) state = ddi_get_soft_state(dtrace_softstate, minor); #else if (dev != NULL) { - /* - * Disable this until we have the ability to set user - * credentials for DTrace. - * cr = dev->si_cred; - */ + cr = dev->si_cred; m = dev2unit(dev); } @@ -15241,6 +15239,15 @@ dtrace_attach(dev_info_t *devi, ddi_atta } #endif +#if !defined(sun) +#if __FreeBSD_version >= 800039 +static void +dtrace_dtr(void *data __unused) +{ +} +#endif +#endif + /*ARGSUSED*/ static int #if defined(sun) @@ -15266,6 +15273,7 @@ dtrace_open(struct cdev *dev, int oflags #else cred_t *cred_p = NULL; +#if __FreeBSD_version < 800039 /* * The first minor device is the one that is cloned so there is * nothing more to do here. @@ -15281,6 +15289,7 @@ dtrace_open(struct cdev *dev, int oflags */ if (dev->si_drv1 != NULL) return (EBUSY); +#endif cred_p = dev->si_cred; #endif @@ -15292,9 +15301,11 @@ dtrace_open(struct cdev *dev, int oflags dtrace_cred2priv(cred_p, &priv, &uid, &zoneid); if (priv == DTRACE_PRIV_NONE) { #if !defined(sun) +#if __FreeBSD_version < 800039 /* Destroy the cloned device. */ destroy_dev(dev); #endif +#endif return (EACCES); } @@ -15326,7 +15337,11 @@ dtrace_open(struct cdev *dev, int oflags state = dtrace_state_create(devp, cred_p); #else state = dtrace_state_create(dev); +#if __FreeBSD_version < 800039 dev->si_drv1 = state; +#else + devfs_set_cdevpriv(state, dtrace_dtr); +#endif #endif mutex_exit(&cpu_lock); @@ -15340,9 +15355,11 @@ dtrace_open(struct cdev *dev, int oflags #endif mutex_exit(&dtrace_lock); #if !defined(sun) +#if __FreeBSD_version < 800039 /* Destroy the cloned device. */ destroy_dev(dev); #endif +#endif return (EAGAIN); } @@ -15368,11 +15385,16 @@ dtrace_close(struct cdev *dev, int flags state = ddi_get_soft_state(dtrace_softstate, minor); #else +#if __FreeBSD_version < 800039 dtrace_state_t *state = dev->si_drv1; /* Check if this is not a cloned device. */ if (dev2unit(dev) == 0) return (0); +#else + dtrace_state_t *state; + devfs_get_cdevpriv((void **) &state); +#endif #endif @@ -15392,7 +15414,11 @@ dtrace_close(struct cdev *dev, int flags #if !defined(sun) kmem_free(state, 0); +#if __FreeBSD_version < 800039 dev->si_drv1 = NULL; +#else + devfs_clear_cdevpriv(); +#endif #endif } @@ -15407,8 +15433,10 @@ dtrace_close(struct cdev *dev, int flags mutex_exit(&dtrace_lock); mutex_exit(&cpu_lock); +#if __FreeBSD_version < 800039 /* Schedule this cloned device to be destroyed. */ destroy_dev_sched(dev); +#endif return (0); } @@ -16442,16 +16470,20 @@ _fini(void) static d_ioctl_t dtrace_ioctl; static void dtrace_load(void *); static int dtrace_unload(void); +#if __FreeBSD_version < 800039 static void dtrace_clone(void *, struct ucred *, char *, int , struct cdev **); static struct clonedevs *dtrace_clones; /* Ptr to the array of cloned devices. */ static eventhandler_tag eh_tag; /* Event handler tag. */ +#else +static struct cdev *dtrace_dev; +#endif void dtrace_invop_init(void); void dtrace_invop_uninit(void); static struct cdevsw dtrace_cdevsw = { .d_version = D_VERSION, - .d_flags = D_NEEDMINOR, + .d_flags = D_TRACKCLOSE | D_NEEDMINOR, .d_close = dtrace_close, .d_ioctl = dtrace_ioctl, .d_open = dtrace_open, @@ -16459,7 +16491,9 @@ static struct cdevsw dtrace_cdevsw = { }; #include +#if __FreeBSD_version < 800039 #include +#endif #include #include #include Modified: head/sys/cddl/contrib/opensolaris/uts/common/dtrace/fasttrap.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/dtrace/fasttrap.c Wed Nov 5 19:35:43 2008 (r184697) +++ head/sys/cddl/contrib/opensolaris/uts/common/dtrace/fasttrap.c Wed Nov 5 19:39:11 2008 (r184698) @@ -2044,13 +2044,6 @@ err: tp->ftt_proc->ftpc_acount != 0) break; - /* - * The count of active providers can only be - * decremented (i.e. to zero) during exec, exit, and - * removal of a meta provider so it should be - * impossible to drop the count during this operation(). - */ - ASSERT(tp->ftt_proc->ftpc_acount != 0); tp = tp->ftt_next; } Modified: head/sys/cddl/dev/dtrace/dtrace_ioctl.c ============================================================================== --- head/sys/cddl/dev/dtrace/dtrace_ioctl.c Wed Nov 5 19:35:43 2008 (r184697) +++ head/sys/cddl/dev/dtrace/dtrace_ioctl.c Wed Nov 5 19:39:11 2008 (r184698) @@ -32,7 +32,12 @@ static int dtrace_ioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flags __unused, struct thread *td) { +#if __FreeBSD_version < 800039 dtrace_state_t *state = dev->si_drv1; +#else + dtrace_state_t *state; + devfs_get_cdevpriv((void **) &state); +#endif int error = 0; if (state == NULL) return (EINVAL); Modified: head/sys/cddl/dev/dtrace/dtrace_load.c ============================================================================== --- head/sys/cddl/dev/dtrace/dtrace_load.c Wed Nov 5 19:35:43 2008 (r184697) +++ head/sys/cddl/dev/dtrace/dtrace_load.c Wed Nov 5 19:39:11 2008 (r184698) @@ -154,11 +154,15 @@ dtrace_load(void *dummy) mutex_exit(&cpu_lock); +#if __FreeBSD_version < 800039 /* Enable device cloning. */ clone_setup(&dtrace_clones); /* Setup device cloning events. */ eh_tag = EVENTHANDLER_REGISTER(dev_clone, dtrace_clone, 0, 1000); +#else + dtrace_dev = make_dev(&dtrace_cdevsw, 0, UID_ROOT, GID_WHEEL, 0600, "dtrace/dtrace"); +#endif return; } Modified: head/sys/cddl/dev/dtrace/dtrace_unload.c ============================================================================== --- head/sys/cddl/dev/dtrace/dtrace_unload.c Wed Nov 5 19:35:43 2008 (r184697) +++ head/sys/cddl/dev/dtrace/dtrace_unload.c Wed Nov 5 19:39:11 2008 (r184698) @@ -28,6 +28,7 @@ dtrace_unload() dtrace_state_t *state; int error = 0; +#if __FreeBSD_version < 800039 /* * Check if there is still an event handler callback * registered. @@ -40,6 +41,9 @@ dtrace_unload() /* Stop device cloning. */ clone_cleanup(&dtrace_clones); } +#else + destroy_dev(dtrace_dev); +#endif mutex_enter(&dtrace_provider_lock); mutex_enter(&dtrace_lock); Modified: head/sys/cddl/dev/systrace/systrace.c ============================================================================== --- head/sys/cddl/dev/systrace/systrace.c Wed Nov 5 19:35:43 2008 (r184697) +++ head/sys/cddl/dev/systrace/systrace.c Wed Nov 5 19:39:11 2008 (r184698) @@ -50,15 +50,41 @@ #include #include #include -#include -#include #include +#include #include #include #include #include +#ifdef LINUX_SYSTRACE +#include +#include +#include +#include +#include +extern struct sysent linux_sysent[]; +#define DEVNAME "dtrace/linsystrace" +#define PROVNAME "linsyscall" +#define MAXSYSCALL LINUX_SYS_MAXSYSCALL +#define SYSCALLNAMES linux_syscallnames +#define SYSENT linux_sysent +#else +/* + * The syscall arguments are processed into a DTrace argument array + * using a generated function. See sys/kern/makesyscalls.sh. + */ +#include +#include +extern const char *syscallnames[]; +#define DEVNAME "dtrace/systrace" +#define PROVNAME "syscall" +#define MAXSYSCALL SYS_MAXSYSCALL +#define SYSCALLNAMES syscallnames +#define SYSENT sysent +#endif + #define SYSTRACE_ARTIFICIAL_FRAMES 1 #define SYSTRACE_SHIFT 16 @@ -67,17 +93,13 @@ #define SYSTRACE_ENTRY(id) ((1 << SYSTRACE_SHIFT) | (id)) #define SYSTRACE_RETURN(id) (id) -#if ((1 << SYSTRACE_SHIFT) <= SYS_MAXSYSCALL) +#if ((1 << SYSTRACE_SHIFT) <= MAXSYSCALL) #error 1 << SYSTRACE_SHIFT must exceed number of system calls #endif -extern char *syscallnames[]; - static d_open_t systrace_open; static int systrace_unload(void); static void systrace_getargdesc(void *, dtrace_id_t, void *, dtrace_argdesc_t *); -static void systrace_args(int, void *, u_int64_t *, int *); -static void systrace_probe(u_int32_t, int, struct sysent *, void *); static void systrace_provide(void *, dtrace_probedesc_t *); static void systrace_destroy(void *, dtrace_id_t, void *); static void systrace_enable(void *, dtrace_id_t, void *); @@ -87,9 +109,18 @@ static void systrace_load(void *); static struct cdevsw systrace_cdevsw = { .d_version = D_VERSION, .d_open = systrace_open, +#ifdef LINUX_SYSTRACE + .d_name = "linsystrace", +#else .d_name = "systrace", +#endif }; +static union { + const char **p_constnames; + char **pp_syscallnames; +} uglyhack = { SYSCALLNAMES }; + static dtrace_pattr_t systrace_attr = { { DTRACE_STABILITY_EVOLVING, DTRACE_STABILITY_EVOLVING, DTRACE_CLASS_COMMON }, { DTRACE_STABILITY_PRIVATE, DTRACE_STABILITY_PRIVATE, DTRACE_CLASS_UNKNOWN }, @@ -114,12 +145,14 @@ static dtrace_pops_t systrace_pops = { static struct cdev *systrace_cdev; static dtrace_provider_id_t systrace_id; +#if !defined(LINUX_SYSTRACE) /* - * The syscall arguments are processed into a DTrace argument array - * using a generated function. See sys/kern/makesyscalls.sh. + * Probe callback function. + * + * Note: This function is called for _all_ syscalls, regardless of which sysent + * array the syscall comes from. It could be a standard syscall or a + * compat syscall from something like Linux. */ -#include - static void systrace_probe(u_int32_t id, int sysnum, struct sysent *sysent, void *params) { @@ -127,21 +160,20 @@ systrace_probe(u_int32_t id, int sysnum, u_int64_t uargs[8]; /* - * Check if this syscall has a custom argument conversion - * function registered. If so, it is a syscall registered - * by a loaded module. + * Check if this syscall has an argument conversion function + * registered. */ if (sysent->sy_systrace_args_func != NULL) /* * Convert the syscall parameters using the registered * function. */ - (*sysent->sy_systrace_args_func)(params, uargs, &n_args); + (*sysent->sy_systrace_args_func)(sysnum, params, uargs, &n_args); else /* * Use the built-in system call argument conversion * function to translate the syscall structure fields - * into thhe array of 64-bit values that DTrace + * into the array of 64-bit values that DTrace * expects. */ systrace_args(sysnum, params, uargs, &n_args); @@ -149,6 +181,7 @@ systrace_probe(u_int32_t id, int sysnum, /* Process the probe using the converted argments. */ dtrace_probe(id, uargs[0], uargs[1], uargs[2], uargs[3], uargs[4]); } +#endif static void systrace_getargdesc(void *arg, dtrace_id_t id, void *parg, dtrace_argdesc_t *desc) @@ -172,15 +205,15 @@ systrace_provide(void *arg, dtrace_probe if (desc != NULL) return; - for (i = 0; i < SYS_MAXSYSCALL; i++) { + for (i = 0; i < MAXSYSCALL; i++) { if (dtrace_probe_lookup(systrace_id, NULL, - syscallnames[i], "entry") != 0) + uglyhack.pp_syscallnames[i], "entry") != 0) continue; - (void) dtrace_probe_create(systrace_id, NULL, syscallnames[i], + (void) dtrace_probe_create(systrace_id, NULL, uglyhack.pp_syscallnames[i], "entry", SYSTRACE_ARTIFICIAL_FRAMES, (void *)((uintptr_t)SYSTRACE_ENTRY(i))); - (void) dtrace_probe_create(systrace_id, NULL, syscallnames[i], + (void) dtrace_probe_create(systrace_id, NULL, uglyhack.pp_syscallnames[i], "return", SYSTRACE_ARTIFICIAL_FRAMES, (void *)((uintptr_t)SYSTRACE_RETURN(i))); } @@ -209,10 +242,13 @@ systrace_enable(void *arg, dtrace_id_t i { int sysnum = SYSTRACE_SYSNUM((uintptr_t)parg); + if (SYSENT[sysnum].sy_systrace_args_func == NULL) + SYSENT[sysnum].sy_systrace_args_func = systrace_args; + if (SYSTRACE_ISENTRY((uintptr_t)parg)) - sysent[sysnum].sy_entry = id; + SYSENT[sysnum].sy_entry = id; else - sysent[sysnum].sy_return = id; + SYSENT[sysnum].sy_return = id; } static void @@ -220,8 +256,8 @@ systrace_disable(void *arg, dtrace_id_t { int sysnum = SYSTRACE_SYSNUM((uintptr_t)parg); - sysent[sysnum].sy_entry = 0; - sysent[sysnum].sy_return = 0; + SYSENT[sysnum].sy_entry = 0; + SYSENT[sysnum].sy_return = 0; } static void @@ -229,13 +265,15 @@ systrace_load(void *dummy) { /* Create the /dev/dtrace/systrace entry. */ systrace_cdev = make_dev(&systrace_cdevsw, 0, UID_ROOT, GID_WHEEL, 0600, - "dtrace/systrace"); + DEVNAME); - if (dtrace_register("syscall", &systrace_attr, DTRACE_PRIV_USER, + if (dtrace_register(PROVNAME, &systrace_attr, DTRACE_PRIV_USER, NULL, &systrace_pops, NULL, &systrace_id) != 0) return; +#if !defined(LINUX_SYSTRACE) systrace_probe_func = systrace_probe; +#endif } @@ -247,7 +285,9 @@ systrace_unload() if ((error = dtrace_unregister(systrace_id)) != 0) return (error); +#if !defined(LINUX_SYSTRACE) systrace_probe_func = NULL; +#endif destroy_dev(systrace_cdev); @@ -286,7 +326,16 @@ systrace_open(struct cdev *dev __unused, SYSINIT(systrace_load, SI_SUB_DTRACE_PROVIDER, SI_ORDER_ANY, systrace_load, NULL); SYSUNINIT(systrace_unload, SI_SUB_DTRACE_PROVIDER, SI_ORDER_ANY, systrace_unload, NULL); +#ifdef LINUX_SYSTRACE +DEV_MODULE(linsystrace, systrace_modevent, NULL); +MODULE_VERSION(linsystrace, 1); +MODULE_DEPEND(linsystrace, linux, 1, 1, 1); +MODULE_DEPEND(linsystrace, systrace, 1, 1, 1); +MODULE_DEPEND(linsystrace, dtrace, 1, 1, 1); +MODULE_DEPEND(linsystrace, opensolaris, 1, 1, 1); +#else DEV_MODULE(systrace, systrace_modevent, NULL); MODULE_VERSION(systrace, 1); MODULE_DEPEND(systrace, dtrace, 1, 1, 1); MODULE_DEPEND(systrace, opensolaris, 1, 1, 1); +#endif Modified: head/sys/sys/sysent.h ============================================================================== --- head/sys/sys/sysent.h Wed Nov 5 19:35:43 2008 (r184697) +++ head/sys/sys/sysent.h Wed Nov 5 19:39:11 2008 (r184698) @@ -48,7 +48,7 @@ typedef void (*systrace_probe_func_t)(u_ * Used by loaded syscalls to convert arguments to a DTrace array * of 64-bit arguments. */ -typedef void (*systrace_args_func_t)(void *, u_int64_t *, int *); +typedef void (*systrace_args_func_t)(int, void *, u_int64_t *, int *); extern systrace_probe_func_t systrace_probe_func; From rodrigc at FreeBSD.org Wed Nov 5 11:39:38 2008 From: rodrigc at FreeBSD.org (Craig Rodrigues) Date: Wed Nov 5 11:39:44 2008 Subject: svn commit: r184699 - head/usr.bin/fstat/zfs Message-ID: <200811051939.mA5JdcZ4035627@svn.freebsd.org> Author: rodrigc Date: Wed Nov 5 19:39:37 2008 New Revision: 184699 URL: http://svn.freebsd.org/changeset/base/184699 Log: Merge latest DTrace changes from Perforce. Approved by: jb Modified: head/usr.bin/fstat/zfs/Makefile Modified: head/usr.bin/fstat/zfs/Makefile ============================================================================== --- head/usr.bin/fstat/zfs/Makefile Wed Nov 5 19:39:11 2008 (r184698) +++ head/usr.bin/fstat/zfs/Makefile Wed Nov 5 19:39:37 2008 (r184699) @@ -15,6 +15,7 @@ CFLAGS+= -I${.CURDIR}/../../../sys/cddl/ CFLAGS+= -I${.CURDIR}/../../../sys/cddl/contrib/opensolaris/uts/common/sys CFLAGS+= -I${.CURDIR}/../../../cddl/contrib/opensolaris/head CFLAGS+= -I${.CURDIR}/.. +CFLAGS+= -DNEED_SOLARIS_BOOLEAN all: ${OBJS} CLEANFILES= ${OBJS} From rodrigc at FreeBSD.org Wed Nov 5 11:40:37 2008 From: rodrigc at FreeBSD.org (Craig Rodrigues) Date: Wed Nov 5 11:40:48 2008 Subject: svn commit: r184700 - in head/sys: kern modules/zfs Message-ID: <200811051940.mA5JeapQ035688@svn.freebsd.org> Author: rodrigc Date: Wed Nov 5 19:40:36 2008 New Revision: 184700 URL: http://svn.freebsd.org/changeset/base/184700 Log: Merge latest DTrace changes from Perforce. Approved by: jb Modified: head/sys/kern/kern_exec.c head/sys/kern/vfs_syscalls.c head/sys/modules/zfs/Makefile Modified: head/sys/kern/kern_exec.c ============================================================================== --- head/sys/kern/kern_exec.c Wed Nov 5 19:39:37 2008 (r184699) +++ head/sys/kern/kern_exec.c Wed Nov 5 19:40:36 2008 (r184700) @@ -388,8 +388,6 @@ do_execve(td, args, mac_p) imgp->image_header = NULL; - SDT_PROBE(proc, kernel, , exec, args->fname, 0, 0, 0, 0 ); - /* * Translate the file name. namei() returns a vnode pointer * in ni_vp amoung other things. @@ -403,6 +401,8 @@ do_execve(td, args, mac_p) | MPSAFE | AUDITVNODE1, UIO_SYSSPACE, args->fname, td); } + SDT_PROBE(proc, kernel, , exec, args->fname, 0, 0, 0, 0 ); + interpret: if (args->fname != NULL) { error = namei(ndp); @@ -800,8 +800,9 @@ interpret: vfs_mark_atime(imgp->vp, td->td_ucred); -done1: + SDT_PROBE(proc, kernel, , exec_success, args->fname, 0, 0, 0, 0); +done1: /* * Free any resources malloc'd earlier that we didn't use. */ @@ -812,8 +813,6 @@ done1: crfree(newcred); VOP_UNLOCK(imgp->vp, 0); - SDT_PROBE(proc, kernel, , exec_success, args->fname, 0, 0, 0, 0); - /* * Handle deferred decrement of ref counts. */ Modified: head/sys/kern/vfs_syscalls.c ============================================================================== --- head/sys/kern/vfs_syscalls.c Wed Nov 5 19:39:37 2008 (r184699) +++ head/sys/kern/vfs_syscalls.c Wed Nov 5 19:40:36 2008 (r184700) @@ -38,6 +38,7 @@ __FBSDID("$FreeBSD$"); #include "opt_compat.h" +#include "opt_kdtrace.h" #include "opt_ktrace.h" #include "opt_mac.h" @@ -58,6 +59,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -82,6 +84,14 @@ __FBSDID("$FreeBSD$"); #include #include +SDT_PROVIDER_DEFINE(vfs); +SDT_PROBE_DEFINE(vfs, , stat, mode); +SDT_PROBE_ARGTYPE(vfs, , stat, mode, 0, "char *"); +SDT_PROBE_ARGTYPE(vfs, , stat, mode, 1, "int"); +SDT_PROBE_DEFINE(vfs, , stat, reg); +SDT_PROBE_ARGTYPE(vfs, , stat, reg, 0, "char *"); +SDT_PROBE_ARGTYPE(vfs, , stat, reg, 1, "int"); + static int chroot_refuse_vdir_fds(struct filedesc *fdp); static int getutimes(const struct timeval *, enum uio_seg, struct timespec *); static int setfown(struct thread *td, struct vnode *, uid_t, gid_t); @@ -2334,6 +2344,11 @@ kern_statat(struct thread *td, int flag, return (error); vfslocked = NDHASGIANT(&nd); error = vn_stat(nd.ni_vp, &sb, td->td_ucred, NOCRED, td); + if (!error) { + SDT_PROBE(vfs, , stat, mode, path, sb.st_mode, 0, 0, 0); + if (S_ISREG(sb.st_mode)) + SDT_PROBE(vfs, , stat, reg, path, pathseg, 0, 0, 0); + } NDFREE(&nd, NDF_ONLY_PNBUF); vput(nd.ni_vp); VFS_UNLOCK_GIANT(vfslocked); Modified: head/sys/modules/zfs/Makefile ============================================================================== --- head/sys/modules/zfs/Makefile Wed Nov 5 19:39:37 2008 (r184699) +++ head/sys/modules/zfs/Makefile Wed Nov 5 19:40:36 2008 (r184700) @@ -78,6 +78,7 @@ CFLAGS+=-I${.CURDIR}/../.. CFLAGS+=-I${SUNW}/common/zfs CFLAGS+=-I${SUNW}/common CFLAGS+=-I${.CURDIR}/../../../include +CFLAGS+=-DBUILDING_ZFS #CFLAGS+=-DDEBUG=1 #DEBUG_FLAGS=-g From thompsa at FreeBSD.org Wed Nov 5 11:50:43 2008 From: thompsa at FreeBSD.org (Andrew Thompson) Date: Wed Nov 5 11:50:55 2008 Subject: svn commit: r184698 - in head/sys: cddl/compat/opensolaris/kern cddl/compat/opensolaris/sys cddl/contrib/opensolaris/uts/common/dtrace cddl/dev/dtrace cddl/dev/systrace sys In-Reply-To: <200811051939.mA5JdBCK035580@svn.freebsd.org> References: <200811051939.mA5JdBCK035580@svn.freebsd.org> Message-ID: <20081105195037.GF840@citylink.fud.org.nz> On Wed, Nov 05, 2008 at 07:39:11PM +0000, Craig Rodrigues wrote: > Author: rodrigc > Date: Wed Nov 5 19:39:11 2008 > New Revision: 184698 > URL: http://svn.freebsd.org/changeset/base/184698 > > Log: > Merge latest DTrace changes from Perforce. > > Modified: > head/sys/cddl/compat/opensolaris/kern/opensolaris_kmem.c > head/sys/cddl/compat/opensolaris/sys/types.h > head/sys/cddl/compat/opensolaris/sys/uio.h > head/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c > head/sys/cddl/contrib/opensolaris/uts/common/dtrace/fasttrap.c > head/sys/cddl/dev/dtrace/dtrace_ioctl.c > head/sys/cddl/dev/dtrace/dtrace_load.c > head/sys/cddl/dev/dtrace/dtrace_unload.c > head/sys/cddl/dev/systrace/systrace.c > head/sys/sys/sysent.h > > Modified: head/sys/cddl/compat/opensolaris/kern/opensolaris_kmem.c > ============================================================================== > --- head/sys/cddl/compat/opensolaris/kern/opensolaris_kmem.c Wed Nov 5 19:35:43 2008 (r184697) > +++ head/sys/cddl/compat/opensolaris/kern/opensolaris_kmem.c Wed Nov 5 19:39:11 2008 (r184698) > @@ -40,6 +40,8 @@ __FBSDID("$FreeBSD$"); > #include > #include > > +#define KMEM_DEBUG Didnt this cause a huge performance hit when it was accidentally merged with the stable-7 dtrace import? Andrew From rodrigc at FreeBSD.org Wed Nov 5 12:32:14 2008 From: rodrigc at FreeBSD.org (Craig Rodrigues) Date: Wed Nov 5 12:32:25 2008 Subject: svn commit: r184701 - head/sys/cddl/compat/opensolaris/kern Message-ID: <200811052032.mA5KWDDl036639@svn.freebsd.org> Author: rodrigc Date: Wed Nov 5 20:32:13 2008 New Revision: 184701 URL: http://svn.freebsd.org/changeset/base/184701 Log: Remove definition of KMEM_DEBUG accidentally brought in by latest DTrace import. Noticed by: thompsa Modified: head/sys/cddl/compat/opensolaris/kern/opensolaris_kmem.c Modified: head/sys/cddl/compat/opensolaris/kern/opensolaris_kmem.c ============================================================================== --- head/sys/cddl/compat/opensolaris/kern/opensolaris_kmem.c Wed Nov 5 19:40:36 2008 (r184700) +++ head/sys/cddl/compat/opensolaris/kern/opensolaris_kmem.c Wed Nov 5 20:32:13 2008 (r184701) @@ -40,8 +40,6 @@ __FBSDID("$FreeBSD$"); #include #include -#define KMEM_DEBUG - #ifdef KMEM_DEBUG #include #include From jhb at freebsd.org Wed Nov 5 13:00:34 2008 From: jhb at freebsd.org (John Baldwin) Date: Wed Nov 5 13:00:50 2008 Subject: svn commit: r184667 - in head/sys: kern sys In-Reply-To: <200811050301.mA531Nmk014730@svn.freebsd.org> References: <200811050301.mA531Nmk014730@svn.freebsd.org> Message-ID: <200811051035.21103.jhb@freebsd.org> On Tuesday 04 November 2008 10:01:23 pm David Xu wrote: > Author: davidxu > Date: Wed Nov 5 03:01:23 2008 > New Revision: 184667 > URL: http://svn.freebsd.org/changeset/base/184667 > > Log: > Revert rev 184216 and 184199, due to the way the thread_lock works, > it may cause a lockup. > > Noticed by: peter, jhb Thanks. -- John Baldwin From jhb at freebsd.org Wed Nov 5 13:00:44 2008 From: jhb at freebsd.org (John Baldwin) Date: Wed Nov 5 13:00:51 2008 Subject: svn commit: r184217 - head/sys/kern In-Reply-To: <4910F8E7.4010805@freebsd.org> References: <200810240109.m9O19P1u071214@svn.freebsd.org> <200811041705.48043.jhb@freebsd.org> <4910F8E7.4010805@freebsd.org> Message-ID: <200811051044.08650.jhb@freebsd.org> On Tuesday 04 November 2008 08:37:43 pm David Xu wrote: > John Baldwin wrote: > > On Thursday 23 October 2008 09:09:25 pm David Xu wrote: > >> Author: davidxu > >> Date: Fri Oct 24 01:09:24 2008 > >> New Revision: 184217 > >> URL: http://svn.freebsd.org/changeset/base/184217 > >> > >> Log: > >> Don't rearm callout if the process is exiting, it may leak a callout > >> because callout_drain() only waits for running callout, but not disable > >> it if it is rearmed. > > > > Can you please revert this as per previous discussion? > > > > I will do it, maybe I lost previous discussion ? I thought someone else had followed up to my original e-mail, but here are my comments from when this was first committed: > Log: > Don't rearm callout if the process is exiting, it may leak a callout > because callout_drain() only waits for running callout, but not disable > it if it is rearmed. Actually, it does prevent rearming from within the callout routine itself while waiting: int callout_reset_on(struct callout *c, int to_ticks, void (*ftn)(void *), void *arg, int cpu) { ... if (cc->cc_curr == c) { ... if (cc->cc_waiting) { /* * Someone has called callout_drain to kill this * callout. Don't reschedule. */ CTR4(KTR_CALLOUT, "%s %p func %p arg %p", cancelled ? "cancelled" : "failed to cancel", c, c->c_func, c->c_arg); CC_UNLOCK(cc); return (cancelled); } } ... } Lots of callouts using callout_init_mtx() (e.g. all the callouts in the NIC drivers) depend on this feature. Please revert this. -- John Baldwin From imp at bsdimp.com Wed Nov 5 13:50:30 2008 From: imp at bsdimp.com (M. Warner Losh) Date: Wed Nov 5 13:50:36 2008 Subject: svn commit: r184610 - in head: lib/libusb20 share/man/man4 sys/conf sys/dev/sound/pcm sys/dev/usb2 sys/dev/usb2/bluetooth sys/dev/usb2/controller sys/dev/usb2/core sys/dev/usb2/ethernet sys/dev/usb... In-Reply-To: <86skq6gxtn.fsf@ds4.des.no> References: <200811040231.mA42V4EQ083516@svn.freebsd.org> <86skq6gxtn.fsf@ds4.des.no> Message-ID: <20081105.144840.-432836001.imp@bsdimp.com> In message: <86skq6gxtn.fsf@ds4.des.no> Dag-Erling_Sm?rgrav writes: : It looks like whoever wrote this went out of their way to find new and : creative ways to break just about every style rule we have. Not just coding style, but also style of /dev entries, the modules style, etc. Warner From imp at bsdimp.com Wed Nov 5 14:02:53 2008 From: imp at bsdimp.com (M. Warner Losh) Date: Wed Nov 5 14:03:05 2008 Subject: svn commit: r184691 - head/sys/compat/linprocfs In-Reply-To: <200811051508.mA5F89XD030040@svn.freebsd.org> References: <200811051508.mA5F89XD030040@svn.freebsd.org> Message-ID: <20081105.150108.1649771743.imp@bsdimp.com> In message: <200811051508.mA5F89XD030040@svn.freebsd.org> Dag-Erling Smorgrav writes: : utf-8 Is there some reason to prefer utf-8 over the 8-bit iso character set we were using? Warner From ivoras at gmail.com Wed Nov 5 15:26:44 2008 From: ivoras at gmail.com (Ivan Voras) Date: Wed Nov 5 15:26:55 2008 Subject: svn commit: r184691 - head/sys/compat/linprocfs In-Reply-To: <20081105.150108.1649771743.imp@bsdimp.com> References: <200811051508.mA5F89XD030040@svn.freebsd.org> <20081105.150108.1649771743.imp@bsdimp.com> Message-ID: <9bbcef730811051526p3a978848uf904a149cb81fbce@mail.gmail.com> 2008/11/5 M. Warner Losh : > In message: <200811051508.mA5F89XD030040@svn.freebsd.org> > Dag-Erling Smorgrav writes: > : utf-8 > > Is there some reason to prefer utf-8 over the 8-bit iso character set > we were using? Reason? You mean you actually *like* 8-bit code pages in the first place? :) As a person from a country that has during its history decided it really needs 3-4 dots and dashes in its alphabet that make it (the alphabet) not representable in ASCII, and who has had Many Fun Days converting between various 8-bit code pages, ISO standard or not, and especially with deducing which code page is actually being used as all bytes are created equal (and Microsoft just *had* to tweak two letters from iso8859-2 into Latin2), I welcome UTF-8 with a warm room, a beer, peanuts and a backrub. UTF-8 (as opposed to old 8-bit code pages which need to die as soon as possible and UTF-16 which got itself messed up with endianess) in unambiguous. A sequence of proper UTF-8 bytes (and UTF-8 has a structure so not every random collection of bytes with the 8th bit set is proper UTF-8) can always be linked to the same letter. This is why there's such a big push to get systems to properly support UTF-8. FreeBSD had a SoC project this year that was supposed to properly implement Unicode collations (and thus collation of UTF-8 strings) but it looks dead or in a dormant state right now (though I didn't follow it attentively). From imp at bsdimp.com Wed Nov 5 15:38:50 2008 From: imp at bsdimp.com (M. Warner Losh) Date: Wed Nov 5 15:39:02 2008 Subject: svn commit: r184691 - head/sys/compat/linprocfs In-Reply-To: <9bbcef730811051526p3a978848uf904a149cb81fbce@mail.gmail.com> References: <200811051508.mA5F89XD030040@svn.freebsd.org> <20081105.150108.1649771743.imp@bsdimp.com> <9bbcef730811051526p3a978848uf904a149cb81fbce@mail.gmail.com> Message-ID: <20081105.163911.420518480.imp@bsdimp.com> In message: <9bbcef730811051526p3a978848uf904a149cb81fbce@mail.gmail.com> "Ivan Voras" writes: : 2008/11/5 M. Warner Losh : : > In message: <200811051508.mA5F89XD030040@svn.freebsd.org> : > Dag-Erling Smorgrav writes: : > : utf-8 : > : > Is there some reason to prefer utf-8 over the 8-bit iso character set : > we were using? : : Reason? You mean you actually *like* 8-bit code pages in the first place? :) Liked? Not necessarily. Understood: yes. Just didn't have a clue why the change. : As a person from a country that has during its history decided it : really needs 3-4 dots and dashes in its alphabet that make it (the : alphabet) not representable in ASCII, and who has had Many Fun Days : converting between various 8-bit code pages, ISO standard or not, and : especially with deducing which code page is actually being used as all : bytes are created equal (and Microsoft just *had* to tweak two letters : from iso8859-2 into Latin2), I welcome UTF-8 with a warm room, a beer, : peanuts and a backrub. Hmmmm. peanuts.... : UTF-8 (as opposed to old 8-bit code pages which need to die as soon as : possible and UTF-16 which got itself messed up with endianess) in : unambiguous. A sequence of proper UTF-8 bytes (and UTF-8 has a : structure so not every random collection of bytes with the 8th bit set : is proper UTF-8) can always be linked to the same letter. : : This is why there's such a big push to get systems to properly support : UTF-8. FreeBSD had a SoC project this year that was supposed to : properly implement Unicode collations (and thus collation of UTF-8 : strings) but it looks dead or in a dormant state right now (though I : didn't follow it attentively). That makes sense. Warner From kientzle at freebsd.org Wed Nov 5 20:06:33 2008 From: kientzle at freebsd.org (Tim Kientzle) Date: Wed Nov 5 20:06:46 2008 Subject: svn commit: r184691 - head/sys/compat/linprocfs In-Reply-To: <20081105.163911.420518480.imp@bsdimp.com> References: <200811051508.mA5F89XD030040@svn.freebsd.org> <20081105.150108.1649771743.imp@bsdimp.com> <9bbcef730811051526p3a978848uf904a149cb81fbce@mail.gmail.com> <20081105.163911.420518480.imp@bsdimp.com> Message-ID: <491264B8.80602@freebsd.org> > : This is why there's such a big push to get systems to properly support > : UTF-8. FreeBSD had a SoC project this year that was supposed to > : properly implement Unicode collations... > > That makes sense. Yes, UTF-8 is good. More UTF-8, please. Tim From matteo at FreeBSD.org Wed Nov 5 20:53:02 2008 From: matteo at FreeBSD.org (Matteo Riondato) Date: Wed Nov 5 20:53:09 2008 Subject: svn commit: r184706 - head/usr.sbin/cron/crontab Message-ID: <200811060453.mA64r24k045757@svn.freebsd.org> Author: matteo Date: Thu Nov 6 04:53:02 2008 New Revision: 184706 URL: http://svn.freebsd.org/changeset/base/184706 Log: Be paranoid and zero out passwd PR: 122070 Submitted by: Steven Kreuzer Reminded by: gnn@ MFC after: 3 days Modified: head/usr.sbin/cron/crontab/crontab.c Modified: head/usr.sbin/cron/crontab/crontab.c ============================================================================== --- head/usr.sbin/cron/crontab/crontab.c Thu Nov 6 04:51:09 2008 (r184705) +++ head/usr.sbin/cron/crontab/crontab.c Thu Nov 6 04:53:02 2008 (r184706) @@ -138,6 +138,7 @@ parse_args(argc, argv) if (!(pw = getpwuid(getuid()))) errx(ERROR_EXIT, "your UID isn't in the passwd file, bailing out"); + bzero(pw->pw_passwd, strlen(pw->pw_passwd)); (void) strncpy(User, pw->pw_name, (sizeof User)-1); User[(sizeof User)-1] = '\0'; strcpy(RealUser, User); @@ -154,6 +155,7 @@ parse_args(argc, argv) errx(ERROR_EXIT, "must be privileged to use -u"); if (!(pw = getpwnam(optarg))) errx(ERROR_EXIT, "user `%s' unknown", optarg); + bzero(pw->pw_passwd, strlen(pw->pw_passwd)); (void) strncpy(User, pw->pw_name, (sizeof User)-1); User[(sizeof User)-1] = '\0'; break; From bz at FreeBSD.org Thu Nov 6 00:55:47 2008 From: bz at FreeBSD.org (Bjoern A. Zeeb) Date: Thu Nov 6 00:55:54 2008 Subject: svn commit: r184708 - head/sys/dev/an Message-ID: <200811060855.mA68tklS050030@svn.freebsd.org> Author: bz Date: Thu Nov 6 08:55:46 2008 New Revision: 184708 URL: http://svn.freebsd.org/changeset/base/184708 Log: In case INET is not defined, then ANCACHE is not defined and the sc does not have 'an_have_rssimap' variable. Add an ANCACHE check to poperly hide the case and make an(4) compile without INET. MFC after: 2 months Modified: head/sys/dev/an/if_an.c Modified: head/sys/dev/an/if_an.c ============================================================================== --- head/sys/dev/an/if_an.c Thu Nov 6 06:14:25 2008 (r184707) +++ head/sys/dev/an/if_an.c Thu Nov 6 08:55:46 2008 (r184708) @@ -2686,8 +2686,10 @@ an_init(void *xsc) } } +#ifdef ANCACHE if (sc->an_have_rssimap) sc->an_config.an_rxmode |= AN_RXMODE_NORMALIZED_RSSI; +#endif /* Set the ssid list */ sc->an_ssidlist.an_type = AN_RID_SSIDLIST; From bz at FreeBSD.org Thu Nov 6 01:07:56 2008 From: bz at FreeBSD.org (Bjoern A. Zeeb) Date: Thu Nov 6 01:08:08 2008 Subject: svn commit: r184709 - head/sys/net Message-ID: <200811060907.mA697ue4050298@svn.freebsd.org> Author: bz Date: Thu Nov 6 09:07:56 2008 New Revision: 184709 URL: http://svn.freebsd.org/changeset/base/184709 Log: Hide an unused variable in case we compile without INET. Include ethernet.h directly so that the constants are always defined. Makes fddi compile without INET. MFC after: 2 months Modified: head/sys/net/if_fddisubr.c Modified: head/sys/net/if_fddisubr.c ============================================================================== --- head/sys/net/if_fddisubr.c Thu Nov 6 08:55:46 2008 (r184708) +++ head/sys/net/if_fddisubr.c Thu Nov 6 09:07:56 2008 (r184709) @@ -56,6 +56,7 @@ #include #include +#include #include #include #include @@ -695,7 +696,9 @@ fddi_resolvemulti(ifp, llsa, sa) struct sockaddr *sa; { struct sockaddr_dl *sdl; +#ifdef INET struct sockaddr_in *sin; +#endif #ifdef INET6 struct sockaddr_in6 *sin6; #endif From bz at FreeBSD.org Thu Nov 6 01:18:30 2008 From: bz at FreeBSD.org (Bjoern A. Zeeb) Date: Thu Nov 6 01:18:42 2008 Subject: svn commit: r184710 - head/sys/net Message-ID: <200811060918.mA69ITMR050550@svn.freebsd.org> Author: bz Date: Thu Nov 6 09:18:29 2008 New Revision: 184710 URL: http://svn.freebsd.org/changeset/base/184710 Log: Hide an unused variable in case we compile without INET. Include ethernet.h and if_arp.h directly so that the constants are always defined. Makes token compile without INET. MFC after: 2 months Modified: head/sys/net/if_iso88025subr.c Modified: head/sys/net/if_iso88025subr.c ============================================================================== --- head/sys/net/if_iso88025subr.c Thu Nov 6 09:07:56 2008 (r184709) +++ head/sys/net/if_iso88025subr.c Thu Nov 6 09:18:29 2008 (r184710) @@ -55,10 +55,12 @@ #include #include +#include #include #include #include +#include #include #include #include @@ -695,7 +697,9 @@ iso88025_resolvemulti (ifp, llsa, sa) struct sockaddr *sa; { struct sockaddr_dl *sdl; +#ifdef INET struct sockaddr_in *sin; +#endif #ifdef INET6 struct sockaddr_in6 *sin6; #endif From bz at FreeBSD.org Thu Nov 6 01:27:47 2008 From: bz at FreeBSD.org (Bjoern A. Zeeb) Date: Thu Nov 6 01:27:53 2008 Subject: svn commit: r184711 - head/sys/net Message-ID: <200811060927.mA69RlEd050752@svn.freebsd.org> Author: bz Date: Thu Nov 6 09:27:47 2008 New Revision: 184711 URL: http://svn.freebsd.org/changeset/base/184711 Log: Check for INET not AF_INET in #ifdef. Makes it compile without INET. MFC after: 2 months Modified: head/sys/net/if_fwsubr.c Modified: head/sys/net/if_fwsubr.c ============================================================================== --- head/sys/net/if_fwsubr.c Thu Nov 6 09:18:29 2008 (r184710) +++ head/sys/net/if_fwsubr.c Thu Nov 6 09:27:47 2008 (r184711) @@ -136,7 +136,7 @@ firewire_output(struct ifnet *ifp, struc } switch (dst->sa_family) { -#ifdef AF_INET +#ifdef INET case AF_INET: /* * Only bother with arp for unicast. Allocation of From des at des.no Thu Nov 6 01:31:17 2008 From: des at des.no (=?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?=) Date: Thu Nov 6 01:31:28 2008 Subject: svn commit: r184588 - in head: etc/gss etc/rc.d include/rpc lib/libc/sys lib/libc/xdr lib/librpcsec_gss sbin/mount_nfs sys/compat/freebsd32 sys/conf sys/fs/unionfs sys/kern sys/kgssapi sys/kgssapi/... In-Reply-To: <200811031038.mA3Ac0UR064387@svn.freebsd.org> (Doug Rabson's message of "Mon, 3 Nov 2008 10:38:00 +0000 (UTC)") References: <200811031038.mA3Ac0UR064387@svn.freebsd.org> Message-ID: <868wrx5hgc.fsf@ds4.des.no> Doug Rabson writes: > Log: > Implement support for RPCSEC_GSS authentication to both the NFS client > and server. This replaces the RPC implementation of the NFS client and > server with the newer RPC implementation originally developed > (actually ported from the userland sunrpc code) to support the NFS > Lock Manager. I have tested this code extensively and I believe it is > stable and that performance is at least equal to the legacy RPC > implementation. I wonder how much you *did* test. The nfsserver module won't load: Nov 6 10:00:14 ds4 kernel: link_elf_obj: symbol svcpool_create undefined Nov 6 10:00:14 ds4 kernel: kldload: /boot/ds4/nfsserver.ko: Unsupported file type svcpool_create is apparently part of the krpc module: des@ds4 ~% gfk \^svcpool_create src/sys/rpc/svc.c: svcpool_create(const char *name, struct sysctl_oid_list *sysctl_base) des@ds4 ~% grep -wF svc.c /sys/conf/files* /sys/conf/files:rpc/svc.c optional krpc | nfslockd | nfsserver des@ds4 ~% find /sys/modules -name Makefile | xargs grep -wF svc.c /sys/modules/krpc/Makefile: svc.c \ so the nfsserver module lacks a dependency on the krpc module, but that doesn't matter, because the krpc module won't load either: Nov 6 10:02:10 ds4 kernel: link_elf_obj: symbol replay_setreply undefined Nov 6 10:02:10 ds4 kernel: kldload: /boot/ds4/krpc.ko: Unsupported file type replay_setreply is not part of any module: des@ds4 ~% gfk \^replay_setreply src/sys/rpc/replay.c: replay_setreply(struct replay_cache *rc, des@ds4 ~% grep -wF replay.c /sys/conf/files* /sys/conf/files:rpc/replay.c optional krpc | nfslockd | nfsserver des@ds4 ~% find /sys/modules -name Makefile | xargs grep -wF replay.c DES -- Dag-Erling Sm?rgrav - des@des.no From des at des.no Thu Nov 6 01:32:04 2008 From: des at des.no (=?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?=) Date: Thu Nov 6 01:32:15 2008 Subject: svn commit: r184610 - in head: lib/libusb20 share/man/man4 sys/conf sys/dev/sound/pcm sys/dev/usb2 sys/dev/usb2/bluetooth sys/dev/usb2/controller sys/dev/usb2/core sys/dev/usb2/ethernet sys/dev/usb... In-Reply-To: <20081105.144840.-432836001.imp@bsdimp.com> (M. Warner Losh's message of "Wed, 05 Nov 2008 14:48:40 -0700 (MST)") References: <200811040231.mA42V4EQ083516@svn.freebsd.org> <86skq6gxtn.fsf@ds4.des.no> <20081105.144840.-432836001.imp@bsdimp.com> Message-ID: <864p2l5hf1.fsf@ds4.des.no> "M. Warner Losh" writes: > Dag-Erling_Sm?rgrav writes: > > It looks like whoever wrote this went out of their way to find new and > > creative ways to break just about every style rule we have. > Not just coding style, but also style of /dev entries, the modules > style, etc. So the question is, why was this code imported at all? DES -- Dag-Erling Sm?rgrav - des@des.no From bz at FreeBSD.org Thu Nov 6 01:41:32 2008 From: bz at FreeBSD.org (Bjoern A. Zeeb) Date: Thu Nov 6 01:41:42 2008 Subject: svn commit: r184712 - head/sys/dev/en Message-ID: <200811060941.mA69fV1U051030@svn.freebsd.org> Author: bz Date: Thu Nov 6 09:41:31 2008 New Revision: 184712 URL: http://svn.freebsd.org/changeset/base/184712 Log: Hide an unused variable in case we compile with neither INET nor INET6. NATM needs 'struct in_addr' to compile, which is a problem on its own but include in.h for now if we have NATM but neither INET or INET6. MFC after: 2 months Modified: head/sys/dev/en/midway.c Modified: head/sys/dev/en/midway.c ============================================================================== --- head/sys/dev/en/midway.c Thu Nov 6 09:27:47 2008 (r184711) +++ head/sys/dev/en/midway.c Thu Nov 6 09:41:31 2008 (r184712) @@ -141,10 +141,12 @@ enum { #include #include -#if defined(INET) || defined(INET6) +#if defined(NATM) || defined(INET) || defined(INET6) #include +#if defined(INET) || defined(INET6) #include #endif +#endif #ifdef NATM #include @@ -1524,7 +1526,9 @@ static int en_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) { struct en_softc *sc = (struct en_softc *)ifp->if_softc; +#if defined(INET) || defined(INET6) struct ifaddr *ifa = (struct ifaddr *)data; +#endif struct ifreq *ifr = (struct ifreq *)data; struct atmio_vcctable *vtab; int error = 0; From des at des.no Thu Nov 6 01:53:00 2008 From: des at des.no (=?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?=) Date: Thu Nov 6 01:53:11 2008 Subject: svn commit: r184691 - head/sys/compat/linprocfs In-Reply-To: <20081105.150108.1649771743.imp@bsdimp.com> (M. Warner Losh's message of "Wed, 05 Nov 2008 15:01:08 -0700 (MST)") References: <200811051508.mA5F89XD030040@svn.freebsd.org> <20081105.150108.1649771743.imp@bsdimp.com> Message-ID: <86iqr141vp.fsf@ds4.des.no> "M. Warner Losh" writes: > Is there some reason to prefer utf-8 over the 8-bit iso character set > we were using? Respect for people whose names can't be spelled using ISO-8859-1. DES -- Dag-Erling Sm?rgrav - des@des.no From danfe at FreeBSD.org Thu Nov 6 02:11:56 2008 From: danfe at FreeBSD.org (Alexey Dokuchaev) Date: Thu Nov 6 02:12:07 2008 Subject: svn commit: r184610 - in head: lib/libusb20 share/man/man4 sys/conf sys/dev/sound/pcm sys/dev/usb2 sys/dev/usb2/bluetooth sys/dev/usb2/controller sys/dev/usb2/core sys/dev/usb2/ethernet sys/dev/usb... In-Reply-To: <864p2l5hf1.fsf@ds4.des.no> References: <200811040231.mA42V4EQ083516@svn.freebsd.org> <86skq6gxtn.fsf@ds4.des.no> <20081105.144840.-432836001.imp@bsdimp.com> <864p2l5hf1.fsf@ds4.des.no> Message-ID: <20081106101156.GA40311@FreeBSD.org> On Thu, Nov 06, 2008 at 10:32:02AM +0100, Dag-Erling Sm??rgrav wrote: > "M. Warner Losh" writes: > > Dag-Erling_Sm??rgrav writes: > > > It looks like whoever wrote this went out of their way to find new and > > > creative ways to break just about every style rule we have. > > Not just coding style, but also style of /dev entries, the modules > > style, etc. > > So the question is, why was this code imported at all? Seconded, especially since it says the code was reviewed by you Warner in the commit log. ./danfe From bz at FreeBSD.org Thu Nov 6 02:17:58 2008 From: bz at FreeBSD.org (Bjoern A. Zeeb) Date: Thu Nov 6 02:18:05 2008 Subject: svn commit: r184714 - head/sys/dev/cxgb Message-ID: <200811061017.mA6AHv91051810@svn.freebsd.org> Author: bz Date: Thu Nov 6 10:17:57 2008 New Revision: 184714 URL: http://svn.freebsd.org/changeset/base/184714 Log: Hide AF_INET specific ioctl handling under #ifdef INET. Reviewed by: kmacy MFC after: 2 months Modified: head/sys/dev/cxgb/cxgb_main.c Modified: head/sys/dev/cxgb/cxgb_main.c ============================================================================== --- head/sys/dev/cxgb/cxgb_main.c Thu Nov 6 09:59:57 2008 (r184713) +++ head/sys/dev/cxgb/cxgb_main.c Thu Nov 6 10:17:57 2008 (r184714) @@ -1931,7 +1931,9 @@ static int cxgb_ioctl(struct ifnet *ifp, unsigned long command, caddr_t data) { struct port_info *p = ifp->if_softc; +#ifdef INET struct ifaddr *ifa = (struct ifaddr *)data; +#endif struct ifreq *ifr = (struct ifreq *)data; int flags, error = 0, reinit = 0; uint32_t mask; @@ -1944,6 +1946,7 @@ cxgb_ioctl(struct ifnet *ifp, unsigned l error = cxgb_set_mtu(p, ifr->ifr_mtu); break; case SIOCSIFADDR: +#ifdef INET if (ifa->ifa_addr->sa_family == AF_INET) { ifp->if_flags |= IFF_UP; if (!(ifp->if_drv_flags & IFF_DRV_RUNNING)) { @@ -1953,6 +1956,7 @@ cxgb_ioctl(struct ifnet *ifp, unsigned l } arp_ifinit(ifp, ifa); } else +#endif error = ether_ioctl(ifp, command, data); break; case SIOCSIFFLAGS: From bz at FreeBSD.org Thu Nov 6 02:35:47 2008 From: bz at FreeBSD.org (Bjoern A. Zeeb) Date: Thu Nov 6 02:35:58 2008 Subject: svn commit: r184715 - head/sys/dev/cxgb Message-ID: <200811061035.mA6AZkPH053372@svn.freebsd.org> Author: bz Date: Thu Nov 6 10:35:46 2008 New Revision: 184715 URL: http://svn.freebsd.org/changeset/base/184715 Log: For now our LRO code (tcp_lro.c) only supports IPv4 properly thus only enable if INET is on. Reviewed by: kmacy MFC after: 2 months Modified: head/sys/dev/cxgb/cxgb_osdep.h Modified: head/sys/dev/cxgb/cxgb_osdep.h ============================================================================== --- head/sys/dev/cxgb/cxgb_osdep.h Thu Nov 6 10:17:57 2008 (r184714) +++ head/sys/dev/cxgb/cxgb_osdep.h Thu Nov 6 10:35:46 2008 (r184715) @@ -110,7 +110,10 @@ struct t3_mbuf_hdr { #endif #if __FreeBSD_version >= 701000 +#include "opt_inet.h" +#ifdef INET #define LRO_SUPPORTED +#endif #define TOE_SUPPORTED #endif From des at FreeBSD.org Thu Nov 6 02:53:36 2008 From: des at FreeBSD.org (Dag-Erling Smorgrav) Date: Thu Nov 6 02:53:41 2008 Subject: svn commit: r184716 - in head/sys: modules/krpc modules/nfsserver nfsserver Message-ID: <200811061053.mA6ArZri053711@svn.freebsd.org> Author: des Date: Thu Nov 6 10:53:35 2008 New Revision: 184716 URL: http://svn.freebsd.org/changeset/base/184716 Log: Unbreak NFS. Pointy hat to: dfr Modified: head/sys/modules/krpc/Makefile head/sys/modules/nfsserver/Makefile head/sys/nfsserver/nfs_srvsubs.c Modified: head/sys/modules/krpc/Makefile ============================================================================== --- head/sys/modules/krpc/Makefile Thu Nov 6 10:35:46 2008 (r184715) +++ head/sys/modules/krpc/Makefile Thu Nov 6 10:53:35 2008 (r184716) @@ -16,6 +16,7 @@ SRCS= auth_none.c \ rpc_prot.c \ rpcb_clnt.c \ rpcb_prot.c \ + replay.c \ svc.c \ svc_auth.c \ svc_auth_unix.c \ Modified: head/sys/modules/nfsserver/Makefile ============================================================================== --- head/sys/modules/nfsserver/Makefile Thu Nov 6 10:35:46 2008 (r184715) +++ head/sys/modules/nfsserver/Makefile Thu Nov 6 10:53:35 2008 (r184716) @@ -3,8 +3,8 @@ .PATH: ${.CURDIR}/../../nfsserver ${.CURDIR}/../../nfs KMOD= nfsserver SRCS= vnode_if.h \ - nfs_serv.c nfs_srvkrpc.c nfs_srvsock.c nfs_srvcache.c nfs_srvsubs.c \ - nfs_syscalls.c nfs_common.c \ + nfs_fha.c nfs_serv.c nfs_srvkrpc.c nfs_srvsock.c nfs_srvcache.c \ + nfs_srvsubs.c nfs_syscalls.c nfs_common.c \ opt_mac.h \ opt_nfs.h SRCS+= opt_inet6.h Modified: head/sys/nfsserver/nfs_srvsubs.c ============================================================================== --- head/sys/nfsserver/nfs_srvsubs.c Thu Nov 6 10:35:46 2008 (r184715) +++ head/sys/nfsserver/nfs_srvsubs.c Thu Nov 6 10:53:35 2008 (r184716) @@ -596,6 +596,7 @@ DECLARE_MODULE(nfsserver, nfsserver_mod, /* So that loader and kldload(2) can find us, wherever we are.. */ MODULE_VERSION(nfsserver, 1); +MODULE_DEPEND(nfsserver, krpc, 1, 1, 1); /* * Set up nameidata for a lookup() call and do it. From bz at FreeBSD.org Thu Nov 6 03:00:57 2008 From: bz at FreeBSD.org (Bjoern A. Zeeb) Date: Thu Nov 6 03:01:03 2008 Subject: svn commit: r184717 - head/sys/dev/e1000 Message-ID: <200811061100.mA6B0vjg053896@svn.freebsd.org> Author: bz Date: Thu Nov 6 11:00:57 2008 New Revision: 184717 URL: http://svn.freebsd.org/changeset/base/184717 Log: Hide AF_INET specific ioctl handling under #ifdef INET. MFC after: 2 months Modified: head/sys/dev/e1000/if_em.c Modified: head/sys/dev/e1000/if_em.c ============================================================================== --- head/sys/dev/e1000/if_em.c Thu Nov 6 10:53:35 2008 (r184716) +++ head/sys/dev/e1000/if_em.c Thu Nov 6 11:00:57 2008 (r184717) @@ -34,6 +34,7 @@ #ifdef HAVE_KERNEL_OPTION_HEADERS #include "opt_device_polling.h" +#include "opt_inet.h" #endif #include @@ -1033,7 +1034,9 @@ em_ioctl(struct ifnet *ifp, u_long comma { struct adapter *adapter = ifp->if_softc; struct ifreq *ifr = (struct ifreq *)data; +#ifdef INET struct ifaddr *ifa = (struct ifaddr *)data; +#endif int error = 0; if (adapter->in_detach) @@ -1041,6 +1044,7 @@ em_ioctl(struct ifnet *ifp, u_long comma switch (command) { case SIOCSIFADDR: +#ifdef INET if (ifa->ifa_addr->sa_family == AF_INET) { /* * XXX @@ -1057,6 +1061,7 @@ em_ioctl(struct ifnet *ifp, u_long comma } arp_ifinit(ifp, ifa); } else +#endif error = ether_ioctl(ifp, command, data); break; case SIOCSIFMTU: From bz at FreeBSD.org Thu Nov 6 03:11:25 2008 From: bz at FreeBSD.org (Bjoern A. Zeeb) Date: Thu Nov 6 03:11:31 2008 Subject: svn commit: r184718 - head/sys/dev/e1000 Message-ID: <200811061111.mA6BBPgS054102@svn.freebsd.org> Author: bz Date: Thu Nov 6 11:11:25 2008 New Revision: 184718 URL: http://svn.freebsd.org/changeset/base/184718 Log: Hide AF_INET specific ioctl handling under #ifdef INET. MFC after: 2 months Modified: head/sys/dev/e1000/if_igb.c Modified: head/sys/dev/e1000/if_igb.c ============================================================================== --- head/sys/dev/e1000/if_igb.c Thu Nov 6 11:00:57 2008 (r184717) +++ head/sys/dev/e1000/if_igb.c Thu Nov 6 11:11:25 2008 (r184718) @@ -34,6 +34,7 @@ #ifdef HAVE_KERNEL_OPTION_HEADERS #include "opt_device_polling.h" +#include "opt_inet.h" #endif #include @@ -802,7 +803,9 @@ igb_ioctl(struct ifnet *ifp, u_long comm { struct adapter *adapter = ifp->if_softc; struct ifreq *ifr = (struct ifreq *)data; +#ifdef INET struct ifaddr *ifa = (struct ifaddr *)data; +#endif int error = 0; if (adapter->in_detach) @@ -810,6 +813,7 @@ igb_ioctl(struct ifnet *ifp, u_long comm switch (command) { case SIOCSIFADDR: +#ifdef INET if (ifa->ifa_addr->sa_family == AF_INET) { /* * XXX @@ -826,6 +830,7 @@ igb_ioctl(struct ifnet *ifp, u_long comm } arp_ifinit(ifp, ifa); } else +#endif error = ether_ioctl(ifp, command, data); break; case SIOCSIFMTU: From dfr at FreeBSD.org Thu Nov 6 03:43:50 2008 From: dfr at FreeBSD.org (Doug Rabson) Date: Thu Nov 6 03:43:56 2008 Subject: svn commit: r184719 - head/sys/nfsserver Message-ID: <200811061143.mA6BhnnZ054678@svn.freebsd.org> Author: dfr Date: Thu Nov 6 11:43:49 2008 New Revision: 184719 URL: http://svn.freebsd.org/changeset/base/184719 Log: Don't depend on krpc.ko in the NFS_LEGACYRPC case. Modified: head/sys/nfsserver/nfs_srvsubs.c Modified: head/sys/nfsserver/nfs_srvsubs.c ============================================================================== --- head/sys/nfsserver/nfs_srvsubs.c Thu Nov 6 11:11:25 2008 (r184718) +++ head/sys/nfsserver/nfs_srvsubs.c Thu Nov 6 11:43:49 2008 (r184719) @@ -596,7 +596,9 @@ DECLARE_MODULE(nfsserver, nfsserver_mod, /* So that loader and kldload(2) can find us, wherever we are.. */ MODULE_VERSION(nfsserver, 1); +#ifndef NFS_LEGACYRPC MODULE_DEPEND(nfsserver, krpc, 1, 1, 1); +#endif /* * Set up nameidata for a lookup() call and do it. From bz at FreeBSD.org Thu Nov 6 04:33:33 2008 From: bz at FreeBSD.org (Bjoern A. Zeeb) Date: Thu Nov 6 04:33:39 2008 Subject: svn commit: r184720 - head/sys/netinet Message-ID: <200811061233.mA6CXXCb055643@svn.freebsd.org> Author: bz Date: Thu Nov 6 12:33:33 2008 New Revision: 184720 URL: http://svn.freebsd.org/changeset/base/184720 Log: Fix a bug introduced with r182851 splitting tcp_mss() into tcp_mss() and tcp_mss_update() so that tcp_mtudisc() could re-use the same code. In case we return early and got a metricptr to pass the hostcache info back to the caller we need to initialize the data to a defined state (zero it) as tcp_hc_get() would do if there was no hit. Without that the caller would check on random stack garbage which could lead to undefined results. This only affected tcp_mss() if there was no routing entry for the peer, tcp_mtudisc() was not affected. MFC after: 2 months (along with r182851) Modified: head/sys/netinet/tcp_input.c Modified: head/sys/netinet/tcp_input.c ============================================================================== --- head/sys/netinet/tcp_input.c Thu Nov 6 11:43:49 2008 (r184719) +++ head/sys/netinet/tcp_input.c Thu Nov 6 12:33:33 2008 (r184720) @@ -2847,8 +2847,16 @@ tcp_mss_update(struct tcpcb *tp, int off /* * No route to sender, stay with default mss and return. */ - if (maxmtu == 0) + if (maxmtu == 0) { + /* + * In case we return early we need to intialize metrics + * to a defined state as tcp_hc_get() would do for us + * if there was no cache hit. + */ + if (metricptr != NULL) + bzero(metricptr, sizeof(struct hc_metrics_lite)); return; + } /* Check the interface for TSO capabilities. */ if (mtuflags & CSUM_TSO) From bz at FreeBSD.org Thu Nov 6 04:59:00 2008 From: bz at FreeBSD.org (Bjoern A. Zeeb) Date: Thu Nov 6 04:59:11 2008 Subject: svn commit: r184721 - head/sys/netinet Message-ID: <200811061259.mA6Cx0YK056106@svn.freebsd.org> Author: bz Date: Thu Nov 6 12:59:00 2008 New Revision: 184721 URL: http://svn.freebsd.org/changeset/base/184721 Log: Adopt the comment for tcp_maxmtu(); we are returning a number not a pointer. While here update the rest of the comment to better match what we have these days. MFC after: 2 months Modified: head/sys/netinet/tcp_subr.c Modified: head/sys/netinet/tcp_subr.c ============================================================================== --- head/sys/netinet/tcp_subr.c Thu Nov 6 12:33:33 2008 (r184720) +++ head/sys/netinet/tcp_subr.c Thu Nov 6 12:59:00 2008 (r184721) @@ -1584,9 +1584,9 @@ tcp_mtudisc(struct inpcb *inp, int errno /* * Look-up the routing entry to the peer of this inpcb. If no route - * is found and it cannot be allocated, then return NULL. This routine - * is called by TCP routines that access the rmx structure and by tcp_mss - * to get the interface MTU. + * is found and it cannot be allocated, then return 0. This routine + * is called by TCP routines that access the rmx structure and by + * tcp_mss_update to get the peer/interface MTU. */ u_long tcp_maxmtu(struct in_conninfo *inc, int *flags) From bz at FreeBSD.org Thu Nov 6 05:26:00 2008 From: bz at FreeBSD.org (Bjoern A. Zeeb) Date: Thu Nov 6 05:26:11 2008 Subject: svn commit: r184722 - head/sys/netinet Message-ID: <200811061325.mA6DPxDW056618@svn.freebsd.org> Author: bz Date: Thu Nov 6 13:25:59 2008 New Revision: 184722 URL: http://svn.freebsd.org/changeset/base/184722 Log: Fix a bug introduced with r182851 splitting tcp_mss() into tcp_mss() and tcp_mss_update() so that tcp_mtudisc() could re-use the same code. Move the TSO logic back to tcp_mss() and out of tcp_mss_update(). We tried to avoid that initially but if were are called from tcp_output() with EMSGSIZE, we cleared the TSO flag on the tcpcb there, called into tcp_mtudisc() and tcp_mss_update() which then would reenable TSO on the tcpcb based on TSO capabilities of the interface as learnt in tcp_maxmtu/6(). So if TSO was enabled on the (possibly new) outgoing interface it was turned back on, which lead to an endless loop between tcp_output() and tcp_mtudisc() until we overflew the stack. Reported by: kmacy MFC after: 2 months (along with r182851) Modified: head/sys/netinet/tcp_input.c head/sys/netinet/tcp_subr.c head/sys/netinet/tcp_var.h Modified: head/sys/netinet/tcp_input.c ============================================================================== --- head/sys/netinet/tcp_input.c Thu Nov 6 12:59:00 2008 (r184721) +++ head/sys/netinet/tcp_input.c Thu Nov 6 13:25:59 2008 (r184722) @@ -2812,7 +2812,8 @@ tcp_xmit_timer(struct tcpcb *tp, int rtt * segment. Outgoing SYN/ACK MSS settings are handled in tcp_mssopt(). */ void -tcp_mss_update(struct tcpcb *tp, int offer, struct hc_metrics_lite *metricptr) +tcp_mss_update(struct tcpcb *tp, int offer, + struct hc_metrics_lite *metricptr, int *mtuflags) { INIT_VNET_INET(tp->t_inpcb->inp_vnet); int mss; @@ -2820,7 +2821,6 @@ tcp_mss_update(struct tcpcb *tp, int off struct inpcb *inp = tp->t_inpcb; struct hc_metrics_lite metrics; int origoffer = offer; - int mtuflags = 0; #ifdef INET6 int isipv6 = ((inp->inp_vflag & INP_IPV6) != 0) ? 1 : 0; size_t min_protoh = isipv6 ? @@ -2835,12 +2835,12 @@ tcp_mss_update(struct tcpcb *tp, int off /* Initialize. */ #ifdef INET6 if (isipv6) { - maxmtu = tcp_maxmtu6(&inp->inp_inc, &mtuflags); + maxmtu = tcp_maxmtu6(&inp->inp_inc, mtuflags); tp->t_maxopd = tp->t_maxseg = V_tcp_v6mssdflt; } else #endif { - maxmtu = tcp_maxmtu(&inp->inp_inc, &mtuflags); + maxmtu = tcp_maxmtu(&inp->inp_inc, mtuflags); tp->t_maxopd = tp->t_maxseg = V_tcp_mssdflt; } @@ -2858,10 +2858,6 @@ tcp_mss_update(struct tcpcb *tp, int off return; } - /* Check the interface for TSO capabilities. */ - if (mtuflags & CSUM_TSO) - tp->t_flags |= TF_TSO; - /* What have we got? */ switch (offer) { case 0: @@ -2980,12 +2976,13 @@ tcp_mss(struct tcpcb *tp, int offer) struct inpcb *inp; struct socket *so; struct hc_metrics_lite metrics; + int mtuflags = 0; #ifdef INET6 int isipv6; #endif KASSERT(tp != NULL, ("%s: tp == NULL", __func__)); - tcp_mss_update(tp, offer, &metrics); + tcp_mss_update(tp, offer, &metrics, &mtuflags); mss = tp->t_maxseg; inp = tp->t_inpcb; @@ -3098,6 +3095,10 @@ tcp_mss(struct tcpcb *tp, int offer) tp->snd_cwnd = mss * V_ss_fltsz_local; else tp->snd_cwnd = mss * V_ss_fltsz; + + /* Check the interface for TSO capabilities. */ + if (mtuflags & CSUM_TSO) + tp->t_flags |= TF_TSO; } /* Modified: head/sys/netinet/tcp_subr.c ============================================================================== --- head/sys/netinet/tcp_subr.c Thu Nov 6 12:59:00 2008 (r184721) +++ head/sys/netinet/tcp_subr.c Thu Nov 6 13:25:59 2008 (r184722) @@ -1562,7 +1562,7 @@ tcp_mtudisc(struct inpcb *inp, int errno tp = intotcpcb(inp); KASSERT(tp != NULL, ("tcp_mtudisc: tp == NULL")); - tcp_mss_update(tp, -1, NULL); + tcp_mss_update(tp, -1, NULL, NULL); so = inp->inp_socket; SOCKBUF_LOCK(&so->so_snd); Modified: head/sys/netinet/tcp_var.h ============================================================================== --- head/sys/netinet/tcp_var.h Thu Nov 6 12:59:00 2008 (r184721) +++ head/sys/netinet/tcp_var.h Thu Nov 6 13:25:59 2008 (r184722) @@ -546,7 +546,7 @@ void tcp_reass_init(void); void tcp_input(struct mbuf *, int); u_long tcp_maxmtu(struct in_conninfo *, int *); u_long tcp_maxmtu6(struct in_conninfo *, int *); -void tcp_mss_update(struct tcpcb *, int, struct hc_metrics_lite *); +void tcp_mss_update(struct tcpcb *, int, struct hc_metrics_lite *, int *); void tcp_mss(struct tcpcb *, int); int tcp_mssopt(struct in_conninfo *); struct inpcb * From kensmith at FreeBSD.org Thu Nov 6 05:28:50 2008 From: kensmith at FreeBSD.org (Ken Smith) Date: Thu Nov 6 05:28:57 2008 Subject: svn commit: r184723 - stable/7/release Message-ID: <200811061328.mA6DSonm056705@svn.freebsd.org> Author: kensmith Date: Thu Nov 6 13:28:50 2008 New Revision: 184723 URL: http://svn.freebsd.org/changeset/base/184723 Log: Oops. Correct a mis-merge. This piece of r183860 didn't make it through while doing the merge. PR: misc/128610 Submitted by: veron x503 hotmail com Approved by: re (blackend, kib) Modified: stable/7/release/Makefile Modified: stable/7/release/Makefile ============================================================================== --- stable/7/release/Makefile Thu Nov 6 13:25:59 2008 (r184722) +++ stable/7/release/Makefile Thu Nov 6 13:28:50 2008 (r184723) @@ -1091,7 +1091,7 @@ CD_DISC2_PKGS= ${CD_PACKAGE_TREE}/disc2 CD_DISC3_PKGS= ${CD_PACKAGE_TREE}/disc3 .endif .if exists(${CD_PACKAGE_TREE}/dvd1) -CD_DVD_PKGS= ${CD_PACKAGE_TREE}/dvd1 +CD_DVD1_PKGS= ${CD_PACKAGE_TREE}/dvd1 .endif .endif .endif From kensmith at FreeBSD.org Thu Nov 6 05:32:49 2008 From: kensmith at FreeBSD.org (Ken Smith) Date: Thu Nov 6 05:32:56 2008 Subject: svn commit: r184724 - stable/6/release Message-ID: <200811061332.mA6DWnN1056804@svn.freebsd.org> Author: kensmith Date: Thu Nov 6 13:32:49 2008 New Revision: 184724 URL: http://svn.freebsd.org/changeset/base/184724 Log: Oops. Correct a mis-merge. This piece of r183860 didn't make it through while doing the merge. PR: misc/128610 Submitted by: veron x503 hotmail com Approved by: re (blackend, kib) Modified: stable/6/release/Makefile Modified: stable/6/release/Makefile ============================================================================== --- stable/6/release/Makefile Thu Nov 6 13:28:50 2008 (r184723) +++ stable/6/release/Makefile Thu Nov 6 13:32:49 2008 (r184724) @@ -1109,7 +1109,7 @@ CD_DISC2_PKGS= ${CD_PACKAGE_TREE}/disc2 CD_DISC3_PKGS= ${CD_PACKAGE_TREE}/disc3 .endif .if exists(${CD_PACKAGE_TREE}/dvd1) -CD_DVD_PKGS= ${CD_PACKAGE_TREE}/dvd1 +CD_DVD1_PKGS= ${CD_PACKAGE_TREE}/dvd1 .endif .endif .endif From kensmith at FreeBSD.org Thu Nov 6 05:34:49 2008 From: kensmith at FreeBSD.org (Ken Smith) Date: Thu Nov 6 05:34:56 2008 Subject: svn commit: r184725 - releng/6.4/release Message-ID: <200811061334.mA6DYna9056891@svn.freebsd.org> Author: kensmith Date: Thu Nov 6 13:34:49 2008 New Revision: 184725 URL: http://svn.freebsd.org/changeset/base/184725 Log: Oops. Correct a mis-merge. This piece of r183860 didn't make it through while doing the merge. PR: misc/128610 Submitted by: veron x503 hotmail com Approved by: re (blackend, kib) Modified: releng/6.4/release/Makefile Modified: releng/6.4/release/Makefile ============================================================================== --- releng/6.4/release/Makefile Thu Nov 6 13:32:49 2008 (r184724) +++ releng/6.4/release/Makefile Thu Nov 6 13:34:49 2008 (r184725) @@ -1109,7 +1109,7 @@ CD_DISC2_PKGS= ${CD_PACKAGE_TREE}/disc2 CD_DISC3_PKGS= ${CD_PACKAGE_TREE}/disc3 .endif .if exists(${CD_PACKAGE_TREE}/dvd1) -CD_DVD_PKGS= ${CD_PACKAGE_TREE}/dvd1 +CD_DVD1_PKGS= ${CD_PACKAGE_TREE}/dvd1 .endif .endif .endif From Alexander at Leidinger.net Thu Nov 6 05:40:03 2008 From: Alexander at Leidinger.net (Alexander Leidinger) Date: Thu Nov 6 05:40:19 2008 Subject: svn commit: r184691 - head/sys/compat/linprocfs In-Reply-To: <9bbcef730811051526p3a978848uf904a149cb81fbce@mail.gmail.com> References: <200811051508.mA5F89XD030040@svn.freebsd.org> <20081105.150108.1649771743.imp@bsdimp.com> <9bbcef730811051526p3a978848uf904a149cb81fbce@mail.gmail.com> Message-ID: <20081106143947.14544np9rgzv5egw@webmail.leidinger.net> Quoting Ivan Voras (from Thu, 6 Nov 2008 00:26:41 +0100): > This is why there's such a big push to get systems to properly support > UTF-8. FreeBSD had a SoC project this year that was supposed to > properly implement Unicode collations (and thus collation of UTF-8 > strings) but it looks dead or in a dormant state right now (though I > didn't follow it attentively). As per the commit log of the ideas list, this is on the way into SVN (soon-ish, I assume). Bye, Alexander. -- http://www.Leidinger.net Alexander @ Leidinger.net: PGP ID = B0063FE7 http://www.FreeBSD.org netchild @ FreeBSD.org : PGP ID = 72077137 From Alexander at Leidinger.net Thu Nov 6 05:41:12 2008 From: Alexander at Leidinger.net (Alexander Leidinger) Date: Thu Nov 6 05:41:24 2008 Subject: svn commit: r184696 - in head/cddl: . contrib/opensolaris/cmd/dtrace contrib/opensolaris/cmd/dtrace/test/cmd/jdtrace contrib/opensolaris/lib/libdtrace/common In-Reply-To: <200811051935.mA5JZ9GB035415@svn.freebsd.org> References: <200811051935.mA5JZ9GB035415@svn.freebsd.org> Message-ID: <20081106144100.13331xe51kxe0mjo@webmail.leidinger.net> Quoting Craig Rodrigues (from Wed, 5 Nov 2008 19:35:09 +0000 (UTC)): > Author: rodrigc > Date: Wed Nov 5 19:35:09 2008 > New Revision: 184696 > URL: http://svn.freebsd.org/changeset/base/184696 > > Log: > Merge latest DTrace changes from Perforce. It would be good to mention what kind of changes are merged. Bye, Alexander. -- Join the Navy; sail to far-off exotic lands, meet exciting interesting people, and kill them. http://www.Leidinger.net Alexander @ Leidinger.net: PGP ID = B0063FE7 http://www.FreeBSD.org netchild @ FreeBSD.org : PGP ID = 72077137 From rdivacky at freebsd.org Thu Nov 6 05:41:53 2008 From: rdivacky at freebsd.org (Roman Divacky) Date: Thu Nov 6 05:42:04 2008 Subject: svn commit: r184691 - head/sys/compat/linprocfs In-Reply-To: <20081106143947.14544np9rgzv5egw@webmail.leidinger.net> References: <200811051508.mA5F89XD030040@svn.freebsd.org> <20081105.150108.1649771743.imp@bsdimp.com> <9bbcef730811051526p3a978848uf904a149cb81fbce@mail.gmail.com> <20081106143947.14544np9rgzv5egw@webmail.leidinger.net> Message-ID: <20081106133916.GA91328@freebsd.org> On Thu, Nov 06, 2008 at 02:39:47PM +0100, Alexander Leidinger wrote: > Quoting Ivan Voras (from Thu, 6 Nov 2008 00:26:41 +0100): > > >This is why there's such a big push to get systems to properly support > >UTF-8. FreeBSD had a SoC project this year that was supposed to > >properly implement Unicode collations (and thus collation of UTF-8 > >strings) but it looks dead or in a dormant state right now (though I > >didn't follow it attentively). > > As per the commit log of the ideas list, this is on the way into SVN > (soon-ish, I assume). Konrad just got his commit bit, I believe he's going to do something with it :) From ivoras at gmail.com Thu Nov 6 05:49:47 2008 From: ivoras at gmail.com (Ivan Voras) Date: Thu Nov 6 05:49:53 2008 Subject: svn commit: r184691 - head/sys/compat/linprocfs In-Reply-To: <20081106133916.GA91328@freebsd.org> References: <200811051508.mA5F89XD030040@svn.freebsd.org> <20081105.150108.1649771743.imp@bsdimp.com> <9bbcef730811051526p3a978848uf904a149cb81fbce@mail.gmail.com> <20081106143947.14544np9rgzv5egw@webmail.leidinger.net> <20081106133916.GA91328@freebsd.org> Message-ID: <9bbcef730811060549y6f821062kac2572510cfd76d4@mail.gmail.com> 2008/11/6 Roman Divacky : > On Thu, Nov 06, 2008 at 02:39:47PM +0100, Alexander Leidinger wrote: >> Quoting Ivan Voras (from Thu, 6 Nov 2008 00:26:41 +0100): >> >> >This is why there's such a big push to get systems to properly support >> >UTF-8. FreeBSD had a SoC project this year that was supposed to >> >properly implement Unicode collations (and thus collation of UTF-8 >> >strings) but it looks dead or in a dormant state right now (though I >> >didn't follow it attentively). >> >> As per the commit log of the ideas list, this is on the way into SVN >> (soon-ish, I assume). > > Konrad just got his commit bit, I believe he's going to do something > with it :) Excellent news :) If it works it means no more patching PostgreSQL to support my collation! From peter at wemm.org Thu Nov 6 07:21:38 2008 From: peter at wemm.org (Peter Wemm) Date: Thu Nov 6 07:21:50 2008 Subject: svn commit: r184652 - in head/sys: dev/hwpmc fs/procfs kern In-Reply-To: <200811041750.08355.jhb@freebsd.org> References: <200811041904.mA4J41dL005103@svn.freebsd.org> <9bbcef730811041422x5f1e7bfco45380390c64b3b1c@mail.gmail.com> <200811041750.08355.jhb@freebsd.org> Message-ID: On Tue, Nov 4, 2008 at 2:50 PM, John Baldwin wrote: > On Tuesday 04 November 2008 05:22:47 pm Ivan Voras wrote: >> 2008/11/4 John Baldwin : >> > Author: jhb >> > Date: Tue Nov 4 19:04:01 2008 >> > New Revision: 184652 >> > URL: http://svn.freebsd.org/changeset/base/184652 >> > >> > Log: >> > Remove unnecessary locking around vn_fullpath(). The vnode lock for the >> >> Does this affect realpath(3)? (whose non-scalability is often reported >> for PHP web servers). > > realpath(3) calls getcwd(3) (which devolves to __getcwd(2) I think) once per > invocation (and that already did not lock the vnode). It then calls lstat() > for each component in the path. The lstat() calls should be using shared > locks (at least with the recent changes to use shared lookups for UFS in > HEAD). I imagine the bottleneck is more with lstat() than getcwd(3). > Neither is helped by the specific changes above. Hmm. Would it make sense to provide a helper syscall specifically for php to use for this? Without having looked at the php code, it sounds like it might be helpful to have a syscall that returns the path and an array of stat structs for each path component. Or is php only doing this because of compatability with non-atomic getcwd() implementations? Does php even need to do it? -- Peter Wemm - peter@wemm.org; peter@FreeBSD.org; peter@yahoo-inc.com; KI6FJV "All of this is for nothing if we don't go to the stars" - JMS/B5 "If Java had true garbage collection, most programs would delete themselves upon execution." -- Robert Sewell From bz at FreeBSD.org Thu Nov 6 07:26:09 2008 From: bz at FreeBSD.org (Bjoern A. Zeeb) Date: Thu Nov 6 07:26:16 2008 Subject: svn commit: r184726 - head/sys/net Message-ID: <200811061526.mA6FQ9tR058850@svn.freebsd.org> Author: bz Date: Thu Nov 6 15:26:09 2008 New Revision: 184726 URL: http://svn.freebsd.org/changeset/base/184726 Log: Include if_arp.h for IFP2AC so that the netgraph parts in if.c are happy even if compiled without INET or INET6. MFC after: 2 months Modified: head/sys/net/if.c Modified: head/sys/net/if.c ============================================================================== --- head/sys/net/if.c Thu Nov 6 13:34:49 2008 (r184725) +++ head/sys/net/if.c Thu Nov 6 15:26:09 2008 (r184726) @@ -60,6 +60,7 @@ #include #include +#include #include #include #include From ivoras at gmail.com Thu Nov 6 07:44:25 2008 From: ivoras at gmail.com (Ivan Voras) Date: Thu Nov 6 07:45:01 2008 Subject: svn commit: r184652 - in head/sys: dev/hwpmc fs/procfs kern In-Reply-To: References: <200811041904.mA4J41dL005103@svn.freebsd.org> <9bbcef730811041422x5f1e7bfco45380390c64b3b1c@mail.gmail.com> <200811041750.08355.jhb@freebsd.org> Message-ID: <9bbcef730811060744p6bb85393h297ac247d98a0d5d@mail.gmail.com> 2008/11/6 Peter Wemm : > On Tue, Nov 4, 2008 at 2:50 PM, John Baldwin wrote: > Hmm. Would it make sense to provide a helper syscall specifically for > php to use for this? Without having looked at the php code, it sounds > like it might be helpful to have a syscall that returns the path and > an array of stat structs for each path component. Or is php only > doing this because of compatability with non-atomic getcwd() > implementations? Does php even need to do it? Here's a discussion on the performance problem: http://lists.freebsd.org/pipermail/freebsd-performance/2008-January/003096.html I remember, but can't find the reference now, that the problem became visible because PHP introduced realpath() checking for include files in a minor release (like 5.1.6 or something like that) to work around a security problem. This is when users saw noticeable drops in performance (and I don't think it solved their security problem :) ). From keramida at ceid.upatras.gr Thu Nov 6 08:10:50 2008 From: keramida at ceid.upatras.gr (Giorgos Keramidas) Date: Thu Nov 6 08:10:58 2008 Subject: svn commit: r184695 - head/share/man/man4 In-Reply-To: <200811051712.mA5HCIP7032611@svn.freebsd.org> (Alexander Motin's message of "Wed, 5 Nov 2008 17:12:18 +0000 (UTC)") References: <200811051712.mA5HCIP7032611@svn.freebsd.org> Message-ID: <87r65okf7n.fsf@kobe.laptop> On Wed, 5 Nov 2008 17:12:18 +0000 (UTC), Alexander Motin wrote: > Author: mav > Date: Wed Nov 5 17:12:18 2008 > New Revision: 184695 > URL: http://svn.freebsd.org/changeset/base/184695 > > Log: > Improve driver operation example description. > > Modified: > head/share/man/man4/snd_hda.4 Hi Alexander, There are a few places where we can probably improve the manpage a bit more. I am not sure I understand *all* the technical details of pins and association numbers, but does the following look like something worth committing? %%% diff -r ea818a53fb86 share/man/man4/snd_hda.4 --- a/share/man/man4/snd_hda.4 Thu Nov 06 07:04:46 2008 +0200 +++ b/share/man/man4/snd_hda.4 Thu Nov 06 18:09:06 2008 +0200 @@ -57,8 +57,8 @@ driver that allows the generic audio driver, .Xr sound 4 , to be used with this hardware. -.Nm -only supports audio functions. +Only audio functions are supported by +.Nm . Modem, HDMI and other possible functions are not implemented. .Pp The @@ -68,7 +68,7 @@ Universal Audio Architecture (UAA) draft (revision 0.7b) for handling audio devices. .Pp -According to HDA and UAA specifications, depending on number of HDA buses +According to HDA and UAA specifications, depending on the number of HDA buses and codecs present in system, their audio capabilities and BIOS provided configuration, the .Nm @@ -76,14 +76,16 @@ For example, one device for main rear 7.1 output and inputs, one device for independent headset connectors at front and one device for SPDIF or HDMI audio input/output. -Usually that assignment may be widely tuned by using device hints. -A lot of useful information about driver operation and present audio setup may -be obtained from the driver verbose boot messages. +The assignment of audio inputs and outputs may be tuned with +.Xr device.hints 5 . +The driver's verbose boot messages provide a lot of information about +the operation of the driver and present audio setup. .Pp -You can select audio device to use by default with hw.snd.default_unit -sysctl described in -.Xr sound 4 -or explicitly specify it in appliation settings. +The default audio device may be tuned by setting the +.Ar hw.snd.default_unit +sysctl, as described in +.Xr sound 4 , +or by explicitly specify it in application settings. .Ss Boot-time Configuration The following variables are available at boot-time through the .Xr device.hints 5 @@ -123,18 +125,26 @@ .Dq Li nofixedrate , will do the opposite and takes precedence. Options can be separated by whitespace and commas. -GPIO is a codecs General Purpose I/O pins which system integrators sometimes +.Dq Li GPIO Ns s +are a codec's General Purpose I/O pins, which system integrators sometimes use to control external muters, amplifiers and so on. -If you have no sound or sound volume is not adequate you may need to find a -GPIO combination required for your system. -ivrefX/ovrefX options controls voltage used to power external microphones -and so on. +If you have no sound, or sound volume is not adequate, you may have to +experiment a bit with the GPIO setup to find the optimal setup for your +system. +The +.Dq Li ivref Ns Ar X +and +.Dq Li ovref Ns Ar X +options control the voltage used to power external microphones. .It Va hint.hdac.%d.msi Controls MSI (Message Signaled Interrupts) support. .It Va hint.hdac.%d.cad%d.nid%d.config Overrides codec pin configuration set by BIOS. -May be specified as a 32bit HEX value with a leading "0x" or as a set of -space separated "option=value" pairs. +May be specified as a 32-bit hexadecimal value with a leading +.Dq 0x , +or as a set of space-separated +.Dq Ar option Ns = Ns Ar value +pairs. .El .Pp Pin configuration is the UAA driver's main source of information about codec @@ -143,33 +153,36 @@ by system integrators for specific system requirements. The .Nm -driver allows users to override it to fix integrator mistakes or to use codec -in alternative ways, for example, to get stereo output and 2 inputs -instead of a single 5.1 output. -Configuration includes the following options: +driver allows users to override it to fix integrator mistakes or to use the available codecs +in alternative ways (for example to get stereo output and 2 inputs +instead of a single 5.1 output). +.Pp +The following options are supported: .Bl -tag -width ".Va device=" -offset indent .It Va as Association number. -Associations are used to group individual pins to form a complex multipin +Associations are used to group individual pins to form a complex multi-pin device. -For example, to group 4 connectors for 7.1 output or to treat several +For example, to group 4 connectors for 7.1 output, or to treat several input connectors as sources for the same input device. -Can be specified as number from 0 to 15. -Association number 0 means disabled pin, number 15 is a set of independent -unassociated pins. -Each association includes only pins of the same direction (in/out) and -detected atomically - all pins or none. -For every pair of input+output associations in order of their numeration -separate PCM audio device is created. +Association numbers can be specified as numeric values from 0 to 15. +A value of 0 means disabled pin. +A value of 15 is a set of independent unassociated pins. +Each association includes only pins of the same direction (in/out) and is +detected atomically (all pins or none). +A separate PCM audio device is created for every pair of input and +output associations. .It Va seq Sequence number. -This unique inside every association number used to order pins inside -association. -Can be specified as a number from 0 to 15. -Sequence number 15 for output associations has also special meaning. -Output pin with sequence number 15 and device type Headhones will duplicate -(with automatic mute if jack detection is supported) the first pin in that -association. +A unique, per-association number used to order pins inside the +particular association. +Sequence numbers can be specified as numeric values from 0 to 15. +.Pp +The sequence number 15 has a special meaning for output associations. +Output pins with this number and device type +.Dq Ar Headphones +will duplicate (with automatic mute if jack detection is supported) the +first pin in that association. .It Va device Device type. Can be specified as a number from 0 to 15 or as a name: @@ -193,27 +206,31 @@ The device type also describes the pin direction (in/out). For example, .Dq Li CD -always means input pin, while +always means an input pin, while .Dq Li Headphones -always means output. +always means an output pin. .It Va conn Connection type. -Can be specified as a number from 0 to 3 or as a name: +Can be specified as a number from 0 to 3. +The connection type can also be specified as one of the special names .Dq Li Jack , .Dq Li None , .Dq Li Fixed , or .Dq Li Both . -Pins with +Pins with a connection type of .Dq Li None -connection type are disabled. +are disabled. .It Va ctype Connector physical type. Can be specified as a number from 0 to 15. -This is a reference only value which is ignored by the driver. +This is a reference only value. +It is ignored by the +.Nm +driver. .It Va color Connector color. -Can be specified as a number from 0 to 15 or as a name: +Can be specified as a number from 0 to 15 or as one of the names .Dq Li Unknown , .Dq Li Black , .Dq Li Grey , @@ -231,16 +248,23 @@ .Dq Li White , or .Dq Li Other . -This is a reference only value which is ignored by the driver. +This is a reference only value . +It is ignored by the +.Nm +driver. .It Va loc Connector physical location. Can be specified as a number from 0 to 63. -This is a reference only value which is ignored by the driver. +This is a reference only value. +It is ignored by the +.Nm +driver. .It Va misc Misc bits. Can be specified as a number from 0 to 15. -Bit 0, if set, tells that jack detection on this pin supported by the codec -is not implemented in hardware. +.Pp +Bit 0 has a special meaning. When set it means that jack detection is +not implemented in hardware. .El .Ss Runtime Configuration The following @@ -250,8 +274,9 @@ devices: .Bl -tag -width ".Va dev.hdac.%d.polling" -offset indent .It Va dev.hdac.%d.polling -Enables polling mode, where the driver operates by querying the device -state on timer ticks using +Enables polling mode. +In this mode the driver operates by querying the device state on timer +ticks using .Xr callout 9 instead of interrupts. Polling is disabled by default. @@ -264,14 +289,17 @@ capabilities and jack sense status to console and syslog. .El .Sh EXAMPLES -Taking HP Compaq DX2300 with Realtek ALC888 HDA codec for example. It has two +Taking HP Compaq DX2300 with Realtek ALC888 HDA codec for example. +This system has two audio connectors on a front side, three audio connectors on a rear side and one -internal speaker. According to verbose driver output and codec datasheet, -codec has five stereo DACs and two stereo ADCs, all of them are routable to -any codec pin (external connector). All codec pins are reversible. +internal speaker. +According to verbose driver output and the codec datasheet, +this codec has five stereo DACs and two stereo ADCs, all of them are routable to +any codec pin (external connector). +All codec pins are reversible. .Pp So high codec uniformity and flexibility allow driver to configure it in many -deferent ways, depending on requested pins usage decribed by pins configuration. +different ways, depending on requested pins usage decribed by pins configuration. Driver reports such default pin configuration when verbose messages enabled: .Bd -literal hdac0: nid 20 0x01014020 as 2 seq 0 Line-out Jack jack 1 loc 1 color Green misc 0 @@ -308,49 +336,83 @@ hdac0: Pin nid=25 seq=15 .Ed .Pp -Each pcm device uses two associations: one for playback and one for recording. -Associations processed and assigned to pcm devices in order of their numbers. -It means that association #0 (1) will become pcm0 device playback, using -internal speaker and headphones jack with speaker automute on headphones -connection. -Association #1 (2) will become pcm1 playback, using the Line-out jack. -Association #2 (3) will become pcm0 recording, using external microphones and -line-in jack. +Each +.Xr pcm 4 +device uses two associations: one for playback and one for recording. +Associations processed and assigned to +.Xr pcm 4 +devices in increasing numerical order. +In this case association #0 (1) will become +.Li pcm0 +device playback, using the internal speakers and headphones jack with +speaker automute of the headphones. +Association #1 (2) will become +.Li pcm1 +playback, using the +.Ar Line-out +jack. +Association #2 (3) will become +.Li pcm0 +recording, using the external microphones and the line-in jack. .Pp -Driver provides extensive set of verbose messages to diagnose it's operation -logic and description of resulted codec configuration. +The +.Nm +driver provides extensive verbose messages to diagnose its operation +logic and describe its current codec configuration. .Pp -Using device.hints it is possible to modify existing pins configuration to -create broad range of different audio setups. Here is examples of some setups -possible for the described hardware: +Using +.Xr device.hints 5 +it is possible to modify the configuration of the existing pins, +allowing a broad range of different audio setups. +Here are a few examples of some setups possible for this particular +hardware: .Ss Example 1 -Setting +Setting the +.Xr device.hints 5 +options .Bd -literal hint.hdac.0.cad0.nid20.config="as=1" hint.hdac.0.cad0.nid21.config="as=2" .Ed .Pp -will swap line-out and speaker functions. So pcm0 device will play to the -line-out and headphones jacks with line-out automute on headphones connection. -Recording on pcm0 will go from two external microphones and line-in jacks. -pcm1 playback will go to the internal speaker. +will swap line-out and speaker functions. +So the +.Li pcm0 +device will play to the line-out and headphones jacks, and line-out will +automute the headphones connection. +Recording on +.Li pcm0 +will go from two external microphones and line-in jacks. +.Li pcm1 +playback will go to the internal speaker. .Pp .Ss Example 2 -Setting +Setting the +.Xr device.hints 5 +options .Bd -literal hint.hdac.0.cad0.nid20.config="as=1 seq=15 device=Headphones" hint.hdac.0.cad0.nid27.config="as=2 seq=0" hint.hdac.0.cad0.nid25.config="as=4 seq=0" .Ed .Pp -will split headphones and one of mics to separate device. So pcm0 device will -play to the internal speaker and line-out jack with speaker automute on -line-out connection. Recording on pcm0 will go from one external microphone -and line-in jacks. pcm1 will be completely dedicated to headset (headphones and -mic) connected to the front connectors. +will split the headphones and one of the microphones to a separate device. +The +.Li pcm0 +device will play to the internal speaker and to the line-out jack, with +speaker automute on the line-out connection. +Recording on +.Li pcm0 +will use input from one external microphone and the line-in jacks. +The +.Li pcm1 +device will be completely dedicated to a headset (headphones and mic) +connected to the front connectors. .Pp .Ss Example 3 -Setting +Setting the +.Xr device.hints 5 +options .Bd -literal hint.hdac.0.cad0.nid20.config="as=1 seq=0" hint.hdac.0.cad0.nid26.config="as=2 seq=0" @@ -360,12 +422,21 @@ hint.hdac.0.cad0.nid21.config="as=6 seq=0" .Ed .Pp -will give 4 independent devices: pcm0 - line-out + line-in, pcm1 - headphones -+ mic, pcm2 - additional line-out via retasked rear mic jack, pcm3 - internal -speaker. +will give 4 independent devices: +.Li pcm0 +.Pq line-out and line-in , +.Li pcm1 +.Pq headphones and mic , +.Li pcm2 +.Pq additional line-out via retasked rear mic jack , +and +.Li pcm3 +.Pq internal speaker . .Pp .Ss Example 4 -Setting +Setting the +.Xr device.hints 5 +options .Bd -literal hint.hdac.0.cad0.nid20.config="as=1 seq=0" hint.hdac.0.cad0.nid24.config="as=1 seq=1 device=Line-out" @@ -373,10 +444,13 @@ hint.hdac.0.cad0.nid21.config="as=2 seq=0" .Ed .Pp -will give 2 devices: pcm0 - 5.1 playback via 3 rear (line-out and retasked -mic and line-in) connectors and front headphones with rear connectors automute -on headphones connection + front mic recording. pcm1 - internal speaker -playback. +will give 2 devices: +.Li pcm0 +for 5.1 playback via 3 rear connectors and front headphones (line-out, +retasked mic and line-in), with rear connectors automute on headphones +connection and front mic recording, and +.Li pcm1 +for internal speaker playback. .Sh HARDWARE The .Nm @@ -533,4 +607,4 @@ driver seems to attach and work, but without any sound. .Pp Due to OSS limitation multichannel (not multidevice) playback is not -supported. \ No newline at end of file +supported. %%% From raj at FreeBSD.org Thu Nov 6 08:20:27 2008 From: raj at FreeBSD.org (Rafal Jaworowski) Date: Thu Nov 6 08:20:40 2008 Subject: svn commit: r184728 - in head: lib/libkvm sys/arm/arm sys/arm/include sys/conf sys/vm Message-ID: <200811061620.mA6GKRsr059912@svn.freebsd.org> Author: raj Date: Thu Nov 6 16:20:27 2008 New Revision: 184728 URL: http://svn.freebsd.org/changeset/base/184728 Log: Support kernel crash mini dumps on ARM architecture. Obtained from: Juniper Networks, Semihalf Added: head/lib/libkvm/kvm_minidump_arm.c (contents, props changed) head/sys/arm/arm/minidump_machdep.c (contents, props changed) head/sys/arm/include/minidump.h (contents, props changed) Modified: head/lib/libkvm/Makefile head/lib/libkvm/kvm_arm.c head/lib/libkvm/kvm_private.h head/sys/arm/arm/dump_machdep.c head/sys/arm/arm/pmap.c head/sys/arm/include/md_var.h head/sys/arm/include/pmap.h head/sys/conf/files.arm head/sys/vm/vm_page.c Modified: head/lib/libkvm/Makefile ============================================================================== --- head/lib/libkvm/Makefile Thu Nov 6 15:32:02 2008 (r184727) +++ head/lib/libkvm/Makefile Thu Nov 6 16:20:27 2008 (r184728) @@ -11,7 +11,7 @@ CFLAGS+=-DSUN4V SRCS= kvm.c kvm_${MACHINE_ARCH}.c kvm_cptime.c kvm_file.c kvm_getloadavg.c \ kvm_getswapinfo.c kvm_pcpu.c kvm_proc.c -.if ${MACHINE_ARCH} == "amd64" || ${MACHINE_ARCH} == "i386" +.if ${MACHINE_ARCH} == "amd64" || ${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH} == "arm" SRCS+= kvm_minidump_${MACHINE_ARCH}.c .endif INCS= kvm.h Modified: head/lib/libkvm/kvm_arm.c ============================================================================== --- head/lib/libkvm/kvm_arm.c Thu Nov 6 15:32:02 2008 (r184727) +++ head/lib/libkvm/kvm_arm.c Thu Nov 6 16:20:27 2008 (r184728) @@ -52,10 +52,13 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include "kvm_private.h" +/* minidump must be the first item! */ struct vmstate { + int minidump; /* 1 = minidump mode */ pd_entry_t *l1pt; void *mmapbase; size_t mmapsize; @@ -107,6 +110,8 @@ void _kvm_freevtop(kvm_t *kd) { if (kd->vmst != 0) { + if (kd->vmst->minidump) + return (_kvm_minidump_freevtop(kd)); if (kd->vmst->mmapbase != NULL) munmap(kd->vmst->mmapbase, kd->vmst->mmapsize); free(kd->vmst); @@ -117,13 +122,25 @@ _kvm_freevtop(kvm_t *kd) int _kvm_initvtop(kvm_t *kd) { - struct vmstate *vm = _kvm_malloc(kd, sizeof(*vm)); + struct vmstate *vm; struct nlist nlist[2]; u_long kernbase, physaddr, pa; pd_entry_t *l1pt; Elf32_Ehdr *ehdr; size_t hdrsz; - + char minihdr[8]; + + if (!kd->rawdump) { + if (pread(kd->pmfd, &minihdr, 8, 0) == 8) { + if (memcmp(&minihdr, "minidump", 8) == 0) + return (_kvm_minidump_initvtop(kd)); + } else { + _kvm_err(kd, kd->program, "cannot read header"); + return (-1); + } + } + + vm = _kvm_malloc(kd, sizeof(*vm)); if (vm == 0) { _kvm_err(kd, kd->program, "cannot allocate vm"); return (-1); @@ -193,6 +210,9 @@ _kvm_kvatop(kvm_t *kd, u_long va, off_t pt_entry_t pte; u_long pte_pa; + if (kd->vmst->minidump) + return (_kvm_minidump_kvatop(kd, va, pa)); + if (vm->l1pt == NULL) return (_kvm_pa2off(kd, va, pa, PAGE_SIZE)); pd = vm->l1pt[L1_IDX(va)]; Added: head/lib/libkvm/kvm_minidump_arm.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libkvm/kvm_minidump_arm.c Thu Nov 6 16:20:27 2008 (r184728) @@ -0,0 +1,262 @@ +/*- + * Copyright (c) 2008 Semihalf, Grzegorz Bernacki + * Copyright (c) 2006 Peter Wemm + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * From: FreeBSD: src/lib/libkvm/kvm_minidump_i386.c,v 1.2 2006/06/05 08:51:14 + */ + +#include +__FBSDID("$FreeBSD$"); + +/* + * ARM machine dependent routines for kvm and minidumps. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include +#include +#include + +#include + +#include "kvm_private.h" + +struct hpte { + struct hpte *next; + uint64_t pa; + int64_t off; +}; + +#define HPT_SIZE 1024 + +/* minidump must be the first field */ +struct vmstate { + int minidump; /* 1 = minidump mode */ + struct minidumphdr hdr; + void *hpt_head[HPT_SIZE]; + uint32_t *bitmap; + void *ptemap; +}; + +static void +hpt_insert(kvm_t *kd, uint64_t pa, int64_t off) +{ + struct hpte *hpte; + uint32_t fnv = FNV1_32_INIT; + + fnv = fnv_32_buf(&pa, sizeof(pa), fnv); + fnv &= (HPT_SIZE - 1); + hpte = malloc(sizeof(*hpte)); + hpte->pa = pa; + hpte->off = off; + hpte->next = kd->vmst->hpt_head[fnv]; + kd->vmst->hpt_head[fnv] = hpte; +} + +static int64_t +hpt_find(kvm_t *kd, uint64_t pa) +{ + struct hpte *hpte; + uint32_t fnv = FNV1_32_INIT; + + fnv = fnv_32_buf(&pa, sizeof(pa), fnv); + fnv &= (HPT_SIZE - 1); + for (hpte = kd->vmst->hpt_head[fnv]; hpte != NULL; hpte = hpte->next) + if (pa == hpte->pa) + return (hpte->off); + + return (-1); +} + +static int +inithash(kvm_t *kd, uint32_t *base, int len, off_t off) +{ + uint64_t idx, pa; + uint32_t bit, bits; + + for (idx = 0; idx < len / sizeof(*base); idx++) { + bits = base[idx]; + while (bits) { + bit = ffs(bits) - 1; + bits &= ~(1ul << bit); + pa = (idx * sizeof(*base) * NBBY + bit) * PAGE_SIZE; + hpt_insert(kd, pa, off); + off += PAGE_SIZE; + } + } + return (off); +} + +void +_kvm_minidump_freevtop(kvm_t *kd) +{ + struct vmstate *vm = kd->vmst; + + if (vm->bitmap) + free(vm->bitmap); + if (vm->ptemap) + free(vm->ptemap); + free(vm); + kd->vmst = NULL; +} + +int +_kvm_minidump_initvtop(kvm_t *kd) +{ + u_long pa; + struct vmstate *vmst; + off_t off; + + vmst = _kvm_malloc(kd, sizeof(*vmst)); + if (vmst == 0) { + _kvm_err(kd, kd->program, "cannot allocate vm"); + return (-1); + } + + kd->vmst = vmst; + vmst->minidump = 1; + + if (pread(kd->pmfd, &vmst->hdr, + sizeof(vmst->hdr), 0) != sizeof(vmst->hdr)) { + _kvm_err(kd, kd->program, "cannot read dump header"); + return (-1); + } + + if (strncmp(MINIDUMP_MAGIC, vmst->hdr.magic, + sizeof(vmst->hdr.magic)) != 0) { + _kvm_err(kd, kd->program, "not a minidump for this platform"); + return (-1); + } + if (vmst->hdr.version != MINIDUMP_VERSION) { + _kvm_err(kd, kd->program, "wrong minidump version. " + "Expected %d got %d", MINIDUMP_VERSION, vmst->hdr.version); + return (-1); + } + + /* Skip header and msgbuf */ + off = PAGE_SIZE + round_page(vmst->hdr.msgbufsize); + + vmst->bitmap = _kvm_malloc(kd, vmst->hdr.bitmapsize); + if (vmst->bitmap == NULL) { + _kvm_err(kd, kd->program, "cannot allocate %d bytes for " + "bitmap", vmst->hdr.bitmapsize); + return (-1); + } + + if (pread(kd->pmfd, vmst->bitmap, vmst->hdr.bitmapsize, off) != + vmst->hdr.bitmapsize) { + _kvm_err(kd, kd->program, "cannot read %d bytes for page bitmap", + vmst->hdr.bitmapsize); + return (-1); + } + off += round_page(vmst->hdr.bitmapsize); + + vmst->ptemap = _kvm_malloc(kd, vmst->hdr.ptesize); + if (vmst->ptemap == NULL) { + _kvm_err(kd, kd->program, "cannot allocate %d bytes for " + "ptemap", vmst->hdr.ptesize); + return (-1); + } + + if (pread(kd->pmfd, vmst->ptemap, vmst->hdr.ptesize, off) != + vmst->hdr.ptesize) { + _kvm_err(kd, kd->program, "cannot read %d bytes for ptemap", + vmst->hdr.ptesize); + return (-1); + } + + off += vmst->hdr.ptesize; + + /* Build physical address hash table for sparse pages */ + inithash(kd, vmst->bitmap, vmst->hdr.bitmapsize, off); + + return (0); +} + +int +_kvm_minidump_kvatop(kvm_t *kd, u_long va, off_t *pa) +{ + struct vmstate *vm; + pt_entry_t pte; + u_long offset, pteindex, a; + off_t ofs; + uint32_t *ptemap; + int i; + + if (ISALIVE(kd)) { + _kvm_err(kd, 0, "kvm_kvatop called in live kernel!"); + return (0); + } + + vm = kd->vmst; + ptemap = vm->ptemap; + + if (va >= vm->hdr.kernbase) { + pteindex = (va - vm->hdr.kernbase) >> PAGE_SHIFT; + pte = ptemap[pteindex]; + if (!pte) { + _kvm_err(kd, kd->program, "_kvm_vatop: pte not valid"); + goto invalid; + } + if ((pte & L2_TYPE_MASK) == L2_TYPE_L) { + offset = va & L2_L_OFFSET; + a = pte & L2_L_FRAME; + } else if ((pte & L2_TYPE_MASK) == L2_TYPE_S) { + offset = va & L2_S_OFFSET; + a = pte & L2_S_FRAME; + } else + goto invalid; + + ofs = hpt_find(kd, a); + if (ofs == -1) { + _kvm_err(kd, kd->program, "_kvm_vatop: physical " + "address 0x%lx not in minidump", a); + goto invalid; + } + + *pa = ofs + offset; + return (PAGE_SIZE - offset); + + } else + _kvm_err(kd, kd->program, "_kvm_vatop: virtual address 0x%lx " + "not minidumped", va); + +invalid: + _kvm_err(kd, 0, "invalid address (0x%lx)", va); + return (0); +} Modified: head/lib/libkvm/kvm_private.h ============================================================================== --- head/lib/libkvm/kvm_private.h Thu Nov 6 15:32:02 2008 (r184727) +++ head/lib/libkvm/kvm_private.h Thu Nov 6 16:20:27 2008 (r184728) @@ -79,7 +79,7 @@ void _kvm_syserr (kvm_t *kd, const char __printflike(3, 4); int _kvm_uvatop(kvm_t *, const struct proc *, u_long, u_long *); -#if defined(__amd64__) || defined(__i386__) +#if defined(__amd64__) || defined(__i386__) || defined(__arm__) void _kvm_minidump_freevtop(kvm_t *); int _kvm_minidump_initvtop(kvm_t *); int _kvm_minidump_kvatop(kvm_t *, u_long, off_t *); Modified: head/sys/arm/arm/dump_machdep.c ============================================================================== --- head/sys/arm/arm/dump_machdep.c Thu Nov 6 15:32:02 2008 (r184727) +++ head/sys/arm/arm/dump_machdep.c Thu Nov 6 16:20:27 2008 (r184728) @@ -31,6 +31,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -44,6 +45,11 @@ __FBSDID("$FreeBSD$"); CTASSERT(sizeof(struct kerneldumpheader) == 512); +int do_minidump = 1; +TUNABLE_INT("debug.minidump", &do_minidump); +SYSCTL_INT(_debug, OID_AUTO, minidump, CTLFLAG_RW, &do_minidump, 0, + "Enable mini crash dumps"); + /* * Don't touch the first SIZEOF_METADATA bytes on the dump device. This * is to protect us from metadata and to protect metadata from us. @@ -155,11 +161,10 @@ cb_dumpdata(struct md_pa *mdp, int seqnr vm_offset_t va; uint32_t pgs; size_t counter, sz, chunk; - int c, error, twiddle; + int c, error; error = 0; /* catch case in which chunk size is 0 */ - counter = 0; /* Update twiddle every 16MB */ - twiddle = 0; + counter = 0; va = 0; pgs = mdp->md_size / PAGE_SIZE; pa = mdp->md_start; @@ -264,7 +269,12 @@ dumpsys(struct dumperinfo *di) off_t hdrgap; size_t hdrsz; int error; - + + if (do_minidump) { + minidumpsys(di); + return; + } + bzero(&ehdr, sizeof(ehdr)); ehdr.e_ident[EI_MAG0] = ELFMAG0; ehdr.e_ident[EI_MAG1] = ELFMAG1; Added: head/sys/arm/arm/minidump_machdep.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/arm/arm/minidump_machdep.c Thu Nov 6 16:20:27 2008 (r184728) @@ -0,0 +1,483 @@ +/*- + * Copyright (c) 2008 Semihalf, Grzegorz Bernacki + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * from: FreeBSD: src/sys/i386/i386/minidump_machdep.c,v 1.6 2008/08/17 23:27:27 + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +CTASSERT(sizeof(struct kerneldumpheader) == 512); + +/* + * Don't touch the first SIZEOF_METADATA bytes on the dump device. This + * is to protect us from metadata and to protect metadata from us. + */ +#define SIZEOF_METADATA (64*1024) + +uint32_t *vm_page_dump; +int vm_page_dump_size; + +static struct kerneldumpheader kdh; +static off_t dumplo; + +/* Handle chunked writes. */ +static size_t fragsz, offset; +static void *dump_va; +static uint64_t counter, progress; + +CTASSERT(sizeof(*vm_page_dump) == 4); + +static int +is_dumpable(vm_paddr_t pa) +{ + int i; + + for (i = 0; dump_avail[i] != 0 || dump_avail[i + 1] != 0; i += 2) { + if (pa >= dump_avail[i] && pa < dump_avail[i + 1]) + return (1); + } + return (0); +} + +#define PG2MB(pgs) (((pgs) + (1 << 8) - 1) >> 8) + +static int +blk_flush(struct dumperinfo *di) +{ + int error; + + if (fragsz == 0) + return (0); + + error = dump_write(di, (char*)dump_va + offset, 0, dumplo, fragsz - offset); + dumplo += (fragsz - offset); + fragsz = 0; + offset = 0; + return (error); +} + +static int +blk_write(struct dumperinfo *di, char *ptr, vm_paddr_t pa, size_t sz) +{ + size_t len; + int error, i, c; + u_int maxdumpsz; + + maxdumpsz = di->maxiosize; + + if (maxdumpsz == 0) /* seatbelt */ + maxdumpsz = PAGE_SIZE; + + error = 0; + + if (ptr != NULL && pa != 0) { + printf("cant have both va and pa!\n"); + return (EINVAL); + } + + if (ptr != NULL) { + /* If we're doing a virtual dump, flush any pre-existing pa pages */ + error = blk_flush(di); + if (error) + return (error); + } + + while (sz) { + if (fragsz == 0) { + offset = pa & PAGE_MASK; + fragsz += offset; + } + len = maxdumpsz - fragsz; + if (len > sz) + len = sz; + counter += len; + progress -= len; + + if (counter >> 22) { + printf(" %lld", PG2MB(progress >> PAGE_SHIFT)); + counter &= (1<<22) - 1; + } + + if (ptr) { + error = dump_write(di, ptr, 0, dumplo, len); + if (error) + return (error); + dumplo += len; + ptr += len; + sz -= len; + } else { + for (i = 0; i < len; i += PAGE_SIZE) + dump_va = pmap_kenter_temp(pa + i, + (i + fragsz) >> PAGE_SHIFT); + fragsz += len; + pa += len; + sz -= len; + if (fragsz == maxdumpsz) { + error = blk_flush(di); + if (error) + return (error); + } + } + + /* Check for user abort. */ + c = cncheckc(); + if (c == 0x03) + return (ECANCELED); + if (c != -1) + printf(" (CTRL-C to abort) "); + } + + return (0); +} + +static int +blk_write_cont(struct dumperinfo *di, vm_paddr_t pa, size_t sz) +{ + int error; + + error = blk_write(di, 0, pa, sz); + if (error) + return (error); + + error = blk_flush(di); + if (error) + return (error); + + return (0); +} + +/* A fake page table page, to avoid having to handle both 4K and 2M pages */ +static pt_entry_t fakept[NPTEPG]; + +void +minidumpsys(struct dumperinfo *di) +{ + struct minidumphdr mdhdr; + uint64_t dumpsize; + uint32_t ptesize; + uint32_t bits; + uint32_t pa, prev_pa = 0, count = 0; + vm_offset_t va; + pd_entry_t *pdp; + pt_entry_t *pt, *ptp; + int i, k, bit, error; + char *addr; + + /* Flush cache */ + cpu_idcache_wbinv_all(); + cpu_l2cache_wbinv_all(); + + counter = 0; + /* Walk page table pages, set bits in vm_page_dump */ + ptesize = 0; + for (va = KERNBASE; va < kernel_vm_end; va += NBPDR) { + /* + * We always write a page, even if it is zero. Each + * page written corresponds to 2MB of space + */ + ptesize += L2_TABLE_SIZE_REAL; + pmap_get_pde_pte(pmap_kernel(), va, &pdp, &ptp); + if (pmap_pde_v(pdp) && pmap_pde_section(pdp)) { + /* This is a section mapping 1M page. */ + pa = (*pdp & L1_S_ADDR_MASK) | (va & ~L1_S_ADDR_MASK); + for (k = 0; k < (L1_S_SIZE / PAGE_SIZE); k++) { + if (is_dumpable(pa)) + dump_add_page(pa); + pa += PAGE_SIZE; + } + continue; + } + if (pmap_pde_v(pdp) && pmap_pde_page(pdp)) { + /* Set bit for each valid page in this 1MB block */ + addr = pmap_kenter_temp(*pdp & L1_C_ADDR_MASK, 0); + pt = (pt_entry_t*)(addr + + (((uint32_t)*pdp & L1_C_ADDR_MASK) & PAGE_MASK)); + for (k = 0; k < 256; k++) { + if ((pt[k] & L2_TYPE_MASK) == L2_TYPE_L) { + pa = (pt[k] & L2_L_FRAME) | + (va & L2_L_OFFSET); + for (i = 0; i < 16; i++) { + if (is_dumpable(pa)) + dump_add_page(pa); + k++; + pa += PAGE_SIZE; + } + } else if ((pt[k] & L2_TYPE_MASK) == L2_TYPE_S) { + pa = (pt[k] & L2_S_FRAME) | + (va & L2_S_OFFSET); + if (is_dumpable(pa)) + dump_add_page(pa); + } + } + } else { + /* Nothing, we're going to dump a null page */ + } + } + + /* Calculate dump size. */ + dumpsize = ptesize; + dumpsize += round_page(msgbufp->msg_size); + dumpsize += round_page(vm_page_dump_size); + + for (i = 0; i < vm_page_dump_size / sizeof(*vm_page_dump); i++) { + bits = vm_page_dump[i]; + while (bits) { + bit = ffs(bits) - 1; + pa = (((uint64_t)i * sizeof(*vm_page_dump) * NBBY) + + bit) * PAGE_SIZE; + /* Clear out undumpable pages now if needed */ + if (is_dumpable(pa)) + dumpsize += PAGE_SIZE; + else + dump_drop_page(pa); + bits &= ~(1ul << bit); + } + } + + dumpsize += PAGE_SIZE; + + /* Determine dump offset on device. */ + if (di->mediasize < SIZEOF_METADATA + dumpsize + sizeof(kdh) * 2) { + error = ENOSPC; + goto fail; + } + + dumplo = di->mediaoffset + di->mediasize - dumpsize; + dumplo -= sizeof(kdh) * 2; + progress = dumpsize; + + /* Initialize mdhdr */ + bzero(&mdhdr, sizeof(mdhdr)); + strcpy(mdhdr.magic, MINIDUMP_MAGIC); + mdhdr.version = MINIDUMP_VERSION; + mdhdr.msgbufsize = msgbufp->msg_size; + mdhdr.bitmapsize = vm_page_dump_size; + mdhdr.ptesize = ptesize; + mdhdr.kernbase = KERNBASE; + + mkdumpheader(&kdh, KERNELDUMPMAGIC, KERNELDUMP_ARM_VERSION, dumpsize, + di->blocksize); + + printf("Physical memory: %u MB\n", ptoa((uintmax_t)physmem) / 1048576); + printf("Dumping %llu MB:", (long long)dumpsize >> 20); + + /* Dump leader */ + error = dump_write(di, &kdh, 0, dumplo, sizeof(kdh)); + if (error) + goto fail; + dumplo += sizeof(kdh); + + /* Dump my header */ + bzero(&fakept, sizeof(fakept)); + bcopy(&mdhdr, &fakept, sizeof(mdhdr)); + error = blk_write(di, (char *)&fakept, 0, PAGE_SIZE); + if (error) + goto fail; + + /* Dump msgbuf up front */ + error = blk_write(di, (char *)msgbufp->msg_ptr, 0, round_page(msgbufp->msg_size)); + if (error) + goto fail; + + /* Dump bitmap */ + error = blk_write(di, (char *)vm_page_dump, 0, + round_page(vm_page_dump_size)); + if (error) + goto fail; + + /* Dump kernel page table pages */ + for (va = KERNBASE; va < kernel_vm_end; va += NBPDR) { + /* We always write a page, even if it is zero */ + pmap_get_pde_pte(pmap_kernel(), va, &pdp, &ptp); + + if (pmap_pde_v(pdp) && pmap_pde_section(pdp)) { + if (count) { + error = blk_write_cont(di, prev_pa, + count * L2_TABLE_SIZE_REAL); + if (error) + goto fail; + count = 0; + prev_pa = 0; + } + /* This is a single 2M block. Generate a fake PTP */ + pa = (*pdp & L1_S_ADDR_MASK) | (va & ~L1_S_ADDR_MASK); + for (k = 0; k < (L1_S_SIZE / PAGE_SIZE); k++) { + fakept[k] = L2_S_PROTO | (pa + (k * PAGE_SIZE)) | + L2_S_PROT(PTE_KERNEL, + VM_PROT_READ | VM_PROT_WRITE); + } + error = blk_write(di, (char *)&fakept, 0, + L2_TABLE_SIZE_REAL); + if (error) + goto fail; + /* Flush, in case we reuse fakept in the same block */ + error = blk_flush(di); + if (error) + goto fail; + continue; + } + if (pmap_pde_v(pdp) && pmap_pde_page(pdp)) { + pa = *pdp & L1_C_ADDR_MASK; + if (!count) { + prev_pa = pa; + count++; + } + else { + if (pa == (prev_pa + count * L2_TABLE_SIZE_REAL)) + count++; + else { + error = blk_write_cont(di, prev_pa, + count * L2_TABLE_SIZE_REAL); + if (error) + goto fail; + count = 1; + prev_pa = pa; + } + } + } else { + if (count) { + error = blk_write_cont(di, prev_pa, + count * L2_TABLE_SIZE_REAL); + if (error) + goto fail; + count = 0; + prev_pa = 0; + } + bzero(fakept, sizeof(fakept)); + error = blk_write(di, (char *)&fakept, 0, + L2_TABLE_SIZE_REAL); + if (error) + goto fail; + /* Flush, in case we reuse fakept in the same block */ + error = blk_flush(di); + if (error) + goto fail; + } + } + + if (count) { + error = blk_write_cont(di, prev_pa, count * L2_TABLE_SIZE_REAL); + if (error) + goto fail; + count = 0; + prev_pa = 0; + } + + /* Dump memory chunks */ + for (i = 0; i < vm_page_dump_size / sizeof(*vm_page_dump); i++) { + bits = vm_page_dump[i]; + while (bits) { + bit = ffs(bits) - 1; + pa = (((uint64_t)i * sizeof(*vm_page_dump) * NBBY) + + bit) * PAGE_SIZE; + if (!count) { + prev_pa = pa; + count++; + } else { + if (pa == (prev_pa + count * PAGE_SIZE)) + count++; + else { + error = blk_write_cont(di, prev_pa, + count * PAGE_SIZE); + if (error) + goto fail; + count = 1; + prev_pa = pa; + } + } + bits &= ~(1ul << bit); + } + } + if (count) { + error = blk_write_cont(di, prev_pa, count * PAGE_SIZE); + if (error) + goto fail; + count = 0; + prev_pa = 0; + } + + /* Dump trailer */ + error = dump_write(di, &kdh, 0, dumplo, sizeof(kdh)); + if (error) + goto fail; + dumplo += sizeof(kdh); + + /* Signal completion, signoff and exit stage left. */ + dump_write(di, NULL, 0, 0, 0); + printf("\nDump complete\n"); + return; + +fail: + if (error < 0) + error = -error; + + if (error == ECANCELED) + printf("\nDump aborted\n"); + else if (error == ENOSPC) + printf("\nDump failed. Partition too small.\n"); + else + printf("\n** DUMP FAILED (ERROR %d) **\n", error); +} + +void +dump_add_page(vm_paddr_t pa) +{ + int idx, bit; + + pa >>= PAGE_SHIFT; + idx = pa >> 5; /* 2^5 = 32 */ + bit = pa & 31; + atomic_set_int(&vm_page_dump[idx], 1ul << bit); +} + +void +dump_drop_page(vm_paddr_t pa) +{ + int idx, bit; + + pa >>= PAGE_SHIFT; + idx = pa >> 5; /* 2^5 = 32 */ + bit = pa & 31; + atomic_clear_int(&vm_page_dump[idx], 1ul << bit); +} Modified: head/sys/arm/arm/pmap.c ============================================================================== --- head/sys/arm/arm/pmap.c Thu Nov 6 15:32:02 2008 (r184727) +++ head/sys/arm/arm/pmap.c Thu Nov 6 16:20:27 2008 (r184728) @@ -270,6 +270,11 @@ union pmap_cache_state *pmap_cache_state struct msgbuf *msgbufp = 0; +/* + * Crashdump maps. + */ +static caddr_t crashdumpmap; + extern void bcopy_page(vm_offset_t, vm_offset_t); extern void bzero_page(vm_offset_t); @@ -2455,6 +2460,8 @@ pmap_bootstrap(vm_offset_t firstaddr, vm pmap_alloc_specials(&virtual_avail, 1, (vm_offset_t*)&_tmppt, NULL); + pmap_alloc_specials(&virtual_avail, + MAXDUMPPGS, (vm_offset_t *)&crashdumpmap, NULL); SLIST_INIT(&l1_list); TAILQ_INIT(&l1_lru_list); mtx_init(&l1_lru_lock, "l1 list lock", NULL, MTX_DEF); @@ -2793,6 +2800,20 @@ pmap_kenter_section(vm_offset_t va, vm_o } /* + * Make a temporary mapping for a physical address. This is only intended + * to be used for panic dumps. + */ +void * +pmap_kenter_temp(vm_paddr_t pa, int i) +{ + vm_offset_t va; + + va = (vm_offset_t)crashdumpmap + (i * PAGE_SIZE); + pmap_kenter(va, pa); + return ((void *)crashdumpmap); +} + +/* * add a wired page to the kva * note that in order for the mapping to take effect -- you * should do a invltlb after doing the pmap_kenter... Modified: head/sys/arm/include/md_var.h ============================================================================== --- head/sys/arm/include/md_var.h Thu Nov 6 15:32:02 2008 (r184727) +++ head/sys/arm/include/md_var.h Thu Nov 6 16:20:27 2008 (r184728) @@ -35,6 +35,8 @@ extern char sigcode[]; extern int szsigcode; +extern uint32_t *vm_page_dump; +extern int vm_page_dump_size; extern int (*_arm_memcpy)(void *, void *, int, int); extern int (*_arm_bzero)(void *, int, int); @@ -46,7 +48,11 @@ extern int _min_bzero_size; #define SRC_IS_USER 0x2 #define IS_PHYSICAL 0x4 +struct dumperinfo; extern int busdma_swi_pending; void busdma_swi(void); +void dump_add_page(vm_paddr_t); +void dump_drop_page(vm_paddr_t); +void minidumpsys(struct dumperinfo *); #endif /* !_MACHINE_MD_VAR_H_ */ Added: head/sys/arm/include/minidump.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/arm/include/minidump.h Thu Nov 6 16:20:27 2008 (r184728) @@ -0,0 +1,45 @@ +/*- + * Copyright (c) 2006 Peter Wemm + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * From: FreeBSD: src/sys/i386/include/minidump.h,v 1.1 2006/04/21 04:28:43 + * $FreeBSD$ + */ + +#ifndef _MACHINE_MINIDUMP_H_ +#define _MACHINE_MINIDUMP_H_ 1 + +#define MINIDUMP_MAGIC "minidump FreeBSD/arm" +#define MINIDUMP_VERSION 1 + +struct minidumphdr { + char magic[24]; + uint32_t version; + uint32_t msgbufsize; + uint32_t bitmapsize; + uint32_t ptesize; + uint32_t kernbase; +}; + *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From raj at FreeBSD.org Thu Nov 6 08:25:12 2008 From: raj at FreeBSD.org (Rafal Jaworowski) Date: Thu Nov 6 08:25:24 2008 Subject: svn commit: r184729 - head/sys/arm/mv Message-ID: <200811061625.mA6GPCRg060046@svn.freebsd.org> Author: raj Date: Thu Nov 6 16:25:12 2008 New Revision: 184729 URL: http://svn.freebsd.org/changeset/base/184729 Log: Auto-size kernel page tables allocation on Marvell systems. This allows mini dumps to fully work for these platforms. Obtained from: Juniper Networks, Semihalf Modified: head/sys/arm/mv/mv_machdep.c Modified: head/sys/arm/mv/mv_machdep.c ============================================================================== --- head/sys/arm/mv/mv_machdep.c Thu Nov 6 16:20:27 2008 (r184728) +++ head/sys/arm/mv/mv_machdep.c Thu Nov 6 16:25:12 2008 (r184729) @@ -93,9 +93,6 @@ __FBSDID("$FreeBSD$"); #define debugf(fmt, args...) #endif -#define KERNEL_PT_SYS 0 /* Page table for mapping proc0 zero page */ -#define KERNEL_PT_KERN 1 - /* * This is the number of L2 page tables required for covering max * (hypothetical) memsize of 4GB and all kernel mappings (vectors, msgbuf, @@ -366,7 +363,7 @@ initarm(void *mdp, void *unused __unused struct bi_mem_region *mr; void *kmdp; u_int l1pagetable; - int i = 0; + int i = 0, j = 0; kmdp = NULL; lastaddr = 0; @@ -465,13 +462,14 @@ initarm(void *mdp, void *unused __unused if (!(i % (PAGE_SIZE / L2_TABLE_SIZE_REAL))) { valloc_pages(kernel_pt_table[i], L2_TABLE_SIZE / PAGE_SIZE); + j = i; } else { - kernel_pt_table[i].pv_va = freemempos - - (i % (PAGE_SIZE / L2_TABLE_SIZE_REAL)) * - L2_TABLE_SIZE_REAL; + kernel_pt_table[i].pv_va = kernel_pt_table[j].pv_va + + L2_TABLE_SIZE_REAL * (i - j); kernel_pt_table[i].pv_pa = kernel_pt_table[i].pv_va - KERNVIRTADDR + KERNPHYSADDR; + } } /* @@ -506,7 +504,7 @@ initarm(void *mdp, void *unused __unused l2_start = lastaddr & ~(L1_S_OFFSET); for (i = 0 ; i < l2size - 1; i++) pmap_link_l2pt(l1pagetable, l2_start + i * L1_S_SIZE, - &kernel_pt_table[KERNEL_PT_KERN + i]); + &kernel_pt_table[i]); pmap_curmaxkvaddr = l2_start + (l2size - 1) * L1_S_SIZE; @@ -532,7 +530,7 @@ initarm(void *mdp, void *unused __unused /* Link and map the vector page */ pmap_link_l2pt(l1pagetable, ARM_VECTORS_HIGH, - &kernel_pt_table[KERNEL_PT_SYS]); + &kernel_pt_table[l2size - 1]); pmap_map_entry(l1pagetable, ARM_VECTORS_HIGH, systempage.pv_pa, VM_PROT_READ|VM_PROT_WRITE, PTE_CACHE); @@ -603,8 +601,8 @@ initarm(void *mdp, void *unused __unused arm_vector_init(ARM_VECTORS_HIGH, ARM_VEC_ALL); - dump_avail[0] = KERNPHYSADDR; - dump_avail[1] = KERNPHYSADDR + memsize; + dump_avail[0] = 0; + dump_avail[1] = memsize; dump_avail[2] = 0; dump_avail[3] = 0; From raj at FreeBSD.org Thu Nov 6 08:28:29 2008 From: raj at FreeBSD.org (Rafal Jaworowski) Date: Thu Nov 6 08:28:35 2008 Subject: svn commit: r184730 - head/sys/arm/arm Message-ID: <200811061628.mA6GSSYR060128@svn.freebsd.org> Author: raj Date: Thu Nov 6 16:28:28 2008 New Revision: 184730 URL: http://svn.freebsd.org/changeset/base/184730 Log: ARM pmap style(9) and cosmetics. Modified: head/sys/arm/arm/pmap.c Modified: head/sys/arm/arm/pmap.c ============================================================================== --- head/sys/arm/arm/pmap.c Thu Nov 6 16:25:12 2008 (r184729) +++ head/sys/arm/arm/pmap.c Thu Nov 6 16:28:28 2008 (r184730) @@ -1214,7 +1214,7 @@ pmap_l2cache_wbinv_range(pmap_t pm, vm_o CTR4(KTR_PMAP, "pmap_l2cache_wbinv_range: pmap %p is_kernel %d " "va 0x%08x len 0x%x ", pm, pm == pmap_kernel(), va, rest); if (pmap_get_pde_pte(pm, va, &pde, &ptep) && l2pte_valid(*ptep)) - cpu_l2cache_wb_range(va, rest); + cpu_l2cache_wb_range(va, rest); len -= rest; va += rest; @@ -1246,7 +1246,7 @@ pmap_l2cache_wb_range(pmap_t pm, vm_offs CTR4(KTR_PMAP, "pmap_l2cache_wb_range: pmap %p is_kernel %d " "va 0x%08x len 0x%x ", pm, pm == pmap_kernel(), va, rest); if (pmap_get_pde_pte(pm, va, &pde, &ptep) && l2pte_valid(*ptep)) - cpu_l2cache_wb_range(va, rest); + cpu_l2cache_wb_range(va, rest); len -= rest; va += rest; @@ -1281,6 +1281,7 @@ static PMAP_INLINE void pmap_dcache_wb_range(pmap_t pm, vm_offset_t va, vm_size_t len, boolean_t do_inv, boolean_t rd_only) { + CTR4(KTR_PMAP, "pmap_dcache_wb_range: pmap %p is_kernel %d va 0x%08x " "len 0x%x ", pm, pm == pmap_kernel(), va, len); CTR2(KTR_PMAP, " do_inv %d rd_only %d", do_inv, rd_only); @@ -1295,8 +1296,7 @@ pmap_dcache_wb_range(pmap_t pm, vm_offse cpu_dcache_wbinv_range(va, len); pmap_l2cache_wbinv_range(pm, va, len); } - } else - if (!rd_only) { + } else if (!rd_only) { cpu_dcache_wb_range(va, len); pmap_l2cache_wb_range(pm, va, len); } @@ -3979,7 +3979,7 @@ pmap_zero_page_generic(vm_paddr_t phys, * Hook in the page, zero it, invalidate the TLB as needed. * * Note the temporary zero-page mapping must be a non-cached page in - * ordert to work without corruption when write-allocate is enabled. + * order to work without corruption when write-allocate is enabled. */ *cdst_pte = L2_S_PROTO | phys | L2_S_PROT(PTE_KERNEL, VM_PROT_WRITE); cpu_tlb_flushD_SE(cdstp); From bz at FreeBSD.org Thu Nov 6 08:30:21 2008 From: bz at FreeBSD.org (Bjoern A. Zeeb) Date: Thu Nov 6 08:30:32 2008 Subject: svn commit: r184731 - head/sys/netinet Message-ID: <200811061630.mA6GUKZY060199@svn.freebsd.org> Author: bz Date: Thu Nov 6 16:30:20 2008 New Revision: 184731 URL: http://svn.freebsd.org/changeset/base/184731 Log: Fix typo and while here another one. Reviewed by: keramida Reported by: keramida MFC after: 2 months (with r184720) Modified: head/sys/netinet/tcp_input.c Modified: head/sys/netinet/tcp_input.c ============================================================================== --- head/sys/netinet/tcp_input.c Thu Nov 6 16:28:28 2008 (r184730) +++ head/sys/netinet/tcp_input.c Thu Nov 6 16:30:20 2008 (r184731) @@ -1501,7 +1501,7 @@ tcp_do_segment(struct mbuf *m, struct tc * only accepting RSTs where the sequence number is equal to * last_ack_sent. In all other states (the states in which a * RST is more likely), the more permissive check is used. - * If we have multiple segments in flight, the intial reset + * If we have multiple segments in flight, the initial reset * segment sequence numbers will be to the left of last_ack_sent, * but they will eventually catch up. * In any case, it never made sense to trim reset segments to @@ -2849,7 +2849,7 @@ tcp_mss_update(struct tcpcb *tp, int off */ if (maxmtu == 0) { /* - * In case we return early we need to intialize metrics + * In case we return early we need to initialize metrics * to a defined state as tcp_hc_get() would do for us * if there was no cache hit. */ From raj at FreeBSD.org Thu Nov 6 08:30:33 2008 From: raj at FreeBSD.org (Rafal Jaworowski) Date: Thu Nov 6 08:30:53 2008 Subject: svn commit: r184732 - head/lib/libstand Message-ID: <200811061630.mA6GUWCl060238@svn.freebsd.org> Author: raj Date: Thu Nov 6 16:30:32 2008 New Revision: 184732 URL: http://svn.freebsd.org/changeset/base/184732 Log: Eliminate dead declarations in libstand. Modified: head/lib/libstand/stand.h Modified: head/lib/libstand/stand.h ============================================================================== --- head/lib/libstand/stand.h Thu Nov 6 16:30:20 2008 (r184731) +++ head/lib/libstand/stand.h Thu Nov 6 16:30:32 2008 (r184732) @@ -236,10 +236,6 @@ extern void *realloc(void *ptr, size_t s extern void *reallocf(void *ptr, size_t size); extern void mallocstats(void); -/* disklabel support (undocumented, may be junk) */ -struct disklabel; -extern char *getdisklabel(const char *, struct disklabel *); - extern int printf(const char *fmt, ...) __printflike(1, 2); extern void vprintf(const char *fmt, __va_list); extern int sprintf(char *buf, const char *cfmt, ...) __printflike(2, 3); From mlaier at FreeBSD.org Thu Nov 6 08:30:38 2008 From: mlaier at FreeBSD.org (Max Laier) Date: Thu Nov 6 08:30:53 2008 Subject: svn commit: r184733 - head/usr.bin/du Message-ID: <200811061630.mA6GUc41060276@svn.freebsd.org> Author: mlaier Date: Thu Nov 6 16:30:38 2008 New Revision: 184733 URL: http://svn.freebsd.org/changeset/base/184733 Log: Add two new options to du(1): -A Display the apparent size instead of the disk usage. This can be helpful when operating on compressed volumes or sparse files. -B blocksize Calculate block counts in blocksize byte blocks. This is differ- ent from the -k, -m options or setting BLOCKSIZE and gives an estimate of how much space the examined file hierachy would require on a filesystem with the given blocksize. Unless in -A mode, blocksize is rounded up to the next multiple of 512. The former is similar to GNU's du(1) --apparent-size. The latter is different from what GNU's du(1) -B does, which is equivalent to setting BLOCKSIZE in our implementation and is rather pointless as it doesn't add any real value (i.e. you can achieve the same with a simple awk-script). No change in the normal output or processing. Reviewed by: keramida@, Peter French Otherwise silience from: freebsd-hackers@ Modified: head/usr.bin/du/du.1 head/usr.bin/du/du.c Modified: head/usr.bin/du/du.1 ============================================================================== --- head/usr.bin/du/du.1 Thu Nov 6 16:30:32 2008 (r184732) +++ head/usr.bin/du/du.1 Thu Nov 6 16:30:38 2008 (r184733) @@ -32,7 +32,7 @@ .\" @(#)du.1 8.2 (Berkeley) 4/1/94 .\" $FreeBSD$ .\" -.Dd February 25, 2008 +.Dd November 6, 2008 .Dt DU 1 .Os .Sh NAME @@ -40,11 +40,12 @@ .Nd display disk usage statistics .Sh SYNOPSIS .Nm +.Op Fl A .Op Fl H | L | P .Op Fl a | s | d Ar depth .Op Fl c .Op Fl l -.Op Fl h | k | m +.Op Fl h | k | m | B Ar blocksize .Op Fl n .Op Fl x .Op Fl I Ar mask @@ -60,6 +61,25 @@ the current directory is displayed. .Pp The options are as follows: .Bl -tag -width indent +.It Fl A +Display the apparent size instead of the disk usage. +This can be helpful when operating on compressed volumes or sparse files. +.It Fl B Ar blocksize +Calculate block counts in +.Ar blocksize +byte blocks. +This is different from the +.Fl k, m +options or setting +.Ev BLOCKSIZE +and gives an estimate of how much space the examined file hierachy would +require on a filesystem with the given +.Ar blocksize . +Unless in +.Fl A +mode, +.Ar blocksize +is rounded up to the next multiple of 512. .It Fl H Symbolic links on the command line are followed, symbolic links in file hierarchies are not followed. @@ -136,14 +156,19 @@ followed is not counted or displayed. If the environment variable .Ev BLOCKSIZE is set, and the -.Fl k -option is not specified, the block counts will be displayed in units of that -size block. +.Fl k, m +or +.Fl h +options are not specified, the block counts will be displayed in units of +that block size. If .Ev BLOCKSIZE is not set, and the -.Fl k -option is not specified, the block counts will be displayed in 512-byte blocks. +.Fl k, m +or +.Fl h +options are not specified, the block counts will be displayed in 512-byte +blocks. .El .Sh SEE ALSO .Xr df 1 , Modified: head/usr.bin/du/du.c ============================================================================== --- head/usr.bin/du/du.c Thu Nov 6 16:30:32 2008 (r184732) +++ head/usr.bin/du/du.c Thu Nov 6 16:30:38 2008 (r184733) @@ -79,14 +79,15 @@ static void ignoreclean(void); static int ignorep(FTSENT *); static int nodumpflag = 0; +static int Aflag; +static long blocksize, cblocksize; int main(int argc, char *argv[]) { FTS *fts; FTSENT *p; - off_t savednumber; - long blocksize; + off_t savednumber, curblocks; int ftsoptions; int listall; int depth; @@ -98,16 +99,30 @@ main(int argc, char *argv[]) setlocale(LC_ALL, ""); Hflag = Lflag = Pflag = aflag = sflag = dflag = cflag = hflag = - lflag = 0; + lflag = Aflag = 0; save = argv; ftsoptions = 0; savednumber = 0; + cblocksize = DEV_BSIZE; + blocksize = 0; depth = INT_MAX; SLIST_INIT(&ignores); - while ((ch = getopt(argc, argv, "HI:LPasd:chklmnrx")) != -1) + while ((ch = getopt(argc, argv, "AB:HI:LPasd:chklmnrx")) != -1) switch (ch) { + case 'A': + Aflag = 1; + break; + case 'B': + errno = 0; + cblocksize = atoi(optarg); + if (errno == ERANGE || cblocksize <= 0) { + warnx("invalid argument to option B: %s", + optarg); + usage(); + } + break; case 'H': Hflag = 1; break; @@ -144,22 +159,18 @@ main(int argc, char *argv[]) cflag = 1; break; case 'h': - if (setenv("BLOCKSIZE", "512", 1) == -1) - warn("setenv: cannot set BLOCKSIZE=512"); hflag = 1; break; case 'k': hflag = 0; - if (setenv("BLOCKSIZE", "1024", 1) == -1) - warn("setenv: cannot set BLOCKSIZE=1024"); + blocksize = 1024; break; case 'l': lflag = 1; break; case 'm': hflag = 0; - if (setenv("BLOCKSIZE", "1048576", 1) == -1) - warn("setenv: cannot set BLOCKSIZE=1048576"); + blocksize = 1048576; break; case 'n': nodumpflag = 1; @@ -206,6 +217,9 @@ main(int argc, char *argv[]) if (Pflag) ftsoptions |= FTS_PHYSICAL; + if (!Aflag && (cblocksize % DEV_BSIZE) != 0) + cblocksize = howmany(cblocksize, DEV_BSIZE) * DEV_BSIZE; + listall = 0; if (aflag) { @@ -224,8 +238,13 @@ main(int argc, char *argv[]) argv[1] = NULL; } - (void)getbsize(¬used, &blocksize); - blocksize /= 512; + if (blocksize == 0) + (void)getbsize(¬used, &blocksize); + + if (!Aflag) { + cblocksize /= DEV_BSIZE; + blocksize /= DEV_BSIZE; + } rval = 0; @@ -242,17 +261,19 @@ main(int argc, char *argv[]) if (ignorep(p)) break; + curblocks = Aflag ? + howmany(p->fts_statp->st_size, cblocksize) : + howmany(p->fts_statp->st_blocks, cblocksize); p->fts_parent->fts_bignum += p->fts_bignum += - p->fts_statp->st_blocks; + curblocks; if (p->fts_level <= depth) { if (hflag) { - prthumanval(howmany(p->fts_bignum, - blocksize)); + prthumanval(p->fts_bignum); (void)printf("\t%s\n", p->fts_path); } else { (void)printf("%jd\t%s\n", - (intmax_t)howmany(p->fts_bignum, + howmany(p->fts_bignum * cblocksize, blocksize), p->fts_path); } } @@ -273,21 +294,22 @@ main(int argc, char *argv[]) linkchk(p)) break; + curblocks = Aflag ? + howmany(p->fts_statp->st_size, cblocksize) : + howmany(p->fts_statp->st_blocks, cblocksize); + if (listall || p->fts_level == 0) { if (hflag) { - prthumanval(howmany( - p->fts_statp->st_blocks, - blocksize)); + prthumanval(curblocks); (void)printf("\t%s\n", p->fts_path); } else { (void)printf("%jd\t%s\n", - (intmax_t)howmany( - p->fts_statp->st_blocks, - blocksize), p->fts_path); + howmany(curblocks * cblocksize, + blocksize), p->fts_path); } } - p->fts_parent->fts_bignum += p->fts_statp->st_blocks; + p->fts_parent->fts_bignum += curblocks; } savednumber = p->fts_parent->fts_bignum; } @@ -297,11 +319,11 @@ main(int argc, char *argv[]) if (cflag) { if (hflag) { - prthumanval(howmany(savednumber, blocksize)); + prthumanval(savednumber); (void)printf("\ttotal\n"); } else { (void)printf("%jd\ttotal\n", (intmax_t)howmany( - savednumber, blocksize)); + savednumber * cblocksize, blocksize)); } } @@ -448,7 +470,9 @@ prthumanval(int64_t bytes) { char buf[5]; - bytes *= DEV_BSIZE; + bytes *= cblocksize; + if (!Aflag) + bytes *= DEV_BSIZE; humanize_number(buf, sizeof(buf), bytes, "", HN_AUTOSCALE, HN_B | HN_NOSPACE | HN_DECIMAL); @@ -460,8 +484,9 @@ static void usage(void) { (void)fprintf(stderr, - "usage: du [-H | -L | -P] [-a | -s | -d depth] [-c] " - "[-l] [-h | -k | -m] [-n] [-x] [-I mask] [file ...]\n"); + "usage: du [-A] [-H | -L | -P] [-a | -s | -d depth] [-c] " + "[-l] [-h | -k | -m | -B bsize] [-n] [-x] [-I mask] " + "[file ...]\n"); exit(EX_USAGE); } From marcel at FreeBSD.org Thu Nov 6 08:51:34 2008 From: marcel at FreeBSD.org (Marcel Moolenaar) Date: Thu Nov 6 08:51:41 2008 Subject: svn commit: r184734 - head/sys/geom/part Message-ID: <200811061651.mA6GpX1k060674@svn.freebsd.org> Author: marcel Date: Thu Nov 6 16:51:33 2008 New Revision: 184734 URL: http://svn.freebsd.org/changeset/base/184734 Log: Fix a panic caused by a corrupted table when the header is still valid. We were checking the state of the header and not the table. PR: 119868 Based on a patch from: Jaakko Heinonen MFC after: 1 week Modified: head/sys/geom/part/g_part_gpt.c Modified: head/sys/geom/part/g_part_gpt.c ============================================================================== --- head/sys/geom/part/g_part_gpt.c Thu Nov 6 16:30:38 2008 (r184733) +++ head/sys/geom/part/g_part_gpt.c Thu Nov 6 16:51:33 2008 (r184734) @@ -625,13 +625,16 @@ g_part_gpt_read(struct g_part_table *bas if (table->state[GPT_ELT_PRIHDR] == GPT_STATE_OK && table->state[GPT_ELT_SECHDR] == GPT_STATE_OK && !gpt_matched_hdrs(&prihdr, &sechdr)) { - if (table->state[GPT_ELT_PRITBL] == GPT_STATE_OK) + if (table->state[GPT_ELT_PRITBL] == GPT_STATE_OK) { table->state[GPT_ELT_SECHDR] = GPT_STATE_INVALID; - else + table->state[GPT_ELT_SECTBL] = GPT_STATE_MISSING; + } else { table->state[GPT_ELT_PRIHDR] = GPT_STATE_INVALID; + table->state[GPT_ELT_PRITBL] = GPT_STATE_MISSING; + } } - if (table->state[GPT_ELT_PRIHDR] != GPT_STATE_OK) { + if (table->state[GPT_ELT_PRITBL] != GPT_STATE_OK) { printf("GEOM: %s: the primary GPT table is corrupt or " "invalid.\n", pp->name); printf("GEOM: %s: using the secondary instead -- recovery " @@ -641,7 +644,7 @@ g_part_gpt_read(struct g_part_table *bas if (pritbl != NULL) g_free(pritbl); } else { - if (table->state[GPT_ELT_SECHDR] != GPT_STATE_OK) { + if (table->state[GPT_ELT_SECTBL] != GPT_STATE_OK) { printf("GEOM: %s: the secondary GPT table is corrupt " "or invalid.\n", pp->name); printf("GEOM: %s: using the primary only -- recovery " From marcel at FreeBSD.org Thu Nov 6 09:00:19 2008 From: marcel at FreeBSD.org (Marcel Moolenaar) Date: Thu Nov 6 09:00:31 2008 Subject: svn commit: r184735 - head/sys/sys Message-ID: <200811061700.mA6H0JVq060934@svn.freebsd.org> Author: marcel Date: Thu Nov 6 17:00:19 2008 New Revision: 184735 URL: http://svn.freebsd.org/changeset/base/184735 Log: Fix copyright notice. Modified: head/sys/sys/cfictl.h Modified: head/sys/sys/cfictl.h ============================================================================== --- head/sys/sys/cfictl.h Thu Nov 6 16:51:33 2008 (r184734) +++ head/sys/sys/cfictl.h Thu Nov 6 17:00:19 2008 (r184735) @@ -14,17 +14,17 @@ * may be used to endorse or promote products derived from this software * without specific prior written permission. * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL Bill Paul OR THE VOICES IN HIS HEAD - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF - * THE POSSIBILITY OF SUCH DAMAGE. + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. * * $FreeBSD$ */ From imp at bsdimp.com Thu Nov 6 09:02:44 2008 From: imp at bsdimp.com (M. Warner Losh) Date: Thu Nov 6 09:02:56 2008 Subject: svn commit: r184610 - in head: lib/libusb20 share/man/man4 sys/conf sys/dev/sound/pcm sys/dev/usb2 sys/dev/usb2/bluetooth sys/dev/usb2/controller sys/dev/usb2/core sys/dev/usb2/ethernet sys/dev/usb... In-Reply-To: <864p2l5hf1.fsf@ds4.des.no> References: <86skq6gxtn.fsf@ds4.des.no> <20081105.144840.-432836001.imp@bsdimp.com> <864p2l5hf1.fsf@ds4.des.no> Message-ID: <20081106.100206.-1889957246.imp@bsdimp.com> In message: <864p2l5hf1.fsf@ds4.des.no> Dag-Erling_Sm?rgrav writes: : "M. Warner Losh" writes: : > Dag-Erling_Sm?rgrav writes: : > > It looks like whoever wrote this went out of their way to find new and : > > creative ways to break just about every style rule we have. : > Not just coding style, but also style of /dev entries, the modules : > style, etc. : : So the question is, why was this code imported at all? Because it is useful. The current usb stack is in disrepair and people thought it could be fixed up after the import. This is an experiment, one that may well fail, to see if that's the case. Warner From imp at bsdimp.com Thu Nov 6 09:02:46 2008 From: imp at bsdimp.com (M. Warner Losh) Date: Thu Nov 6 09:03:07 2008 Subject: svn commit: r184610 - in head: lib/libusb20 share/man/man4 sys/conf sys/dev/sound/pcm sys/dev/usb2 sys/dev/usb2/bluetooth sys/dev/usb2/controller sys/dev/usb2/core sys/dev/usb2/ethernet sys/dev/usb... In-Reply-To: <20081106101156.GA40311@FreeBSD.org> References: <20081105.144840.-432836001.imp@bsdimp.com> <864p2l5hf1.fsf@ds4.des.no> <20081106101156.GA40311@FreeBSD.org> Message-ID: <20081106.100323.195417660.imp@bsdimp.com> In message: <20081106101156.GA40311@FreeBSD.org> Alexey Dokuchaev writes: : On Thu, Nov 06, 2008 at 10:32:02AM +0100, Dag-Erling Sm??rgrav wrote: : > "M. Warner Losh" writes: : > > Dag-Erling_Sm??rgrav writes: : > > > It looks like whoever wrote this went out of their way to find new and : > > > creative ways to break just about every style rule we have. : > > Not just coding style, but also style of /dev entries, the modules : > > style, etc. : > : > So the question is, why was this code imported at all? : : Seconded, especially since it says the code was reviewed by you Warner in : the commit log. Unfortunately, most of my reviews were ignored, as were those of a great many other people. There's lots of pressure for this code from the user community. It is an experiment, one that may well ultimately fail. Warner From imp at FreeBSD.org Thu Nov 6 09:26:13 2008 From: imp at FreeBSD.org (Warner Losh) Date: Thu Nov 6 09:26:25 2008 Subject: svn commit: r184736 - head/sys/dev/usb2/serial Message-ID: <200811061726.mA6HQCfm061397@svn.freebsd.org> Author: imp Date: Thu Nov 6 17:26:12 2008 New Revision: 184736 URL: http://svn.freebsd.org/changeset/base/184736 Log: Bring in http://perforce.freebsd.org/chv.cgi?CH=152584 from hps. Submitted by: hps Modified: head/sys/dev/usb2/serial/uark2.c head/sys/dev/usb2/serial/ubsa2.c head/sys/dev/usb2/serial/ubser2.c head/sys/dev/usb2/serial/uchcom2.c head/sys/dev/usb2/serial/ucycom2.c head/sys/dev/usb2/serial/ufoma2.c head/sys/dev/usb2/serial/uftdi2.c head/sys/dev/usb2/serial/ugensa2.c head/sys/dev/usb2/serial/uipaq2.c head/sys/dev/usb2/serial/umct2.c head/sys/dev/usb2/serial/umodem2.c head/sys/dev/usb2/serial/umoscom2.c head/sys/dev/usb2/serial/uplcom2.c head/sys/dev/usb2/serial/usb2_serial.c head/sys/dev/usb2/serial/uvisor2.c head/sys/dev/usb2/serial/uvscom2.c Modified: head/sys/dev/usb2/serial/uark2.c ============================================================================== --- head/sys/dev/usb2/serial/uark2.c Thu Nov 6 17:00:19 2008 (r184735) +++ head/sys/dev/usb2/serial/uark2.c Thu Nov 6 17:26:12 2008 (r184736) @@ -174,7 +174,6 @@ static driver_t uark_driver = { DRIVER_MODULE(uark, ushub, uark_driver, uark_devclass, NULL, 0); MODULE_DEPEND(uark, usb2_serial, 1, 1, 1); MODULE_DEPEND(uark, usb2_core, 1, 1, 1); -MODULE_DEPEND(uark, ucom, UCOM_MINVER, UCOM_PREFVER, UCOM_MAXVER); static const struct usb2_device_id uark_devs[] = { {USB_VPI(USB_VENDOR_ARKMICRO, USB_PRODUCT_ARKMICRO_ARK3116, 0)}, Modified: head/sys/dev/usb2/serial/ubsa2.c ============================================================================== --- head/sys/dev/usb2/serial/ubsa2.c Thu Nov 6 17:00:19 2008 (r184735) +++ head/sys/dev/usb2/serial/ubsa2.c Thu Nov 6 17:26:12 2008 (r184736) @@ -313,7 +313,6 @@ static driver_t ubsa_driver = { DRIVER_MODULE(ubsa, ushub, ubsa_driver, ubsa_devclass, NULL, 0); MODULE_DEPEND(ubsa, usb2_serial, 1, 1, 1); MODULE_DEPEND(ubsa, usb2_core, 1, 1, 1); -MODULE_DEPEND(ubsa, ucom, UCOM_MINVER, UCOM_PREFVER, UCOM_MAXVER); static int ubsa_probe(device_t dev) Modified: head/sys/dev/usb2/serial/ubser2.c ============================================================================== --- head/sys/dev/usb2/serial/ubser2.c Thu Nov 6 17:00:19 2008 (r184735) +++ head/sys/dev/usb2/serial/ubser2.c Thu Nov 6 17:26:12 2008 (r184736) @@ -227,7 +227,6 @@ static driver_t ubser_driver = { DRIVER_MODULE(ubser, ushub, ubser_driver, ubser_devclass, NULL, 0); MODULE_DEPEND(ubser, usb2_serial, 1, 1, 1); MODULE_DEPEND(ubser, usb2_core, 1, 1, 1); -MODULE_DEPEND(ubser, ucom, UCOM_MINVER, UCOM_PREFVER, UCOM_MAXVER); static int ubser_probe(device_t dev) Modified: head/sys/dev/usb2/serial/uchcom2.c ============================================================================== --- head/sys/dev/usb2/serial/uchcom2.c Thu Nov 6 17:00:19 2008 (r184735) +++ head/sys/dev/usb2/serial/uchcom2.c Thu Nov 6 17:26:12 2008 (r184736) @@ -1035,4 +1035,3 @@ static devclass_t uchcom_devclass; DRIVER_MODULE(uchcom, ushub, uchcom_driver, uchcom_devclass, NULL, 0); MODULE_DEPEND(uchcom, usb2_serial, 1, 1, 1); MODULE_DEPEND(uchcom, usb2_core, 1, 1, 1); -MODULE_DEPEND(uchcom, ucom, UCOM_MINVER, UCOM_PREFVER, UCOM_MAXVER); Modified: head/sys/dev/usb2/serial/ucycom2.c ============================================================================== --- head/sys/dev/usb2/serial/ucycom2.c Thu Nov 6 17:00:19 2008 (r184735) +++ head/sys/dev/usb2/serial/ucycom2.c Thu Nov 6 17:26:12 2008 (r184736) @@ -173,7 +173,6 @@ static driver_t ucycom_driver = { DRIVER_MODULE(ucycom, ushub, ucycom_driver, ucycom_devclass, NULL, 0); MODULE_DEPEND(ucycom, usb2_serial, 1, 1, 1); MODULE_DEPEND(ucycom, usb2_core, 1, 1, 1); -MODULE_DEPEND(ucycom, ucom, UCOM_MINVER, UCOM_PREFVER, UCOM_MAXVER); /* * Supported devices Modified: head/sys/dev/usb2/serial/ufoma2.c ============================================================================== --- head/sys/dev/usb2/serial/ufoma2.c Thu Nov 6 17:00:19 2008 (r184735) +++ head/sys/dev/usb2/serial/ufoma2.c Thu Nov 6 17:26:12 2008 (r184736) @@ -335,7 +335,6 @@ static driver_t ufoma_driver = { DRIVER_MODULE(ufoma, ushub, ufoma_driver, ufoma_devclass, NULL, 0); MODULE_DEPEND(ufoma, usb2_serial, 1, 1, 1); MODULE_DEPEND(ufoma, usb2_core, 1, 1, 1); -MODULE_DEPEND(ufoma, ucom, UCOM_MINVER, UCOM_PREFVER, UCOM_MAXVER); static int ufoma_probe(device_t dev) Modified: head/sys/dev/usb2/serial/uftdi2.c ============================================================================== --- head/sys/dev/usb2/serial/uftdi2.c Thu Nov 6 17:00:19 2008 (r184735) +++ head/sys/dev/usb2/serial/uftdi2.c Thu Nov 6 17:26:12 2008 (r184736) @@ -222,7 +222,6 @@ static driver_t uftdi_driver = { DRIVER_MODULE(uftdi, ushub, uftdi_driver, uftdi_devclass, NULL, 0); MODULE_DEPEND(uftdi, usb2_serial, 1, 1, 1); MODULE_DEPEND(uftdi, usb2_core, 1, 1, 1); -MODULE_DEPEND(uftdi, ucom, UCOM_MINVER, UCOM_PREFVER, UCOM_MAXVER); static struct usb2_device_id uftdi_devs[] = { {USB_VPI(USB_VENDOR_FTDI, USB_PRODUCT_FTDI_SERIAL_8U100AX, UFTDI_TYPE_SIO)}, Modified: head/sys/dev/usb2/serial/ugensa2.c ============================================================================== --- head/sys/dev/usb2/serial/ugensa2.c Thu Nov 6 17:00:19 2008 (r184735) +++ head/sys/dev/usb2/serial/ugensa2.c Thu Nov 6 17:26:12 2008 (r184736) @@ -172,7 +172,6 @@ static driver_t ugensa_driver = { DRIVER_MODULE(ugensa, ushub, ugensa_driver, ugensa_devclass, NULL, 0); MODULE_DEPEND(ugensa, usb2_serial, 1, 1, 1); MODULE_DEPEND(ugensa, usb2_core, 1, 1, 1); -MODULE_DEPEND(ugensa, ucom, UCOM_MINVER, UCOM_PREFVER, UCOM_MAXVER); static const struct usb2_device_id ugensa_devs[] = { {USB_VPI(USB_VENDOR_AIRPRIME, USB_PRODUCT_AIRPRIME_PC5220, 0)}, Modified: head/sys/dev/usb2/serial/uipaq2.c ============================================================================== --- head/sys/dev/usb2/serial/uipaq2.c Thu Nov 6 17:00:19 2008 (r184735) +++ head/sys/dev/usb2/serial/uipaq2.c Thu Nov 6 17:26:12 2008 (r184736) @@ -1094,7 +1094,6 @@ static driver_t uipaq_driver = { DRIVER_MODULE(uipaq, ushub, uipaq_driver, uipaq_devclass, NULL, 0); MODULE_DEPEND(uipaq, usb2_serial, 1, 1, 1); MODULE_DEPEND(uipaq, usb2_core, 1, 1, 1); -MODULE_DEPEND(uipaq, ucom, UCOM_MINVER, UCOM_PREFVER, UCOM_MAXVER); static int uipaq_probe(device_t dev) Modified: head/sys/dev/usb2/serial/umct2.c ============================================================================== --- head/sys/dev/usb2/serial/umct2.c Thu Nov 6 17:00:19 2008 (r184735) +++ head/sys/dev/usb2/serial/umct2.c Thu Nov 6 17:26:12 2008 (r184736) @@ -237,7 +237,6 @@ static driver_t umct_driver = { DRIVER_MODULE(umct, ushub, umct_driver, umct_devclass, NULL, 0); MODULE_DEPEND(umct, usb2_serial, 1, 1, 1); MODULE_DEPEND(umct, usb2_core, 1, 1, 1); -MODULE_DEPEND(umct, ucom, UCOM_MINVER, UCOM_PREFVER, UCOM_MAXVER); static int umct_probe(device_t dev) Modified: head/sys/dev/usb2/serial/umodem2.c ============================================================================== --- head/sys/dev/usb2/serial/umodem2.c Thu Nov 6 17:00:19 2008 (r184735) +++ head/sys/dev/usb2/serial/umodem2.c Thu Nov 6 17:26:12 2008 (r184736) @@ -278,7 +278,6 @@ static driver_t umodem_driver = { DRIVER_MODULE(umodem, ushub, umodem_driver, umodem_devclass, NULL, 0); MODULE_DEPEND(umodem, usb2_serial, 1, 1, 1); MODULE_DEPEND(umodem, usb2_core, 1, 1, 1); -MODULE_DEPEND(umodem, ucom, UCOM_MINVER, UCOM_PREFVER, UCOM_MAXVER); MODULE_VERSION(umodem, UMODEM_MODVER); static int Modified: head/sys/dev/usb2/serial/umoscom2.c ============================================================================== --- head/sys/dev/usb2/serial/umoscom2.c Thu Nov 6 17:00:19 2008 (r184735) +++ head/sys/dev/usb2/serial/umoscom2.c Thu Nov 6 17:26:12 2008 (r184736) @@ -296,7 +296,6 @@ static driver_t umoscom_driver = { DRIVER_MODULE(umoscom, ushub, umoscom_driver, umoscom_devclass, NULL, 0); MODULE_DEPEND(umoscom, usb2_serial, 1, 1, 1); MODULE_DEPEND(umoscom, usb2_core, 1, 1, 1); -MODULE_DEPEND(umoscom, ucom, UCOM_MINVER, UCOM_PREFVER, UCOM_MAXVER); static const struct usb2_device_id umoscom_devs[] = { {USB_VPI(USB_VENDOR_MOSCHIP, USB_PRODUCT_MOSCHIP_MCS7703, 0)} Modified: head/sys/dev/usb2/serial/uplcom2.c ============================================================================== --- head/sys/dev/usb2/serial/uplcom2.c Thu Nov 6 17:00:19 2008 (r184735) +++ head/sys/dev/usb2/serial/uplcom2.c Thu Nov 6 17:26:12 2008 (r184736) @@ -331,7 +331,6 @@ static driver_t uplcom_driver = { DRIVER_MODULE(uplcom, ushub, uplcom_driver, uplcom_devclass, NULL, 0); MODULE_DEPEND(uplcom, usb2_serial, 1, 1, 1); MODULE_DEPEND(uplcom, usb2_core, 1, 1, 1); -MODULE_DEPEND(uplcom, ucom, UCOM_MINVER, UCOM_PREFVER, UCOM_MAXVER); MODULE_VERSION(uplcom, UPLCOM_MODVER); static int Modified: head/sys/dev/usb2/serial/usb2_serial.c ============================================================================== --- head/sys/dev/usb2/serial/usb2_serial.c Thu Nov 6 17:00:19 2008 (r184735) +++ head/sys/dev/usb2/serial/usb2_serial.c Thu Nov 6 17:26:12 2008 (r184736) @@ -147,8 +147,7 @@ static struct ttydevsw usb2_com_class = .tsw_free = usb2_com_free, }; -MODULE_DEPEND(ucom, usb2_core, 1, 1, 1); -MODULE_VERSION(ucom, UCOM_MODVER); +MODULE_DEPEND(usb2_serial, usb2_core, 1, 1, 1); MODULE_VERSION(usb2_serial, 1); #define UCOM_UNIT_MAX 0x1000 /* exclusive */ Modified: head/sys/dev/usb2/serial/uvisor2.c ============================================================================== --- head/sys/dev/usb2/serial/uvisor2.c Thu Nov 6 17:00:19 2008 (r184735) +++ head/sys/dev/usb2/serial/uvisor2.c Thu Nov 6 17:26:12 2008 (r184736) @@ -256,7 +256,6 @@ static driver_t uvisor_driver = { DRIVER_MODULE(uvisor, ushub, uvisor_driver, uvisor_devclass, NULL, 0); MODULE_DEPEND(uvisor, usb2_serial, 1, 1, 1); MODULE_DEPEND(uvisor, usb2_core, 1, 1, 1); -MODULE_DEPEND(uvisor, ucom, UCOM_MINVER, UCOM_PREFVER, UCOM_MAXVER); static const struct usb2_device_id uvisor_devs[] = { {USB_VPI(USB_VENDOR_ACEECA, USB_PRODUCT_ACEECA_MEZ1000, UVISOR_FLAG_PALM4)}, Modified: head/sys/dev/usb2/serial/uvscom2.c ============================================================================== --- head/sys/dev/usb2/serial/uvscom2.c Thu Nov 6 17:00:19 2008 (r184735) +++ head/sys/dev/usb2/serial/uvscom2.c Thu Nov 6 17:26:12 2008 (r184736) @@ -283,7 +283,6 @@ static driver_t uvscom_driver = { DRIVER_MODULE(uvscom, ushub, uvscom_driver, uvscom_devclass, NULL, 0); MODULE_DEPEND(uvscom, usb2_serial, 1, 1, 1); MODULE_DEPEND(uvscom, usb2_core, 1, 1, 1); -MODULE_DEPEND(uvscom, ucom, UCOM_MINVER, UCOM_PREFVER, UCOM_MAXVER); MODULE_VERSION(uvscom, UVSCOM_MODVER); static int From sam at freebsd.org Thu Nov 6 09:31:46 2008 From: sam at freebsd.org (Sam Leffler) Date: Thu Nov 6 09:31:52 2008 Subject: svn commit: r184736 - head/sys/dev/usb2/serial In-Reply-To: <200811061726.mA6HQCfm061397@svn.freebsd.org> References: <200811061726.mA6HQCfm061397@svn.freebsd.org> Message-ID: <49132A00.6090900@freebsd.org> Warner Losh wrote: > Author: imp > Date: Thu Nov 6 17:26:12 2008 > New Revision: 184736 > URL: http://svn.freebsd.org/changeset/base/184736 > > Log: > Bring in http://perforce.freebsd.org/chv.cgi?CH=152584 from hps. > > Submitted by: hps > > Please call out the reason for a change. Indirect references easily go stale and do not help people track/understand changes when offline. Sam From imp at bsdimp.com Thu Nov 6 09:51:58 2008 From: imp at bsdimp.com (M. Warner Losh) Date: Thu Nov 6 09:52:04 2008 Subject: svn commit: r184736 - head/sys/dev/usb2/serial In-Reply-To: <49132A00.6090900@freebsd.org> References: <200811061726.mA6HQCfm061397@svn.freebsd.org> <49132A00.6090900@freebsd.org> Message-ID: <20081106.104911.514365389.imp@bsdimp.com> In message: <49132A00.6090900@freebsd.org> Sam Leffler writes: : Warner Losh wrote: : > Author: imp : > Date: Thu Nov 6 17:26:12 2008 : > New Revision: 184736 : > URL: http://svn.freebsd.org/changeset/base/184736 : > : > Log: : > Bring in http://perforce.freebsd.org/chv.cgi?CH=152584 from hps. : > : > Submitted by: hps : > : > : Please call out the reason for a change. Indirect references easily go : stale and do not help people track/understand changes when offline. Good point. I recall seeing that that's no way to do a forced commit with svn to explain. The reason for the change was that the new serial modules were referencing the old serial module name mistakenly, causing module load ordering issues. Warner From trasz at FreeBSD.org Thu Nov 6 11:17:59 2008 From: trasz at FreeBSD.org (Edward Tomasz Napierala) Date: Thu Nov 6 11:18:05 2008 Subject: svn commit: r184737 - in head: sys/cddl/contrib/opensolaris/uts/common/fs/zfs tools/regression/fstest/tests/rename Message-ID: <200811061917.mA6JHx9i063769@svn.freebsd.org> Author: trasz Date: Thu Nov 6 19:17:58 2008 New Revision: 184737 URL: http://svn.freebsd.org/changeset/base/184737 Log: Change ZFS behaviour to match UFS: when moving (rename(2)) a subdirectory from one parent directory to another, in addition to the usual access checks one also needs write access to the subdirectory being moved. Approved by: rwatson (mentor), pjd Added: head/tools/regression/fstest/tests/rename/21.t (contents, props changed) Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_acl.c Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_acl.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_acl.c Thu Nov 6 17:26:12 2008 (r184736) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_acl.c Thu Nov 6 19:17:58 2008 (r184737) @@ -1580,7 +1580,14 @@ zfs_zaccess_rename(znode_t *sdzp, znode_ /* * Rename permissions are combination of delete permission + * add file/subdir permission. + * + * BSD operating systems also require write permission + * on the directory being moved. */ + if (ZTOV(szp)->v_type == VDIR) { + if (error = zfs_zaccess(szp, ACE_WRITE_DATA, cr)) + return (error); + } /* * first make sure we do the delete portion. Added: head/tools/regression/fstest/tests/rename/21.t ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/regression/fstest/tests/rename/21.t Thu Nov 6 19:17:58 2008 (r184737) @@ -0,0 +1,38 @@ +#!/bin/sh +# $FreeBSD$ + +desc="write access to subdirectory is required to move it to another directory" + +dir=`dirname $0` +. ${dir}/../misc.sh + +echo "1..12" + +n0=`namegen` +n1=`namegen` +n2=`namegen` +n3=`namegen` + +expect 0 mkdir ${n2} 0777 +expect 0 mkdir ${n3} 0777 +cdir=`pwd` + +# Check that write permission on containing directory (${n2}) is not enough +# to move subdirectory (${n0}) from that directory. +expect 0 mkdir ${n2}/${n0} 0700 +expect EACCES -u 65534 -g 65534 rename ${n2}/${n0} ${n3}/${n0} + +expect 0 rmdir ${n2}/${n0} +expect ENOENT rmdir ${n2}/${n0} + +# Check that write permission on containing directory (${n2}) is enough +# to move file (${n0}) from that directory. +expect 0 create ${n2}/${n0} 0755 +expect 0 -u 65534 -g 65534 rename ${n2}/${n0} ${n3}/${n0} + +expect 0 unlink ${n3}/${n0} +expect ENOENT unlink ${n2}/${n0} + +expect 0 rmdir ${n3} +expect 0 rmdir ${n2} + From bms at FreeBSD.org Thu Nov 6 12:10:09 2008 From: bms at FreeBSD.org (Bruce M. Simpson) Date: Thu Nov 6 12:10:15 2008 Subject: svn commit: r184610 - in head: lib/libusb20 share/man/man4 sys/conf sys/dev/sound/pcm sys/dev/usb2 sys/dev/usb2/bluetooth sys/dev/usb2/controller sys/dev/usb2/core sys/dev/usb2/ethernet sys/dev/usb... In-Reply-To: <20081106.100323.195417660.imp@bsdimp.com> References: <20081105.144840.-432836001.imp@bsdimp.com> <864p2l5hf1.fsf@ds4.des.no> <20081106101156.GA40311@FreeBSD.org> <20081106.100323.195417660.imp@bsdimp.com> Message-ID: <49134F1C.2000102@FreeBSD.org> M. Warner Losh wrote: > ... > : > So the question is, why was this code imported at all? > : > : Seconded, especially since it says the code was reviewed by you Warner in > : the commit log. > > Unfortunately, most of my reviews were ignored, as were those of a > great many other people. There's lots of pressure for this code from > the user community. It is an experiment, one that may well ultimately > fail. Or ultimately succeed. I have every confidence in Alfred's ability to see things through. It is better that this is happening now, after the SVN import, therefore the change cost may not be so great as it may have been with CVS. One of the long-standing problems with FreeBSD is that we have been too conservative in what we've allowed into the code base. There are sound and compelling reasons why we have such rules, however, it's worth remembering that competition has been able to get a foothold in various key areas that could have been expanded into. The fact is, at the end of the day, it's about how things get used, so perhaps an experiment in user-driven development isn't so bad (for some value of "user" other than large corporate sponsor giving code away 6-12 months after something happened). cheers BMS From imp at bsdimp.com Thu Nov 6 13:14:35 2008 From: imp at bsdimp.com (M. Warner Losh) Date: Thu Nov 6 13:14:44 2008 Subject: svn commit: r184610 - in head: lib/libusb20 share/man/man4 sys/conf sys/dev/sound/pcm sys/dev/usb2 sys/dev/usb2/bluetooth sys/dev/usb2/controller sys/dev/usb2/core sys/dev/usb2/ethernet sys/dev/usb... In-Reply-To: <49134F1C.2000102@FreeBSD.org> References: <20081106101156.GA40311@FreeBSD.org> <20081106.100323.195417660.imp@bsdimp.com> <49134F1C.2000102@FreeBSD.org> Message-ID: <20081106.141336.-2063499770.imp@bsdimp.com> In message: <49134F1C.2000102@FreeBSD.org> "Bruce M. Simpson" writes: : M. Warner Losh wrote: : > ... : > : > So the question is, why was this code imported at all? : > : : > : Seconded, especially since it says the code was reviewed by you Warner in : > : the commit log. : > : > Unfortunately, most of my reviews were ignored, as were those of a : > great many other people. There's lots of pressure for this code from : > the user community. It is an experiment, one that may well ultimately : > fail. : : Or ultimately succeed. I have every confidence in Alfred's ability to : see things through. Alfred doesn't matter so much here. Not to minimize his work to date in coordination for usb2, but it won't succeed or fail based on him alone. The success or failure of this will be how well hps can cope with the code being shared. How well the FreeBSD developers adapt the code to be closer to FreeBSD standard in a number of areas. How well people are able to fix the flaws that grew into this code base as it developed in isolation. : It is better that this is happening now, after the SVN import, therefore : the change cost may not be so great as it may have been with CVS. This is true. : One of the long-standing problems with FreeBSD is that we have been too : conservative in what we've allowed into the code base. There are sound : and compelling reasons why we have such rules, however, it's worth : remembering that competition has been able to get a foothold in various : key areas that could have been expanded into. I'm not so sure I agree with this. The problems with the usb import was social, not technical. Warner From mav at FreeBSD.org Thu Nov 6 13:47:03 2008 From: mav at FreeBSD.org (Alexander Motin) Date: Thu Nov 6 13:47:15 2008 Subject: svn commit: r184738 - head/share/man/man4 Message-ID: <200811062147.mA6Ll2Vp066404@svn.freebsd.org> Author: mav Date: Thu Nov 6 21:47:02 2008 New Revision: 184738 URL: http://svn.freebsd.org/changeset/base/184738 Log: A lot of spelling fixes. Submitted by: keramida Modified: head/share/man/man4/snd_hda.4 Modified: head/share/man/man4/snd_hda.4 ============================================================================== --- head/share/man/man4/snd_hda.4 Thu Nov 6 19:17:58 2008 (r184737) +++ head/share/man/man4/snd_hda.4 Thu Nov 6 21:47:02 2008 (r184738) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd November 5, 2008 +.Dd November 6, 2008 .Dt SND_HDA 4 .Os .Sh NAME @@ -57,8 +57,8 @@ driver is a HDA bus controller driver an driver that allows the generic audio driver, .Xr sound 4 , to be used with this hardware. +Only audio functions are supported by .Nm -only supports audio functions. Modem, HDMI and other possible functions are not implemented. .Pp The @@ -68,7 +68,7 @@ Definition Audio specification and tries Universal Audio Architecture (UAA) draft (revision 0.7b) for handling audio devices. .Pp -According to HDA and UAA specifications, depending on number of HDA buses +According to HDA and UAA specifications, depending on the number of HDA buses and codecs present in system, their audio capabilities and BIOS provided configuration, the .Nm @@ -76,14 +76,16 @@ driver often provides several PCM audio For example, one device for main rear 7.1 output and inputs, one device for independent headset connectors at front and one device for SPDIF or HDMI audio input/output. -Usually that assignment may be widely tuned by using device hints. -A lot of useful information about driver operation and present audio setup may -be obtained from the driver verbose boot messages. -.Pp -You can select audio device to use by default with hw.snd.default_unit -sysctl described in -.Xr sound 4 -or explicitly specify it in appliation settings. +The assignment of audio inputs and outputs may be tuned with +.Xr device.hints 5 . +The driver's verbose boot messages provide a lot of information about +the operation of the driver and present audio setup. +.Pp +The default audio device may be tuned by setting the +.Ar hw.snd.default_unit +sysctl, as described in +.Xr sound 4 , +or explicitly specified it in application settings. .Ss Boot-time Configuration The following variables are available at boot-time through the .Xr device.hints 5 @@ -123,18 +125,26 @@ such as .Dq Li nofixedrate , will do the opposite and takes precedence. Options can be separated by whitespace and commas. -GPIO is a codecs General Purpose I/O pins which system integrators sometimes +.Dq Li GPIO Ns s +are a codec's General Purpose I/O pins which system integrators sometimes use to control external muters, amplifiers and so on. -If you have no sound or sound volume is not adequate you may need to find a -GPIO combination required for your system. -ivrefX/ovrefX options controls voltage used to power external microphones -and so on. +If you have no sound, or sound volume is not adequate, you may have to +experiment a bit with the GPIO setup to find the optimal setup for your +system. +The +.Dq Li ivref Ns Ar X +and +.Dq Li ovref Ns Ar X +options control the voltage used to power external microphones. .It Va hint.hdac.%d.msi Controls MSI (Message Signaled Interrupts) support. .It Va hint.hdac.%d.cad%d.nid%d.config Overrides codec pin configuration set by BIOS. -May be specified as a 32bit HEX value with a leading "0x" or as a set of -space separated "option=value" pairs. +May be specified as a 32-bit hexadecimal value with a leading +.Dq 0x , +or as a set of space-separated +.Dq Ar option Ns = Ns Ar value +pairs. .El .Pp Pin configuration is the UAA driver's main source of information about codec @@ -143,33 +153,36 @@ This information is usually provided by by system integrators for specific system requirements. The .Nm -driver allows users to override it to fix integrator mistakes or to use codec -in alternative ways, for example, to get stereo output and 2 inputs -instead of a single 5.1 output. -Configuration includes the following options: +driver allows users to override it to fix integrator mistakes or to use the +available codec in alternative ways (for example to get stereo output and 2 +inputs instead of a single 5.1 output). +.Pp +The following options are supported: .Bl -tag -width ".Va device=" -offset indent .It Va as Association number. -Associations are used to group individual pins to form a complex multipin +Associations are used to group individual pins to form a complex multi-pin device. -For example, to group 4 connectors for 7.1 output or to treat several +For example, to group 4 connectors for 7.1 output, or to treat several input connectors as sources for the same input device. -Can be specified as number from 0 to 15. -Association number 0 means disabled pin, number 15 is a set of independent -unassociated pins. -Each association includes only pins of the same direction (in/out) and -detected atomically - all pins or none. -For every pair of input+output associations in order of their numeration -separate PCM audio device is created. +Association numbers can be specified as numeric values from 0 to 15. +A value of 0 means disabled pin. +A value of 15 is a set of independent unassociated pins. +Each association includes only pins of the same direction (in/out) and is +detected atomically (all pins or none). +A separate PCM audio device is created for every pair of input and +output associations. .It Va seq Sequence number. -This unique inside every association number used to order pins inside -association. -Can be specified as a number from 0 to 15. -Sequence number 15 for output associations has also special meaning. -Output pin with sequence number 15 and device type Headhones will duplicate -(with automatic mute if jack detection is supported) the first pin in that -association. +A unique, per-association number used to order pins inside the +particular association. +Sequence numbers can be specified as numeric values from 0 to 15. +.Pp +The sequence number 15 has a special meaning for output associations. +Output pins with this number and device type +.Dq Ar Headphones +will duplicate (with automatic mute if jack detection is supported) the +first pin in that association. .It Va device Device type. Can be specified as a number from 0 to 15 or as a name: @@ -193,27 +206,31 @@ or The device type also describes the pin direction (in/out). For example, .Dq Li CD -always means input pin, while +always means an input pin, while .Dq Li Headphones -always means output. +always means an output. .It Va conn Connection type. -Can be specified as a number from 0 to 3 or as a name: +Can be specified as a number from 0 to 3. +The connection type can also be specified as one of the special names .Dq Li Jack , .Dq Li None , .Dq Li Fixed , or .Dq Li Both . -Pins with +Pins with a connection type of .Dq Li None -connection type are disabled. +are disabled. .It Va ctype Connector physical type. Can be specified as a number from 0 to 15. -This is a reference only value which is ignored by the driver. +This is a reference only value. +It is ignored by the +.Nm +driver. .It Va color Connector color. -Can be specified as a number from 0 to 15 or as a name: +Can be specified as a number from 0 to 15 or as one of the names .Dq Li Unknown , .Dq Li Black , .Dq Li Grey , @@ -231,16 +248,22 @@ Can be specified as a number from 0 to 1 .Dq Li White , or .Dq Li Other . -This is a reference only value which is ignored by the driver. +This is a reference only value. +It is ignored by the +.Nm +driver. .It Va loc Connector physical location. Can be specified as a number from 0 to 63. -This is a reference only value which is ignored by the driver. +This is a reference only value. +It is ignored by the +.Nm +driver. .It Va misc Misc bits. Can be specified as a number from 0 to 15. -Bit 0, if set, tells that jack detection on this pin supported by the codec -is not implemented in hardware. +Bit 0 has a special meaning. When set it means that jack detection is +not implemented in hardware. .El .Ss Runtime Configuration The following @@ -250,8 +273,9 @@ variables are available in addition to t devices: .Bl -tag -width ".Va dev.hdac.%d.polling" -offset indent .It Va dev.hdac.%d.polling -Enables polling mode, where the driver operates by querying the device -state on timer ticks using +Enables polling mode. +In this mode the driver operates by querying the device state on timer +ticks using .Xr callout 9 instead of interrupts. Polling is disabled by default. @@ -264,14 +288,16 @@ Setting this to a non-zero value dumps t capabilities and jack sense status to console and syslog. .El .Sh EXAMPLES -Taking HP Compaq DX2300 with Realtek ALC888 HDA codec for example. It has two -audio connectors on a front side, three audio connectors on a rear side and one -internal speaker. According to verbose driver output and codec datasheet, -codec has five stereo DACs and two stereo ADCs, all of them are routable to -any codec pin (external connector). All codec pins are reversible. +Taking HP Compaq DX2300 with Realtek ALC888 HDA codec for example. +This system has two audio connectors on a front side, three audio connectors +on a rear side and one internal speaker. +According to verbose driver output and the codec datasheet, +this codec has five stereo DACs and two stereo ADCs, all of them are routable to +any codec pin (external connector). +All codec pins are reversible (could be configured either as input or output). .Pp So high codec uniformity and flexibility allow driver to configure it in many -deferent ways, depending on requested pins usage decribed by pins configuration. +defferent ways, depending on requested pins usage decribed by pins configuration. Driver reports such default pin configuration when verbose messages enabled: .Bd -literal hdac0: nid 20 0x01014020 as 2 seq 0 Line-out Jack jack 1 loc 1 color Green misc 0 @@ -308,49 +334,86 @@ hdac0: Pin nid=26 seq=1 hdac0: Pin nid=25 seq=15 .Ed .Pp -Each pcm device uses two associations: one for playback and one for recording. -Associations processed and assigned to pcm devices in order of their numbers. -It means that association #0 (1) will become pcm0 device playback, using -internal speaker and headphones jack with speaker automute on headphones -connection. -Association #1 (2) will become pcm1 playback, using the Line-out jack. -Association #2 (3) will become pcm0 recording, using external microphones and -line-in jack. -.Pp -Driver provides extensive set of verbose messages to diagnose it's operation -logic and description of resulted codec configuration. -.Pp -Using device.hints it is possible to modify existing pins configuration to -create broad range of different audio setups. Here is examples of some setups -possible for the described hardware: +Each +.Xr pcm 4 +device uses two associations: one for playback and one for recording. +Associations processed and assigned to +.Xr pcm 4 +devices in increasing numerical order. +In this case association #0 (1) will become +.Li pcm0 +device playback, using the internal speakers and +.Ar Headphones +jack with speaker automute on the headphones jack connection. +Association #1 (2) will become +.Li pcm1 +playback, using the +.Ar Line-out +jack. +Association #2 (3) will become +.Li pcm0 +recording, using the external microphones and the +.Ar Line-in +jack. +.Pp +The +.Nm +driver provides extensive verbose messages to diagnose its operation +logic and describe its current codec configuration. +.Pp +Using +.Xr device.hints 5 +it is possible to modify the configuration of the existing pins, +allowing a broad range of different audio setups. +Here are a few examples of some setups possible for this particular +hardware: .Ss Example 1 -Setting +Setting the +.Xr device.hints 5 +options .Bd -literal hint.hdac.0.cad0.nid20.config="as=1" hint.hdac.0.cad0.nid21.config="as=2" .Ed .Pp -will swap line-out and speaker functions. So pcm0 device will play to the -line-out and headphones jacks with line-out automute on headphones connection. -Recording on pcm0 will go from two external microphones and line-in jacks. -pcm1 playback will go to the internal speaker. +will swap line-out and speaker functions. +So the +.Li pcm0 +device will play to the line-out and headphones jacks. Line-out will +be muted on the headphones jack connection. +Recording on +.Li pcm0 +will go from two external microphones and line-in jacks. +.Li pcm1 +playback will go to the internal speaker. .Pp .Ss Example 2 -Setting +Setting the +.Xr device.hints 5 +options .Bd -literal hint.hdac.0.cad0.nid20.config="as=1 seq=15 device=Headphones" hint.hdac.0.cad0.nid27.config="as=2 seq=0" hint.hdac.0.cad0.nid25.config="as=4 seq=0" .Ed .Pp -will split headphones and one of mics to separate device. So pcm0 device will -play to the internal speaker and line-out jack with speaker automute on -line-out connection. Recording on pcm0 will go from one external microphone -and line-in jacks. pcm1 will be completely dedicated to headset (headphones and -mic) connected to the front connectors. +will split the headphones and one of the microphones to a separate device. +The +.Li pcm0 +device will play to the internal speaker and to the line-out jack, with +speaker automute on the line-out jack connection. +Recording on +.Li pcm0 +will use input from one external microphone and the line-in jacks. +The +.Li pcm1 +device will be completely dedicated to a headset (headphones and mic) +connected to the front connectors. .Pp .Ss Example 3 -Setting +Setting the +.Xr device.hints 5 +options .Bd -literal hint.hdac.0.cad0.nid20.config="as=1 seq=0" hint.hdac.0.cad0.nid26.config="as=2 seq=0" @@ -360,12 +423,21 @@ hint.hdac.0.cad0.nid24.config="as=5 seq= hint.hdac.0.cad0.nid21.config="as=6 seq=0" .Ed .Pp -will give 4 independent devices: pcm0 - line-out + line-in, pcm1 - headphones -+ mic, pcm2 - additional line-out via retasked rear mic jack, pcm3 - internal -speaker. +will give 4 independent devices: +.Li pcm0 +.Pq line-out and line-in , +.Li pcm1 +.Pq headphones and mic , +.Li pcm2 +.Pq additional line-out via retasked rear mic jack , +and +.Li pcm3 +.Pq internal speaker . .Pp .Ss Example 4 -Setting +Setting the +.Xr device.hints 5 +options .Bd -literal hint.hdac.0.cad0.nid20.config="as=1 seq=0" hint.hdac.0.cad0.nid24.config="as=1 seq=1 device=Line-out" @@ -373,10 +445,13 @@ hint.hdac.0.cad0.nid26.config="as=1 seq= hint.hdac.0.cad0.nid21.config="as=2 seq=0" .Ed .Pp -will give 2 devices: pcm0 - 5.1 playback via 3 rear (line-out and retasked -mic and line-in) connectors and front headphones with rear connectors automute -on headphones connection + front mic recording. pcm1 - internal speaker -playback. +will give 2 devices: +.Li pcm0 +for 5.1 playback via 3 rear connectors (line-out and retasked +mic and line-in) and headset (headphones and mic) at front connectors. +.Li pcm1 +for internal speaker playback. +On headphones connection rear connectors will be muted. .Sh HARDWARE The .Nm @@ -521,9 +596,10 @@ driver was written by and .An Alexander Motin Aq mav@FreeBSD.org . This manual page was written by -.An Joel Dahl Aq joel@FreeBSD.org +.An Joel Dahl Aq joel@FreeBSD.org , +.An Alexander Motin Aq mav@FreeBSD.org and -.An Alexander Motin Aq mav@FreeBSD.org . +.An Giorgos Keramidas Aq keramida@FreeBSD.org . .Sh BUGS A few Hardware/OEM vendors tend to screw up BIOS settings, thus rendering the @@ -533,4 +609,4 @@ driver useless, which usually results in driver seems to attach and work, but without any sound. .Pp Due to OSS limitation multichannel (not multidevice) playback is not -supported. \ No newline at end of file +supported. From mav at FreeBSD.org Thu Nov 6 13:49:24 2008 From: mav at FreeBSD.org (Alexander Motin) Date: Thu Nov 6 13:49:35 2008 Subject: svn commit: r184695 - head/share/man/man4 In-Reply-To: <87r65okf7n.fsf@kobe.laptop> References: <200811051712.mA5HCIP7032611@svn.freebsd.org> <87r65okf7n.fsf@kobe.laptop> Message-ID: <49136661.9060004@FreeBSD.org> Hi. Giorgos Keramidas wrote: > There are a few places where we can probably improve the manpage a bit > more. I am not sure I understand *all* the technical details of pins > and association numbers, but does the following look like something > worth committing? I have changed some incorrect peaces, but mostly committed as is. Thanks! -- Alexander Motin From julian at FreeBSD.org Thu Nov 6 14:11:58 2008 From: julian at FreeBSD.org (Julian Elischer) Date: Thu Nov 6 14:12:10 2008 Subject: svn commit: r184739 - in stable/7/sys: . modules/cxgb net netinet Message-ID: <200811062211.mA6MBvdU066984@svn.freebsd.org> Author: julian Date: Thu Nov 6 22:11:57 2008 New Revision: 184739 URL: http://svn.freebsd.org/changeset/base/184739 Log: MFC a rewrite of rt_check(). also revert the addition of rt_check_fib() which we discovered is not needed. fixes some hangs people have seen Approved by: re (ken) Modified: stable/7/sys/ (props changed) stable/7/sys/modules/cxgb/ (props changed) stable/7/sys/net/if_atmsubr.c stable/7/sys/net/if_fwsubr.c stable/7/sys/net/if_iso88025subr.c stable/7/sys/net/route.c stable/7/sys/net/route.h stable/7/sys/netinet/if_ether.c stable/7/sys/netinet/in_rmx.c stable/7/sys/netinet/in_var.h Modified: stable/7/sys/net/if_atmsubr.c ============================================================================== --- stable/7/sys/net/if_atmsubr.c Thu Nov 6 21:47:02 2008 (r184738) +++ stable/7/sys/net/if_atmsubr.c Thu Nov 6 22:11:57 2008 (r184739) @@ -158,8 +158,7 @@ atm_output(struct ifnet *ifp, struct mbu * check route */ if (rt0 != NULL) { - error = rt_check_fib(&rt, &rt0, - dst, rt0->rt_fibnum); + error = rt_check(&rt, &rt0, dst); if (error) goto bad; RT_UNLOCK(rt); Modified: stable/7/sys/net/if_fwsubr.c ============================================================================== --- stable/7/sys/net/if_fwsubr.c Thu Nov 6 21:47:02 2008 (r184738) +++ stable/7/sys/net/if_fwsubr.c Thu Nov 6 22:11:57 2008 (r184739) @@ -103,7 +103,7 @@ firewire_output(struct ifnet *ifp, struc } if (rt0 != NULL) { - error = rt_check_fib(&rt, &rt0, dst, rt0->rt_fibnum); + error = rt_check(&rt, &rt0, dst); if (error) goto bad; RT_UNLOCK(rt); Modified: stable/7/sys/net/if_iso88025subr.c ============================================================================== --- stable/7/sys/net/if_iso88025subr.c Thu Nov 6 21:47:02 2008 (r184738) +++ stable/7/sys/net/if_iso88025subr.c Thu Nov 6 22:11:57 2008 (r184739) @@ -259,8 +259,7 @@ iso88025_output(ifp, m, dst, rt0) /* Calculate routing info length based on arp table entry */ /* XXX any better way to do this ? */ if (rt0 != NULL) { -/* XXX MRT *//* Guess only */ - error = rt_check_fib(&rt, &rt0, dst, rt0->rt_fibnum); + error = rt_check(&rt, &rt0, dst); if (error) goto bad; RT_UNLOCK(rt); Modified: stable/7/sys/net/route.c ============================================================================== --- stable/7/sys/net/route.c Thu Nov 6 21:47:02 2008 (r184738) +++ stable/7/sys/net/route.c Thu Nov 6 22:11:57 2008 (r184739) @@ -1549,84 +1549,120 @@ rtinit(struct ifaddr *ifa, int cmd, int * final destination if directly reachable); * *lrt0 points to the cached route to the final destination; * *lrt is not meaningful; - * fibnum is the index to the correct network fib for this packet + * (*lrt0 has no ref held on it by us so REMREF is not needed. + * Refs only account for major structural references and not usages, + * which is actually a bit of a problem.) * * === Operation === * If the route is marked down try to find a new route. If the route * to the gateway is gone, try to setup a new route. Otherwise, * if the route is marked for packets to be rejected, enforce that. + * Note that rtalloc returns an rtentry with an extra REF that we may + * need to lose. * * === On return === * *dst is unchanged; * *lrt0 points to the (possibly new) route to the final destination - * *lrt points to the route to the next hop + * *lrt points to the route to the next hop [LOCKED] * * Their values are meaningful ONLY if no error is returned. + * + * To follow this you have to remember that: + * RT_REMREF reduces the reference count by 1 but doesn't check it for 0 (!) + * RTFREE_LOCKED includes an RT_REMREF (or an rtfree if refs == 1) + * and an RT_UNLOCK + * RTFREE does an RT_LOCK and an RTFREE_LOCKED + * The gwroute pointer counts as a reference on the rtentry to which it points. + * so when we add it we use the ref that rtalloc gives us and when we lose it + * we need to remove the reference. + * RT_TEMP_UNLOCK does an RT_ADDREF before freeing the lock, and + * RT_RELOCK locks it (it can't have gone away due to the ref) and + * drops the ref, possibly freeing it and zeroing the pointer if + * the ref goes to 0 (unlocking in the process). */ int rt_check(struct rtentry **lrt, struct rtentry **lrt0, struct sockaddr *dst) { - return (rt_check_fib(lrt, lrt0, dst, 0)); -} - -int -rt_check_fib(struct rtentry **lrt, struct rtentry **lrt0, struct sockaddr *dst, - u_int fibnum) -{ struct rtentry *rt; struct rtentry *rt0; - int error; + u_int fibnum; KASSERT(*lrt0 != NULL, ("rt_check")); - rt = rt0 = *lrt0; + rt0 = *lrt0; + rt = NULL; + fibnum = rt0->rt_fibnum; /* NB: the locking here is tortuous... */ - RT_LOCK(rt); - if ((rt->rt_flags & RTF_UP) == 0) { - RT_UNLOCK(rt); - rt = rtalloc1_fib(dst, 1, 0UL, fibnum); - if (rt != NULL) { - RT_REMREF(rt); - /* XXX what about if change? */ - } else + RT_LOCK(rt0); +retry: + if (rt0 && (rt0->rt_flags & RTF_UP) == 0) { + /* Current rt0 is useless, try get a replacement. */ + RT_UNLOCK(rt0); + rt0 = NULL; + } + if (rt0 == NULL) { + rt0 = rtalloc1_fib(dst, 1, 0UL, fibnum); + if (rt0 == NULL) { return (EHOSTUNREACH); - rt0 = rt; + } + RT_REMREF(rt0); /* don't need the reference. */ } - /* XXX BSD/OS checks dst->sa_family != AF_NS */ - if (rt->rt_flags & RTF_GATEWAY) { - if (rt->rt_gwroute == NULL) - goto lookup; - rt = rt->rt_gwroute; - RT_LOCK(rt); /* NB: gwroute */ - if ((rt->rt_flags & RTF_UP) == 0) { - RTFREE_LOCKED(rt); /* unlock gwroute */ - rt = rt0; - rt0->rt_gwroute = NULL; - lookup: - RT_UNLOCK(rt0); -/* XXX MRT link level looked up in table 0 */ - rt = rtalloc1_fib(rt->rt_gateway, 1, 0UL, 0); - if (rt == rt0) { - RT_REMREF(rt0); - RT_UNLOCK(rt0); + + if (rt0->rt_flags & RTF_GATEWAY) { + if ((rt = rt0->rt_gwroute) != NULL) { + RT_LOCK(rt); /* NB: gwroute */ + if ((rt->rt_flags & RTF_UP) == 0) { + /* gw route is dud. ignore/lose it */ + RTFREE_LOCKED(rt); /* unref (&unlock) gwroute */ + rt = rt0->rt_gwroute = NULL; + } + } + + if (rt == NULL) { /* NOT AN ELSE CLAUSE */ + RT_TEMP_UNLOCK(rt0); /* MUST return to undo this */ + rt = rtalloc1_fib(rt0->rt_gateway, 1, 0UL, fibnum); + if ((rt == rt0) || (rt == NULL)) { + /* the best we can do is not good enough */ + if (rt) { + RT_REMREF(rt); /* assumes ref > 0 */ + RT_UNLOCK(rt); + } + RTFREE(rt0); /* lock, unref, (unlock) */ return (ENETUNREACH); } - RT_LOCK(rt0); - if (rt0->rt_gwroute != NULL) - RTFREE(rt0->rt_gwroute); - rt0->rt_gwroute = rt; - if (rt == NULL) { - RT_UNLOCK(rt0); - return (EHOSTUNREACH); + /* + * Relock it and lose the added reference. + * All sorts of things could have happenned while we + * had no lock on it, so check for them. + */ + RT_RELOCK(rt0); + if (rt0 == NULL || ((rt0->rt_flags & RTF_UP) == 0)) + /* Ru-roh.. what we had is no longer any good */ + goto retry; + /* + * While we were away, someone replaced the gateway. + * Since a reference count is involved we can't just + * overwrite it. + */ + if (rt0->rt_gwroute) { + if (rt0->rt_gwroute != rt) { + RTFREE_LOCKED(rt); + goto retry; + } + } else { + rt0->rt_gwroute = rt; } } + RT_LOCK_ASSERT(rt); RT_UNLOCK(rt0); + } else { + /* think of rt as having the lock from now on.. */ + rt = rt0; } /* XXX why are we inspecting rmx_expire? */ - error = (rt->rt_flags & RTF_REJECT) && - (rt->rt_rmx.rmx_expire == 0 || - time_uptime < rt->rt_rmx.rmx_expire); - if (error) { + if ((rt->rt_flags & RTF_REJECT) && + (rt->rt_rmx.rmx_expire == 0 || + time_uptime < rt->rt_rmx.rmx_expire)) { RT_UNLOCK(rt); return (rt == rt0 ? EHOSTDOWN : EHOSTUNREACH); } Modified: stable/7/sys/net/route.h ============================================================================== --- stable/7/sys/net/route.h Thu Nov 6 21:47:02 2008 (r184738) +++ stable/7/sys/net/route.h Thu Nov 6 22:11:57 2008 (r184739) @@ -312,19 +312,35 @@ struct rt_addrinfo { } while (0) #define RTFREE_LOCKED(_rt) do { \ - if ((_rt)->rt_refcnt <= 1) \ - rtfree(_rt); \ - else { \ - RT_REMREF(_rt); \ - RT_UNLOCK(_rt); \ - } \ - /* guard against invalid refs */ \ - _rt = 0; \ - } while (0) + if ((_rt)->rt_refcnt <= 1) \ + rtfree(_rt); \ + else { \ + RT_REMREF(_rt); \ + RT_UNLOCK(_rt); \ + } \ + /* guard against invalid refs */ \ + _rt = 0; \ +} while (0) #define RTFREE(_rt) do { \ - RT_LOCK(_rt); \ - RTFREE_LOCKED(_rt); \ - } while (0) + RT_LOCK(_rt); \ + RTFREE_LOCKED(_rt); \ +} while (0) + +#define RT_TEMP_UNLOCK(_rt) do { \ + RT_ADDREF(_rt); \ + RT_UNLOCK(_rt); \ +} while (0) + +#define RT_RELOCK(_rt) do { \ + RT_LOCK(_rt); \ + if ((_rt)->rt_refcnt <= 1) { \ + rtfree(_rt); \ + _rt = 0; /* signal that it went away */ \ + } else { \ + RT_REMREF(_rt); \ + /* note that _rt is still valid */ \ + } \ +} while (0) extern struct radix_node_head *rt_tables[][AF_MAX+1]; @@ -352,6 +368,7 @@ int rt_setgate(struct rtentry *, struct int rtexpunge(struct rtentry *); void rtfree(struct rtentry *); +int rt_check(struct rtentry **, struct rtentry **, struct sockaddr *); /* XXX MRT COMPAT VERSIONS THAT SET UNIVERSE to 0 */ /* Thes are used by old code not yet converted to use multiple FIBS */ @@ -366,7 +383,6 @@ void rtredirect(struct sockaddr *, stru int rtrequest(int, struct sockaddr *, struct sockaddr *, struct sockaddr *, int, struct rtentry **); int rtrequest1(int, struct rt_addrinfo *, struct rtentry **); -int rt_check(struct rtentry **, struct rtentry **, struct sockaddr *); /* defaults to "all" FIBs */ int rtinit_fib(struct ifaddr *, int, int); @@ -385,7 +401,6 @@ void rtredirect_fib(struct sockaddr *, int rtrequest_fib(int, struct sockaddr *, struct sockaddr *, struct sockaddr *, int, struct rtentry **, u_int); int rtrequest1_fib(int, struct rt_addrinfo *, struct rtentry **, u_int); -int rt_check_fib(struct rtentry **, struct rtentry **, struct sockaddr *, u_int); #include typedef void (*rtevent_arp_update_fn)(void *, struct rtentry *, uint8_t *, struct sockaddr *); Modified: stable/7/sys/netinet/if_ether.c ============================================================================== --- stable/7/sys/netinet/if_ether.c Thu Nov 6 21:47:02 2008 (r184738) +++ stable/7/sys/netinet/if_ether.c Thu Nov 6 22:11:57 2008 (r184739) @@ -362,7 +362,7 @@ arpresolve(struct ifnet *ifp, struct rte struct rtentry *rt = NULL; struct sockaddr_dl *sdl; int error; - int fibnum = 0; + int fibnum = -1; if (m) { @@ -379,7 +379,7 @@ arpresolve(struct ifnet *ifp, struct rte if (rt0 != NULL) { /* Look for a cached arp (ll) entry. */ - error = in_rt_check(&rt, &rt0, dst, fibnum); + error = rt_check(&rt, &rt0, dst); if (error) { m_freem(m); return error; @@ -388,14 +388,23 @@ arpresolve(struct ifnet *ifp, struct rte if (la == NULL) RT_UNLOCK(rt); } + + /* + * If we had no mbuf and no route, then hope the caller + * has a fib in mind because we are running out of ideas. + * I think this should not happen in current code. + * (kmacy would know). + */ + if (fibnum == -1) + fibnum = curthread->td_proc->p_fibnum; /* last gasp */ + if (la == NULL) { /* * We enter this block if rt0 was NULL, - * or if rt found by in_rt_check() didn't have llinfo. - * we should get a cloned route, which since it should - * come from the local interface should have a ll entry. - * if may be incoplete but that's ok. - * XXXMRT if we haven't found a fibnum is that OK? + * or if rt found by rt_check() didn't have llinfo. + * We should get a cloned route from the local interface, + * so it should have an ll entry. + * It may be incomplete but that's ok. */ rt = arplookup(SIN(dst)->sin_addr.s_addr, 1, 0, fibnum); if (rt == NULL) { Modified: stable/7/sys/netinet/in_rmx.c ============================================================================== --- stable/7/sys/netinet/in_rmx.c Thu Nov 6 21:47:02 2008 (r184738) +++ stable/7/sys/netinet/in_rmx.c Thu Nov 6 22:11:57 2008 (r184739) @@ -465,13 +465,6 @@ in_rtalloc1(struct sockaddr *dst, int re return (rtalloc1_fib(dst, report, ignflags, fibnum)); } -int -in_rt_check(struct rtentry **lrt, struct rtentry **lrt0, - struct sockaddr *dst, u_int fibnum) -{ - return (rt_check_fib(lrt, lrt0, dst, fibnum)); -} - void in_rtredirect(struct sockaddr *dst, struct sockaddr *gateway, Modified: stable/7/sys/netinet/in_var.h ============================================================================== --- stable/7/sys/netinet/in_var.h Thu Nov 6 21:47:02 2008 (r184738) +++ stable/7/sys/netinet/in_var.h Thu Nov 6 22:11:57 2008 (r184739) @@ -314,7 +314,6 @@ void in_rtredirect(struct sockaddr *, s struct sockaddr *, int, struct sockaddr *, u_int); int in_rtrequest(int, struct sockaddr *, struct sockaddr *, struct sockaddr *, int, struct rtentry **, u_int); -int in_rt_check(struct rtentry **, struct rtentry **, struct sockaddr *, u_int); #if 0 int in_rt_getifa(struct rt_addrinfo *, u_int fibnum); From trasz at FreeBSD.org Thu Nov 6 14:28:04 2008 From: trasz at FreeBSD.org (Edward Tomasz Napierala) Date: Thu Nov 6 14:28:15 2008 Subject: svn commit: r184740 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs Message-ID: <200811062228.mA6MS45S067374@svn.freebsd.org> Author: trasz Date: Thu Nov 6 22:28:04 2008 New Revision: 184740 URL: http://svn.freebsd.org/changeset/base/184740 Log: Backoff the last patch. It was overly restrictive - we want to check for write permission on target only when moving the target between two directories. Approved by: rwatson (mentor) Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_acl.c Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_acl.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_acl.c Thu Nov 6 22:11:57 2008 (r184739) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_acl.c Thu Nov 6 22:28:04 2008 (r184740) @@ -1580,14 +1580,7 @@ zfs_zaccess_rename(znode_t *sdzp, znode_ /* * Rename permissions are combination of delete permission + * add file/subdir permission. - * - * BSD operating systems also require write permission - * on the directory being moved. */ - if (ZTOV(szp)->v_type == VDIR) { - if (error = zfs_zaccess(szp, ACE_WRITE_DATA, cr)) - return (error); - } /* * first make sure we do the delete portion. From peter at FreeBSD.org Thu Nov 6 14:32:20 2008 From: peter at FreeBSD.org (Peter Wemm) Date: Thu Nov 6 14:32:26 2008 Subject: svn commit: r184741 - in stable/7/sys: . kern modules/cxgb sys Message-ID: <200811062232.mA6MWKD4067493@svn.freebsd.org> Author: peter Date: Thu Nov 6 22:32:19 2008 New Revision: 184741 URL: http://svn.freebsd.org/changeset/base/184741 Log: MFC: r184492 - add offset / fileid / fsid to KERN_PROC_VMMAP sysctl for the benefit of valgrind. Approved by: re (kib) Modified: stable/7/sys/ (props changed) stable/7/sys/kern/kern_proc.c stable/7/sys/modules/cxgb/ (props changed) stable/7/sys/sys/user.h Modified: stable/7/sys/kern/kern_proc.c ============================================================================== --- stable/7/sys/kern/kern_proc.c Thu Nov 6 22:28:04 2008 (r184740) +++ stable/7/sys/kern/kern_proc.c Thu Nov 6 22:32:19 2008 (r184741) @@ -1346,6 +1346,8 @@ sysctl_kern_proc_vmmap(SYSCTL_HANDLER_AR unsigned int last_timestamp; char *fullpath, *freepath; struct kinfo_vmentry *kve; + struct vattr va; + struct ucred *cred; int error, *name; struct vnode *vp; struct proc *p; @@ -1405,6 +1407,8 @@ sysctl_kern_proc_vmmap(SYSCTL_HANDLER_AR lobj = tobj; } + kve->kve_fileid = 0; + kve->kve_fsid = 0; freepath = NULL; fullpath = ""; if (lobj) { @@ -1446,6 +1450,11 @@ sysctl_kern_proc_vmmap(SYSCTL_HANDLER_AR curthread); vn_fullpath(curthread, vp, &fullpath, &freepath); + cred = curthread->td_ucred; + if (VOP_GETATTR(vp, &va, cred) == 0) { + kve->kve_fileid = va.va_fileid; + kve->kve_fsid = va.va_fsid; + } vput(vp); VFS_UNLOCK_GIANT(vfslocked); } @@ -1457,6 +1466,7 @@ sysctl_kern_proc_vmmap(SYSCTL_HANDLER_AR kve->kve_start = (void*)entry->start; kve->kve_end = (void*)entry->end; + kve->kve_offset = (off_t)entry->offset; if (entry->protection & VM_PROT_READ) kve->kve_protection |= KVME_PROT_READ; Modified: stable/7/sys/sys/user.h ============================================================================== --- stable/7/sys/sys/user.h Thu Nov 6 22:28:04 2008 (r184740) +++ stable/7/sys/sys/user.h Thu Nov 6 22:32:19 2008 (r184741) @@ -320,7 +320,10 @@ struct kinfo_vmentry { int kve_shadow_count; /* VM obj shadow count. */ char kve_path[PATH_MAX]; /* Path to VM obj, if any. */ void *_kve_pspare[8]; /* Space for more stuff. */ - int _kve_ispare[8]; /* Space for more stuff. */ + off_t kve_offset; /* Mapping offset in object */ + uint64_t kve_fileid; /* inode number of vnode */ + dev_t kve_fsid; /* dev_t of vnode location */ + int _kve_ispare[3]; /* Space for more stuff. */ }; /* From mlaier at FreeBSD.org Thu Nov 6 15:55:29 2008 From: mlaier at FreeBSD.org (Max Laier) Date: Thu Nov 6 15:55:35 2008 Subject: svn commit: r184742 - head/usr.bin/du Message-ID: <200811062355.mA6NtTed068948@svn.freebsd.org> Author: mlaier Date: Thu Nov 6 23:55:28 2008 New Revision: 184742 URL: http://svn.freebsd.org/changeset/base/184742 Log: Restore (intmax_t) casts I lost during the last change & unbreak the build. Modified: head/usr.bin/du/du.c Modified: head/usr.bin/du/du.c ============================================================================== --- head/usr.bin/du/du.c Thu Nov 6 22:32:19 2008 (r184741) +++ head/usr.bin/du/du.c Thu Nov 6 23:55:28 2008 (r184742) @@ -273,8 +273,9 @@ main(int argc, char *argv[]) (void)printf("\t%s\n", p->fts_path); } else { (void)printf("%jd\t%s\n", - howmany(p->fts_bignum * cblocksize, - blocksize), p->fts_path); + (intmax_t)howmany(p->fts_bignum * + cblocksize, blocksize), + p->fts_path); } } break; @@ -304,8 +305,9 @@ main(int argc, char *argv[]) (void)printf("\t%s\n", p->fts_path); } else { (void)printf("%jd\t%s\n", - howmany(curblocks * cblocksize, - blocksize), p->fts_path); + (intmax_t)howmany(curblocks * + cblocksize, blocksize), + p->fts_path); } } From keramida at freebsd.org Thu Nov 6 19:36:07 2008 From: keramida at freebsd.org (Giorgos Keramidas) Date: Thu Nov 6 19:36:14 2008 Subject: svn commit: r184695 - head/share/man/man4 In-Reply-To: <49136661.9060004@FreeBSD.org> (Alexander Motin's message of "Thu, 06 Nov 2008 23:49:21 +0200") References: <200811051712.mA5HCIP7032611@svn.freebsd.org> <87r65okf7n.fsf@kobe.laptop> <49136661.9060004@FreeBSD.org> Message-ID: <87zlkcnr6s.fsf@kobe.laptop> On Thu, 06 Nov 2008 23:49:21 +0200, Alexander Motin wrote: > Giorgos Keramidas wrote: >> There are a few places where we can probably improve the manpage a bit >> more. I am not sure I understand *all* the technical details of pins >> and association numbers, but does the following look like something >> worth committing? > > I have changed some incorrect peaces, but mostly committed as is. Excellent, thanks! I knew you could do a better job with the manpage text than some of the guesses I had to make :) From yongari at FreeBSD.org Thu Nov 6 23:02:29 2008 From: yongari at FreeBSD.org (Pyun YongHyeon) Date: Thu Nov 6 23:02:41 2008 Subject: svn commit: r184743 - head/sys/dev/age Message-ID: <200811070702.mA772TN7076504@svn.freebsd.org> Author: yongari Date: Fri Nov 7 07:02:28 2008 New Revision: 184743 URL: http://svn.freebsd.org/changeset/base/184743 Log: Remove informational messages left. These messages were intended to show up in verbose boot mode. Reported by: pluknet ( pluknet<> gmail DOT com ) Modified: head/sys/dev/age/if_age.c Modified: head/sys/dev/age/if_age.c ============================================================================== --- head/sys/dev/age/if_age.c Thu Nov 6 23:55:28 2008 (r184742) +++ head/sys/dev/age/if_age.c Fri Nov 7 07:02:28 2008 (r184743) @@ -429,17 +429,17 @@ age_get_macaddr(struct age_softc *sc) ea[1] &= 0xFFFF; if ((ea[0] == 0 && ea[1] == 0) || (ea[0] == 0xFFFFFFFF && ea[1] == 0xFFFF)) { - if (1 || bootverbose) + if (bootverbose) device_printf(sc->age_dev, "invalid ethernet address " "returned from VPD.\n"); vpd_error = EINVAL; } } - if (vpd_error != 0 && (1 || bootverbose)) + if (vpd_error != 0 && (bootverbose)) device_printf(sc->age_dev, "VPD access failure!\n"); } else { - if (1 || bootverbose) + if (bootverbose) device_printf(sc->age_dev, "PCI VPD capability not found!\n"); } @@ -538,7 +538,7 @@ age_attach(device_t dev) sc->age_rev = pci_get_revid(dev); sc->age_chip_rev = CSR_READ_4(sc, AGE_MASTER_CFG) >> MASTER_CHIP_REV_SHIFT; - if (1 || bootverbose) { + if (bootverbose) { device_printf(dev, "PCI device revision : 0x%04x\n", sc->age_rev); device_printf(dev, "Chip id/revision : 0x%04x\n", sc->age_chip_rev); @@ -565,7 +565,7 @@ age_attach(device_t dev) /* Allocate IRQ resources. */ msixc = pci_msix_count(dev); msic = pci_msi_count(dev); - if (1 || bootverbose) { + if (bootverbose) { device_printf(dev, "MSIX count : %d\n", msixc); device_printf(dev, "MSI count : %d\n", msic); } @@ -612,7 +612,7 @@ age_attach(device_t dev) /* Max payload size. */ sc->age_dma_wr_burst = ((burst >> 5) & 0x07) << DMA_CFG_WR_BURST_SHIFT; - if (1 || bootverbose) { + if (bootverbose) { device_printf(dev, "Read request size : %d bytes.\n", 128 << ((burst >> 12) & 0x07)); device_printf(dev, "TLP payload size : %d bytes.\n", @@ -2685,7 +2685,7 @@ age_init_locked(struct age_softc *sc) else reg |= MASTER_ITIMER_ENB; CSR_WRITE_4(sc, AGE_MASTER_CFG, reg); - if (1 || bootverbose) + if (bootverbose) device_printf(sc->age_dev, "interrupt moderation is %d us.\n", sc->age_int_mod); CSR_WRITE_2(sc, AGE_INTR_CLR_TIMER, AGE_USECS(1000)); From dfr at FreeBSD.org Fri Nov 7 02:43:01 2008 From: dfr at FreeBSD.org (Doug Rabson) Date: Fri Nov 7 02:43:13 2008 Subject: svn commit: r184744 - head/sys/nfsserver Message-ID: <200811071043.mA7Ah1jd081563@svn.freebsd.org> Author: dfr Date: Fri Nov 7 10:43:01 2008 New Revision: 184744 URL: http://svn.freebsd.org/changeset/base/184744 Log: Range-check NFSv2 procedure numbers before converting to NFSv3. Submitted by: csjp Modified: head/sys/nfsserver/nfs_fha.c Modified: head/sys/nfsserver/nfs_fha.c ============================================================================== --- head/sys/nfsserver/nfs_fha.c Fri Nov 7 07:02:28 2008 (r184743) +++ head/sys/nfsserver/nfs_fha.c Fri Nov 7 10:43:01 2008 (r184744) @@ -180,11 +180,16 @@ fha_extract_info(struct svc_req *req, st i->locktype = LK_EXCLUSIVE; /* - * Extract the procnum and convert to v3 form if necessary. + * Extract the procnum and convert to v3 form if necessary, + * taking care to deal with out-of-range procnums. Caller will + * ensure that rq_vers is either 2 or 3. */ procnum = req->rq_proc; - if (!v3) + if (!v3) { + if (procnum > NFSV2PROC_STATFS) + goto out; procnum = nfsrv_nfsv3_procid[procnum]; + } /* * We do affinity for most. However, we divide a realm of affinity From kib at FreeBSD.org Fri Nov 7 03:07:58 2008 From: kib at FreeBSD.org (Konstantin Belousov) Date: Fri Nov 7 03:08:14 2008 Subject: svn commit: r184746 - stable/7/sys/kern Message-ID: <200811071107.mA7B7vZF082104@svn.freebsd.org> Author: kib Date: Fri Nov 7 11:07:57 2008 New Revision: 184746 URL: http://svn.freebsd.org/changeset/base/184746 Log: This is direct commit to stable/7 to accomodate KPI difference between HEAD and the branch. Provide struct thread * argument to VOP_GETATTR. Approved by: re (rwatson) Modified: stable/7/sys/kern/kern_proc.c Modified: stable/7/sys/kern/kern_proc.c ============================================================================== --- stable/7/sys/kern/kern_proc.c Fri Nov 7 10:46:15 2008 (r184745) +++ stable/7/sys/kern/kern_proc.c Fri Nov 7 11:07:57 2008 (r184746) @@ -1451,7 +1451,7 @@ sysctl_kern_proc_vmmap(SYSCTL_HANDLER_AR vn_fullpath(curthread, vp, &fullpath, &freepath); cred = curthread->td_ucred; - if (VOP_GETATTR(vp, &va, cred) == 0) { + if (VOP_GETATTR(vp, &va, cred, curthread) == 0) { kve->kve_fileid = va.va_fileid; kve->kve_fsid = va.va_fsid; } From bz at FreeBSD.org Fri Nov 7 03:42:02 2008 From: bz at FreeBSD.org (Bjoern A. Zeeb) Date: Fri Nov 7 03:42:19 2008 Subject: svn commit: r184747 - in stable/7/sys: . modules/cxgb netinet Message-ID: <200811071142.mA7Bg2Bx082737@svn.freebsd.org> Author: bz Date: Fri Nov 7 11:42:02 2008 New Revision: 184747 URL: http://svn.freebsd.org/changeset/base/184747 Log: MFC: r183014 (which was missed with r184739: r183013,r183017,r183032,r183034) Original commit message from HEAD: Julian: "oops commit the version that compiles" Unbreak RELENG_7 including the missing sys/proc.h header file. Approved by: re (kib) Modified: stable/7/sys/ (props changed) stable/7/sys/modules/cxgb/ (props changed) stable/7/sys/netinet/if_ether.c Modified: stable/7/sys/netinet/if_ether.c ============================================================================== --- stable/7/sys/netinet/if_ether.c Fri Nov 7 11:07:57 2008 (r184746) +++ stable/7/sys/netinet/if_ether.c Fri Nov 7 11:42:02 2008 (r184747) @@ -49,6 +49,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include From joao.barros at gmail.com Fri Nov 7 04:35:42 2008 From: joao.barros at gmail.com (Joao Barros) Date: Fri Nov 7 04:35:49 2008 Subject: svn commit: r183724 - in head/sys: conf dev/ata dev/ata/chipsets modules/ata modules/ata/ata modules/ata/atacore modules/ata/atadevel modules/ata/atapci modules/ata/atapci/chipsets modules/ata/atap... In-Reply-To: <200810091256.m99Cuvex062502@svn.freebsd.org> References: <200810091256.m99Cuvex062502@svn.freebsd.org> Message-ID: <70e8236f0811070410t751240f4m5d81e9dfe9590c3d@mail.gmail.com> On Thu, Oct 9, 2008 at 12:56 PM, S?ren Schmidt wrote: > > Author: sos > Date: Thu Oct 9 12:56:57 2008 > New Revision: 183724 > URL: http://svn.freebsd.org/changeset/base/183724 > > Log: > This is the roumored ATA modulerisation works, and it needs a little explanation. > > If you just config KERNEL as usual there should be no apparent changes, you'll get all chipset support code compiled in. > > However there is now a way to only compile in code for chipsets needed on a pr vendor basis. ATA now has the following "device" entries: > > atacore: ATA core functionality, always needed for any ATA setup > > atacard: CARDBUS support > atacbus: PC98 cbus support > ataisa: ISA bus support > atapci: PCI bus support only generic chipset support. > > ataahci: AHCI support, also pulled in by some vendor modules. > > ataacard, ataacerlabs, ataadaptec, ataamd, ataati, atacenatek, atacypress, atacyrix, atahighpoint, ataintel, ataite, atajmicron, atamarvell, atamicron, atanational, atanetcell, atanvidia, atapromise, ataserverworks, atasiliconimage, atasis, atavia; Vendor support, ie atavia for VIA chipsets > > atadisk: ATA disk driver > ataraid: ATA softraid driver > > atapicd: ATAPI cd/dvd driver > atapifd: ATAPI floppy/flashdisk driver > atapist: ATAPI tape driver > > atausb: ATA<>USB bridge > atapicam: ATA<>CAM bridge > > This makes it possible to config a kernel with just VIA chipset support by having the following ATA lines in the kernel config file: > > device atacore > device atapci > device atavia > > And then you need the atadisk, atapicd etc lines in there just as usual. > > If you use ATA as modules loaded at boot there is few changes except the rename of the "ata" module to "atacore", things looks just as usual. > However under atapci you now have a whole bunch of vendor specific drivers, that you can kldload individually depending on you needs. Drivers have the same names as used in the kernel config explained above. (snip) > > Deleted: > head/sys/dev/ata/ata-chipset.c > head/sys/modules/ata/ata/Makefile > Modified: > head/sys/conf/files > head/sys/dev/ata/ata-all.c > head/sys/dev/ata/ata-all.h > head/sys/dev/ata/ata-dma.c > head/sys/dev/ata/ata-pci.c > head/sys/dev/ata/ata-pci.h Hi S?ren, There is a stale reference to ata-chipset.c and ident functions in ata-pci-h after this change: /* global prototypes ata-chipset.c */ int ata_generic_ident(device_t); int ata_ahci_ident(device_t); int ata_acard_ident(device_t); int ata_ali_ident(device_t); int ata_amd_ident(device_t); int ata_ati_ident(device_t); int ata_cyrix_ident(device_t); int ata_cypress_ident(device_t); int ata_highpoint_ident(device_t); int ata_intel_ident(device_t); int ata_ite_ident(device_t); int ata_jmicron_ident(device_t); int ata_marvell_ident(device_t); int ata_national_ident(device_t); int ata_nvidia_ident(device_t); int ata_netcell_ident(device_t); int ata_promise_ident(device_t); int ata_serverworks_ident(device_t); int ata_sii_ident(device_t); int ata_sis_ident(device_t); int ata_via_ident(device_t); int ata_legacy(device_t); -- Joao Barros From sos at FreeBSD.org Fri Nov 7 05:15:46 2008 From: sos at FreeBSD.org (=?ISO-8859-1?Q?S=F8ren_Schmidt?=) Date: Fri Nov 7 05:15:53 2008 Subject: svn commit: r183724 - in head/sys: conf dev/ata dev/ata/chipsets modules/ata modules/ata/ata modules/ata/atacore modules/ata/atadevel modules/ata/atapci modules/ata/atapci/chipsets modules/ata/atap... In-Reply-To: <70e8236f0811070410t751240f4m5d81e9dfe9590c3d@mail.gmail.com> References: <200810091256.m99Cuvex062502@svn.freebsd.org> <70e8236f0811070410t751240f4m5d81e9dfe9590c3d@mail.gmail.com> Message-ID: <60256C21-4DC2-4998-97C1-214027C2B994@FreeBSD.org> On 7Nov, 2008, at 13:10 , Joao Barros wrote: > On Thu, Oct 9, 2008 at 12:56 PM, S?ren Schmidt > wrote: >> >> Author: sos >> Date: Thu Oct 9 12:56:57 2008 >> New Revision: 183724 >> URL: http://svn.freebsd.org/changeset/base/183724 >> (snip) >> >> Deleted: >> head/sys/dev/ata/ata-chipset.c >> head/sys/modules/ata/ata/Makefile >> Modified: >> head/sys/conf/files >> head/sys/dev/ata/ata-all.c >> head/sys/dev/ata/ata-all.h >> head/sys/dev/ata/ata-dma.c >> head/sys/dev/ata/ata-pci.c >> head/sys/dev/ata/ata-pci.h > > > Hi S?ren, > There is a stale reference to ata-chipset.c and ident functions in > ata-pci-h after this change: > > /* global prototypes ata-chipset.c */ > int ata_generic_ident(device_t); > int ata_ahci_ident(device_t); > int ata_acard_ident(device_t); > int ata_ali_ident(device_t); > int ata_amd_ident(device_t); > int ata_ati_ident(device_t); > int ata_cyrix_ident(device_t); > int ata_cypress_ident(device_t); > int ata_highpoint_ident(device_t); > int ata_intel_ident(device_t); > int ata_ite_ident(device_t); > int ata_jmicron_ident(device_t); > int ata_marvell_ident(device_t); > int ata_national_ident(device_t); > int ata_nvidia_ident(device_t); > int ata_netcell_ident(device_t); > int ata_promise_ident(device_t); > int ata_serverworks_ident(device_t); > int ata_sii_ident(device_t); > int ata_sis_ident(device_t); > int ata_via_ident(device_t); > int ata_legacy(device_t); Yeah I know, it will be gone in the next cleanup phase, but thanks for the reminder!! -S?ren From sos at freebsd.org Fri Nov 7 05:24:56 2008 From: sos at freebsd.org (=?ISO-8859-1?Q?S=F8ren_Schmidt?=) Date: Fri Nov 7 05:25:03 2008 Subject: svn commit: r183724 - in head/sys: conf dev/ata dev/ata/chipsets modules/ata modules/ata/ata modules/ata/atacore modules/ata/atadevel modules/ata/atapci modules/ata/atapci/chipsets modules/ata/atap... In-Reply-To: <60256C21-4DC2-4998-97C1-214027C2B994@FreeBSD.org> References: <200810091256.m99Cuvex062502@svn.freebsd.org> <70e8236f0811070410t751240f4m5d81e9dfe9590c3d@mail.gmail.com> <60256C21-4DC2-4998-97C1-214027C2B994@FreeBSD.org> Message-ID: <93415C48-08D8-416D-9EC9-1B35291FF54B@freebsd.org> On 7Nov, 2008, at 14:15 , S?ren Schmidt wrote: > On 7Nov, 2008, at 13:10 , Joao Barros wrote: >> >> Hi S?ren, >> There is a stale reference to ata-chipset.c and ident functions in >> ata-pci-h after this change: >> >> /* global prototypes ata-chipset.c */ >> int ata_generic_ident(device_t); >> int ata_ahci_ident(device_t); >> int ata_acard_ident(device_t); >> int ata_ali_ident(device_t); >> int ata_amd_ident(device_t); >> int ata_ati_ident(device_t); >> int ata_cyrix_ident(device_t); >> int ata_cypress_ident(device_t); >> int ata_highpoint_ident(device_t); >> int ata_intel_ident(device_t); >> int ata_ite_ident(device_t); >> int ata_jmicron_ident(device_t); >> int ata_marvell_ident(device_t); >> int ata_national_ident(device_t); >> int ata_nvidia_ident(device_t); >> int ata_netcell_ident(device_t); >> int ata_promise_ident(device_t); >> int ata_serverworks_ident(device_t); >> int ata_sii_ident(device_t); >> int ata_sis_ident(device_t); >> int ata_via_ident(device_t); >> int ata_legacy(device_t); > > Yeah I know, it will be gone in the next cleanup phase, but thanks > for the reminder!! Actually I did commit those changes now that I just checked to make sure they got over next time, you must have some stale changes in your tree. -S?ren From trasz at FreeBSD.org Fri Nov 7 06:45:42 2008 From: trasz at FreeBSD.org (Edward Tomasz Napierala) Date: Fri Nov 7 06:45:54 2008 Subject: svn commit: r184748 - head/tools/regression/fstest/tests Message-ID: <200811071445.mA7EjgSx085994@svn.freebsd.org> Author: trasz Date: Fri Nov 7 14:45:42 2008 New Revision: 184748 URL: http://svn.freebsd.org/changeset/base/184748 Log: Improve output when a test fails. Approved by: rwatson (mentor) Modified: head/tools/regression/fstest/tests/misc.sh Modified: head/tools/regression/fstest/tests/misc.sh ============================================================================== --- head/tools/regression/fstest/tests/misc.sh Fri Nov 7 11:42:02 2008 (r184747) +++ head/tools/regression/fstest/tests/misc.sh Fri Nov 7 14:45:42 2008 (r184748) @@ -27,7 +27,7 @@ expect() if [ $? -eq 0 ]; then echo "ok ${ntest}" else - echo "not ok ${ntest}" + echo "not ok ${ntest} - tried '$*', expected ${e}, got ${r}" fi ntest=`expr $ntest + 1` } @@ -43,7 +43,7 @@ jexpect() if [ $? -eq 0 ]; then echo "ok ${ntest}" else - echo "not ok ${ntest}" + echo "not ok ${ntest} - tried '$*', expected ${e}, got ${r}" fi ntest=`expr $ntest + 1` } From trasz at FreeBSD.org Fri Nov 7 06:46:46 2008 From: trasz at FreeBSD.org (Edward Tomasz Napierala) Date: Fri Nov 7 06:46:58 2008 Subject: svn commit: r184749 - head/tools/regression/fstest/tests/rename Message-ID: <200811071446.mA7EkkXb086047@svn.freebsd.org> Author: trasz Date: Fri Nov 7 14:46:46 2008 New Revision: 184749 URL: http://svn.freebsd.org/changeset/base/184749 Log: Make test for write access to the directory being moved a little more specific. Approved by: rwatson (mentor) Modified: head/tools/regression/fstest/tests/rename/21.t Modified: head/tools/regression/fstest/tests/rename/21.t ============================================================================== --- head/tools/regression/fstest/tests/rename/21.t Fri Nov 7 14:45:42 2008 (r184748) +++ head/tools/regression/fstest/tests/rename/21.t Fri Nov 7 14:46:46 2008 (r184749) @@ -6,7 +6,7 @@ desc="write access to subdirectory is re dir=`dirname $0` . ${dir}/../misc.sh -echo "1..12" +echo "1..13" n0=`namegen` n1=`namegen` @@ -17,13 +17,17 @@ expect 0 mkdir ${n2} 0777 expect 0 mkdir ${n3} 0777 cdir=`pwd` +# Check that write permission on containing directory (${n2}) is enough +# to rename subdirectory (${n0}). +expect 0 mkdir ${n2}/${n0} 0700 +expect 0 -u 65534 -g 65534 rename ${n2}/${n0} ${n2}/${n1} + # Check that write permission on containing directory (${n2}) is not enough # to move subdirectory (${n0}) from that directory. -expect 0 mkdir ${n2}/${n0} 0700 -expect EACCES -u 65534 -g 65534 rename ${n2}/${n0} ${n3}/${n0} +expect EACCES -u 65534 -g 65534 rename ${n2}/${n1} ${n3}/${n0} -expect 0 rmdir ${n2}/${n0} -expect ENOENT rmdir ${n2}/${n0} +expect 0 rmdir ${n2}/${n1} +expect ENOENT rmdir ${n2}/${n1} # Check that write permission on containing directory (${n2}) is enough # to move file (${n0}) from that directory. From joao.barros at gmail.com Fri Nov 7 06:53:55 2008 From: joao.barros at gmail.com (Joao Barros) Date: Fri Nov 7 06:54:00 2008 Subject: svn commit: r183724 - in head/sys: conf dev/ata dev/ata/chipsets modules/ata modules/ata/ata modules/ata/atacore modules/ata/atadevel modules/ata/atapci modules/ata/atapci/chipsets modules/ata/atap... In-Reply-To: <93415C48-08D8-416D-9EC9-1B35291FF54B@freebsd.org> References: <200810091256.m99Cuvex062502@svn.freebsd.org> <70e8236f0811070410t751240f4m5d81e9dfe9590c3d@mail.gmail.com> <60256C21-4DC2-4998-97C1-214027C2B994@FreeBSD.org> <93415C48-08D8-416D-9EC9-1B35291FF54B@freebsd.org> Message-ID: <70e8236f0811070653m5af02ee3p5bbba050ad6e5c79@mail.gmail.com> On Fri, Nov 7, 2008 at 1:24 PM, S?ren Schmidt wrote: > On 7Nov, 2008, at 14:15 , S?ren Schmidt wrote: > >> On 7Nov, 2008, at 13:10 , Joao Barros wrote: >>> >>> Hi S?ren, >>> There is a stale reference to ata-chipset.c and ident functions in >>> ata-pci-h after this change: >>> >>> /* global prototypes ata-chipset.c */ >>> int ata_generic_ident(device_t); >>> int ata_ahci_ident(device_t); >>> int ata_acard_ident(device_t); >>> int ata_ali_ident(device_t); >>> int ata_amd_ident(device_t); >>> int ata_ati_ident(device_t); >>> int ata_cyrix_ident(device_t); >>> int ata_cypress_ident(device_t); >>> int ata_highpoint_ident(device_t); >>> int ata_intel_ident(device_t); >>> int ata_ite_ident(device_t); >>> int ata_jmicron_ident(device_t); >>> int ata_marvell_ident(device_t); >>> int ata_national_ident(device_t); >>> int ata_nvidia_ident(device_t); >>> int ata_netcell_ident(device_t); >>> int ata_promise_ident(device_t); >>> int ata_serverworks_ident(device_t); >>> int ata_sii_ident(device_t); >>> int ata_sis_ident(device_t); >>> int ata_via_ident(device_t); >>> int ata_legacy(device_t); >> >> Yeah I know, it will be gone in the next cleanup phase, but thanks for the >> reminder!! > > Actually I did commit those changes now that I just checked to make sure > they got over next time, you must have some stale changes in your tree. > > -S?ren You're right, I was looking at it through cvsweb and the last commit is for RELENG_7, not CURRENT. Sorry for the noise. -- Joao Barros From trasz at FreeBSD.org Fri Nov 7 07:01:40 2008 From: trasz at FreeBSD.org (Edward Tomasz Napierala) Date: Fri Nov 7 07:01:47 2008 Subject: svn commit: r184750 - head/lib/libc/sys Message-ID: <200811071501.mA7F1ewh086339@svn.freebsd.org> Author: trasz Date: Fri Nov 7 15:01:40 2008 New Revision: 184750 URL: http://svn.freebsd.org/changeset/base/184750 Log: Add one more EACCES clause to rename.2. Approved by: rwatson (mentor) Modified: head/lib/libc/sys/rename.2 Modified: head/lib/libc/sys/rename.2 ============================================================================== --- head/lib/libc/sys/rename.2 Fri Nov 7 14:46:46 2008 (r184749) +++ head/lib/libc/sys/rename.2 Fri Nov 7 15:01:40 2008 (r184750) @@ -156,6 +156,11 @@ A component of either path prefix denies .It Bq Er EACCES The requested link requires writing in a directory with a mode that denies write permission. +.It Bq Er EACCES +The directory pointed at by the +.Fa from +argument denies write permission, and the operation would move +it to another parent directory. .It Bq Er EPERM The file pointed at by the .Fa from From mav at FreeBSD.org Fri Nov 7 09:55:10 2008 From: mav at FreeBSD.org (Alexander Motin) Date: Fri Nov 7 09:55:17 2008 Subject: svn commit: r184751 - head/share/man/man4 Message-ID: <200811071755.mA7Ht9vS089482@svn.freebsd.org> Author: mav Date: Fri Nov 7 17:55:09 2008 New Revision: 184751 URL: http://svn.freebsd.org/changeset/base/184751 Log: Two minor fixes. Modified: head/share/man/man4/snd_hda.4 Modified: head/share/man/man4/snd_hda.4 ============================================================================== --- head/share/man/man4/snd_hda.4 Fri Nov 7 15:01:40 2008 (r184750) +++ head/share/man/man4/snd_hda.4 Fri Nov 7 17:55:09 2008 (r184751) @@ -58,7 +58,7 @@ driver that allows the generic audio dri .Xr sound 4 , to be used with this hardware. Only audio functions are supported by -.Nm +.Nm . Modem, HDMI and other possible functions are not implemented. .Pp The @@ -85,7 +85,7 @@ The default audio device may be tuned by .Ar hw.snd.default_unit sysctl, as described in .Xr sound 4 , -or explicitly specified it in application settings. +or explicitly specified in application settings. .Ss Boot-time Configuration The following variables are available at boot-time through the .Xr device.hints 5 From mav at FreeBSD.org Fri Nov 7 11:51:08 2008 From: mav at FreeBSD.org (Alexander Motin) Date: Fri Nov 7 11:51:14 2008 Subject: svn commit: r184752 - head/sys/netgraph Message-ID: <200811071951.mA7Jp7wu091486@svn.freebsd.org> Author: mav Date: Fri Nov 7 19:51:07 2008 New Revision: 184752 URL: http://svn.freebsd.org/changeset/base/184752 Log: Don't assign completely meaningless name to the node on creation. As soon as node is created from the netgraph side now, it can be found without using this. Allow application to assign whatever name it want later. Modified: head/sys/netgraph/ng_tty.c Modified: head/sys/netgraph/ng_tty.c ============================================================================== --- head/sys/netgraph/ng_tty.c Fri Nov 7 17:55:09 2008 (r184751) +++ head/sys/netgraph/ng_tty.c Fri Nov 7 19:51:07 2008 (r184752) @@ -94,8 +94,6 @@ struct ngt_softc { }; typedef struct ngt_softc *sc_p; -static int ngt_unit; - /* Flags */ #define FLG_DEBUG 0x0002 @@ -157,7 +155,6 @@ static int ngt_constructor(node_p node) { sc_p sc; - char name[sizeof(NG_TTY_NODE_TYPE) + 8]; /* Allocate private structure */ sc = malloc(sizeof(*sc), M_NETGRAPH, M_NOWAIT | M_ZERO); @@ -170,14 +167,6 @@ ngt_constructor(node_p node) mtx_init(&sc->outq.ifq_mtx, "ng_tty node+queue", NULL, MTX_DEF); IFQ_SET_MAXLEN(&sc->outq, IFQ_MAXLEN); - atomic_add_int(&ngt_unit, 1); - snprintf(name, sizeof(name), "%s%d", typestruct.name, ngt_unit); - - /* Assign node its name */ - if (ng_name_node(node, name)) - log(LOG_WARNING, "%s: can't name node %s\n", - __func__, name); - /* Done */ return (0); } From blackend at FreeBSD.org Fri Nov 7 14:01:31 2008 From: blackend at FreeBSD.org (Marc Fonvieille) Date: Fri Nov 7 14:01:43 2008 Subject: svn commit: r184753 - head/usr.sbin/sysinstall Message-ID: <200811072201.mA7M1VlX093904@svn.freebsd.org> Author: blackend (doc committer) Date: Fri Nov 7 22:01:31 2008 New Revision: 184753 URL: http://svn.freebsd.org/changeset/base/184753 Log: Update ports number and size of Ports Collection. Modified: head/usr.sbin/sysinstall/dist.c Modified: head/usr.sbin/sysinstall/dist.c ============================================================================== --- head/usr.sbin/sysinstall/dist.c Fri Nov 7 19:51:07 2008 (r184752) +++ head/usr.sbin/sysinstall/dist.c Fri Nov 7 22:01:31 2008 (r184753) @@ -304,8 +304,8 @@ distMaybeSetPorts(dialogMenuItem *self) { dialog_clear_norefresh(); if (!msgYesNo("Would you like to install the FreeBSD ports collection?\n\n" - "This will give you ready access to over 17,000 ported software packages,\n" - "at a cost of around 400MB of disk space when \"clean\" and possibly\n" + "This will give you ready access to over 19,000 ported software packages,\n" + "at a cost of around 445MB of disk space when \"clean\" and possibly\n" "much more than that when a lot of the distribution tarballs are loaded\n" "(unless you have the extra discs available from a FreeBSD CD/DVD distribution\n" "and can mount them on /cdrom, in which case this is far less of a problem).\n\n" From blackend at FreeBSD.org Fri Nov 7 14:06:06 2008 From: blackend at FreeBSD.org (Marc Fonvieille) Date: Fri Nov 7 14:06:22 2008 Subject: svn commit: r184754 - stable/7/usr.sbin/sysinstall Message-ID: <200811072206.mA7M64P5094011@svn.freebsd.org> Author: blackend (doc committer) Date: Fri Nov 7 22:06:04 2008 New Revision: 184754 URL: http://svn.freebsd.org/changeset/base/184754 Log: MFC: r184753 Update ports number and size of Ports Collection. Approved by: re (kib) Modified: stable/7/usr.sbin/sysinstall/dist.c Modified: stable/7/usr.sbin/sysinstall/dist.c ============================================================================== --- stable/7/usr.sbin/sysinstall/dist.c Fri Nov 7 22:01:31 2008 (r184753) +++ stable/7/usr.sbin/sysinstall/dist.c Fri Nov 7 22:06:04 2008 (r184754) @@ -304,8 +304,8 @@ distMaybeSetPorts(dialogMenuItem *self) { dialog_clear_norefresh(); if (!msgYesNo("Would you like to install the FreeBSD ports collection?\n\n" - "This will give you ready access to over 17,000 ported software packages,\n" - "at a cost of around 400MB of disk space when \"clean\" and possibly\n" + "This will give you ready access to over 19,000 ported software packages,\n" + "at a cost of around 445MB of disk space when \"clean\" and possibly\n" "much more than that when a lot of the distribution tarballs are loaded\n" "(unless you have the extra discs available from a FreeBSD CD/DVD distribution\n" "and can mount them on /cdrom, in which case this is far less of a problem).\n\n" From blackend at FreeBSD.org Fri Nov 7 14:06:51 2008 From: blackend at FreeBSD.org (Marc Fonvieille) Date: Fri Nov 7 14:07:08 2008 Subject: svn commit: r184755 - stable/6/usr.sbin/sysinstall Message-ID: <200811072206.mA7M6oKx094056@svn.freebsd.org> Author: blackend (doc committer) Date: Fri Nov 7 22:06:50 2008 New Revision: 184755 URL: http://svn.freebsd.org/changeset/base/184755 Log: MFC: rev. 184753 Update ports number and size of Ports Collection. Approved by: re (kib) Modified: stable/6/usr.sbin/sysinstall/dist.c Modified: stable/6/usr.sbin/sysinstall/dist.c ============================================================================== --- stable/6/usr.sbin/sysinstall/dist.c Fri Nov 7 22:06:04 2008 (r184754) +++ stable/6/usr.sbin/sysinstall/dist.c Fri Nov 7 22:06:50 2008 (r184755) @@ -303,8 +303,8 @@ distMaybeSetPorts(dialogMenuItem *self) { dialog_clear_norefresh(); if (!msgYesNo("Would you like to install the FreeBSD ports collection?\n\n" - "This will give you ready access to over 14,900 ported software packages,\n" - "at a cost of around 440MB of disk space when \"clean\" and possibly\n" + "This will give you ready access to over 19,000 ported software packages,\n" + "at a cost of around 445MB of disk space when \"clean\" and possibly\n" "much more than that when a lot of the distribution tarballs are loaded\n" "(unless you have the extra discs available from a FreeBSD CD/DVD distribution\n" "and can mount them on /cdrom, in which case this is far less of a problem).\n\n" From blackend at FreeBSD.org Fri Nov 7 14:07:28 2008 From: blackend at FreeBSD.org (Marc Fonvieille) Date: Fri Nov 7 14:08:05 2008 Subject: svn commit: r184756 - releng/6.4/usr.sbin/sysinstall Message-ID: <200811072207.mA7M7Sk8094108@svn.freebsd.org> Author: blackend (doc committer) Date: Fri Nov 7 22:07:27 2008 New Revision: 184756 URL: http://svn.freebsd.org/changeset/base/184756 Log: MFC: rev. 184753 Update ports number and size of Ports Collection. Approved by: re (kib) Modified: releng/6.4/usr.sbin/sysinstall/dist.c Modified: releng/6.4/usr.sbin/sysinstall/dist.c ============================================================================== --- releng/6.4/usr.sbin/sysinstall/dist.c Fri Nov 7 22:06:50 2008 (r184755) +++ releng/6.4/usr.sbin/sysinstall/dist.c Fri Nov 7 22:07:27 2008 (r184756) @@ -303,8 +303,8 @@ distMaybeSetPorts(dialogMenuItem *self) { dialog_clear_norefresh(); if (!msgYesNo("Would you like to install the FreeBSD ports collection?\n\n" - "This will give you ready access to over 14,900 ported software packages,\n" - "at a cost of around 440MB of disk space when \"clean\" and possibly\n" + "This will give you ready access to over 19,000 ported software packages,\n" + "at a cost of around 445MB of disk space when \"clean\" and possibly\n" "much more than that when a lot of the distribution tarballs are loaded\n" "(unless you have the extra discs available from a FreeBSD CD/DVD distribution\n" "and can mount them on /cdrom, in which case this is far less of a problem).\n\n" From rabe at uugrn.org Fri Nov 7 16:28:27 2008 From: rabe at uugrn.org (Raphael Becker) Date: Fri Nov 7 16:28:34 2008 Subject: svn commit: r184753 - head/usr.sbin/sysinstall In-Reply-To: <200811072201.mA7M1VlX093904@svn.freebsd.org> References: <200811072201.mA7M1VlX093904@svn.freebsd.org> Message-ID: <20081108001032.GA21542@ma.sigsys.de> On Fri, Nov 07, 2008 at 10:01:31PM +0000, Marc Fonvieille wrote: > + "This will give you ready access to over 19,000 ported software packages,\n" > + "at a cost of around 445MB of disk space when \"clean\" and possibly\n" I see around 700M here, my ports are configured "read-only", so all work/, packages/ distfiles/ and so on are outside /usr/ports, updates are done by cvsup: # df -mi /usr/ports/ Filesystem 1M-blocks Used Avail Capacity iused ifree %iused Mounted on /dev/md0 1039 712 119 86% 129743 478895 21% /usr/ports # du -sm /usr/ports/ 713 /usr/ports/ It heavily depends on inode-sizes. I have about 130k inodes in use which cause a "theoretical minimum" of 508MB disk on filesystems with 4k inode-density, about 1G with 8k inodes (default is 8k, see by newfs(8)) -i bytes Specify the density of inodes in the file system. The default is to create an inode for every (4 * frag-size) bytes of data space. -f frag-size The fragment size of the file system in bytes. It must be a power of two ranging in value between blocksize/8 and blocksize. The default is 2048 bytes. An uncompressed tarball (without the "inode-overhead") of /usr/ports/ is around 600MB here: # tar cf - /usr/ports/ | wc -c tar: Removing leading '/' from member names 629196800 or 600MB. How did you measure / calculate 445MB? Regards Raphael -- Raphael Becker http://rabe.uugrn.org/ GnuPG: E7B2 1D66 3AF2 EDC7 9828 6D7A 9CDA 3E7B 10CA 9F2D .........|.........|.........|.........|.........|.........|.........|.. -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 187 bytes Desc: not available Url : http://lists.freebsd.org/pipermail/svn-src-all/attachments/20081108/48e16c24/attachment.pgp From mav at FreeBSD.org Fri Nov 7 18:05:41 2008 From: mav at FreeBSD.org (Alexander Motin) Date: Fri Nov 7 18:05:47 2008 Subject: svn commit: r184760 - head/sys/netgraph Message-ID: <200811080205.mA825fux098376@svn.freebsd.org> Author: mav Date: Sat Nov 8 02:05:41 2008 New Revision: 184760 URL: http://svn.freebsd.org/changeset/base/184760 Log: Assign new cookie to the node to reflect API change. All applications will have to be adapted and rebuilt. Modified: head/sys/netgraph/ng_tty.h Modified: head/sys/netgraph/ng_tty.h ============================================================================== --- head/sys/netgraph/ng_tty.h Sat Nov 8 02:02:13 2008 (r184759) +++ head/sys/netgraph/ng_tty.h Sat Nov 8 02:05:41 2008 (r184760) @@ -47,7 +47,7 @@ /* Node type name and magic cookie */ #define NG_TTY_NODE_TYPE "tty" -#define NGM_TTY_COOKIE 886279262 +#define NGM_TTY_COOKIE 1226109660 /* Default hot char */ #define NG_TTY_DFL_HOTCHAR 0x7e /* PPP flag byte */ From kientzle at FreeBSD.org Fri Nov 7 20:43:24 2008 From: kientzle at FreeBSD.org (Tim Kientzle) Date: Fri Nov 7 20:43:31 2008 Subject: svn commit: r184761 - head/usr.bin/tar Message-ID: <200811080443.mA84hOLe001689@svn.freebsd.org> Author: kientzle Date: Sat Nov 8 04:43:24 2008 New Revision: 184761 URL: http://svn.freebsd.org/changeset/base/184761 Log: New command-line parser for bsdtar. This replaces the getopt()/getopt_long() wrapper, the old-style argument rewriter and the associated configuration glue with a more straightforward custom command parser. In particular, this ensures that bsdtar will have consistent option parsing on every platform, regardless of whether the platform supports getopt_long(). MFC after: 30 days Added: head/usr.bin/tar/cmdline.c (contents, props changed) Modified: head/usr.bin/tar/Makefile head/usr.bin/tar/bsdtar.1 head/usr.bin/tar/bsdtar.c head/usr.bin/tar/bsdtar.h head/usr.bin/tar/config_freebsd.h Modified: head/usr.bin/tar/Makefile ============================================================================== --- head/usr.bin/tar/Makefile Sat Nov 8 02:05:41 2008 (r184760) +++ head/usr.bin/tar/Makefile Sat Nov 8 04:43:24 2008 (r184761) @@ -2,7 +2,7 @@ PROG= bsdtar BSDTAR_VERSION_STRING=2.5.5 -SRCS= bsdtar.c getdate.y matching.c read.c siginfo.c subst.c tree.c util.c write.c +SRCS= bsdtar.c cmdline.c getdate.y matching.c read.c siginfo.c subst.c tree.c util.c write.c WARNS?= 5 DPADD= ${LIBARCHIVE} ${LIBBZ2} ${LIBZ} LDADD= -larchive -lbz2 -lz @@ -11,6 +11,7 @@ CFLAGS+= -DPLATFORM_CONFIG_H=\"config_fr CFLAGS+= -I${.CURDIR} SYMLINKS= bsdtar ${BINDIR}/tar MLINKS= bsdtar.1 tar.1 +DEBUG_FLAGS=-g .PHONY: check test check test: $(PROG) bsdtar.1.gz Modified: head/usr.bin/tar/bsdtar.1 ============================================================================== --- head/usr.bin/tar/bsdtar.1 Sat Nov 8 02:05:41 2008 (r184760) +++ head/usr.bin/tar/bsdtar.1 Sat Nov 8 04:43:24 2008 (r184761) @@ -144,21 +144,21 @@ In c and r mode, this changes the direct the following files. In x mode, change directories after opening the archive but before extracting entries from the archive. -.It Fl -check-links ( Fl W Cm check-links ) +.It Fl -check-links (c and r modes only) Issue a warning message unless all links to each file are archived. -.It Fl -chroot ( Fl W Cm chroot ) +.It Fl -chroot (x mode only) .Fn chroot to the current directory after processing any .Fl C options and before extracting any files. -.It Fl -exclude Ar pattern ( Fl W Cm exclude Ns = Ns Ar pattern ) +.It Fl -exclude Ar pattern Do not process files or directories that match the specified pattern. Note that exclusions take precedence over patterns or filenames specified on the command line. -.It Fl -format Ar format ( Fl W Cm format Ns = Ns Ar format ) +.It Fl -format Ar format (c, r, u mode only) Use the specified format for the created archive. Supported formats include @@ -193,7 +193,7 @@ Synonym for .It Fl I Synonym for .Fl T . -.It Fl -include Ar pattern ( Fl W Cm include Ns = Ns Ar pattern ) +.It Fl -include Ar pattern Process only files or directories that match the specified pattern. Note that exclusions specified with .Fl -exclude @@ -225,7 +225,7 @@ automatically when reading archives. Do not overwrite existing files. In particular, if a file appears more than once in an archive, later copies will not overwrite earlier copies. -.It Fl -keep-newer-files ( Fl W Cm keep-newer-files ) +.It Fl -keep-newer-files (x mode only) Do not overwrite existing files that are newer than the versions appearing in the archive being extracted. @@ -245,28 +245,28 @@ By default, the modification time is set .It Fl n (c, r, u modes only) Do not recursively archive the contents of directories. -.It Fl -newer Ar date ( Fl W Cm newer Ns = Ns Ar date ) +.It Fl -newer Ar date (c, r, u modes only) Only include files and directories newer than the specified date. This compares ctime entries. -.It Fl -newer-mtime Ar date ( Fl W Cm newer-mtime Ns = Ns Ar date ) +.It Fl -newer-mtime Ar date (c, r, u modes only) Like .Fl -newer , except it compares mtime entries instead of ctime entries. -.It Fl -newer-than Pa file ( Fl W Cm newer-than Ns = Ns Pa file ) +.It Fl -newer-than Pa file (c, r, u modes only) Only include files and directories newer than the specified file. This compares ctime entries. -.It Fl -newer-mtime-than Pa file ( Fl W Cm newer-mtime-than Ns = Ns Pa file ) +.It Fl -newer-mtime-than Pa file (c, r, u modes only) Like .Fl -newer-than , except it compares mtime entries instead of ctime entries. -.It Fl -nodump ( Fl W Cm nodump ) +.It Fl -nodump (c and r modes only) Honor the nodump file flag by skipping this file. -.It Fl -null ( Fl W Cm null ) +.It Fl -null (use with .Fl I , .Fl T , @@ -302,7 +302,7 @@ the archive will be discarded. (c, r, u mode) A synonym for .Fl -format Ar ustar -.It Fl -one-file-system ( Fl W Cm one-file-system ) +.It Fl -one-file-system (c, r, and u modes) Do not cross mount points. .It Fl P @@ -345,8 +345,8 @@ Extract files as sparse files. For every block on disk, check first if it contains only NULL bytes and seek over it otherwise. This works similiar to the conv=sparse option of dd. -.It Fl -strip-components Ar count ( Fl W Cm strip-components Ns = Ns Ar count ) -(x and t mode only) +.It Fl -strip-components Ar count +(x mode only) Remove the specified number of leading path elements. Pathnames with fewer elements will be silently skipped. Note that the pathname is edited after checking inclusion/exclusion patterns @@ -418,16 +418,6 @@ Print version of and .Nm libarchive , and exit. -.It Fl W Ar longopt=value -Long options (preceded by -.Fl - ) -are only supported directly on systems that have the -.Xr getopt_long 3 -function. -The -.Fl W -option can be used to access long options on systems that -do not support this function. .It Fl w Ask for confirmation for every action. .It Fl X Ar filename Modified: head/usr.bin/tar/bsdtar.c ============================================================================== --- head/usr.bin/tar/bsdtar.c Sat Nov 8 02:05:41 2008 (r184760) +++ head/usr.bin/tar/bsdtar.c Sat Nov 8 04:43:24 2008 (r184761) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2003-2007 Tim Kientzle + * Copyright (c) 2003-2008 Tim Kientzle * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -38,18 +38,6 @@ __FBSDID("$FreeBSD$"); #ifdef HAVE_FCNTL_H #include #endif -#ifdef HAVE_GETOPT_LONG -#include -#else -struct option { - const char *name; - int has_arg; - int *flag; - int val; -}; -#define no_argument 0 -#define required_argument 1 -#endif #ifdef HAVE_LANGINFO_H #include #endif @@ -78,14 +66,6 @@ struct option { #include "bsdtar.h" -#if !HAVE_DECL_OPTARG -extern int optarg; -#endif - -#if !HAVE_DECL_OPTIND -extern int optind; -#endif - /* * Per POSIX.1-1988, tar defaults to reading/writing archives to/from * the default tape device for the system. Pick something reasonable here. @@ -101,133 +81,12 @@ extern int optind; /* External function to parse a date/time string (from getdate.y) */ time_t get_date(const char *); -static int bsdtar_getopt(struct bsdtar *, const char *optstring, - const struct option **poption); static void long_help(struct bsdtar *); static void only_mode(struct bsdtar *, const char *opt, const char *valid); -static char ** rewrite_argv(struct bsdtar *, - int *argc, char ** src_argv, - const char *optstring); static void set_mode(struct bsdtar *, char opt); static void version(void); -/* - * The leading '+' here forces the GNU version of getopt() (as well as - * both the GNU and BSD versions of getopt_long) to stop at the first - * non-option. Otherwise, GNU getopt() permutes the arguments and - * screws up -C processing. - */ -static const char *tar_opts = "+Bb:C:cf:HhI:jkLlmnOoPpqrts:ST:UuvW:wX:xyZz"; - -/* - * Most of these long options are deliberately not documented. They - * are provided only to make life easier for people who also use GNU tar. - * The only long options documented in the manual page are the ones - * with no corresponding short option, such as --exclude, --nodump, - * and --fast-read. - * - * On systems that lack getopt_long, long options can be specified - * using -W longopt and -W longopt=value, e.g. "-W nodump" is the same - * as "--nodump" and "-W exclude=pattern" is the same as "--exclude - * pattern". This does not rely the GNU getopt() "W;" extension, so - * should work correctly on any system with a POSIX-compliant getopt(). - */ - -/* Fake short equivalents for long options that otherwise lack them. */ -enum { - OPTION_CHECK_LINKS = 1, - OPTION_CHROOT, - OPTION_EXCLUDE, - OPTION_FORMAT, - OPTION_HELP, - OPTION_INCLUDE, - OPTION_KEEP_NEWER_FILES, - OPTION_NEWER_CTIME, - OPTION_NEWER_CTIME_THAN, - OPTION_NEWER_MTIME, - OPTION_NEWER_MTIME_THAN, - OPTION_NODUMP, - OPTION_NO_SAME_OWNER, - OPTION_NO_SAME_PERMISSIONS, - OPTION_NULL, - OPTION_NUMERIC_OWNER, - OPTION_ONE_FILE_SYSTEM, - OPTION_POSIX, - OPTION_STRIP_COMPONENTS, - OPTION_TOTALS, - OPTION_USE_COMPRESS_PROGRAM, - OPTION_VERSION -}; - -/* - * If you add anything, be very careful to keep this list properly - * sorted, as the -W logic relies on it. - */ -static const struct option tar_longopts[] = { - { "absolute-paths", no_argument, NULL, 'P' }, - { "append", no_argument, NULL, 'r' }, - { "block-size", required_argument, NULL, 'b' }, - { "bunzip2", no_argument, NULL, 'j' }, - { "bzip", no_argument, NULL, 'j' }, - { "bzip2", no_argument, NULL, 'j' }, - { "cd", required_argument, NULL, 'C' }, - { "check-links", no_argument, NULL, OPTION_CHECK_LINKS }, - { "chroot", no_argument, NULL, OPTION_CHROOT }, - { "compress", no_argument, NULL, 'Z' }, - { "confirmation", no_argument, NULL, 'w' }, - { "create", no_argument, NULL, 'c' }, - { "dereference", no_argument, NULL, 'L' }, - { "directory", required_argument, NULL, 'C' }, - { "exclude", required_argument, NULL, OPTION_EXCLUDE }, - { "exclude-from", required_argument, NULL, 'X' }, - { "extract", no_argument, NULL, 'x' }, - { "fast-read", no_argument, NULL, 'q' }, - { "file", required_argument, NULL, 'f' }, - { "files-from", required_argument, NULL, 'T' }, - { "format", required_argument, NULL, OPTION_FORMAT }, - { "gunzip", no_argument, NULL, 'z' }, - { "gzip", no_argument, NULL, 'z' }, - { "help", no_argument, NULL, OPTION_HELP }, - { "include", required_argument, NULL, OPTION_INCLUDE }, - { "interactive", no_argument, NULL, 'w' }, - { "insecure", no_argument, NULL, 'P' }, - { "keep-newer-files", no_argument, NULL, OPTION_KEEP_NEWER_FILES }, - { "keep-old-files", no_argument, NULL, 'k' }, - { "list", no_argument, NULL, 't' }, - { "modification-time", no_argument, NULL, 'm' }, - { "newer", required_argument, NULL, OPTION_NEWER_CTIME }, - { "newer-ctime", required_argument, NULL, OPTION_NEWER_CTIME }, - { "newer-ctime-than", required_argument, NULL, OPTION_NEWER_CTIME_THAN }, - { "newer-mtime", required_argument, NULL, OPTION_NEWER_MTIME }, - { "newer-mtime-than", required_argument, NULL, OPTION_NEWER_MTIME_THAN }, - { "newer-than", required_argument, NULL, OPTION_NEWER_CTIME_THAN }, - { "nodump", no_argument, NULL, OPTION_NODUMP }, - { "norecurse", no_argument, NULL, 'n' }, - { "no-recursion", no_argument, NULL, 'n' }, - { "no-same-owner", no_argument, NULL, OPTION_NO_SAME_OWNER }, - { "no-same-permissions",no_argument, NULL, OPTION_NO_SAME_PERMISSIONS }, - { "null", no_argument, NULL, OPTION_NULL }, - { "numeric-owner", no_argument, NULL, OPTION_NUMERIC_OWNER }, - { "one-file-system", no_argument, NULL, OPTION_ONE_FILE_SYSTEM }, - { "posix", no_argument, NULL, OPTION_POSIX }, - { "preserve-permissions", no_argument, NULL, 'p' }, - { "read-full-blocks", no_argument, NULL, 'B' }, - { "same-permissions", no_argument, NULL, 'p' }, - { "strip-components", required_argument, NULL, OPTION_STRIP_COMPONENTS }, - { "to-stdout", no_argument, NULL, 'O' }, - { "totals", no_argument, NULL, OPTION_TOTALS }, - { "uncompress", no_argument, NULL, 'Z' }, - { "unlink", no_argument, NULL, 'U' }, - { "unlink-first", no_argument, NULL, 'U' }, - { "update", no_argument, NULL, 'u' }, - { "use-compress-program", - required_argument, NULL, OPTION_USE_COMPRESS_PROGRAM }, - { "verbose", no_argument, NULL, 'v' }, - { "version", no_argument, NULL, OPTION_VERSION }, - { NULL, 0, NULL, 0 } -}; - /* A basic set of security flags to request from libarchive. */ #define SECURITY \ (ARCHIVE_EXTRACT_SECURE_SYMLINKS \ @@ -237,7 +96,6 @@ int main(int argc, char **argv) { struct bsdtar *bsdtar, bsdtar_storage; - const struct option *option; int opt, t; char option_o; char possible_help_request; @@ -295,33 +153,29 @@ main(int argc, char **argv) bsdtar->extract_flags |= ARCHIVE_EXTRACT_FFLAGS; } - /* Rewrite traditional-style tar arguments, if used. */ - argv = rewrite_argv(bsdtar, &argc, argv, tar_opts); - bsdtar->argv = argv; bsdtar->argc = argc; - /* Process all remaining arguments now. */ /* * Comments following each option indicate where that option * originated: SUSv2, POSIX, GNU tar, star, etc. If there's * no such comment, then I don't know of anyone else who * implements that option. */ - while ((opt = bsdtar_getopt(bsdtar, tar_opts, &option)) != -1) { + while ((opt = bsdtar_getopt(bsdtar)) != -1) { switch (opt) { case 'B': /* GNU tar */ /* libarchive doesn't need this; just ignore it. */ break; case 'b': /* SUSv2 */ - t = atoi(optarg); + t = atoi(bsdtar->optarg); if (t <= 0 || t > 1024) bsdtar_errc(bsdtar, 1, 0, "Argument to -b is out of range (1..1024)"); bsdtar->bytes_per_block = 512 * t; break; case 'C': /* GNU tar */ - set_chdir(bsdtar, optarg); + set_chdir(bsdtar, bsdtar->optarg); break; case 'c': /* SUSv2 */ set_mode(bsdtar, opt); @@ -333,15 +187,15 @@ main(int argc, char **argv) bsdtar->option_chroot = 1; break; case OPTION_EXCLUDE: /* GNU tar */ - if (exclude(bsdtar, optarg)) + if (exclude(bsdtar, bsdtar->optarg)) bsdtar_errc(bsdtar, 1, 0, - "Couldn't exclude %s\n", optarg); + "Couldn't exclude %s\n", bsdtar->optarg); break; case OPTION_FORMAT: /* GNU tar, others */ - bsdtar->create_format = optarg; + bsdtar->create_format = bsdtar->optarg; break; case 'f': /* SUSv2 */ - bsdtar->filename = optarg; + bsdtar->filename = bsdtar->optarg; if (strcmp(bsdtar->filename, "-") == 0) bsdtar->filename = NULL; break; @@ -368,7 +222,7 @@ main(int argc, char **argv) * permissions without having to create those * permissions on disk. */ - bsdtar->names_from_file = optarg; + bsdtar->names_from_file = bsdtar->optarg; break; case OPTION_INCLUDE: /* @@ -376,10 +230,10 @@ main(int argc, char **argv) * noone else needs this to filter entries * when transforming archives. */ - if (include(bsdtar, optarg)) + if (include(bsdtar, bsdtar->optarg)) bsdtar_errc(bsdtar, 1, 0, "Failed to add %s to inclusion list", - optarg); + bsdtar->optarg); break; case 'j': /* GNU tar */ #if HAVE_LIBBZ2 @@ -389,7 +243,8 @@ main(int argc, char **argv) bsdtar->create_compression); bsdtar->create_compression = opt; #else - bsdtar_warnc(bsdtar, 0, "-j compression not supported by this version of bsdtar"); + bsdtar_warnc(bsdtar, 0, + "bzip2 compression not supported by this version of bsdtar"); usage(bsdtar); #endif break; @@ -420,28 +275,28 @@ main(int argc, char **argv) * TODO: Add corresponding "older" options to reverse these. */ case OPTION_NEWER_CTIME: /* GNU tar */ - bsdtar->newer_ctime_sec = get_date(optarg); + bsdtar->newer_ctime_sec = get_date(bsdtar->optarg); break; case OPTION_NEWER_CTIME_THAN: { struct stat st; - if (stat(optarg, &st) != 0) + if (stat(bsdtar->optarg, &st) != 0) bsdtar_errc(bsdtar, 1, 0, - "Can't open file %s", optarg); + "Can't open file %s", bsdtar->optarg); bsdtar->newer_ctime_sec = st.st_ctime; bsdtar->newer_ctime_nsec = ARCHIVE_STAT_CTIME_NANOS(&st); } break; case OPTION_NEWER_MTIME: /* GNU tar */ - bsdtar->newer_mtime_sec = get_date(optarg); + bsdtar->newer_mtime_sec = get_date(bsdtar->optarg); break; case OPTION_NEWER_MTIME_THAN: { struct stat st; - if (stat(optarg, &st) != 0) + if (stat(bsdtar->optarg, &st) != 0) bsdtar_errc(bsdtar, 1, 0, - "Can't open file %s", optarg); + "Can't open file %s", bsdtar->optarg); bsdtar->newer_mtime_sec = st.st_mtime; bsdtar->newer_mtime_nsec = ARCHIVE_STAT_MTIME_NANOS(&st); @@ -509,17 +364,18 @@ main(int argc, char **argv) break; case 's': /* NetBSD pax-as-tar */ #if HAVE_REGEX_H - add_substitution(bsdtar, optarg); + add_substitution(bsdtar, bsdtar->optarg); #else - bsdtar_warnc(bsdtar, 0, "-s is not supported by this version of bsdtar"); + bsdtar_warnc(bsdtar, 0, + "-s is not supported by this version of bsdtar"); usage(bsdtar); #endif break; case OPTION_STRIP_COMPONENTS: /* GNU tar 1.15 */ - bsdtar->strip_components = atoi(optarg); + bsdtar->strip_components = atoi(bsdtar->optarg); break; case 'T': /* GNU tar */ - bsdtar->names_from_file = optarg; + bsdtar->names_from_file = bsdtar->optarg; break; case 't': /* SUSv2 */ set_mode(bsdtar, opt); @@ -544,19 +400,19 @@ main(int argc, char **argv) #if 0 /* * The -W longopt feature is handled inside of - * bsdtar_getop(), so -W is not available here. + * bsdtar_getopt(), so -W is not available here. */ - case 'W': /* Obscure, but useful GNU convention. */ + case 'W': /* Obscure GNU convention. */ break; #endif case 'w': /* SUSv2 */ bsdtar->option_interactive = 1; break; case 'X': /* GNU tar */ - if (exclude_from_file(bsdtar, optarg)) + if (exclude_from_file(bsdtar, bsdtar->optarg)) bsdtar_errc(bsdtar, 1, 0, "failed to process exclusions from file %s", - optarg); + bsdtar->optarg); break; case 'x': /* SUSv2 */ set_mode(bsdtar, opt); @@ -569,7 +425,8 @@ main(int argc, char **argv) bsdtar->create_compression); bsdtar->create_compression = opt; #else - bsdtar_warnc(bsdtar, 0, "-y compression not supported by this version of bsdtar"); + bsdtar_warnc(bsdtar, 0, + "bzip2 compression not supported by this version of bsdtar"); usage(bsdtar); #endif break; @@ -588,12 +445,13 @@ main(int argc, char **argv) bsdtar->create_compression); bsdtar->create_compression = opt; #else - bsdtar_warnc(bsdtar, 0, "-z compression not supported by this version of bsdtar"); + bsdtar_warnc(bsdtar, 0, + "gzip compression not supported by this version of bsdtar"); usage(bsdtar); #endif break; case OPTION_USE_COMPRESS_PROGRAM: - bsdtar->compress_program = optarg; + bsdtar->compress_program = bsdtar->optarg; break; default: usage(bsdtar); @@ -668,9 +526,6 @@ main(int argc, char **argv) if (bsdtar->strip_components != 0) only_mode(bsdtar, "--strip-components", "xt"); - bsdtar->argc -= optind; - bsdtar->argv += optind; - switch(bsdtar->mode) { case 'c': tar_mode_c(bsdtar); @@ -722,72 +577,6 @@ only_mode(struct bsdtar *bsdtar, const c } -/*- - * Convert traditional tar arguments into new-style. - * For example, - * tar tvfb file.tar 32 --exclude FOO - * will be converted to - * tar -t -v -f file.tar -b 32 --exclude FOO - * - * This requires building a new argv array. The initial bundled word - * gets expanded into a new string that looks like "-t\0-v\0-f\0-b\0". - * The new argv array has pointers into this string intermingled with - * pointers to the existing arguments. Arguments are moved to - * immediately follow their options. - * - * The optstring argument here is the same one passed to getopt(3). - * It is used to determine which option letters have trailing arguments. - */ -char ** -rewrite_argv(struct bsdtar *bsdtar, int *argc, char **src_argv, - const char *optstring) -{ - char **new_argv, **dest_argv; - const char *p; - char *src, *dest; - - if (src_argv[0] == NULL || src_argv[1] == NULL || - src_argv[1][0] == '-' || src_argv[1][0] == '\0') - return (src_argv); - - *argc += strlen(src_argv[1]) - 1; - new_argv = malloc((*argc + 1) * sizeof(new_argv[0])); - if (new_argv == NULL) - bsdtar_errc(bsdtar, 1, errno, "No Memory"); - - dest_argv = new_argv; - *dest_argv++ = *src_argv++; - - dest = malloc(strlen(*src_argv) * 3); - if (dest == NULL) - bsdtar_errc(bsdtar, 1, errno, "No memory"); - for (src = *src_argv++; *src != '\0'; src++) { - *dest_argv++ = dest; - *dest++ = '-'; - *dest++ = *src; - *dest++ = '\0'; - /* If option takes an argument, insert that into the list. */ - for (p = optstring; p != NULL && *p != '\0'; p++) { - if (*p != *src) - continue; - if (p[1] != ':') /* No arg required, done. */ - break; - if (*src_argv == NULL) /* No arg available? Error. */ - bsdtar_errc(bsdtar, 1, 0, - "Option %c requires an argument", - *src); - *dest_argv++ = *src_argv++; - break; - } - } - - /* Copy remaining arguments, including trailing NULL. */ - while ((*dest_argv++ = *src_argv++) != NULL) - ; - - return (new_argv); -} - void usage(struct bsdtar *bsdtar) { @@ -799,11 +588,7 @@ usage(struct bsdtar *bsdtar) fprintf(stderr, " List: %s -tf \n", p); fprintf(stderr, " Extract: %s -xf \n", p); fprintf(stderr, " Create: %s -cf [filenames...]\n", p); -#ifdef HAVE_GETOPT_LONG fprintf(stderr, " Help: %s --help\n", p); -#else - fprintf(stderr, " Help: %s -h\n", p); -#endif exit(1); } @@ -828,11 +613,7 @@ static const char *long_help_msg = " , add these items to archive\n" " -z, -j Compress archive with gzip/bzip2\n" " --format {ustar|pax|cpio|shar} Select archive format\n" -#ifdef HAVE_GETOPT_LONG " --exclude Skip files that match pattern\n" -#else - " -W exclude= Skip files that match pattern\n" -#endif " -C Change to before processing remaining files\n" " @ Add entries from to output\n" "List: %p -t [options] []\n" @@ -880,80 +661,3 @@ long_help(struct bsdtar *bsdtar) } version(); } - -static int -bsdtar_getopt(struct bsdtar *bsdtar, const char *optstring, - const struct option **poption) -{ - char *p, *q; - const struct option *option; - int opt; - int option_index; - size_t option_length; - - option_index = -1; - *poption = NULL; - -#ifdef HAVE_GETOPT_LONG - opt = getopt_long(bsdtar->argc, bsdtar->argv, optstring, - tar_longopts, &option_index); - if (option_index > -1) - *poption = tar_longopts + option_index; -#else - opt = getopt(bsdtar->argc, bsdtar->argv, optstring); -#endif - - /* Support long options through -W longopt=value */ - if (opt == 'W') { - p = optarg; - q = strchr(optarg, '='); - if (q != NULL) { - option_length = (size_t)(q - p); - optarg = q + 1; - } else { - option_length = strlen(p); - optarg = NULL; - } - option = tar_longopts; - while (option->name != NULL && - (strlen(option->name) < option_length || - strncmp(p, option->name, option_length) != 0 )) { - option++; - } - - if (option->name != NULL) { - *poption = option; - opt = option->val; - - /* If the first match was exact, we're done. */ - if (strncmp(p, option->name, strlen(option->name)) == 0) { - while (option->name != NULL) - option++; - } else { - /* Check if there's another match. */ - option++; - while (option->name != NULL && - (strlen(option->name) < option_length || - strncmp(p, option->name, option_length) != 0)) { - option++; - } - } - if (option->name != NULL) - bsdtar_errc(bsdtar, 1, 0, - "Ambiguous option %s " - "(matches both %s and %s)", - p, (*poption)->name, option->name); - - if ((*poption)->has_arg == required_argument - && optarg == NULL) - bsdtar_errc(bsdtar, 1, 0, - "Option \"%s\" requires argument", p); - } else { - opt = '?'; - /* TODO: Set up a fake 'struct option' for - * error reporting... ? ? ? */ - } - } - - return (opt); -} Modified: head/usr.bin/tar/bsdtar.h ============================================================================== --- head/usr.bin/tar/bsdtar.h Sat Nov 8 02:05:41 2008 (r184760) +++ head/usr.bin/tar/bsdtar.h Sat Nov 8 04:43:24 2008 (r184761) @@ -80,6 +80,7 @@ struct bsdtar { const char *progname; int argc; char **argv; + const char *optarg; size_t gs_width; /* For 'list_item' in read.c */ size_t u_width; /* for 'list_item' in read.c */ uid_t user_uid; /* UID running this program */ @@ -102,8 +103,36 @@ struct bsdtar { struct substitution *substitution; /* for subst.c */ }; +/* Fake short equivalents for long options that otherwise lack them. */ +enum { + OPTION_CHECK_LINKS = 1, + OPTION_CHROOT, + OPTION_EXCLUDE, + OPTION_FORMAT, + OPTION_HELP, + OPTION_INCLUDE, + OPTION_KEEP_NEWER_FILES, + OPTION_NEWER_CTIME, + OPTION_NEWER_CTIME_THAN, + OPTION_NEWER_MTIME, + OPTION_NEWER_MTIME_THAN, + OPTION_NODUMP, + OPTION_NO_SAME_OWNER, + OPTION_NO_SAME_PERMISSIONS, + OPTION_NULL, + OPTION_NUMERIC_OWNER, + OPTION_ONE_FILE_SYSTEM, + OPTION_POSIX, + OPTION_STRIP_COMPONENTS, + OPTION_TOTALS, + OPTION_USE_COMPRESS_PROGRAM, + OPTION_VERSION +}; + + void bsdtar_errc(struct bsdtar *, int _eval, int _code, const char *fmt, ...) __dead2; +int bsdtar_getopt(struct bsdtar *); void bsdtar_warnc(struct bsdtar *, int _code, const char *fmt, ...); void cleanup_exclusions(struct bsdtar *); void do_chdir(struct bsdtar *); Added: head/usr.bin/tar/cmdline.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.bin/tar/cmdline.c Sat Nov 8 04:43:24 2008 (r184761) @@ -0,0 +1,376 @@ +/*- + * Copyright (c) 2003-2008 Tim Kientzle + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/* + * Command line parser for tar. + */ + +#include "bsdtar_platform.h" +__FBSDID("$FreeBSD$"); + +#ifdef HAVE_ERRNO_H +#include +#endif +#ifdef HAVE_STDLIB_H +#include +#endif +#ifdef HAVE_STRING_H +#include +#endif + +#include "bsdtar.h" + +/* + * Short options for tar. Please keep this sorted. + */ +static const char *short_options + = "Bb:C:cf:HhI:jkLlmnOoPpqrSs:T:tUuvW:wX:xyZz"; + +/* + * Long options for tar. Please keep this list sorted. + * + * The symbolic names for options that lack a short equivalent are + * defined in bsdtar.h. Also note that so far I've found no need + * to support optional arguments to long options. That would be + * a small change to the code below. + */ + +static struct option { + const char *name; + int required; /* 1 if this option requires an argument. */ + int equivalent; /* Equivalent short option. */ +} tar_longopts[] = { + { "absolute-paths", 0, 'P' }, + { "append", 0, 'r' }, + { "block-size", 1, 'b' }, + { "bunzip2", 0, 'j' }, + { "bzip", 0, 'j' }, + { "bzip2", 0, 'j' }, + { "cd", 1, 'C' }, + { "check-links", 0, OPTION_CHECK_LINKS }, + { "chroot", 0, OPTION_CHROOT }, + { "compress", 0, 'Z' }, + { "confirmation", 0, 'w' }, + { "create", 0, 'c' }, + { "dereference", 0, 'L' }, + { "directory", 1, 'C' }, + { "exclude", 1, OPTION_EXCLUDE }, + { "exclude-from", 1, 'X' }, + { "extract", 0, 'x' }, + { "fast-read", 0, 'q' }, + { "file", 1, 'f' }, + { "files-from", 1, 'T' }, + { "format", 1, OPTION_FORMAT }, + { "gunzip", 0, 'z' }, + { "gzip", 0, 'z' }, + { "help", 0, OPTION_HELP }, + { "include", 1, OPTION_INCLUDE }, + { "interactive", 0, 'w' }, + { "insecure", 0, 'P' }, + { "keep-newer-files", 0, OPTION_KEEP_NEWER_FILES }, + { "keep-old-files", 0, 'k' }, + { "list", 0, 't' }, + { "modification-time", 0, 'm' }, + { "newer", 1, OPTION_NEWER_CTIME }, + { "newer-ctime", 1, OPTION_NEWER_CTIME }, + { "newer-ctime-than", 1, OPTION_NEWER_CTIME_THAN }, + { "newer-mtime", 1, OPTION_NEWER_MTIME }, + { "newer-mtime-than", 1, OPTION_NEWER_MTIME_THAN }, + { "newer-than", 1, OPTION_NEWER_CTIME_THAN }, + { "nodump", 0, OPTION_NODUMP }, + { "norecurse", 0, 'n' }, + { "no-recursion", 0, 'n' }, + { "no-same-owner", 0, OPTION_NO_SAME_OWNER }, + { "no-same-permissions", 0, OPTION_NO_SAME_PERMISSIONS }, + { "null", 0, OPTION_NULL }, + { "numeric-owner", 0, OPTION_NUMERIC_OWNER }, + { "one-file-system", 0, OPTION_ONE_FILE_SYSTEM }, + { "posix", 0, OPTION_POSIX }, + { "preserve-permissions", 0, 'p' }, + { "read-full-blocks", 0, 'B' }, + { "same-permissions", 0, 'p' }, + { "strip-components", 1, OPTION_STRIP_COMPONENTS }, + { "to-stdout", 0, 'O' }, + { "totals", 0, OPTION_TOTALS }, + { "uncompress", 0, 'Z' }, + { "unlink", 0, 'U' }, + { "unlink-first", 0, 'U' }, + { "update", 0, 'u' }, + { "use-compress-program", 1, OPTION_USE_COMPRESS_PROGRAM }, + { "verbose", 0, 'v' }, + { "version", 0, OPTION_VERSION }, + { NULL, 0, 0 } +}; + +/* + * This getopt implementation has two key features that common + * getopt_long() implementations lack. Apart from those, it's a + * straightforward option parser, considerably simplified by not + * needing to support the wealth of exotic getopt_long() features. It + * has, of course, been shamelessly tailored for bsdtar. (If you're + * looking for a generic getopt_long() implementation for your + * project, I recommend Gregory Pietsch's public domain getopt_long() + * implementation.) The two additional features are: + * + * Old-style tar arguments: The original tar implementation treated + * the first argument word as a list of single-character option + * letters. All arguments follow as separate words. For example, + * tar xbf 32 /dev/tape + * Here, the "xbf" is three option letters, "32" is the argument for + * "b" and "/dev/tape" is the argument for "f". We support this usage + * if the first command-line argument does not begin with '-'. We + * also allow regular short and long options to follow, e.g., + * tar xbf 32 /dev/tape -P --format=pax + * + * -W long options: There's an obscure GNU convention (only rarely + * supported even there) that allows "-W option=argument" as an + * alternative way to support long options. This was supported in + * early bsdtar as a way to access long options on platforms that did + * not support getopt_long() and is preserved here for backwards + * compatibility. (Of course, if I'd started with a custom + * command-line parser from the beginning, I would have had normal + * long option support on every platform so that hack wouldn't have + * been necessary. Oh, well. Some mistakes you just have to live + * with.) + * + * TODO: We should be able to use this to pull files and intermingled + * options (such as -C) from the command line in write mode. That + * will require a little rethinking of the argument handling in + * bsdtar.c. + * + * TODO: If we want to support arbitrary command-line options from -T + * input (as GNU tar does), we may need to extend this to handle option + * words from sources other than argv/arc. I'm not really sure if I + * like that feature of GNU tar, so it's certainly not a priority. + */ + +int +bsdtar_getopt(struct bsdtar *bsdtar) +{ + enum { state_start = 0, state_old_tar, state_next_word, + state_short, state_long }; + static int state = state_start; + static char *opt_word; + + const struct option *popt, *match = NULL, *match2 = NULL; + const char *p, *long_prefix = "--"; + size_t optlength; + int opt = '?'; + int required = 0; + + bsdtar->optarg = NULL; + + /* First time through, initialize everything. */ + if (state == state_start) { + /* Skip program name. */ + ++bsdtar->argv; + --bsdtar->argc; + if (*bsdtar->argv == NULL) + return (-1); + /* Decide between "new style" and "old style" arguments. */ + if (bsdtar->argv[0][0] == '-') { + state = state_next_word; + } else { + state = state_old_tar; + opt_word = *bsdtar->argv++; + --bsdtar->argc; + } + } + + /* + * We're parsing old-style tar arguments + */ + if (state == state_old_tar) { + /* Get the next option character. */ + opt = *opt_word++; + if (opt == '\0') { + /* New-style args can follow old-style. */ + state = state_next_word; + } else { + /* See if it takes an argument. */ + p = strchr(short_options, opt); + if (p == NULL) + return ('?'); + if (p[1] == ':') { + bsdtar->optarg = *bsdtar->argv; + if (bsdtar->optarg == NULL) { + bsdtar_warnc(bsdtar, 0, + "Option %c requires an argument", + opt); + return ('?'); + } + ++bsdtar->argv; + --bsdtar->argc; + } + } + } + + /* + * We're ready to look at the next word in argv. + */ + if (state == state_next_word) { + /* No more arguments, so no more options. */ + if (bsdtar->argv[0] == NULL) + return (-1); + /* Doesn't start with '-', so no more options. */ + if (bsdtar->argv[0][0] != '-') + return (-1); + /* "--" marks end of options; consume it and return. */ + if (strcmp(bsdtar->argv[0], "--") == 0) { + ++bsdtar->argv; + --bsdtar->argc; *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From mav at FreeBSD.org Fri Nov 7 22:25:57 2008 From: mav at FreeBSD.org (Alexander Motin) Date: Fri Nov 7 22:26:04 2008 Subject: svn commit: r184762 - head/sys/netgraph Message-ID: <200811080625.mA86Pvhw003486@svn.freebsd.org> Author: mav Date: Sat Nov 8 06:25:57 2008 New Revision: 184762 URL: http://svn.freebsd.org/changeset/base/184762 Log: Don't use curthread to resolve file descriptor. Request may be queued, so thread will be different. Instead require sender to send process ID together with file descriptor. Modified: head/sys/netgraph/ng_tty.c Modified: head/sys/netgraph/ng_tty.c ============================================================================== --- head/sys/netgraph/ng_tty.c Sat Nov 8 04:43:24 2008 (r184761) +++ head/sys/netgraph/ng_tty.c Sat Nov 8 06:25:57 2008 (r184762) @@ -73,6 +73,7 @@ #include #include #include +#include #include #include @@ -250,7 +251,8 @@ ngt_shutdown(node_p node) static int ngt_rcvmsg(node_p node, item_p item, hook_p lasthook) { - struct thread *td = curthread; /* XXX */ + struct proc *p; + struct thread *td; const sc_p sc = NG_NODE_PRIVATE(node); struct ng_mesg *msg, *resp = NULL; int error = 0; @@ -262,8 +264,14 @@ ngt_rcvmsg(node_p node, item_p item, hoo case NGM_TTY_SET_TTY: if (sc->tp != NULL) return (EBUSY); - error = ttyhook_register(&sc->tp, td, *(int *)msg->data, + + p = pfind(((int *)msg->data)[0]); + if (p == NULL) + return (ESRCH); + td = FIRST_THREAD_IN_PROC(p); + error = ttyhook_register(&sc->tp, td, ((int *)msg->data)[1], &ngt_hook, sc); + PROC_UNLOCK(p); if (error != 0) return (error); break; From attilio at freebsd.org Sat Nov 8 05:13:49 2008 From: attilio at freebsd.org (Attilio Rao) Date: Sat Nov 8 05:14:01 2008 Subject: svn commit: r184762 - head/sys/netgraph In-Reply-To: <200811080625.mA86Pvhw003486@svn.freebsd.org> References: <200811080625.mA86Pvhw003486@svn.freebsd.org> Message-ID: <3bbf2fe10811080513x2b8bd201gcf24562360374494@mail.gmail.com> 2008/11/8, Alexander Motin : > Author: mav > Date: Sat Nov 8 06:25:57 2008 > New Revision: 184762 > URL: http://svn.freebsd.org/changeset/base/184762 > > Log: > Don't use curthread to resolve file descriptor. Request may be queued, so > thread will be different. Instead require sender to send process ID > together with file descriptor. > > Modified: > head/sys/netgraph/ng_tty.c > > Modified: head/sys/netgraph/ng_tty.c > ============================================================================== > --- head/sys/netgraph/ng_tty.c Sat Nov 8 04:43:24 2008 (r184761) > +++ head/sys/netgraph/ng_tty.c Sat Nov 8 06:25:57 2008 (r184762) > @@ -73,6 +73,7 @@ > #include > #include > #include > +#include > > #include > #include > @@ -250,7 +251,8 @@ ngt_shutdown(node_p node) > static int > ngt_rcvmsg(node_p node, item_p item, hook_p lasthook) > { > - struct thread *td = curthread; /* XXX */ > + struct proc *p; > + struct thread *td; > const sc_p sc = NG_NODE_PRIVATE(node); > struct ng_mesg *msg, *resp = NULL; > int error = 0; > @@ -262,8 +264,14 @@ ngt_rcvmsg(node_p node, item_p item, hoo > case NGM_TTY_SET_TTY: > if (sc->tp != NULL) > return (EBUSY); > - error = ttyhook_register(&sc->tp, td, *(int *)msg->data, > + > + p = pfind(((int *)msg->data)[0]); > + if (p == NULL) > + return (ESRCH); > + td = FIRST_THREAD_IN_PROC(p); > + error = ttyhook_register(&sc->tp, td, ((int *)msg->data)[1], > &ngt_hook, sc); > + PROC_UNLOCK(p); > if (error != 0) > return (error); > break; The threads iterator in strcut proc should be proc_slock protected, so you need to grab/release it around FIRST_THREAD_IN_PROC(). Thanks, Attilio -- Peace can only be achieved by understanding - A. Einstein From kostikbel at gmail.com Sat Nov 8 06:07:57 2008 From: kostikbel at gmail.com (Kostik Belousov) Date: Sat Nov 8 06:08:03 2008 Subject: svn commit: r184762 - head/sys/netgraph In-Reply-To: <3bbf2fe10811080513x2b8bd201gcf24562360374494@mail.gmail.com> References: <200811080625.mA86Pvhw003486@svn.freebsd.org> <3bbf2fe10811080513x2b8bd201gcf24562360374494@mail.gmail.com> Message-ID: <20081108140750.GI18100@deviant.kiev.zoral.com.ua> On Sat, Nov 08, 2008 at 02:13:46PM +0100, Attilio Rao wrote: > 2008/11/8, Alexander Motin : > > Author: mav > > Date: Sat Nov 8 06:25:57 2008 > > New Revision: 184762 > > URL: http://svn.freebsd.org/changeset/base/184762 > > > > Log: > > Don't use curthread to resolve file descriptor. Request may be queued, so > > thread will be different. Instead require sender to send process ID > > together with file descriptor. > > > > Modified: > > head/sys/netgraph/ng_tty.c > > > > Modified: head/sys/netgraph/ng_tty.c > > ============================================================================== > > --- head/sys/netgraph/ng_tty.c Sat Nov 8 04:43:24 2008 (r184761) > > +++ head/sys/netgraph/ng_tty.c Sat Nov 8 06:25:57 2008 (r184762) > > @@ -73,6 +73,7 @@ > > #include > > #include > > #include > > +#include > > > > #include > > #include > > @@ -250,7 +251,8 @@ ngt_shutdown(node_p node) > > static int > > ngt_rcvmsg(node_p node, item_p item, hook_p lasthook) > > { > > - struct thread *td = curthread; /* XXX */ > > + struct proc *p; > > + struct thread *td; > > const sc_p sc = NG_NODE_PRIVATE(node); > > struct ng_mesg *msg, *resp = NULL; > > int error = 0; > > @@ -262,8 +264,14 @@ ngt_rcvmsg(node_p node, item_p item, hoo > > case NGM_TTY_SET_TTY: > > if (sc->tp != NULL) > > return (EBUSY); > > - error = ttyhook_register(&sc->tp, td, *(int *)msg->data, > > + > > + p = pfind(((int *)msg->data)[0]); > > + if (p == NULL) > > + return (ESRCH); > > + td = FIRST_THREAD_IN_PROC(p); > > + error = ttyhook_register(&sc->tp, td, ((int *)msg->data)[1], > > &ngt_hook, sc); > > + PROC_UNLOCK(p); > > if (error != 0) > > return (error); > > break; > > The threads iterator in strcut proc should be proc_slock protected, so > you need to grab/release it around FIRST_THREAD_IN_PROC(). I do not believe that process slock is needed there, since code just dereference a pointer. The process lock seems to be taken to guarantee that td is alive. On the other hand, ttyhook_register locks filedesc sx, that causes sleepable lock acquition after non-sleepable. I believe this is an actual problem with the change. Probably, this is even the problem with KPI of ttyhook_register, since caller need to somehow protect td from going away, and proc lock is a right lock to held. -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 195 bytes Desc: not available Url : http://lists.freebsd.org/pipermail/svn-src-all/attachments/20081108/7abf2c7f/attachment.pgp From blackend at freebsd.org Sat Nov 8 06:18:46 2008 From: blackend at freebsd.org (Marc Fonvieille) Date: Sat Nov 8 06:18:53 2008 Subject: svn commit: r184753 - head/usr.sbin/sysinstall In-Reply-To: <20081108001032.GA21542@ma.sigsys.de> References: <200811072201.mA7M1VlX093904@svn.freebsd.org> <20081108001032.GA21542@ma.sigsys.de> Message-ID: <20081108140813.GA1039@gothic.blackend.org> On Sat, Nov 08, 2008 at 01:10:32AM +0100, Raphael Becker wrote: > On Fri, Nov 07, 2008 at 10:01:31PM +0000, Marc Fonvieille wrote: > > + "This will give you ready access to over 19,000 ported software packages,\n" > > + "at a cost of around 445MB of disk space when \"clean\" and possibly\n" > > > I see around 700M here, my ports are configured "read-only", so all > work/, packages/ distfiles/ and so on are outside /usr/ports, updates > are done by cvsup: > > # df -mi /usr/ports/ > Filesystem 1M-blocks Used Avail Capacity iused ifree %iused Mounted on > /dev/md0 1039 712 119 86% 129743 478895 21% /usr/ports > > # du -sm /usr/ports/ > 713 /usr/ports/ > > It heavily depends on inode-sizes. > > I have about 130k inodes in use which cause a "theoretical minimum" > of 508MB disk on filesystems with 4k inode-density, about 1G with 8k > inodes (default is 8k, see by newfs(8)) > > -i bytes > Specify the density of inodes in the file system. The default is > to create an inode for every (4 * frag-size) bytes of data space. > > -f frag-size > The fragment size of the file system in bytes. It must be a > power of two ranging in value between blocksize/8 and blocksize. > The default is 2048 bytes. > > > An uncompressed tarball (without the "inode-overhead") of > /usr/ports/ is around 600MB here: > > # tar cf - /usr/ports/ | wc -c > tar: Removing leading '/' from member names > 629196800 > > or 600MB. > > How did you measure / calculate 445MB? > If I do a csup after a rm -rf /usr/ports I get 402M according to "du -sh", so if we add INDEXes we should be close to 440M. I used 445MB to be consistent with what we have in http://www.freebsd.org/cgi/cvsweb.cgi/doc/share/sgml/freebsd.ent.diff?r1=1.100;r2=1.101 -- Marc -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 187 bytes Desc: not available Url : http://lists.freebsd.org/pipermail/svn-src-all/attachments/20081108/3b5aad39/attachment.pgp From mav at FreeBSD.org Sat Nov 8 06:39:56 2008 From: mav at FreeBSD.org (Alexander Motin) Date: Sat Nov 8 06:40:02 2008 Subject: svn commit: r184762 - head/sys/netgraph In-Reply-To: <3bbf2fe10811080513x2b8bd201gcf24562360374494@mail.gmail.com> References: <200811080625.mA86Pvhw003486@svn.freebsd.org> <3bbf2fe10811080513x2b8bd201gcf24562360374494@mail.gmail.com> Message-ID: <4915A4BA.6090701@FreeBSD.org> Attilio Rao wrote: > 2008/11/8, Alexander Motin : >> @@ -262,8 +264,14 @@ ngt_rcvmsg(node_p node, item_p item, hoo >> case NGM_TTY_SET_TTY: >> if (sc->tp != NULL) >> return (EBUSY); >> - error = ttyhook_register(&sc->tp, td, *(int *)msg->data, >> + >> + p = pfind(((int *)msg->data)[0]); >> + if (p == NULL) >> + return (ESRCH); >> + td = FIRST_THREAD_IN_PROC(p); >> + error = ttyhook_register(&sc->tp, td, ((int *)msg->data)[1], >> &ngt_hook, sc); >> + PROC_UNLOCK(p); >> if (error != 0) >> return (error); >> break; > > The threads iterator in strcut proc should be proc_slock protected, so > you need to grab/release it around FIRST_THREAD_IN_PROC(). thread_find() also asserts process locked, but then it traverses/dereferences/returns threads without any additional locking. -- Alexander Motin From attilio at freebsd.org Sat Nov 8 06:47:43 2008 From: attilio at freebsd.org (Attilio Rao) Date: Sat Nov 8 06:47:49 2008 Subject: svn commit: r184762 - head/sys/netgraph In-Reply-To: <20081108140750.GI18100@deviant.kiev.zoral.com.ua> References: <200811080625.mA86Pvhw003486@svn.freebsd.org> <3bbf2fe10811080513x2b8bd201gcf24562360374494@mail.gmail.com> <20081108140750.GI18100@deviant.kiev.zoral.com.ua> Message-ID: <3bbf2fe10811080647n3f43c0d5k19a6e673c34b868c@mail.gmail.com> 2008/11/8, Kostik Belousov : > On Sat, Nov 08, 2008 at 02:13:46PM +0100, Attilio Rao wrote: > > 2008/11/8, Alexander Motin : > > > Author: mav > > > Date: Sat Nov 8 06:25:57 2008 > > > New Revision: 184762 > > > URL: http://svn.freebsd.org/changeset/base/184762 > > > > > > Log: > > > Don't use curthread to resolve file descriptor. Request may be queued, so > > > thread will be different. Instead require sender to send process ID > > > together with file descriptor. > > > > > > Modified: > > > head/sys/netgraph/ng_tty.c > > > > > > Modified: head/sys/netgraph/ng_tty.c > > > ============================================================================== > > > --- head/sys/netgraph/ng_tty.c Sat Nov 8 04:43:24 2008 (r184761) > > > +++ head/sys/netgraph/ng_tty.c Sat Nov 8 06:25:57 2008 (r184762) > > > @@ -73,6 +73,7 @@ > > > #include > > > #include > > > #include > > > +#include > > > > > > #include > > > #include > > > @@ -250,7 +251,8 @@ ngt_shutdown(node_p node) > > > static int > > > ngt_rcvmsg(node_p node, item_p item, hook_p lasthook) > > > { > > > - struct thread *td = curthread; /* XXX */ > > > + struct proc *p; > > > + struct thread *td; > > > const sc_p sc = NG_NODE_PRIVATE(node); > > > struct ng_mesg *msg, *resp = NULL; > > > int error = 0; > > > @@ -262,8 +264,14 @@ ngt_rcvmsg(node_p node, item_p item, hoo > > > case NGM_TTY_SET_TTY: > > > if (sc->tp != NULL) > > > return (EBUSY); > > > - error = ttyhook_register(&sc->tp, td, *(int *)msg->data, > > > + > > > + p = pfind(((int *)msg->data)[0]); > > > + if (p == NULL) > > > + return (ESRCH); > > > + td = FIRST_THREAD_IN_PROC(p); > > > + error = ttyhook_register(&sc->tp, td, ((int *)msg->data)[1], > > > &ngt_hook, sc); > > > + PROC_UNLOCK(p); > > > if (error != 0) > > > return (error); > > > break; > > > > The threads iterator in strcut proc should be proc_slock protected, so > > you need to grab/release it around FIRST_THREAD_IN_PROC(). > > > I do not believe that process slock is needed there, since code > just dereference a pointer. The process lock seems to be taken to > guarantee that td is alive. > > On the other hand, ttyhook_register locks filedesc sx, that causes > sleepable lock acquition after non-sleepable. I believe this is > an actual problem with the change. > > Probably, this is even the problem with KPI of ttyhook_register, since > caller need to somehow protect td from going away, and proc lock is > a right lock to held. I spoke briefly with Kostik on IRC and the problem he exposes is real. He suggested to use directly a struct file object to be passed and it seems fine by me. Also, as you are not interested in what thread is returned as first, you probabilly don't need the proc_slock. Thanks, Attilio -- Peace can only be achieved by understanding - A. Einstein From cokane at FreeBSD.org Sat Nov 8 08:05:54 2008 From: cokane at FreeBSD.org (Coleman Kane) Date: Sat Nov 8 08:06:01 2008 Subject: svn commit: r184691 - head/sys/compat/linprocfs In-Reply-To: <491264B8.80602@freebsd.org> References: <200811051508.mA5F89XD030040@svn.freebsd.org> <20081105.150108.1649771743.imp@bsdimp.com> <9bbcef730811051526p3a978848uf904a149cb81fbce@mail.gmail.com> <20081105.163911.420518480.imp@bsdimp.com> <491264B8.80602@freebsd.org> Message-ID: <1226159208.2183.16.camel@localhost> On Wed, 2008-11-05 at 19:30 -0800, Tim Kientzle wrote: > > : This is why there's such a big push to get systems to properly support > > : UTF-8. FreeBSD had a SoC project this year that was supposed to > > : properly implement Unicode collations... > > > > That makes sense. > > Yes, UTF-8 is good. More UTF-8, please. > > Tim I third that motion. -- Coleman Kane -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 195 bytes Desc: This is a digitally signed message part Url : http://lists.freebsd.org/pipermail/svn-src-all/attachments/20081108/9caa1423/attachment.pgp From keramida at FreeBSD.org Sat Nov 8 09:45:47 2008 From: keramida at FreeBSD.org (Giorgos Keramidas) Date: Sat Nov 8 09:45:54 2008 Subject: svn commit: r184769 - head/share/man/man4 Message-ID: <200811081745.mA8Hjlcu018645@svn.freebsd.org> Author: keramida (doc committer) Date: Sat Nov 8 17:45:47 2008 New Revision: 184769 URL: http://svn.freebsd.org/changeset/base/184769 Log: Spell 'different' correctly. Modified: head/share/man/man4/snd_hda.4 Modified: head/share/man/man4/snd_hda.4 ============================================================================== --- head/share/man/man4/snd_hda.4 Sat Nov 8 11:49:58 2008 (r184768) +++ head/share/man/man4/snd_hda.4 Sat Nov 8 17:45:47 2008 (r184769) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd November 6, 2008 +.Dd November 8, 2008 .Dt SND_HDA 4 .Os .Sh NAME @@ -297,7 +297,7 @@ any codec pin (external connector). All codec pins are reversible (could be configured either as input or output). .Pp So high codec uniformity and flexibility allow driver to configure it in many -defferent ways, depending on requested pins usage decribed by pins configuration. +different ways, depending on requested pins usage decribed by pins configuration. Driver reports such default pin configuration when verbose messages enabled: .Bd -literal hdac0: nid 20 0x01014020 as 2 seq 0 Line-out Jack jack 1 loc 1 color Green misc 0 From trasz at FreeBSD.org Sat Nov 8 11:56:33 2008 From: trasz at FreeBSD.org (Edward Tomasz Napierala) Date: Sat Nov 8 11:56:39 2008 Subject: svn commit: r184770 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs Message-ID: <200811081956.mA8JuWdj020934@svn.freebsd.org> Author: trasz Date: Sat Nov 8 19:56:32 2008 New Revision: 184770 URL: http://svn.freebsd.org/changeset/base/184770 Log: Require write access on a directory being moved from one parent directory to another in ZFS. Approved by: rwatson (mentor), pjd Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_acl.c Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_acl.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_acl.c Sat Nov 8 17:45:47 2008 (r184769) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_acl.c Sat Nov 8 19:56:32 2008 (r184770) @@ -1580,7 +1580,15 @@ zfs_zaccess_rename(znode_t *sdzp, znode_ /* * Rename permissions are combination of delete permission + * add file/subdir permission. + * + * BSD operating systems also require write permission + * on the directory being moved from one parent directory + * to another. */ + if (ZTOV(szp)->v_type == VDIR && ZTOV(sdzp) != ZTOV(tdzp)) { + if (error = zfs_zaccess(szp, ACE_WRITE_DATA, cr)) + return (error); + } /* * first make sure we do the delete portion. From ed at FreeBSD.org Sat Nov 8 12:40:40 2008 From: ed at FreeBSD.org (Ed Schouten) Date: Sat Nov 8 12:40:51 2008 Subject: svn commit: r184771 - in head/sys: dev/syscons kern sys Message-ID: <200811082040.mA8KeewQ021788@svn.freebsd.org> Author: ed Date: Sat Nov 8 20:40:39 2008 New Revision: 184771 URL: http://svn.freebsd.org/changeset/base/184771 Log: Reduce the default baud rate of PTY's to 9600. On RELENG_6 (and probably RELENG_7) we see our syscons windows and pseudo-terminals have the following buffer sizes: | LINE RAW CAN OUT IHIWT ILOWT OHWT LWT COL STATE SESS PGID DISC | ttyv0 0 0 0 7680 6720 2052 256 7 OCcl 1146 1146 term | ttyp0 0 0 0 7680 6720 1296 256 0 OCc 82033 82033 term These buffer sizes make no sense, because we often have much more output than input, but I guess having higher input buffer sizes improves guarantees of the system. On MPSAFE TTY I just sent both the input and output buffer sizes to 7 KB, which is pretty big on a standard FreeBSD install with 8 syscons windows and some PTY's. Reduce the baud rate to 9600 baud, which means we now have the following buffer sizes: | LINE INQ CAN LIN LOW OUTQ USE LOW COL SESS PGID STATE | ttyv0 1920 0 0 192 1984 0 199 7 2401 2401 Oil | pts/0 1920 0 0 192 1984 0 199 5631 1305 2526 Oi This is a lot smaller, but for pseudo-devices this should be good enough. You need to do a lot of punching to fill up a 7.5 KB input buffer. If it turns out things don't work out this way, we'll just switch to 19200 baud. Modified: head/sys/dev/syscons/sysmouse.c head/sys/kern/tty.c head/sys/sys/ttydefaults.h Modified: head/sys/dev/syscons/sysmouse.c ============================================================================== --- head/sys/dev/syscons/sysmouse.c Sat Nov 8 19:56:32 2008 (r184770) +++ head/sys/dev/syscons/sysmouse.c Sat Nov 8 20:40:39 2008 (r184771) @@ -148,7 +148,7 @@ smdev_param(struct tty *tp, struct termi * Set the output baud rate to zero. The mouse device supports * no output, so we don't want to waste buffers. */ - t->c_ispeed = TTYDEF_SPEED_PSEUDO; + t->c_ispeed = TTYDEF_SPEED; t->c_ospeed = B0; return (0); Modified: head/sys/kern/tty.c ============================================================================== --- head/sys/kern/tty.c Sat Nov 8 19:56:32 2008 (r184770) +++ head/sys/kern/tty.c Sat Nov 8 20:40:39 2008 (r184771) @@ -802,7 +802,7 @@ ttydevsw_defparam(struct tty *tp, struct { /* Use a fake baud rate, we're not a real device. */ - t->c_ispeed = t->c_ospeed = TTYDEF_SPEED_PSEUDO; + t->c_ispeed = t->c_ospeed = TTYDEF_SPEED; return (0); } Modified: head/sys/sys/ttydefaults.h ============================================================================== --- head/sys/sys/ttydefaults.h Sat Nov 8 19:56:32 2008 (r184770) +++ head/sys/sys/ttydefaults.h Sat Nov 8 20:40:39 2008 (r184771) @@ -52,7 +52,6 @@ #define TTYDEF_LFLAG TTYDEF_LFLAG_ECHO #define TTYDEF_CFLAG (CREAD | CS8 | HUPCL) #define TTYDEF_SPEED (B9600) -#define TTYDEF_SPEED_PSEUDO (B38400) /* * Control Character Defaults From hrs at FreeBSD.org Sat Nov 8 17:10:21 2008 From: hrs at FreeBSD.org (Hiroki Sato) Date: Sat Nov 8 17:10:27 2008 Subject: svn commit: r184777 - head/usr.bin/sed Message-ID: <200811090110.mA91ALkc026621@svn.freebsd.org> Author: hrs Date: Sun Nov 9 01:10:21 2008 New Revision: 184777 URL: http://svn.freebsd.org/changeset/base/184777 Log: Add workaround for a back reference when no corresponding parenthesized subexpression is defined. For example, the following command line caused unexpected behavior like segmentation fault: % echo test | sed -e 's/test/\1/' PR: bin/126682 MFC after: 1 week Modified: head/usr.bin/sed/compile.c Modified: head/usr.bin/sed/compile.c ============================================================================== --- head/usr.bin/sed/compile.c Sun Nov 9 00:49:36 2008 (r184776) +++ head/usr.bin/sed/compile.c Sun Nov 9 01:10:21 2008 (r184777) @@ -324,9 +324,17 @@ nonsel: /* Now parse the command */ if (p == NULL) errx(1, "%lu: %s: unterminated substitute pattern", linenum, fname); + + /* Compile RE with no case sensitivity temporarily */ + if (*re == '\0') + cmd->u.s->re = NULL; + else + cmd->u.s->re = compile_re(re, 0); --p; p = compile_subst(p, cmd->u.s); p = compile_flags(p, cmd->u.s); + + /* Recompile RE with case sensitivity from "I" flag if any */ if (*re == '\0') cmd->u.s->re = NULL; else From kmacy at FreeBSD.org Sat Nov 8 17:53:06 2008 From: kmacy at FreeBSD.org (Kip Macy) Date: Sat Nov 8 17:53:50 2008 Subject: svn commit: r184778 - head/sys/kern Message-ID: <200811090153.mA91r6b9027362@svn.freebsd.org> Author: kmacy Date: Sun Nov 9 01:53:06 2008 New Revision: 184778 URL: http://svn.freebsd.org/changeset/base/184778 Log: make kern.ipc.nmbclusters actually have a useful effect on nmbclusters et al. initialize pkthdr in field order Modified: head/sys/kern/kern_mbuf.c Modified: head/sys/kern/kern_mbuf.c ============================================================================== --- head/sys/kern/kern_mbuf.c Sun Nov 9 01:10:21 2008 (r184777) +++ head/sys/kern/kern_mbuf.c Sun Nov 9 01:53:06 2008 (r184778) @@ -104,13 +104,14 @@ struct mbstat mbstat; static void tunable_mbinit(void *dummy) { + TUNABLE_INT_FETCH("kern.ipc.nmbclusters", &nmbclusters); /* This has to be done before VM init. */ - nmbclusters = 1024 + maxusers * 64; + if (nmbclusters == 0) + nmbclusters = 1024 + maxusers * 64; nmbjumbop = nmbclusters / 2; nmbjumbo9 = nmbjumbop / 2; nmbjumbo16 = nmbjumbo9 / 2; - TUNABLE_INT_FETCH("kern.ipc.nmbclusters", &nmbclusters); } SYSINIT(tunable_mbinit, SI_SUB_TUNABLES, SI_ORDER_ANY, tunable_mbinit, NULL); @@ -409,8 +410,8 @@ mb_ctor_mbuf(void *mem, int size, void * if (flags & M_PKTHDR) { m->m_data = m->m_pktdat; m->m_pkthdr.rcvif = NULL; - m->m_pkthdr.len = 0; m->m_pkthdr.header = NULL; + m->m_pkthdr.len = 0; m->m_pkthdr.csum_flags = 0; m->m_pkthdr.csum_data = 0; m->m_pkthdr.tso_segsz = 0; From matteo at FreeBSD.org Sat Nov 8 22:44:54 2008 From: matteo at FreeBSD.org (Matteo Riondato) Date: Sat Nov 8 22:45:06 2008 Subject: svn commit: r184779 - head/usr.sbin/cron/crontab Message-ID: <200811090644.mA96ira1032670@svn.freebsd.org> Author: matteo Date: Sun Nov 9 06:44:53 2008 New Revision: 184779 URL: http://svn.freebsd.org/changeset/base/184779 Log: Be paranoid and use snprintf PR: bin/122137 Submitted by: Steven Kreuzer MFC after: 3 days Modified: head/usr.sbin/cron/crontab/crontab.c Modified: head/usr.sbin/cron/crontab/crontab.c ============================================================================== --- head/usr.sbin/cron/crontab/crontab.c Sun Nov 9 01:53:06 2008 (r184778) +++ head/usr.sbin/cron/crontab/crontab.c Sun Nov 9 06:44:53 2008 (r184779) @@ -263,7 +263,7 @@ list_cmd() { FILE *f; log_it(RealUser, Pid, "LIST", User); - (void) sprintf(n, CRON_TAB(User)); + (void) snprintf(n, sizeof(n), CRON_TAB(User)); if (!(f = fopen(n, "r"))) { if (errno == ENOENT) errx(ERROR_EXIT, "no crontab for %s", User); @@ -293,7 +293,7 @@ delete_cmd() { } log_it(RealUser, Pid, "DELETE", User); - (void) sprintf(n, CRON_TAB(User)); + (void) snprintf(n, sizeof(n), CRON_TAB(User)); if (unlink(n)) { if (errno == ENOENT) errx(ERROR_EXIT, "no crontab for %s", User); @@ -327,7 +327,7 @@ edit_cmd() { char new_md5[MD5_SIZE]; log_it(RealUser, Pid, "BEGIN EDIT", User); - (void) sprintf(n, CRON_TAB(User)); + (void) snprintf(n, sizeof(n), CRON_TAB(User)); if (!(f = fopen(n, "r"))) { if (errno != ENOENT) err(ERROR_EXIT, "%s", n); @@ -337,7 +337,7 @@ edit_cmd() { } um = umask(077); - (void) sprintf(Filename, "/tmp/crontab.XXXXXXXXXX"); + (void) snprintf(Filename, sizeof(Filename), "/tmp/crontab.XXXXXXXXXX"); if ((t = mkstemp(Filename)) == -1) { warn("%s", Filename); (void) umask(um); @@ -504,8 +504,8 @@ replace_cmd() { return (-2); } - (void) sprintf(n, "tmp.%d", Pid); - (void) sprintf(tn, CRON_TAB(n)); + (void) snprintf(n, sizeof(n), "tmp.%d", Pid); + (void) snprintf(tn, sizeof(n), CRON_TAB(n)); if (!(tmp = fopen(tn, "w+"))) { warn("%s", tn); return (-2); @@ -592,7 +592,7 @@ replace_cmd() { return (-2); } - (void) sprintf(n, CRON_TAB(User)); + (void) snprintf(n, sizeof(n), CRON_TAB(User)); if (rename(tn, n)) { warn("error renaming %s to %s", tn, n); unlink(tn); From matteo at FreeBSD.org Sat Nov 8 23:34:12 2008 From: matteo at FreeBSD.org (Matteo Riondato) Date: Sat Nov 8 23:34:18 2008 Subject: svn commit: r184780 - head/usr.sbin/cron/crontab Message-ID: <200811090734.mA97YBld033553@svn.freebsd.org> Author: matteo Date: Sun Nov 9 07:34:11 2008 New Revision: 184780 URL: http://svn.freebsd.org/changeset/base/184780 Log: Don't leave files in /var/cront/tabs when interrupted PR: 17363 MFC after: 3 days Modified: head/usr.sbin/cron/crontab/crontab.c Modified: head/usr.sbin/cron/crontab/crontab.c ============================================================================== --- head/usr.sbin/cron/crontab/crontab.c Sun Nov 9 06:44:53 2008 (r184779) +++ head/usr.sbin/cron/crontab/crontab.c Sun Nov 9 07:34:11 2008 (r184780) @@ -63,6 +63,7 @@ static FILE *NewCrontab; static int CheckErrorCount; static enum opt_t Option; static struct passwd *pw; +static char *tmp_path; static void list_cmd(void), delete_cmd(void), edit_cmd(void), @@ -486,6 +487,16 @@ edit_cmd() { } +void +static remove_tmp(int sig) +{ + if (tmp_path) { + unlink(tmp_path); + } + exit(ERROR_EXIT); +} + + /* returns 0 on success * -1 on syntax error * -2 on install error @@ -498,6 +509,7 @@ replace_cmd() { entry *e; time_t now = time(NULL); char **envp = env_init(); + void (*f[3])(); if (envp == NULL) { warnx("cannot allocate memory"); @@ -506,6 +518,13 @@ replace_cmd() { (void) snprintf(n, sizeof(n), "tmp.%d", Pid); (void) snprintf(tn, sizeof(n), CRON_TAB(n)); + + /* Set up to remove the temp file if interrupted by a signal. */ + f[0] = signal(SIGHUP, remove_tmp); + f[1] = signal(SIGINT, remove_tmp); + f[2] = signal(SIGTERM, remove_tmp); + tmp_path = tn; + if (!(tmp = fopen(tn, "w+"))) { warn("%s", tn); return (-2); @@ -598,6 +617,13 @@ replace_cmd() { unlink(tn); return (-2); } + + /* Restore the default signal handlers. */ + tmp_path = NULL; + signal(SIGHUP, f[0]); + signal(SIGINT, f[1]); + signal(SIGTERM, f[2]); + log_it(RealUser, Pid, "REPLACE", User); poke_daemon(); From sobomax at FreeBSD.org Sat Nov 8 23:58:23 2008 From: sobomax at FreeBSD.org (Maxim Sobolev) Date: Sat Nov 8 23:58:29 2008 Subject: svn commit: r184781 - head/usr.sbin/mergemaster Message-ID: <200811090758.mA97wNKt033972@svn.freebsd.org> Author: sobomax Date: Sun Nov 9 07:58:23 2008 New Revision: 184781 URL: http://svn.freebsd.org/changeset/base/184781 Log: Ignore files that only differ in CVS Id tag. MFC after: 2 weeks Modified: head/usr.sbin/mergemaster/mergemaster.sh Modified: head/usr.sbin/mergemaster/mergemaster.sh ============================================================================== --- head/usr.sbin/mergemaster/mergemaster.sh Sun Nov 9 07:34:11 2008 (r184780) +++ head/usr.sbin/mergemaster/mergemaster.sh Sun Nov 9 07:58:23 2008 (r184781) @@ -947,6 +947,20 @@ for COMPFILE in `find . -type f -size +0 echo " *** Temp ${COMPFILE} and installed have the same CVS Id, deleting" rm "${COMPFILE}" ;; + + *) + tempfoo=`basename $0` + TMPFILE1=`mktemp -t ${tempfoo}` || break + TMPFILE2=`mktemp -t ${tempfoo}` || break + sed "s/[$]${CVS_ID_TAG}:.*[$]//g" "${DESTDIR}${COMPFILE#.}" > "${TMPFILE1}" + sed "s/[$]${CVS_ID_TAG}:.*[$]//g" "${COMPFILE}" > "${TMPFILE2}" + if diff -q ${DIFF_OPTIONS} "${TMPFILE1}" "${TMPFILE2}" > \ + /dev/null 2>&1; then + echo " *** Temp ${COMPFILE} and installed are the same except CVS Id, deleting" + rm "${COMPFILE}" + fi + rm -f "${TMPFILE1}" "${TMPFILE2}" + ;; esac ;; esac From jkoshy at FreeBSD.org Sun Nov 9 00:36:35 2008 From: jkoshy at FreeBSD.org (Joseph Koshy) Date: Sun Nov 9 00:36:42 2008 Subject: svn commit: r184782 - head/usr.sbin/pmccontrol Message-ID: <200811090836.mA98aZAD034731@svn.freebsd.org> Author: jkoshy Date: Sun Nov 9 08:36:35 2008 New Revision: 184782 URL: http://svn.freebsd.org/changeset/base/184782 Log: Change the meaning of a "*" argument to option -c to mean 'all unhalted CPUs', instead of 'all CPUs'. This change brings pmccontrol(8) in line with pmcstat(8). Modified: head/usr.sbin/pmccontrol/pmccontrol.c Modified: head/usr.sbin/pmccontrol/pmccontrol.c ============================================================================== --- head/usr.sbin/pmccontrol/pmccontrol.c Sun Nov 9 07:58:23 2008 (r184781) +++ head/usr.sbin/pmccontrol/pmccontrol.c Sun Nov 9 08:36:35 2008 (r184782) @@ -133,21 +133,33 @@ pmcc_init_debug(void) static int pmcc_do_enable_disable(struct pmcc_op_list *op_list) { - unsigned char op; int c, error, i, j, ncpu, npmc, t; - int cpu, pmc; + cpumask_t haltedcpus, cpumask; struct pmcc_op *np; unsigned char *map; + unsigned char op; + int cpu, pmc; + size_t dummy; if ((ncpu = pmc_ncpu()) < 0) err(EX_OSERR, "Unable to determine the number of cpus"); - /* determine the maximum number of PMCs in any CPU */ + /* Determine the set of active CPUs. */ + cpumask = (1 << ncpu) - 1; + dummy = sizeof(int); + haltedcpus = (cpumask_t) 0; + if (ncpu > 1 && sysctlbyname("machdep.hlt_cpus", &haltedcpus, + &dummy, NULL, 0) < 0) + err(EX_OSERR, "ERROR: Cannot determine which CPUs are " + "halted"); + cpumask &= ~haltedcpus; + + /* Determine the maximum number of PMCs in any CPU. */ npmc = 0; for (c = 0; c < ncpu; c++) { if ((t = pmc_npmc(c)) < 0) - err(EX_OSERR, "Unable to determine the number of PMCs in " - "CPU %d", c); + err(EX_OSERR, "Unable to determine the number of " + "PMCs in CPU %d", c); npmc = t > npmc ? t : npmc; } @@ -187,8 +199,10 @@ pmcc_do_enable_disable(struct pmcc_op_li #define MAP(M,C,P) (*((M) + (C)*npmc + (P))) if (cpu == PMCC_CPU_ALL) - for (i = 0; i < ncpu; i++) - SET_PMCS(i, pmc, op); + for (i = 0; i < ncpu; i++) { + if ((1 << i) & cpumask) + SET_PMCS(i, pmc, op); + } else SET_PMCS(cpu, pmc, op); } From jkoshy at FreeBSD.org Sun Nov 9 00:39:53 2008 From: jkoshy at FreeBSD.org (Joseph Koshy) Date: Sun Nov 9 00:40:00 2008 Subject: svn commit: r184783 - head/usr.sbin/pmccontrol Message-ID: <200811090839.mA98dr79034825@svn.freebsd.org> Author: jkoshy Date: Sun Nov 9 08:39:52 2008 New Revision: 184783 URL: http://svn.freebsd.org/changeset/base/184783 Log: - Document the changed meaning of a '*' argument to option "-c". - Tweak grammar. Modified: head/usr.sbin/pmccontrol/pmccontrol.8 Modified: head/usr.sbin/pmccontrol/pmccontrol.8 ============================================================================== --- head/usr.sbin/pmccontrol/pmccontrol.8 Sun Nov 9 08:36:35 2008 (r184782) +++ head/usr.sbin/pmccontrol/pmccontrol.8 Sun Nov 9 08:39:52 2008 (r184783) @@ -1,4 +1,4 @@ -.\" Copyright (c) 2003 Joseph Koshy. All rights reserved. +.\" Copyright (c) 2003,2008 Joseph Koshy. All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions @@ -23,7 +23,7 @@ .\" .\" $FreeBSD$ .\" -.Dd December 15, 2003 +.Dd November 9, 2008 .Os .Dt PMCCONTROL 8 .Sh NAME @@ -52,13 +52,13 @@ The following options are available: .Bl -tag -width indent .It Fl c Ar cpu Subsequent enable and disable options affect the CPU -denoted by +denoted by argument .Ar cpu . The argument .Ar cpu -is either a number denoting a CPU number in the system, or the string +is a number denoting a CPU in the system, or .Dq Li * , -denoting all CPUs in the system. +denoting all unhalted CPUs in the system. .It Fl d Ar pmc Disable PMC number .Ar pmc @@ -67,7 +67,7 @@ on the CPU specified by preventing it from being used till subsequently re-enabled. The argument .Ar pmc -is either a number denoting a specified PMC, or the string +is a number denoting a specific PMC, or .Dq Li * denoting all the PMCs on the specified CPU. .Pp @@ -81,7 +81,7 @@ on the CPU specified by allowing it to be used in the future. The argument .Ar pmc -is either a number denoting a specified PMC, or the string +is a number denoting a specific PMC, or .Dq Li * denoting all the PMCs on the specified CPU. If PMC From danfe at FreeBSD.org Sun Nov 9 00:48:17 2008 From: danfe at FreeBSD.org (Alexey Dokuchaev) Date: Sun Nov 9 00:48:24 2008 Subject: svn commit: r184780 - head/usr.sbin/cron/crontab In-Reply-To: <200811090734.mA97YBld033553@svn.freebsd.org> References: <200811090734.mA97YBld033553@svn.freebsd.org> Message-ID: <20081109084817.GA23323@FreeBSD.org> On Sun, Nov 09, 2008 at 07:34:11AM +0000, Matteo Riondato wrote: > > +void > +static remove_tmp(int sig) > +{ > + if (tmp_path) { > + unlink(tmp_path); > + } > + exit(ERROR_EXIT); > +} This looks weird: `static' should be on same line as `void' as `static void' (so ^remove_tmp would match). It will also always exit with ERROR_EXIT, which does not look right, does it? ./danfe From matteo at FreeBSD.org Sun Nov 9 01:01:10 2008 From: matteo at FreeBSD.org (Matteo Riondato) Date: Sun Nov 9 01:01:21 2008 Subject: svn commit: r184784 - head/usr.sbin/cron/crontab Message-ID: <200811090901.mA9919m3035251@svn.freebsd.org> Author: matteo Date: Sun Nov 9 09:01:09 2008 New Revision: 184784 URL: http://svn.freebsd.org/changeset/base/184784 Log: Revert to previous revision. I should not commit anything at 3.50 AM. In addition to danfe's comments, I got others. I'll work on a better version of the patch. Modified: head/usr.sbin/cron/crontab/crontab.c Modified: head/usr.sbin/cron/crontab/crontab.c ============================================================================== --- head/usr.sbin/cron/crontab/crontab.c Sun Nov 9 08:39:52 2008 (r184783) +++ head/usr.sbin/cron/crontab/crontab.c Sun Nov 9 09:01:09 2008 (r184784) @@ -63,7 +63,6 @@ static FILE *NewCrontab; static int CheckErrorCount; static enum opt_t Option; static struct passwd *pw; -static char *tmp_path; static void list_cmd(void), delete_cmd(void), edit_cmd(void), @@ -487,16 +486,6 @@ edit_cmd() { } -void -static remove_tmp(int sig) -{ - if (tmp_path) { - unlink(tmp_path); - } - exit(ERROR_EXIT); -} - - /* returns 0 on success * -1 on syntax error * -2 on install error @@ -519,12 +508,6 @@ replace_cmd() { (void) snprintf(n, sizeof(n), "tmp.%d", Pid); (void) snprintf(tn, sizeof(n), CRON_TAB(n)); - /* Set up to remove the temp file if interrupted by a signal. */ - f[0] = signal(SIGHUP, remove_tmp); - f[1] = signal(SIGINT, remove_tmp); - f[2] = signal(SIGTERM, remove_tmp); - tmp_path = tn; - if (!(tmp = fopen(tn, "w+"))) { warn("%s", tn); return (-2); @@ -618,12 +601,6 @@ replace_cmd() { return (-2); } - /* Restore the default signal handlers. */ - tmp_path = NULL; - signal(SIGHUP, f[0]); - signal(SIGINT, f[1]); - signal(SIGTERM, f[2]); - log_it(RealUser, Pid, "REPLACE", User); poke_daemon(); From rafan at FreeBSD.org Sun Nov 9 01:05:39 2008 From: rafan at FreeBSD.org (Rong-En Fan) Date: Sun Nov 9 01:05:50 2008 Subject: svn commit: r184785 - svnadmin/conf Message-ID: <200811090905.mA995dho035381@svn.freebsd.org> Author: rafan Date: Sun Nov 9 09:05:38 2008 New Revision: 184785 URL: http://svn.freebsd.org/changeset/base/184785 Log: - Open vendor/ncurses for the upcoming ncurses 5.7 update Modified: svnadmin/conf/paths Modified: svnadmin/conf/paths ============================================================================== --- svnadmin/conf/paths Sun Nov 9 09:01:09 2008 (r184784) +++ svnadmin/conf/paths Sun Nov 9 09:05:38 2008 (r184785) @@ -47,6 +47,7 @@ ^vendor/cpio ^vendor/bind9 ^vendor/gdtoa +^vendor/ncurses ^vendor/netcat ^vendor/ntp ^vendor/sendmail From rafan at FreeBSD.org Sun Nov 9 01:06:05 2008 From: rafan at FreeBSD.org (Rong-En Fan) Date: Sun Nov 9 01:06:20 2008 Subject: svn commit: r184786 - in vendor/ncurses/dist: . contrib doc form include man menu misc ncurses panel progs Message-ID: <200811090906.mA9964w4035426@svn.freebsd.org> Author: rafan Date: Sun Nov 9 09:06:04 2008 New Revision: 184786 URL: http://svn.freebsd.org/changeset/base/184786 Log: - Flatten the vendor area Added: vendor/ncurses/dist/ANNOUNCE - copied unchanged from r184783, vendor/ncurses/dist/contrib/ncurses/ANNOUNCE vendor/ncurses/dist/AUTHORS - copied unchanged from r184783, vendor/ncurses/dist/contrib/ncurses/AUTHORS vendor/ncurses/dist/INSTALL - copied unchanged from r184783, vendor/ncurses/dist/contrib/ncurses/INSTALL vendor/ncurses/dist/MANIFEST - copied unchanged from r184783, vendor/ncurses/dist/contrib/ncurses/MANIFEST vendor/ncurses/dist/Makefile.in - copied unchanged from r184783, vendor/ncurses/dist/contrib/ncurses/Makefile.in vendor/ncurses/dist/Makefile.os2 - copied unchanged from r184783, vendor/ncurses/dist/contrib/ncurses/Makefile.os2 vendor/ncurses/dist/NEWS - copied unchanged from r184783, vendor/ncurses/dist/contrib/ncurses/NEWS vendor/ncurses/dist/README - copied unchanged from r184783, vendor/ncurses/dist/contrib/ncurses/README vendor/ncurses/dist/README.emx - copied unchanged from r184783, vendor/ncurses/dist/contrib/ncurses/README.emx vendor/ncurses/dist/TO-DO - copied unchanged from r184783, vendor/ncurses/dist/contrib/ncurses/TO-DO vendor/ncurses/dist/aclocal.m4 - copied unchanged from r184783, vendor/ncurses/dist/contrib/ncurses/aclocal.m4 vendor/ncurses/dist/announce.html.in - copied unchanged from r184783, vendor/ncurses/dist/contrib/ncurses/announce.html.in vendor/ncurses/dist/config.guess - copied unchanged from r184783, vendor/ncurses/dist/contrib/ncurses/config.guess vendor/ncurses/dist/config.sub - copied unchanged from r184783, vendor/ncurses/dist/contrib/ncurses/config.sub vendor/ncurses/dist/configure - copied unchanged from r184783, vendor/ncurses/dist/contrib/ncurses/configure vendor/ncurses/dist/configure.in - copied unchanged from r184783, vendor/ncurses/dist/contrib/ncurses/configure.in vendor/ncurses/dist/convert_configure.pl - copied unchanged from r184783, vendor/ncurses/dist/contrib/ncurses/convert_configure.pl vendor/ncurses/dist/dist.mk - copied unchanged from r184783, vendor/ncurses/dist/contrib/ncurses/dist.mk vendor/ncurses/dist/doc/ - copied from r184783, vendor/ncurses/dist/contrib/ncurses/doc/ vendor/ncurses/dist/form/ - copied from r184783, vendor/ncurses/dist/contrib/ncurses/form/ vendor/ncurses/dist/include/ - copied from r184783, vendor/ncurses/dist/contrib/ncurses/include/ vendor/ncurses/dist/install-sh - copied unchanged from r184783, vendor/ncurses/dist/contrib/ncurses/install-sh vendor/ncurses/dist/man/ - copied from r184783, vendor/ncurses/dist/contrib/ncurses/man/ vendor/ncurses/dist/menu/ - copied from r184783, vendor/ncurses/dist/contrib/ncurses/menu/ vendor/ncurses/dist/misc/ - copied from r184783, vendor/ncurses/dist/contrib/ncurses/misc/ vendor/ncurses/dist/mk-0th.awk - copied unchanged from r184783, vendor/ncurses/dist/contrib/ncurses/mk-0th.awk vendor/ncurses/dist/mk-1st.awk - copied unchanged from r184783, vendor/ncurses/dist/contrib/ncurses/mk-1st.awk vendor/ncurses/dist/mk-2nd.awk - copied unchanged from r184783, vendor/ncurses/dist/contrib/ncurses/mk-2nd.awk vendor/ncurses/dist/mk-hdr.awk - copied unchanged from r184783, vendor/ncurses/dist/contrib/ncurses/mk-hdr.awk vendor/ncurses/dist/mkdirs.sh - copied unchanged from r184783, vendor/ncurses/dist/contrib/ncurses/mkdirs.sh vendor/ncurses/dist/ncurses/ - copied from r184783, vendor/ncurses/dist/contrib/ncurses/ncurses/ vendor/ncurses/dist/panel/ - copied from r184783, vendor/ncurses/dist/contrib/ncurses/panel/ vendor/ncurses/dist/progs/ - copied from r184783, vendor/ncurses/dist/contrib/ncurses/progs/ vendor/ncurses/dist/tar-copy.sh - copied unchanged from r184783, vendor/ncurses/dist/contrib/ncurses/tar-copy.sh Deleted: vendor/ncurses/dist/contrib/ Copied: vendor/ncurses/dist/ANNOUNCE (from r184783, vendor/ncurses/dist/contrib/ncurses/ANNOUNCE) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/ncurses/dist/ANNOUNCE Sun Nov 9 09:06:04 2008 (r184786, copy of r184783, vendor/ncurses/dist/contrib/ncurses/ANNOUNCE) @@ -0,0 +1,463 @@ + Announcing ncurses 5.6 + + The ncurses (new curses) library is a free software emulation of + curses in System V Release 4.0, and more. It uses terminfo format, + supports pads and color and multiple highlights and forms characters + and function-key mapping, and has all the other SYSV-curses + enhancements over BSD curses. + + In mid-June 1995, the maintainer of 4.4BSD curses declared that he + considered 4.4BSD curses obsolete, and encouraged the keepers of Unix + releases such as BSD/OS, FreeBSD and NetBSD to switch over to ncurses. + + The ncurses code was developed under GNU/Linux. It has been in use for + some time with OpenBSD as the system curses library, and on FreeBSD + and NetBSD as an external package. It should port easily to any + ANSI/POSIX-conforming UNIX. It has even been ported to OS/2 Warp! + + The distribution includes the library and support utilities, including + a terminfo compiler tic(1), a decompiler infocmp(1), clear(1), + tput(1), tset(1), and a termcap conversion tool captoinfo(1). Full + manual pages are provided for the library and tools. + + The ncurses distribution is available via anonymous FTP at the GNU + distribution site [1]ftp://ftp.gnu.org/gnu/ncurses/ . + It is also available at [2]ftp://invisible-island.net/ncurses/ . + + Release Notes + + This release is designed to be upward compatible from ncurses 5.0 + through 5.5; very few applications will require recompilation, + depending on the platform. These are the highlights from the + change-log since ncurses 5.5 release. + + Interface changes: + * generate linkable stubs for some macros: + getbegx, getbegy, getcurx, getcury, getmaxx, getmaxy, getparx, + getpary, getpary, + and (for libncursesw) + wgetbkgrnd + + New features and improvements: + * library + + support hashed databases for the terminal descriptions. This + uses the Berkeley database, has been tested for several + versions on different platforms. + + add use_legacy_coding() function to support lynx's + font-switching feature. + + add extension nofilter(), to cancel a prior filter() call. + + add/install a package config script, e.g., ncurses5-config or + ncursesw5-config, according to configuration options. + + provide ifdef for NCURSES_NOMACROS which suppresses most + macro definitions from curses.h, i.e., where a macro is + defined to override a function to improve performance. + + make ifdef's consistent in curses.h for the extended colors + so the header file can be used for the normal curses library. + The header file installed for extended colors is a variation + of the wide-character configuration. + + improve tgetstr() by making the return value point into the + user's buffer, if provided. + + add ifdef's allowing ncurses to be built with tparm() using + either varargs (the existing status), or using a + fixed-parameter list (to match X/Open). + + widen the test for xterm kmous a little to allow for other + strings than "\E[M", e.g., for xterm-sco functionality in + xterm. + + modify wgetnstr() to return KEY_RESIZE if a sigwinch occurs. + + move prototypes for wide-character trace functions from + curses.tail to curses.wide to avoid accidental reference to + those if _XOPEN_SOURCE_EXTENDED is defined without ensuring + that is included. + + change the way shared libraries (other than libtool) are + installed. Rather than copying the build-tree's libraries, + link the shared objects into the install directory. This + makes the --with-rpath option work except with $(DESTDIR). + + several improvements for rendering in hpterm. These are only + available if the library is configured using + --enable-xmc-glitch. + + Add NCURSES_NO_HARD_TABS and NCURSES_NO_MAGIC_COOKIE + environment variables to allow runtime suppression of the + related hard-tabs and xmc-glitch features. + * programs: + + add new test programs: chgat.c, demo_altkeys.c, echochar.c, + foldkeys.c, movewindow.c, redraw.c, (noting that existing + test programs also were modified to test additional + features). + + modify tack to test extended capability function-key strings. + + modify toe to access termcap data, e.g., via cgetent() + functions, or as a text file if those are not available. + + improve infocmp/tic -f option formatting. + + add toe -a option, to show all databases. This uses new + private interfaces in the ncurses library for iterating + through the list of databases. + + modify MKfallback.sh to use tic -x when constructing fallback + tables to allow extended capabilities to be retrieved from a + fallback entry. + * terminal database + + add terminfo entries for xfce terminal (xfce) and multi gnome + terminal (mgt) + + add nsterm-16color entry + + updated mlterm terminfo entry + + add kon, kon2 and jfbterm terminfo entry + + remove invis capability from klone+sgr, mainly used by linux + entry, since it does not really do this + + add ka2, kb1, kb3, kc2 to vt220-keypad as an extension + + add shifted up/down arrow codes to xterm-new as kind/kri + strings + + add hpterm-color terminfo entry + + add 256color variants of terminfo entries for programs which + are reported to implement this feature + + correct order of use-clauses in rxvt-basic entry which made + codes for f1-f4 vt100-style rather than vt220-style. + + Major bug fixes: + * correct a typo in configure --with-bool option for the case where + --without-cxx is used. + * move assignment from environment variable ESCDELAY from initscr() + down to newterm() so the environment variable affects timeouts for + terminals opened with newterm() as well. + * modify werase to clear multicolumn characters that extend into a + derived window. + * modify wchgat() to mark updated cells as changed so a refresh will + repaint those cells. + * correct logic in wadd_wch() and wecho_wch(), which did not guard + against passing the multi-column attribute into a call on + waddch(), e.g., using data returned by win_wch() + * fix redrawing of windows other than stdscr using wredrawln() by + touching the corresponding rows in curscr. + * reduce memory leaks in repeated calls to tgetent() by remembering + the last TERMINAL* value allocated to hold the corresponding data + and freeing that if the tgetent() result buffer is the same as the + previous call. + * modify read_termtype() so the term_names data is always allocated + as part of the str_table, a better fix for a memory leak. + * fix wins_nwstr(), which did not handle single-column non-8bit + codes. + * modify wbkgrnd() to avoid clearing the A_CHARTEXT attribute bits + since those record the state of multicolumn characters. + * improve SIGWINCH handling by postponing its effect during + newterm(), etc., when allocating screens. + * remove 970913 feature for copying subwindows as they are moved in + mvwin(). + * add checks in waddchnstr() and wadd_wchnstr() to stop copying when + a null character is found. + * add some checks to ensure current position is within scrolling + region before scrolling on a new line. + * add a workaround to ACS mapping to allow applications such as + test/blue.c to use the "PC ROM" characters by masking them with + A_ALTCHARSET. This worked up til 5.5, but was lost in the revision + of legacy coding. + + Portability: + * configure script: + + new options: + + --with-hashed-db + Use Berkeley hashed database for storing terminfo + data rather than storing each compiled entry in a + separate binary file within a directory tree. + + --without-dlsym + Do not use dlsym() to load GPM dynamically. + + --with-valgrind + Simplify building for testing with valgrind. + + --enable-wgetch-events + Compile with experimental wgetch-events code. + + --enable-signed-char + Store booleans in "signed char" rather than "char". + + + improved options: + + --disable-largefile + make the option work both ways. + + --with-gpm + The option now accepts a parameter, i.e., the name + of the dynamic GPM library to load via dlopen() + + --disable-symlinks + The option now allows one to disable symlink() in + tic even when link() does not work. + + * other configure/build issues: + + remove special case for Darwin in CF_XOPEN_SOURCE configure + macro. + + add configure check to ensure that SIGWINCH is defined on + platforms such as OS X which exclude that when _XOPEN_SOURCE, + etc., are defined + + use ld's -search_paths_first option on Darwin to work around + odd search rules on that platform. + + improve ifdef's for _POSIX_VDISABLE in tset to work with Mac + OS X. + + modify configure script to ensure that if the C compiler is + used rather than the loader in making shared libraries, the + $(CFLAGS) variable is also used. + + use ${CC} rather than ${LD} in shared library rules for + IRIX64, Solaris to help ensure that initialization sections + are provided for extra linkage requirements, e.g., of C++ + applications. + + improve some shared-library configure scripting for Linux, + FreeBSD and NetBSD to make --with-shlib-version work. + + split up dependency of names.c and codes.c in + ncurses/Makefile to work with parallel make. + + modify MKlib_gen.sh to change preprocessor-expanded _Bool + back to bool. + + modify progs/Makefile.in to make tput init work properly with + cygwin, i.e., do not pass a .exe in the reference string used + in check_aliases. + * library: + + ignore wide-acs line-drawing characters that wcwidth() claims + are not one-column. This is a workaround for Solaris' broken + locale support. + + reduce name-pollution in term.h by removing #define's for + HAVE_xxx symbols. + + fix #ifdef in c++/internal.h for QNX 6.1 + * test programs: + + modify test/configure script to allow building test programs + with PDCurses/X11. + + modified test programs to allow some to work with NetBSD + curses. Several do not because NetBSD curses implements a + subset of X/Open curses, and also lacks much of SVr4 + additions. But it is enough for comparison. + + improved test/configure to build test/ncurses on HPUX 11 + using the vendor curses. + + change configure script to produce test/Makefile from data + file. + + Features of Ncurses + + The ncurses package is fully compatible with SVr4 (System V Release 4) + curses: + * All 257 of the SVr4 calls have been implemented (and are + documented). + * Full support for SVr4 curses features including keyboard mapping, + color, forms-drawing with ACS characters, and automatic + recognition of keypad and function keys. + * An emulation of the SVr4 panels library, supporting a stack of + windows with backing store, is included. + * An emulation of the SVr4 menus library, supporting a uniform but + flexible interface for menu programming, is included. + * An emulation of the SVr4 form library, supporting data collection + through on-screen forms, is included. + * Binary terminfo entries generated by the ncurses tic(1) + implementation are bit-for-bit-compatible with the entry format + SVr4 curses uses. + * The utilities have options to allow you to filter terminfo entries + for use with less capable curses/terminfo versions such as the + HP/UX and AIX ports. + + The ncurses package also has many useful extensions over SVr4: + * The API is 8-bit clean and base-level conformant with the X/OPEN + curses specification, XSI curses (that is, it implements all BASE + level features, and most EXTENDED features). It includes many + function calls not supported under SVr4 curses (but portability of + all calls is documented so you can use the SVr4 subset only). + * Unlike SVr3 curses, ncurses can write to the rightmost-bottommost + corner of the screen if your terminal has an insert-character + capability. + * Ada95 and C++ bindings. + * Support for mouse event reporting with X Window xterm and FreeBSD + and OS/2 console windows. + * Extended mouse support via Alessandro Rubini's gpm package. + * The function wresize() allows you to resize windows, preserving + their data. + * The function use_default_colors() allows you to use the terminal's + default colors for the default color pair, achieving the effect of + transparent colors. + * The functions keyok() and define_key() allow you to better control + the use of function keys, e.g., disabling the ncurses KEY_MOUSE, + or by defining more than one control sequence to map to a given + key code. + * Support for 16-color terminals, such as aixterm and modern xterm. + * Better cursor-movement optimization. The package now features a + cursor-local-movement computation more efficient than either BSD's + or System V's. + * Super hardware scrolling support. The screen-update code + incorporates a novel, simple, and cheap algorithm that enables it + to make optimal use of hardware scrolling, line-insertion, and + line-deletion for screen-line movements. This algorithm is more + powerful than the 4.4BSD curses quickch() routine. + * Real support for terminals with the magic-cookie glitch. The + screen-update code will refrain from drawing a highlight if the + magic- cookie unattributed spaces required just before the + beginning and after the end would step on a non-space character. + It will automatically shift highlight boundaries when doing so + would make it possible to draw the highlight without changing the + visual appearance of the screen. + * It is possible to generate the library with a list of pre-loaded + fallback entries linked to it so that it can serve those terminal + types even when no terminfo tree or termcap file is accessible + (this may be useful for support of screen-oriented programs that + must run in single-user mode). + * The tic(1)/captoinfo utility provided with ncurses has the ability + to translate many termcaps from the XENIX, IBM and AT&T extension + sets. + * A BSD-like tset(1) utility is provided. + * The ncurses library and utilities will automatically read terminfo + entries from $HOME/.terminfo if it exists, and compile to that + directory if it exists and the user has no write access to the + system directory. This feature makes it easier for users to have + personal terminfo entries without giving up access to the system + terminfo directory. + * You may specify a path of directories to search for compiled + descriptions with the environment variable TERMINFO_DIRS (this + generalizes the feature provided by TERMINFO under stock System + V.) + * In terminfo source files, use capabilities may refer not just to + other entries in the same source file (as in System V) but also to + compiled entries in either the system terminfo directory or the + user's $HOME/.terminfo directory. + * A script (capconvert) is provided to help BSD users transition + from termcap to terminfo. It gathers the information in a TERMCAP + environment variable and/or a ~/.termcap local entries file and + converts it to an equivalent local terminfo tree under + $HOME/.terminfo. + * Automatic fallback to the /etc/termcap file can be compiled in + when it is not possible to build a terminfo tree. This feature is + neither fast nor cheap, you don't want to use it unless you have + to, but it's there. + * The table-of-entries utility toe makes it easy for users to see + exactly what terminal types are available on the system. + * The library meets the XSI requirement that every macro entry point + have a corresponding function which may be linked (and will be + prototype-checked) if the macro definition is disabled with + #undef. + * An HTML "Introduction to Programming with NCURSES" document + provides a narrative introduction to the curses programming + interface. + + State of the Package + + Numerous bugs present in earlier versions have been fixed; the library + is far more reliable than it used to be. Bounds checking in many + `dangerous' entry points has been improved. The code is now type-safe + according to gcc -Wall. The library has been checked for malloc leaks + and arena corruption by the Purify memory-allocation tester. + + The ncurses code has been tested with a wide variety of applications + including (versions starting with those noted): + + cdk + Curses Development Kit + [3]http://invisible-island.net/cdk/ + [4]http://www.vexus.ca/products/CDK/ + + ded + directory-editor + [5]http://invisible-island.net/ded/ + + dialog + the underlying application used in Slackware's setup, and the + basis for similar applications on GNU/Linux. + [6]http://invisible-island.net/dialog/ + + lynx + the character-screen WWW browser + [7]http://lynx.isc.org/release/ + + Midnight Commander + file manager + [8]http://www.ibiblio.org/mc/ + + mutt + mail utility + [9]http://www.mutt.org/ + + ncftp + file-transfer utility + [10]http://www.ncftp.com/ + + nvi + New vi versions 1.50 are able to use ncurses versions 1.9.7 and + later. + [11]http://www.bostic.com/vi/ + + pinfo + Lynx-like info browser. + [12]http://dione.ids.pl/~pborys/software/pinfo/ + + tin + newsreader, supporting color, MIME [13]http://www.tin.org/ + + vh-1.6 + Volks-Hypertext browser for the Jargon File + [14]http://www.debian.org/Packages/unstable/text/vh.html + + as well as some that use ncurses for the terminfo support alone: + + minicom + terminal emulator + [15]http://alioth.debian.org/projects/minicom/ + + vile + vi-like-emacs + [16]http://invisible-island.net/vile/ + + The ncurses distribution includes a selection of test programs + (including a few games). + +Who's Who and What's What + + Zeyd Ben-Halim started it from a previous package pcurses, written by + Pavel Curtis. Eric S. Raymond continued development. Juergen Pfeifer + wrote most of the form and menu libraries. Ongoing work is being done + by [17]Thomas Dickey. Thomas Dickey acts as the maintainer for the + Free Software Foundation, which holds the copyright on ncurses. + Contact the current maintainers at [18]bug-ncurses@gnu.org. + + To join the ncurses mailing list, please write email to + bug-ncurses-request@gnu.org containing the line: + subscribe @ + + This list is open to anyone interested in helping with the development + and testing of this package. + + Beta versions of ncurses and patches to the current release are made + available at [19]ftp://invisible-island.net/ncurses/ . + +Future Plans + + * Extended-level XPG4 conformance, with internationalization + support. + * Ports to more systems, including DOS and Windows. + + We need people to help with these projects. If you are interested in + working on them, please join the ncurses list. + +Other Related Resources + + The distribution provides a newer version of the terminfo-format + terminal description file once maintained by [20]Eric Raymond . Unlike + the older version, the termcap and terminfo data are provided in the + same file, and provides several user-definable extensions beyond the + X/Open specification. + + You can find lots of information on terminal-related topics not + covered in the terminfo file at [21]Richard Shuford's archive . + +References + + 1. ftp://ftp.gnu.org/gnu/ncurses/ + 2. ftp://invisible-island.net/ncurses/ + 3. http://invisible-island.net/cdk/ + 4. http://www.vexus.ca/products/CDK/ + 5. http://invisible-island.net/ded/ + 6. http://invisible-island.net/dialog/ + 7. http://lynx.isc.org/release/ + 8. http://www.ibiblio.org/mc/ + 9. http://www.mutt.org/ + 10. http://www.ncftp.com/ + 11. http://www.bostic.com/vi/ + 12. http://dione.ids.pl/~pborys/software/pinfo/ + 13. http://www.tin.org/ + 14. http://www.debian.org/Packages/unstable/text/vh.html + 15. http://alioth.debian.org/projects/minicom/ + 16. http://invisible-island.net/vile/ + 17. mailto:dickey@invisible-island.net + 18. mailto:bug-ncurses@gnu.org + 19. ftp://invisible-island.net/ncurses/ + 20. http://www.catb.org/~esr/terminfo/ + 21. http://www.cs.utk.edu/~shuford/terminal_index.html Copied: vendor/ncurses/dist/AUTHORS (from r184783, vendor/ncurses/dist/contrib/ncurses/AUTHORS) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/ncurses/dist/AUTHORS Sun Nov 9 09:06:04 2008 (r184786, copy of r184783, vendor/ncurses/dist/contrib/ncurses/AUTHORS) @@ -0,0 +1,38 @@ +------------------------------------------------------------------------------- +-- Copyright (c) 2006 Free Software Foundation, Inc. -- +-- -- +-- Permission is hereby granted, free of charge, to any person obtaining a -- +-- copy of this software and associated documentation files (the -- +-- "Software"), to deal in the Software without restriction, including -- +-- without limitation the rights to use, copy, modify, merge, publish, -- +-- distribute, distribute with modifications, sublicense, and/or sell copies -- +-- of the Software, and to permit persons to whom the Software is furnished -- +-- to do so, subject to the following conditions: -- +-- -- +-- The above copyright notice and this permission notice shall be included -- +-- in all copies or substantial portions of the Software. -- +-- -- +-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -- +-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -- +-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN -- +-- NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -- +-- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -- +-- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE -- +-- USE OR OTHER DEALINGS IN THE SOFTWARE. -- +-- -- +-- Except as contained in this notice, the name(s) of the above copyright -- +-- holders shall not be used in advertising or otherwise to promote the -- +-- sale, use or other dealings in this Software without prior written -- +-- authorization. -- +------------------------------------------------------------------------------- +-- $Id: AUTHORS,v 1.2 2006/10/28 21:44:52 tom Exp $ +------------------------------------------------------------------------------- +These are the principal authors/contributors of ncurses since 1.9.9e, +in decreasing order of their contribution: + +TD Thomas E. Dickey +JPF Juergen Pfeifer +ESR Eric S Raymond +AVL Alexander V Lukyanov +PB Philippe Blain +SV Sven Verdoolaege Copied: vendor/ncurses/dist/INSTALL (from r184783, vendor/ncurses/dist/contrib/ncurses/INSTALL) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/ncurses/dist/INSTALL Sun Nov 9 09:06:04 2008 (r184786, copy of r184783, vendor/ncurses/dist/contrib/ncurses/INSTALL) @@ -0,0 +1,1619 @@ +------------------------------------------------------------------------------- +-- Copyright (c) 1998-2005,2006 Free Software Foundation, Inc. -- +-- -- +-- Permission is hereby granted, free of charge, to any person obtaining a -- +-- copy of this software and associated documentation files (the -- +-- "Software"), to deal in the Software without restriction, including -- +-- without limitation the rights to use, copy, modify, merge, publish, -- +-- distribute, distribute with modifications, sublicense, and/or sell copies -- +-- of the Software, and to permit persons to whom the Software is furnished -- +-- to do so, subject to the following conditions: -- +-- -- +-- The above copyright notice and this permission notice shall be included -- +-- in all copies or substantial portions of the Software. -- +-- -- +-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -- +-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -- +-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN -- +-- NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -- +-- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -- +-- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE -- +-- USE OR OTHER DEALINGS IN THE SOFTWARE. -- +-- -- +-- Except as contained in this notice, the name(s) of the above copyright -- +-- holders shall not be used in advertising or otherwise to promote the -- +-- sale, use or other dealings in this Software without prior written -- +-- authorization. -- +------------------------------------------------------------------------------- +-- $Id: INSTALL,v 1.124 2008/03/29 18:07:32 tom Exp $ +--------------------------------------------------------------------- + How to install Ncurses/Terminfo on your system +--------------------------------------------------------------------- + + ************************************************************ + * READ ALL OF THIS FILE BEFORE YOU TRY TO INSTALL NCURSES. * + ************************************************************ + +You should be reading the file INSTALL in a directory called ncurses-d.d, where +d.d is the current version number. There should be several subdirectories, +including `c++', `form', `man', `menu', 'misc', `ncurses', `panel', `progs', +and `test'. See the README file for a roadmap to the package. + +If you are a Linux or FreeBSD or NetBSD distribution integrator or packager, +please read and act on the section titled IF YOU ARE A SYSTEM INTEGRATOR +below. + +If you are converting from BSD curses and do not have root access, be sure +to read the BSD CONVERSION NOTES section below. + +If you are trying to build applications using gpm with ncurses, +read the USING NCURSES WITH GPM section below. + +If you are running over the Andrew File System see the note below on +USING NCURSES WITH AFS. + +If you are cross-compiling, see the note below on BUILDING NCURSES WITH A +CROSS-COMPILER. + +If you want to build the Ada95 binding, go to the Ada95 directory and +follow the instructions there. The Ada95 binding is not covered below. + +If you are using anything but (a) Linux, or (b) one of the 4.4BSD-based +i386 Unixes, go read the Portability section in the TO-DO file before you +do anything else. + + +REQUIREMENTS: +------------ + +You will need the following to build and install ncurses under UNIX: + + * ANSI C compiler (gcc, for instance) + * sh (bash will do) + * awk (mawk or gawk will do) + * sed + * BSD or System V style install (a script is enclosed) + +Ncurses has been also built in the OS/2 EMX environment. + + +INSTALLATION PROCEDURE: +---------------------- + +1. First, decide whether you want ncurses to replace your existing library (in + which case you'll need super-user privileges) or be installed in parallel + with it. + + The --prefix option to configure changes the root directory for installing + ncurses. The default is normally in subdirectories of /usr/local, except + for systems where ncurses is normally installed as a system library, e.g., + Linux, the various BSD systems and Cygwin. Use --prefix=/usr to replace + your default curses distribution. + + The package gets installed beneath the --prefix directory as follows: + + In $(prefix)/bin: tic, infocmp, captoinfo, tset, + reset, clear, tput, toe + In $(prefix)/lib: libncurses*.* libcurses.a + In $(prefix)/share/terminfo: compiled terminal descriptions + In $(prefix)/include: C header files + Under $(prefix)/man: the manual pages + + Note that the configure script attempts to locate previous installation of + ncurses, and will set the default prefix according to where it finds the + ncurses headers. + + Do not use commands such as + + make install prefix=XXX + + to change the prefix after configuration, since the prefix value is used + for some absolute pathnames such as TERMINFO. Instead do this + + make install DESTDIR=XXX + + See also the discussion of --with-install-prefix. + +2. Type `./configure' in the top-level directory of the distribution to + configure ncurses for your operating system and create the Makefiles. + Besides --prefix, various configuration options are available to customize + the installation; use `./configure --help' to list the available options. + + If your operating system is not supported, read the PORTABILITY section in + the file ncurses/README for information on how to create a configuration + file for your system. + + The `configure' script generates makefile rules for one or more object + models and their associated libraries: + + libncurses.a (normal) + + libcurses.a (normal, a link to libncurses.a) + This gets left out if you configure with --disable-overwrite. + + libncurses.so (shared) + + libncurses_g.a (debug) + + libncurses_p.a (profile) + + libncurses.la (libtool) + + If you configure using the --enable-widec option, a "w" is appended to the + library names (e.g., libncursesw.a), and the resulting libraries support + wide-characters, e.g., via a UTF-8 locale. The corresponding header files + are compatible with the non-wide-character configuration; wide-character + features are provided by ifdef's in the header files. The wide-character + library interfaces are not binary-compatible with the non-wide-character + version. Building and running the wide-character code relies on a fairly + recent implementation of libiconv. We have built this configuration on + Linux using libiconv, sometimes requiring libutf8. + + If you configure using the --with-pthread option, a "t" is appended to + the library names (e.g., libncursest.a, libncursestw.a). + + If you do not specify any models, the normal and debug libraries will be + configured. Typing `configure' with no arguments is equivalent to: + + ./configure --with-normal --with-debug --enable-overwrite + + Typing + + ./configure --with-shared + + makes the shared libraries the default, resulting in + + ./configure --with-shared --with-normal --with-debug --enable-overwrite + + If you want only shared libraries, type + + ./configure --with-shared --without-normal --without-debug + + Rules for generating shared libraries are highly dependent upon the choice + of host system and compiler. We've been testing shared libraries on Linux + and SunOS with gcc, but more work needs to be done to make shared libraries + work on other systems. + + If you have libtool installed, you can type + + ./configure --with-libtool + + to generate the appropriate static and/or shared libraries for your + platform using libtool. + + You can make curses and terminfo fall back to an existing file of termcap + definitions by configuring with --enable-termcap. If you do this, the + library will search /etc/termcap before the terminfo database, and will + also interpret the contents of the TERM environment variable. See the + section BSD CONVERSION NOTES below. + +3. Type `make'. Ignore any warnings, no error messages should be produced. + This should compile the ncurses library, the terminfo compiler tic(1), + captoinfo(1), infocmp(1), toe(1), clear(1) tset(1), reset(1), and tput(1) + programs (see the manual pages for explanation of what they do), some test + programs, and the panels, menus, and forms libraries. + +4. Run ncurses and several other test programs in the test directory to + verify that ncurses functions correctly before doing an install that + may overwrite system files. Read the file test/README for details on + the test programs. + + NOTE: You must have installed the terminfo database, or set the + environment variable $TERMINFO to point to a SVr4-compatible terminfo + database before running the test programs. Not all vendors' terminfo + databases are SVr4-compatible, but most seem to be. Exceptions include + DEC's Digital Unix (formerly known as OSF/1). + + If you run the test programs WITHOUT installing terminfo, ncurses may + read the termcap file and cache that in $HOME/.terminfo, which will + thereafter be used instead of the terminfo database. See the comments + on "--enable-getcap-cache", to see why this is a Bad Thing. + + It is possible to configure ncurses to use other terminfo database formats. + A few are provided as examples in the include-directory (see --with-caps). + + The ncurses program is designed specifically to test the ncurses library. + You can use it to verify that the screen highlights work correctly, that + cursor addressing and window scrolling works OK, etc. + +5. Once you've tested, you can type `make install' to install libraries, + the programs, the terminfo database and the manual pages. Alternately, you + can type `make install' in each directory you want to install. In the + top-level directory, you can do a partial install using these commands: + + 'make install.progs' installs tic, infocmp, etc... + 'make install.includes' installs the headers. + 'make install.libs' installs the libraries (and the headers). + 'make install.data' installs the terminfo data. (Note: `tic' must + be installed before the terminfo data can be + compiled). + 'make install.man' installs the manual pages. + + ############################################################################ + # CAVEAT EMPTOR: `install.data' run as root will NUKE any existing # + # terminfo database. If you have any custom or unusual entries SAVE them # + # before you install ncurses. I have a file called terminfo.custom for # + # this purpose. Don't forget to run tic on the file once you're done. # + ############################################################################ + + The terminfo(5) manual page must be preprocessed with tbl(1) before + being formatted by nroff(1). Modern man(1) implementations tend to do + this by default, but you may want to look at your version's manual page + to be sure. You may also install the manual pages after preprocessing + with tbl(1) by specifying the configure option --with-manpage-tbl. + + If the system already has a curses library that you need to keep using + you'll need to distinguish between it and ncurses. See the discussion of + --disable-overwrite. If ncurses is installed outside the standard + directories (/usr/include and /usr/lib) then all your users will need to + use the -I option to compile programs and -L to link them. + + If you have another curses installed in your system and you accidentally + compile using its curses.h you'll end up with a large number of + undefined symbols at link time. + + IF YOU DO NOT HAVE ROOT: Change directory to the `progs' subdirectory + and run the `capconvert' script. This script will deduce various things + about your environment and use them to build you a private terminfo tree, + so you can use ncurses applications. + + If more than one user at your site does this, the space for the duplicate + trees is wasted. Try to get your site administrators to install a system- + wide terminfo tree instead. + + See the BSD CONVERSION NOTES section below for a few more details. + +6. The c++ directory has C++ classes that are built on top of ncurses and + panels. You must have c++ (and its libraries) installed before you can + compile and run the demo. + + Use --without-cxx-binding to tell configure to not build the C++ bindings + and demo. + + If you do not have C++, you must use the --without-cxx option to tell + the configure script to not attempt to determine the type of 'bool' + which may be supported by C++. IF YOU USE THIS OPTION, BE ADVISED THAT + YOU MAY NOT BE ABLE TO COMPILE (OR RUN) NCURSES APPLICATIONS WITH C++. + + +SUMMARY OF CONFIGURE OPTIONS: +---------------------------- + + The configure script provides a short list of its options when you type + + ./configure --help + + The --help and several options are common to all configure scripts that are + generated with autoconf. Those are all listed before the line + + --enable and --with options recognized: + + The other options are specific to this package. We list them in alphabetic + order. + + --disable-assumed-color + With ncurses 5.1, we introduced a new function, assume_default_colors() + which allows applications to specify what the default foreground and + background color are assumed to be. Most color applications use + full-screen color; but a few do not color the background. While the + assumed values can be overridden by invoking assume_default_colors(), + you may find it useful to set the assumed values to the pre-5.1 + convention, using this configure option. + + --disable-big-core + Assume machine has little memory. The configure script attempts to + determine if your machine has enough memory (about 6Mb) to compile the + terminfo database without writing portions to disk. Some allocators + return deceptive results, so you may have to override the configure + script. Or you may be building tic for a smaller machine. + + --disable-big-strings + Disable compile-time optimization of predefined tables which puts + all of their strings into a very long string, to reduce relocation + overhead. + + --disable-database + Use only built-in data. The ncurses libraries normally read terminfo + and termcap data from disk. You can configure ncurses to have a + built-in database, aka "fallback" entries. Embedded applications may + have no need for an external database. Some, but not all of the + programs are useful in this configuration, e.g., reset and tput versus + infocmp and tic. + + --disable-ext-funcs + Disable function-extensions. Configure ncurses without the functions + that are not specified by XSI. See ncurses/modules for the exact + list of library modules that would be suppressed. + + --disable-hashmap + Compile without hashmap scrolling-optimization code. This algorithm is + the default. + + --disable-home-terminfo + The $HOME/.terminfo directory is normally added to ncurses' search + list for reading/writing terminfo entries, since that directory is + more likely writable than the system terminfo database. Use this + option to disable the feature altogether. + + --disable-largefile + Disable compiler flags needed to use large-file interfaces. + + --disable-leaks + For testing, compile-in code that frees memory that normally would not + be freed, to simplify analysis of memory-leaks. + + Any implementation of curses must not free the memory associated with + a screen, since (even after calling endwin()), it must be available + for use in the next call to refresh(). There are also chunks of + memory held for performance reasons. That makes it hard to analyze + curses applications for memory leaks. To work around this, build + a debugging version of the ncurses library which frees those chunks + which it can, and provides the _nc_free_and_exit() function to free + the remainder on exit. The ncurses utility and test programs use this + feature, e.g., via the ExitProgram() macro. + + --disable-lp64 + The header files will ignore use of the _LP64 symbol to make chtype + and mmask_t types 32 bits (they may be long on 64-bit hosts, for + compatibility with older releases). + + NOTE: this is potentially an ABI change, depending on existing + packages. The default for this option is "disabled" for ncurses + ABI 5, and "enabled" for ABI 6. + + --disable-macros + For testing, use functions rather than macros. The program will run + more slowly, but it is simpler to debug. This defines NCURSES_NOMACROS + at build time. See also the --enable-expanded option. + + --disable-overwrite + If you are installing ncurses on a system which contains another + development version of curses, or which could be confused by the loader + for another version, we recommend that you leave out the link to + -lcurses. The ncurses library is always available as -lncurses. + Disabling overwrite also causes the ncurses header files to be + installed into a subdirectory, e.g., /usr/local/include/ncurses, + rather than the include directory. This makes it simpler to avoid + compile-time conflicts with other versions of curses.h + + --disable-relink + If --enable-rpath is given, the generated makefiles normally will + rebuild the libraries during install. Use this option to simply + copy whatever the linked produced. + + This option is ignored if --enable-rpath is not given. + + --disable-root-environ + Compile with environment restriction, so certain environment variables + are not available when running as root, or via a setuid/setgid + application. These are (for example $TERMINFO) those that allow the + search path for the terminfo or termcap entry to be customized. + + --disable-scroll-hints + Compile without scroll-hints code. This option is ignored when + hashmap scrolling is configured, which is the default. + + --disable-tparm-varargs + Portable programs should call tparm() using the fixed-length parameter + list documented in X/Open. ncurses provides varargs support for this + function. Use --disable-tparm-varargs to disable this support. + + --enable-assertions + For testing, compile-in assertion code. This is used only for a few + places where ncurses cannot easily recover by returning an error code. + + --enable-broken_linker + A few platforms have what we consider a broken linker: it cannot link + objects from an archive solely by referring to data objects in those + files, but requires a function reference. This configure option + changes several data references to functions to work around this + problem. + + NOTE: With ncurses 5.1, this may not be necessary, since we are + told that some linkers interpret uninitialized global data as a + different type of reference which behaves as described above. We have + explicitly initialized all of the global data to work around the + problem. + + --enable-bsdpad + Recognize BSD-style prefix padding. Some ancient BSD programs (such as + nethack) call tputs("50") to implement delays. + + --enable-colorfgbg + Compile with experimental $COLORFGBG code. That environment variable + is set by some terminal emulators as a hint to applications, by + advertising the default foreground and background colors. During + initialization, ncurses sets color pair 0 to match this. + + --enable-const + The curses interface as documented in XSI is rather old, in fact + including features that precede ANSI C. The prototypes generally do + not make effective use of "const". When using stricter compilers (or + gcc with appropriate warnings), you may see warnings about the mismatch + between const and non-const data. We provide a configure option which + changes the interfaces to use const - quieting these warnings and + reflecting the actual use of the parameters more closely. The ncurses + library uses the symbol NCURSES_CONST for these instances of const, + and if you have asked for compiler warnings, will add gcc's const-qual + warning. There will still be warnings due to subtle inconsistencies + in the interface, but at a lower level. + + NOTE: configuring ncurses with this option may detract from the + portability of your applications by encouraging you to use const in + places where the XSI curses interface would not allow them. Similar + issues arise when porting to SVr4 curses, which uses const in even + fewer places. + + --enable-echo + Use the option --disable-echo to make the build-log less verbose by + suppressing the display of the compile and link commands. This makes + it easier to see the compiler warnings. (You can always use "make -n" + to see the options that are used). + + --enable-expanded + For testing, generate functions for certain macros to make them visible + as such to the debugger. See also the --disable-macros option. + + --enable-ext-colors + Extend the cchar_t structure to allow more than 16 colors to be + encoded. This applies only to the wide-character (--enable-widec) + configuration. + + NOTE: using this option will make libraries which are not binary- + compatible with libncursesw 5.4. None of the interfaces change, but + applications which have an array of cchar_t's must be recompiled. + + --enable-ext-mouse + Modify the encoding of mouse state to make room for a 5th mouse button. + That allows one to use ncurses with a wheel mouse with xterm or + similar X terminal emulators. + + NOTE: using this option will make libraries which are not binary- + compatible with libncursesw 5.4. None of the interfaces change, but + applications which have mouse mask mmask_t's must be recompiled. + + --enable-getcap + Use the 4.4BSD getcap code if available, or a bundled version of it to + fetch termcap entries. Entries read in this way cannot use (make + cross-references to) the terminfo tree, but it is faster than reading + /etc/termcap. + + If configured for one of the *BSD systems, this automatically uses + the hashed database system produced using cap_mkdb or similar tools. + In that case, there is no advantage in using the --enable-getcap-cache + option. + + See also the --with-hashed-db option. + + --enable-getcap-cache + Cache translated termcaps under the directory $HOME/.terminfo + *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From rafan at FreeBSD.org Sun Nov 9 01:07:47 2008 From: rafan at FreeBSD.org (Rong-En Fan) Date: Sun Nov 9 01:07:54 2008 Subject: svn commit: r184787 - in vendor/ncurses/dist: . doc doc/html form include man menu misc misc/tabset ncurses ncurses/base ncurses/tinfo ncurses/trace ncurses/tty ncurses/widechar panel progs Message-ID: <200811090907.mA997lIm035487@svn.freebsd.org> Author: rafan Date: Sun Nov 9 09:07:46 2008 New Revision: 184787 URL: http://svn.freebsd.org/changeset/base/184787 Log: - Remove svn:keywords on unmodified vendor code Modified: vendor/ncurses/dist/ANNOUNCE (props changed) vendor/ncurses/dist/AUTHORS (props changed) vendor/ncurses/dist/INSTALL (props changed) vendor/ncurses/dist/MANIFEST (props changed) vendor/ncurses/dist/Makefile.in (props changed) vendor/ncurses/dist/Makefile.os2 (props changed) vendor/ncurses/dist/NEWS (props changed) vendor/ncurses/dist/README (props changed) vendor/ncurses/dist/README.emx (props changed) vendor/ncurses/dist/TO-DO (props changed) vendor/ncurses/dist/aclocal.m4 (props changed) vendor/ncurses/dist/announce.html.in (props changed) vendor/ncurses/dist/config.guess (props changed) vendor/ncurses/dist/config.sub (props changed) vendor/ncurses/dist/configure (props changed) vendor/ncurses/dist/configure.in (props changed) vendor/ncurses/dist/convert_configure.pl (props changed) vendor/ncurses/dist/dist.mk (props changed) vendor/ncurses/dist/doc/hackguide.doc (props changed) vendor/ncurses/dist/doc/html/NCURSES-Programming-HOWTO.html (props changed) vendor/ncurses/dist/doc/html/announce.html (props changed) vendor/ncurses/dist/doc/html/hackguide.html (props changed) vendor/ncurses/dist/doc/html/ncurses-intro.html (props changed) vendor/ncurses/dist/doc/ncurses-intro.doc (props changed) vendor/ncurses/dist/form/Makefile.in (props changed) vendor/ncurses/dist/form/READ.ME (props changed) vendor/ncurses/dist/form/f_trace.c (props changed) vendor/ncurses/dist/form/fld_arg.c (props changed) vendor/ncurses/dist/form/fld_attr.c (props changed) vendor/ncurses/dist/form/fld_current.c (props changed) vendor/ncurses/dist/form/fld_def.c (props changed) vendor/ncurses/dist/form/fld_dup.c (props changed) vendor/ncurses/dist/form/fld_ftchoice.c (props changed) vendor/ncurses/dist/form/fld_ftlink.c (props changed) vendor/ncurses/dist/form/fld_info.c (props changed) vendor/ncurses/dist/form/fld_just.c (props changed) vendor/ncurses/dist/form/fld_link.c (props changed) vendor/ncurses/dist/form/fld_max.c (props changed) vendor/ncurses/dist/form/fld_move.c (props changed) vendor/ncurses/dist/form/fld_newftyp.c (props changed) vendor/ncurses/dist/form/fld_opts.c (props changed) vendor/ncurses/dist/form/fld_pad.c (props changed) vendor/ncurses/dist/form/fld_page.c (props changed) vendor/ncurses/dist/form/fld_stat.c (props changed) vendor/ncurses/dist/form/fld_type.c (props changed) vendor/ncurses/dist/form/fld_user.c (props changed) vendor/ncurses/dist/form/form.h (props changed) vendor/ncurses/dist/form/form.priv.h (props changed) vendor/ncurses/dist/form/frm_cursor.c (props changed) vendor/ncurses/dist/form/frm_data.c (props changed) vendor/ncurses/dist/form/frm_def.c (props changed) vendor/ncurses/dist/form/frm_driver.c (props changed) vendor/ncurses/dist/form/frm_hook.c (props changed) vendor/ncurses/dist/form/frm_opts.c (props changed) vendor/ncurses/dist/form/frm_page.c (props changed) vendor/ncurses/dist/form/frm_post.c (props changed) vendor/ncurses/dist/form/frm_req_name.c (props changed) vendor/ncurses/dist/form/frm_scale.c (props changed) vendor/ncurses/dist/form/frm_sub.c (props changed) vendor/ncurses/dist/form/frm_user.c (props changed) vendor/ncurses/dist/form/frm_win.c (props changed) vendor/ncurses/dist/form/fty_alnum.c (props changed) vendor/ncurses/dist/form/fty_alpha.c (props changed) vendor/ncurses/dist/form/fty_enum.c (props changed) vendor/ncurses/dist/form/fty_int.c (props changed) vendor/ncurses/dist/form/fty_ipv4.c (props changed) vendor/ncurses/dist/form/fty_num.c (props changed) vendor/ncurses/dist/form/fty_regex.c (props changed) vendor/ncurses/dist/form/headers (props changed) vendor/ncurses/dist/form/llib-lform (props changed) vendor/ncurses/dist/form/llib-lformw (props changed) vendor/ncurses/dist/form/modules (props changed) vendor/ncurses/dist/include/Caps (props changed) vendor/ncurses/dist/include/Caps.aix4 (props changed) vendor/ncurses/dist/include/Caps.hpux11 (props changed) vendor/ncurses/dist/include/Caps.keys (props changed) vendor/ncurses/dist/include/Caps.osf1r5 (props changed) vendor/ncurses/dist/include/Caps.uwin (props changed) vendor/ncurses/dist/include/MKhashsize.sh (props changed) vendor/ncurses/dist/include/MKkey_defs.sh (props changed) vendor/ncurses/dist/include/MKncurses_def.sh (props changed) vendor/ncurses/dist/include/MKparametrized.sh (props changed) vendor/ncurses/dist/include/MKterm.h.awk.in (props changed) vendor/ncurses/dist/include/Makefile.in (props changed) vendor/ncurses/dist/include/capdefaults.c (props changed) vendor/ncurses/dist/include/curses.h.in (props changed) vendor/ncurses/dist/include/curses.tail (props changed) vendor/ncurses/dist/include/curses.wide (props changed) vendor/ncurses/dist/include/edit_cfg.sh (props changed) vendor/ncurses/dist/include/hashed_db.h (props changed) vendor/ncurses/dist/include/headers (props changed) vendor/ncurses/dist/include/nc_alloc.h (props changed) vendor/ncurses/dist/include/nc_panel.h (props changed) vendor/ncurses/dist/include/nc_tparm.h (props changed) vendor/ncurses/dist/include/ncurses_cfg.hin (props changed) vendor/ncurses/dist/include/ncurses_defs (props changed) vendor/ncurses/dist/include/ncurses_dll.h (props changed) vendor/ncurses/dist/include/term_entry.h (props changed) vendor/ncurses/dist/include/termcap.h.in (props changed) vendor/ncurses/dist/include/tic.h (props changed) vendor/ncurses/dist/include/unctrl.h.in (props changed) vendor/ncurses/dist/install-sh (props changed) vendor/ncurses/dist/man/MKterminfo.sh (props changed) vendor/ncurses/dist/man/Makefile.in (props changed) vendor/ncurses/dist/man/captoinfo.1m (props changed) vendor/ncurses/dist/man/clear.1 (props changed) vendor/ncurses/dist/man/curs_add_wch.3x (props changed) vendor/ncurses/dist/man/curs_add_wchstr.3x (props changed) vendor/ncurses/dist/man/curs_addch.3x (props changed) vendor/ncurses/dist/man/curs_addchstr.3x (props changed) vendor/ncurses/dist/man/curs_addstr.3x (props changed) vendor/ncurses/dist/man/curs_addwstr.3x (props changed) vendor/ncurses/dist/man/curs_attr.3x (props changed) vendor/ncurses/dist/man/curs_beep.3x (props changed) vendor/ncurses/dist/man/curs_bkgd.3x (props changed) vendor/ncurses/dist/man/curs_bkgrnd.3x (props changed) vendor/ncurses/dist/man/curs_border.3x (props changed) vendor/ncurses/dist/man/curs_border_set.3x (props changed) vendor/ncurses/dist/man/curs_clear.3x (props changed) vendor/ncurses/dist/man/curs_color.3x (props changed) vendor/ncurses/dist/man/curs_delch.3x (props changed) vendor/ncurses/dist/man/curs_deleteln.3x (props changed) vendor/ncurses/dist/man/curs_extend.3x (props changed) vendor/ncurses/dist/man/curs_get_wch.3x (props changed) vendor/ncurses/dist/man/curs_get_wstr.3x (props changed) vendor/ncurses/dist/man/curs_getcchar.3x (props changed) vendor/ncurses/dist/man/curs_getch.3x (props changed) vendor/ncurses/dist/man/curs_getstr.3x (props changed) vendor/ncurses/dist/man/curs_getyx.3x (props changed) vendor/ncurses/dist/man/curs_in_wch.3x (props changed) vendor/ncurses/dist/man/curs_in_wchstr.3x (props changed) vendor/ncurses/dist/man/curs_inch.3x (props changed) vendor/ncurses/dist/man/curs_inchstr.3x (props changed) vendor/ncurses/dist/man/curs_initscr.3x (props changed) vendor/ncurses/dist/man/curs_inopts.3x (props changed) vendor/ncurses/dist/man/curs_ins_wch.3x (props changed) vendor/ncurses/dist/man/curs_ins_wstr.3x (props changed) vendor/ncurses/dist/man/curs_insch.3x (props changed) vendor/ncurses/dist/man/curs_insstr.3x (props changed) vendor/ncurses/dist/man/curs_instr.3x (props changed) vendor/ncurses/dist/man/curs_inwstr.3x (props changed) vendor/ncurses/dist/man/curs_kernel.3x (props changed) vendor/ncurses/dist/man/curs_legacy.3x (props changed) vendor/ncurses/dist/man/curs_mouse.3x (props changed) vendor/ncurses/dist/man/curs_move.3x (props changed) vendor/ncurses/dist/man/curs_opaque.3x (props changed) ve