From owner-p4-projects@FreeBSD.ORG Sat Aug 16 10:01:31 2008 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id B5E051065688; Sat, 16 Aug 2008 10:01:31 +0000 (UTC) Delivered-To: perforce@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 603021065680 for ; Sat, 16 Aug 2008 10:01:31 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id 4F4638FC16 for ; Sat, 16 Aug 2008 10:01:31 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.2/8.14.2) with ESMTP id m7GA1VnX083666 for ; Sat, 16 Aug 2008 10:01:31 GMT (envelope-from ed@FreeBSD.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.2/8.14.1/Submit) id m7GA1VJB083664 for perforce@freebsd.org; Sat, 16 Aug 2008 10:01:31 GMT (envelope-from ed@FreeBSD.org) Date: Sat, 16 Aug 2008 10:01:31 GMT Message-Id: <200808161001.m7GA1VJB083664@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to ed@FreeBSD.org using -f From: Ed Schouten To: Perforce Change Reviews Cc: Subject: PERFORCE change 147517 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 16 Aug 2008 10:01:32 -0000 http://perforce.freebsd.org/chv.cgi?CH=147517 Change 147517 by ed@ed_dull on 2008/08/16 10:01:07 Style fixes: Fix up the comments in the TTY layer by ending sentences with dots. Requested by: attilio (long time ago - sorry) Affected files ... .. //depot/projects/mpsafetty/lib/libc/stdlib/ptsname.c#2 edit .. //depot/projects/mpsafetty/sys/compat/linux/linux_stats.c#2 edit .. //depot/projects/mpsafetty/sys/dev/nmdm/nmdm.c#8 edit .. //depot/projects/mpsafetty/sys/dev/syscons/syscons.c#3 edit .. //depot/projects/mpsafetty/sys/dev/syscons/syscons.h#2 edit .. //depot/projects/mpsafetty/sys/dev/uart/uart_tty.c#2 edit .. //depot/projects/mpsafetty/sys/dev/usb/ucom.c#3 edit .. //depot/projects/mpsafetty/sys/dev/usb/uftdi.c#3 edit .. //depot/projects/mpsafetty/sys/kern/kern_exit.c#2 edit .. //depot/projects/mpsafetty/sys/kern/kern_proc.c#4 edit .. //depot/projects/mpsafetty/sys/kern/tty.c#22 edit .. //depot/projects/mpsafetty/sys/kern/tty_inq.c#3 edit .. //depot/projects/mpsafetty/sys/kern/tty_outq.c#3 edit .. //depot/projects/mpsafetty/sys/kern/tty_pts.c#9 edit .. //depot/projects/mpsafetty/sys/kern/tty_pty.c#7 edit .. //depot/projects/mpsafetty/sys/kern/tty_ttydisc.c#10 edit .. //depot/projects/mpsafetty/sys/sun4v/sun4v/hvcons.c#2 edit .. //depot/projects/mpsafetty/sys/sys/tty.h#10 edit .. //depot/projects/mpsafetty/sys/sys/ttydevsw.h#3 edit .. //depot/projects/mpsafetty/sys/sys/ttydisc.h#3 edit .. //depot/projects/mpsafetty/sys/sys/ttyqueue.h#3 edit .. //depot/projects/mpsafetty/usr.bin/fstat/fstat.c#3 edit .. //depot/projects/mpsafetty/usr.sbin/pstat/pstat.c#5 edit Differences ... ==== //depot/projects/mpsafetty/lib/libc/stdlib/ptsname.c#2 (text+ko) ==== @@ -83,7 +83,7 @@ if (__isptmaster(fildes) != 0) goto done; - /* Obtain the device name through FIODGNAME */ + /* Obtain the device name through FIODGNAME. */ fgn.len = sizeof pt_slave - (sizeof _PATH_DEV - 1); fgn.buf = pt_slave + (sizeof _PATH_DEV - 1); if (_ioctl(fildes, FIODGNAME, &fgn) == 0) ==== //depot/projects/mpsafetty/sys/compat/linux/linux_stats.c#2 (text+ko) ==== @@ -115,7 +115,7 @@ } else if (fp->f_type == DTYPE_PTS) { struct tty *tp = fp->f_data; - /* Convert the numbers for the slave device */ + /* Convert the numbers for the slave device. */ if (linux_driver_get_major_minor(tp->t_dev->si_name, &major, &minor) == 0) { buf->st_rdev = (major << 8 | minor); ==== //depot/projects/mpsafetty/sys/dev/nmdm/nmdm.c#8 (text+ko) ==== @@ -105,7 +105,7 @@ ns = malloc(sizeof(*ns), M_NMDM, M_WAITOK|M_ZERO); mtx_init(&ns->ns_mtx, "nmdm", NULL, MTX_DEF); - /* Hook the pairs together */ + /* Hook the pairs together. */ ns->ns_part1.np_pair = ns; ns->ns_part1.np_other = &ns->ns_part2; TASK_INIT(&ns->ns_part1.np_task, 0, nmdm_task_tty, &ns->ns_part1); @@ -116,7 +116,7 @@ TASK_INIT(&ns->ns_part2.np_task, 0, nmdm_task_tty, &ns->ns_part2); callout_init(&ns->ns_part2.np_callout, 0); - /* Create device nodes */ + /* Create device nodes. */ tp = ns->ns_part1.np_tty = tty_alloc(&nmdm_class, &ns->ns_part1, &ns->ns_mtx); tty_makedev(tp, NULL, "nmdm%luA", unit); @@ -141,7 +141,7 @@ if (strncmp(name, "nmdm", 4) != 0) return; - /* Device name must be "nmdm%lu%c", where %c is 'A' or 'B' */ + /* Device name must be "nmdm%lu%c", where %c is 'A' or 'B'. */ name += 4; unit = strtoul(name, &end, 10); if (unit == ULONG_MAX || name == end) @@ -325,7 +325,7 @@ { struct nmdmpart *np = tty_softc(tp); - /* We can receive again, so wake up the other side */ + /* We can receive again, so wake up the other side. */ taskqueue_enqueue(taskqueue_swi, &np->np_other->np_task); } @@ -334,7 +334,7 @@ { struct nmdmpart *np = tty_softc(tp); - /* We can transmit again, so wake up our side */ + /* We can transmit again, so wake up our side. */ taskqueue_enqueue(taskqueue_swi, &np->np_task); } ==== //depot/projects/mpsafetty/sys/dev/syscons/syscons.c#3 (text+ko) ==== @@ -338,14 +338,13 @@ va_start(ap, fmt); - /* Allocate TTY object and softc to store unit number */ + /* Allocate TTY object and softc to store unit number. */ stc = malloc(sizeof(struct sc_ttysoftc), M_DEVBUF, M_WAITOK); stc->st_index = index; stc->st_stat = NULL; tp = tty_alloc(&sc_ttydevsw, stc, &Giant); - /* Create device node */ - /* XXX: can't we just pass the varargs? */ + /* Create device node. */ va_start(ap, fmt); vsnrprintf(name, sizeof name, 32, fmt, ap); va_end(ap); @@ -526,9 +525,6 @@ return ENXIO; if (!tty_opened(tp)) { -#if 0 - tp->t_termios = tp->t_init_in; -#endif /* Use the current setting of the <-- key as default VERASE. */ /* If the Delete key is preferable, an stty is necessary */ #ifndef __sparc64__ @@ -538,10 +534,6 @@ tp->t_termios.c_cc[VERASE] = key.key.map[0]; } #endif -#if 0 - scparam(tp, &tp->t_termios); - ttyld_modem(tp, 1); -#endif } scp = sc_get_stat(tp); @@ -602,7 +594,7 @@ } } -#if 0 +#if 0 /* XXX mpsafetty: fix screensaver. What about outwakeup? */ static int scread(struct cdev *dev, struct uio *uio, int flag) { ==== //depot/projects/mpsafetty/sys/dev/syscons/syscons.h#2 (text+ko) ==== @@ -339,7 +339,7 @@ #endif } scr_stat; -/* TTY softc */ +/* TTY softc. */ typedef struct sc_ttysoftc { int st_index; scr_stat *st_stat; ==== //depot/projects/mpsafetty/sys/dev/uart/uart_tty.c#2 (text+ko) ==== @@ -174,12 +174,17 @@ * Without hardware support, we need to toggle RTS ourselves. */ if ((tp->t_termios.c_cflag & CRTS_IFLOW) && !sc->sc_hwiflow) { +#if 0 /*if ((tp->t_state & TS_TBLOCK) && (sc->sc_hwsig & SER_RTS)) UART_SETSIG(sc, SER_DRTS); else */ if (/*!(tp->t_state & TS_TBLOCK) &&*/ !(sc->sc_hwsig & SER_RTS)) UART_SETSIG(sc, SER_DRTS|SER_RTS); +#endif + /* XXX: we should use inwakeup to implement this! */ + if (!(sc->sc_hwsig & SER_RTS)) + UART_SETSIG(sc, SER_DRTS|SER_RTS); } if (sc->sc_txbusy) @@ -311,16 +316,8 @@ ttydisc_modem(tp, sig & SER_DCD); if ((sig & SER_DCTS) && (tp->t_termios.c_cflag & CCTS_OFLOW) && !sc->sc_hwoflow) { - if (sig & SER_CTS) { -#if 0 - tp->t_state &= ~TS_TTSTOP; -#endif + if (sig & SER_CTS) uart_tty_outwakeup(tp); - } else { -#if 0 - tp->t_state |= TS_TTSTOP; -#endif - } } } ==== //depot/projects/mpsafetty/sys/dev/usb/ucom.c#3 (text+ko) ==== @@ -554,7 +554,7 @@ if (sc->sc_oxfer == NULL) return; - /* XXX: hardware flow control */ + /* XXX: hardware flow control. We should use inwakeup here. */ #if 0 if (tp->t_state & TS_TBLOCK) { if (ISSET(sc->sc_mcr, SER_RTS) && ==== //depot/projects/mpsafetty/sys/dev/usb/uftdi.c#3 (text+ko) ==== @@ -495,12 +495,12 @@ DPRINTFN(10,("uftdi_write: sc=%p, port=%d tp=%p, count=%u\n", vsc, portno, tp, count)); - /* Leave space for the length tag */ + /* Leave space for the length tag. */ l = ttydisc_getc(tp, to + sc->sc_hdrlen, count - sc->sc_hdrlen); if (l == 0) return (0); - /* Make length tag */ + /* Make length tag. */ if (sc->sc_hdrlen > 0) *to = FTDI_OUT_TAG(l, portno); ==== //depot/projects/mpsafetty/sys/kern/kern_exit.c#2 (text+ko) ==== @@ -350,7 +350,7 @@ sx_xunlock(&proctree_lock); (void)acct_process(td); - /* Release the TTY now we've unlocked everything */ + /* Release the TTY now we've unlocked everything. */ if (ttyvp != NULL) vrele(ttyvp); #ifdef KTRACE ==== //depot/projects/mpsafetty/sys/kern/kern_proc.c#4 (text+ko) ==== @@ -502,7 +502,7 @@ savesess = pgrp->pg_session; PGRP_UNLOCK(pgrp); - /* Remove the reference to the pgrp before deallocating it */ + /* Remove the reference to the pgrp before deallocating it. */ if (tp != NULL) { tty_lock(tp); tty_rel_pgrp(tp, pgrp); ==== //depot/projects/mpsafetty/sys/kern/tty.c#22 (text+ko) ==== @@ -97,18 +97,18 @@ { speed_t sp; - /* Provide an input buffer for 0.2 seconds of data */ + /* Provide an input buffer for 0.2 seconds of data. */ sp = MAX(tp->t_termios.c_ispeed, 0); ttyinq_setsize(&tp->t_inq, tp, sp / 5); - /* Set low watermark at 10% (when 90% is available) */ + /* Set low watermark at 10% (when 90% is available). */ tp->t_inlow = (ttyinq_getsize(&tp->t_inq) * 9) / 10; - /* Provide an ouput buffer for 0.2 seconds of data */ + /* Provide an ouput buffer for 0.2 seconds of data. */ sp = MAX(tp->t_termios.c_ospeed, 0); ttyoutq_setsize(&tp->t_outq, tp, sp / 5); - /* Set low watermark at 10% (when 90% is available) */ + /* Set low watermark at 10% (when 90% is available). */ tp->t_outlow = (ttyoutq_getsize(&tp->t_outq) * 9) / 10; } @@ -116,13 +116,13 @@ tty_freebuffers(struct tty *tp) { - /* Destroy input buffers */ + /* Destroy input buffers. */ ttyinq_flush(&tp->t_inq); ttyinq_setsize(&tp->t_inq, NULL, 0); MPASS(ttyinq_getsize(&tp->t_inq) == 0); tp->t_inlow = 0; - /* Destroy output buffers */ + /* Destroy output buffers. */ ttyoutq_flush(&tp->t_outq); ttyoutq_setsize(&tp->t_outq, NULL, 0); MPASS(ttyoutq_getsize(&tp->t_outq) == 0); @@ -136,11 +136,11 @@ while (ttyoutq_bytesused(&tp->t_outq) > 0) { ttydevsw_outwakeup(tp); - /* Could be handled synchronously */ + /* Could be handled synchronously. */ if (ttyoutq_bytesused(&tp->t_outq) == 0) return (0); - /* Wait for data to be drained */ + /* Wait for data to be drained. */ error = tty_wait(tp, &tp->t_outwait); if (error) return (error); @@ -163,7 +163,7 @@ tty_lock(tp); if (tty_gone(tp) || !tty_opened(tp)) { - /* Device is already gone */ + /* Device is already gone. */ tty_unlock(tp); return (ENXIO); } @@ -177,28 +177,28 @@ tty_lock_assert(tp, MA_OWNED); if (tty_opened(tp) || tp->t_flags & TF_OPENCLOSE) { - /* Device is still opened somewhere */ + /* Device is still opened somewhere. */ tty_unlock(tp); return; } tp->t_flags |= TF_OPENCLOSE; - /* Stop asynchronous I/O */ + /* Stop asynchronous I/O. */ funsetown(&tp->t_sigio); - /* Remove console TTY */ + /* Remove console TTY. */ if (constty == tp) constty_clear(); - /* Drain any output */ + /* Drain any output. */ MPASS((tp->t_flags & TF_STOPPED) == 0); if (!tty_gone(tp)) tty_drain(tp); ttydisc_close(tp); - /* Destroy associated buffers already */ + /* Destroy associated buffers already. */ tty_freebuffers(tp); knlist_clear(&tp->t_inpoll.si_note, 1); @@ -229,7 +229,7 @@ tty_lock(tp); if (tty_gone(tp)) { - /* Device is already gone */ + /* Device is already gone. */ tty_unlock(tp); return (ENXIO); } @@ -265,7 +265,7 @@ } if (!tty_opened(tp)) { - /* Set proper termios flags */ + /* Set proper termios flags. */ if (TTY_CALLOUT(tp, dev)) { tp->t_termios = tp->t_termios_init_out; } else { @@ -283,7 +283,7 @@ tty_watermarks(tp); } - /* Wait for Carrier Detect */ + /* Wait for Carrier Detect. */ if (!TTY_CALLOUT(tp, dev) && (oflags & O_NONBLOCK) == 0 && (tp->t_termios.c_cflag & CLOCAL) == 0) { while ((ttydevsw_modem(tp, 0, 0) & SER_DCD) == 0) { @@ -318,7 +318,7 @@ MPASS((tp->t_flags & TF_OPENED) != TF_OPENED); tp->t_flags &= ~(TF_OPENED|TF_EXCLUDE|TF_STOPPED); - /* Properly wake up threads that are stuck - revoke() */ + /* Properly wake up threads that are stuck - revoke(). */ tp->t_revokecnt++; tty_wakeup(tp, FREAD|FWRITE); cv_broadcast(&tp->t_bgwait); @@ -361,7 +361,7 @@ p->p_pgrp == tp->t_pgrp || p->p_flag & P_PPWAIT || SIGISMEMBER(p->p_sigacts->ps_sigignore, sig) || SIGISMEMBER(td->td_sigmask, sig)) { - /* Allow the action to happen */ + /* Allow the action to happen. */ PROC_UNLOCK(p); return (0); } @@ -506,23 +506,23 @@ error = ttydev_enter(tp); if (error) { - /* Don't return the error here, but the event mask */ + /* Don't return the error here, but the event mask. */ return (events & (POLLHUP|POLLIN|POLLRDNORM|POLLOUT|POLLWRNORM)); } if (events & (POLLIN|POLLRDNORM)) { - /* See if we can read something */ + /* See if we can read something. */ if (ttydisc_read_poll(tp) > 0) revents |= events & (POLLIN|POLLRDNORM); } if (events & (POLLOUT|POLLWRNORM)) { - /* See if we can write something */ + /* See if we can write something. */ if (ttydisc_write_poll(tp) > 0) revents |= events & (POLLOUT|POLLWRNORM); } if (tp->t_flags & TF_ZOMBIE) - /* Hangup flag on zombie state */ + /* Hangup flag on zombie state. */ revents |= events & POLLHUP; if (revents == 0) { @@ -700,11 +700,11 @@ switch (cmd) { case TIOCGETA: - /* Obtain terminal flags through tcgetattr() */ + /* Obtain terminal flags through tcgetattr(). */ bcopy(dev->si_drv2, data, sizeof(struct termios)); break; case TIOCSETA: - /* Set terminal flags through tcsetattr() */ + /* Set terminal flags through tcsetattr(). */ error = priv_check(td, PRIV_TTY_SETA); if (error) break; @@ -818,7 +818,7 @@ ttydevsw_defmodem(struct tty *tp, int sigon, int sigoff) { - /* Simulate a carrier to make the TTY layer happy */ + /* Simulate a carrier to make the TTY layer happy. */ return (SER_DCD); } @@ -848,7 +848,7 @@ { struct tty *tp; - /* Make sure the driver defines all routines */ + /* Make sure the driver defines all routines. */ #define PATCH_FUNC(x) do { \ if (tsw->tsw_ ## x == NULL) \ tsw->tsw_ ## x = ttydevsw_def ## x; \ @@ -879,7 +879,7 @@ TAILQ_INIT(&tp->t_inq.ti_list); STAILQ_INIT(&tp->t_outq.to_list); - /* Allow drivers to use a custom mutex to lock the TTY */ + /* Allow drivers to use a custom mutex to lock the TTY. */ if (mutex != NULL) { tp->t_mtx = mutex; } else { @@ -931,14 +931,14 @@ if (tp->t_sessioncnt != 0 || (tp->t_flags & (TF_GONE|TF_OPENED)) != TF_GONE) { - /* TTY is still in use */ + /* TTY is still in use. */ tty_unlock(tp); return; } tty_freebuffers(tp); - /* TTY can be deallocated */ + /* TTY can be deallocated. */ dev = tp->t_dev; tp->t_dev = NULL; tty_unlock(tp); @@ -960,7 +960,7 @@ { MPASS(tp->t_sessioncnt > 0); - /* Current session has left */ + /* Current session has left. */ if (tp->t_session == sess) { tp->t_session = NULL; MPASS(tp->t_pgrp == NULL); @@ -974,10 +974,10 @@ { MPASS(!tty_gone(tp)); - /* Simulate carrier removal */ + /* Simulate carrier removal. */ ttydisc_modem(tp, 0); - /* Wake up misc. blocked threads */ + /* Wake up misc. blocked threads. */ cv_broadcast(&tp->t_bgwait); cv_broadcast(&tp->t_dcdwait); @@ -1053,12 +1053,12 @@ va_list ap; struct cdev *dev; const char *prefix = "tty"; - char name[SPECNAMELEN - 3]; /* for "tty" and "cua" */ + char name[SPECNAMELEN - 3]; /* for "tty" and "cua". */ uid_t uid; gid_t gid; mode_t mode; - /* Remove "tty" prefix from devices like PTY's */ + /* Remove "tty" prefix from devices like PTY's. */ if (tp->t_flags & TF_NOPREFIX) prefix = ""; @@ -1067,24 +1067,24 @@ va_end(ap); if (cred == NULL) { - /* System device */ + /* System device. */ uid = UID_ROOT; gid = GID_WHEEL; mode = S_IRUSR|S_IWUSR; } else { - /* User device */ + /* User device. */ uid = cred->cr_ruid; gid = GID_TTY; mode = S_IRUSR|S_IWUSR|S_IWGRP; } - /* Master call-in device */ + /* Master call-in device. */ dev = make_dev_cred(&ttydev_cdevsw, 0, cred, uid, gid, mode, "%s%s", prefix, name); dev->si_drv1 = tp; tp->t_dev = dev; - /* Slave call-in devices */ + /* Slave call-in devices. */ if (tp->t_flags & TF_INITLOCK) { dev = make_dev_cred(&ttyil_cdevsw, 0, cred, uid, gid, mode, "%s%s.init", prefix, name); @@ -1099,14 +1099,14 @@ dev->si_drv2 = &tp->t_termios_lock_in; } - /* Call-out devices */ + /* Call-out devices. */ if (tp->t_flags & TF_CALLOUT) { dev = make_dev_cred(&ttydev_cdevsw, 0, cred, UID_UUCP, GID_DIALER, 0660, "cua%s", name); dev_depends(tp->t_dev, dev); dev->si_drv1 = tp; - /* Slave call-out devices */ + /* Slave call-out devices. */ if (tp->t_flags & TF_INITLOCK) { dev = make_dev_cred(&ttyil_cdevsw, 0, cred, UID_UUCP, GID_DIALER, 0660, "cua%s.init", name); @@ -1135,7 +1135,7 @@ tty_lock_assert(tp, MA_OWNED); MPASS(sig >= 1 && sig < NSIG); - /* Make signals start output again */ + /* Make signals start output again. */ tp->t_flags &= ~TF_STOPPED; if (tp->t_session != NULL && tp->t_session->s_leader != NULL) { @@ -1152,7 +1152,7 @@ tty_lock_assert(tp, MA_OWNED); MPASS(sig >= 1 && sig < NSIG); - /* Make signals start output again */ + /* Make signals start output again. */ tp->t_flags &= ~TF_STOPPED; if (sig == SIGINFO && !(tp->t_termios.c_lflag & NOKERNINFO)) @@ -1189,18 +1189,18 @@ int revokecnt = tp->t_revokecnt; #if 0 - /* XXX: /dev/console also picks up Giant */ + /* XXX: /dev/console also picks up Giant. */ tty_lock_assert(tp, MA_OWNED|MA_NOTRECURSED); #endif tty_lock_assert(tp, MA_OWNED); error = cv_wait_sig(cv, tp->t_mtx); - /* Restart the system call when we may have been revoked */ + /* Restart the system call when we may have been revoked. */ if (tp->t_revokecnt != revokecnt) return (ERESTART); - /* Bail out when the device slipped away */ + /* Bail out when the device slipped away. */ if (tty_gone(tp)) return (ENXIO); @@ -1214,18 +1214,18 @@ int revokecnt = tp->t_revokecnt; #if 0 - /* XXX: /dev/console also picks up Giant */ + /* XXX: /dev/console also picks up Giant. */ tty_lock_assert(tp, MA_OWNED|MA_NOTRECURSED); #endif tty_lock_assert(tp, MA_OWNED); error = cv_timedwait_sig(cv, tp->t_mtx, hz); - /* Restart the system call when we may have been revoked */ + /* Restart the system call when we may have been revoked. */ if (tp->t_revokecnt != revokecnt) return (ERESTART); - /* Bail out when the device slipped away */ + /* Bail out when the device slipped away. */ if (tty_gone(tp)) return (ENXIO); @@ -1292,31 +1292,31 @@ tp->t_flags &= ~TF_ASYNC; return (0); case FIONBIO: - /* This device supports non-blocking operation */ + /* This device supports non-blocking operation. */ return (0); case FIONREAD: *(int *)data = ttyinq_bytescanonicalized(&tp->t_inq); return (0); case FIOSETOWN: if (tp->t_session != NULL && !tty_is_ctty(tp, td->td_proc)) - /* Not allowed to set ownership */ + /* Not allowed to set ownership. */ return (ENOTTY); - /* Temporarily unlock the TTY to set ownership */ + /* Temporarily unlock the TTY to set ownership. */ tty_unlock(tp); error = fsetown(*(int *)data, &tp->t_sigio); tty_lock(tp); return (error); case FIOGETOWN: if (tp->t_session != NULL && !tty_is_ctty(tp, td->td_proc)) - /* Not allowed to set ownership */ + /* Not allowed to set ownership. */ return (ENOTTY); - /* Get ownership */ + /* Get ownership. */ *(int *)data = fgetown(&tp->t_sigio); return (0); case TIOCGETA: - /* Obtain terminal flags through tcgetattr() */ + /* Obtain terminal flags through tcgetattr(). */ bcopy(&tp->t_termios, data, sizeof(struct termios)); return (0); case TIOCSETA: @@ -1332,14 +1332,14 @@ if (t->c_ispeed == 0) t->c_ispeed = t->c_ospeed; - /* Don't allow invalid flags to be set */ + /* Don't allow invalid flags to be set. */ if ((t->c_iflag & ~TTYSUP_IFLAG) != 0 || (t->c_oflag & ~TTYSUP_OFLAG) != 0 || (t->c_lflag & ~TTYSUP_LFLAG) != 0 || (t->c_cflag & ~TTYSUP_CFLAG) != 0) return (EINVAL); - /* Set terminal flags through tcsetattr() */ + /* Set terminal flags through tcsetattr(). */ if (cmd == TIOCSETAW || cmd == TIOCSETAF) { error = tty_drain(tp); if (error) @@ -1365,11 +1365,11 @@ tp->t_termios.c_ispeed = t->c_ispeed; tp->t_termios.c_ospeed = t->c_ospeed; - /* Baud rate has changed - update watermarks */ + /* Baud rate has changed - update watermarks. */ tty_watermarks(tp); } - /* Copy new non-device driver parameters */ + /* Copy new non-device driver parameters. */ tp->t_termios.c_iflag = t->c_iflag; tp->t_termios.c_oflag = t->c_oflag; tp->t_termios.c_lflag = t->c_lflag; @@ -1389,7 +1389,7 @@ return (0); } case TIOCGETD: - /* For compatibility - we only support TTYDISC */ + /* For compatibility - we only support TTYDISC. */ *(int *)data = TTYDISC; return (0); case TIOCGPGRP: @@ -1443,13 +1443,13 @@ return (EPERM); } - /* Connect the session to the TTY */ + /* Connect the session to the TTY. */ tp->t_session = p->p_session; tp->t_session->s_ttyp = tp; tp->t_sessioncnt++; sx_xunlock(&proctree_lock); - /* Assign foreground process group */ + /* Assign foreground process group. */ tp->t_pgrp = p->p_pgrp; PROC_LOCK(p); p->p_flag |= P_CONTROLT; @@ -1488,7 +1488,7 @@ tp->t_pgrp = pg; sx_sunlock(&proctree_lock); - /* Wake up the background process groups */ + /* Wake up the background process groups. */ cv_broadcast(&tp->t_bgwait); return (0); } @@ -1503,10 +1503,10 @@ return (0); } case TIOCDRAIN: - /* Drain TTY output */ + /* Drain TTY output. */ return tty_drain(tp); case TIOCCONS: - /* Set terminal as console TTY */ + /* Set terminal as console TTY. */ if (*(int *)data) { struct nameidata nd; int vfslocked; @@ -1555,11 +1555,11 @@ } return (0); case TIOCGWINSZ: - /* Obtain window size */ + /* Obtain window size. */ bcopy(&tp->t_winsize, data, sizeof(struct winsize)); return (0); case TIOCSWINSZ: - /* Set window size */ + /* Set window size. */ if (bcmp(&tp->t_winsize, data, sizeof(struct winsize)) == 0) return (0); bcopy(data, &tp->t_winsize, sizeof(struct winsize)); @@ -1623,7 +1623,7 @@ tty_checkoutq(struct tty *tp) { - /* 256 bytes should be enough to print a log message */ + /* 256 bytes should be enough to print a log message. */ return (ttyoutq_bytesleft(&tp->t_outq) >= 256); } @@ -1642,7 +1642,7 @@ &tp->t_termios.c_cc[VSTOP], 1) == 0) tp->t_flags |= TF_HIWAT_IN; } else { - /* No input flow control */ + /* No input flow control. */ tp->t_flags |= TF_HIWAT_IN; } } @@ -1662,7 +1662,7 @@ &tp->t_termios.c_cc[VSTART], 1) == 0) tp->t_flags &= ~TF_HIWAT_IN; } else { - /* No input flow control */ + /* No input flow control. */ tp->t_flags &= ~TF_HIWAT_IN; } @@ -1684,7 +1684,7 @@ { TF_INITLOCK, 'I' }, { TF_CALLOUT, 'C' }, - /* Keep these together -> 'Oi' and 'Oo' */ + /* Keep these together -> 'Oi' and 'Oo'. */ { TF_OPENED, 'O' }, { TF_OPENED_IN, 'i' }, { TF_OPENED_OUT,'o' }, @@ -1694,7 +1694,7 @@ { TF_ASYNC, 'Y' }, { TF_LITERAL, 'L' }, - /* Keep these together -> 'Hi' and 'Ho' */ + /* Keep these together -> 'Hi' and 'Ho'. */ { TF_HIWAT, 'H' }, { TF_HIWAT_IN, 'i' }, { TF_HIWAT_OUT, 'o' }, @@ -1707,14 +1707,14 @@ { 0, '\0' }, }; -/* DDB command to show TTY statistics */ +/* DDB command to show TTY statistics. */ DB_SHOW_COMMAND(ttys, db_show_ttys) { struct tty *tp; size_t isiz, osiz; int i, j; - /* Make the output look like `pstat -t' */ + /* Make the output look like `pstat -t'. */ db_printf(" LINE INQ CAN LIN LOW OUTQ USE LOW " "COL SESS PGID STATE\n"); @@ -1735,7 +1735,7 @@ tp->t_session ? tp->t_session->s_sid : 0, tp->t_pgrp ? tp->t_pgrp->pg_id : 0); - /* Flag bits */ + /* Flag bits. */ for (i = j = 0; ttystates[i].flag; i++) if (tp->t_flags & ttystates[i].flag) { db_printf("%c", ttystates[i].val); ==== //depot/projects/mpsafetty/sys/kern/tty_inq.c#3 (text+ko) ==== @@ -61,7 +61,7 @@ * the outq, we'll stick to 128 byte blocks here. */ -/* Statistics */ +/* Statistics. */ static long ttyinq_nfast = 0; SYSCTL_LONG(_kern, OID_AUTO, tty_inq_nfast, CTLFLAG_RD, &ttyinq_nfast, 0, "Unbuffered reads to userspace on input"); @@ -152,7 +152,7 @@ struct ttyinq_block *tib; size_t cbegin, cend, clen; - /* See if there still is data */ + /* See if there still is data. */ if (ti->ti_begin == ti->ti_linestart) return (0); tib = TAILQ_FIRST(&ti->ti_list); @@ -217,11 +217,11 @@ tty_lock(tp); if (tty_gone(tp)) { - /* Something went bad - discard this block */ + /* Something went bad - discard this block. */ uma_zfree(ttyinq_zone, tib); return (ENXIO); } - /* Block can now be readded to the list */ + /* Block can now be readded to the list. */ /* * XXX: we could remove the blocks here when the * queue was shrunk, but still in use. See @@ -242,7 +242,7 @@ ti->ti_begin += clen; MPASS(ti->ti_begin < TTYINQ_DATASIZE); - /* Temporary unlock and copy the data to userspace */ + /* Temporary unlock and copy the data to userspace. */ tty_unlock(tp); error = uiomove(ob, clen - flen, uio); tty_lock(tp); @@ -262,11 +262,11 @@ size_t length, int value) { if (value) { - /* Set the bits */ + /* Set the bits. */ for (; length > 0; length--, offset++) SETBIT(tib, offset); } else { - /* Unset the bits */ + /* Unset the bits. */ for (; length > 0; length--, offset++) CLRBIT(tib, offset); } @@ -285,29 +285,29 @@ boff = ti->ti_end % TTYINQ_DATASIZE; if (ti->ti_end == 0) { - /* First time we're being used or drained */ + /* First time we're being used or drained. */ MPASS(ti->ti_begin == 0); tib = ti->ti_lastblock = TAILQ_FIRST(&ti->ti_list); if (tib == NULL) { - /* Queue has no blocks */ + /* Queue has no blocks. */ break; } } else if (boff == 0) { - /* We reached the end of this block on last write */ + /* We reached the end of this block on last write. */ tib = TAILQ_NEXT(tib, tib_list); if (tib == NULL) { - /* We've reached the watermark */ + /* We've reached the watermark. */ break; } ti->ti_lastblock = tib; } - /* Don't copy more than was requested */ + /* Don't copy more than was requested. */ l = MIN(nbytes, TTYINQ_DATASIZE - boff); MPASS(l > 0); memcpy(tib->tib_data + boff, cbuf, l); - /* Set the quoting bits for the proper region */ + /* Set the quoting bits for the proper region. */ ttyinq_set_quotes(tib, boff, l, quote); cbuf += l; @@ -326,7 +326,7 @@ if (ttyinq_bytesleft(ti) < nbytes) return (-1); - /* We should always be able to write it back */ + /* We should always be able to write it back. */ ret = ttyinq_write(ti, buf, nbytes, quote); MPASS(ret == nbytes); @@ -362,7 +362,7 @@ boff++; } - /* Not found - just process the entire block */ + /* Not found - just process the entire block. */ return (bend - ti->ti_begin); } @@ -399,7 +399,7 @@ MPASS(ti->ti_linestart < ti->ti_end); if (--ti->ti_end % TTYINQ_DATASIZE == 0) { - /* Roll back to the previous block */ + /* Roll back to the previous block. */ ti->ti_lastblock = TAILQ_PREV(ti->ti_lastblock, ttyinq_bhead, tib_list); /* @@ -431,19 +431,19 @@ { unsigned int boff; - /* Use the proper block when we're at the queue head */ + /* Use the proper block when we're at the queue head. */ if (offset == 0) tib = TAILQ_FIRST(&ti->ti_list); - /* Iterate all characters and call the iterator function */ + /* Iterate all characters and call the iterator function. */ for (; offset < ti->ti_end; offset++) { boff = offset % TTYINQ_DATASIZE; MPASS(tib != NULL); - /* Call back the iterator function */ + /* Call back the iterator function. */ iterator(data, tib->tib_data[boff], GETBIT(tib, boff)); - /* Last byte iterated - go to the next block */ + /* Last byte iterated - go to the next block. */ if (boff == TTYINQ_DATASIZE - 1) tib = TAILQ_NEXT(tib, tib_list); MPASS(tib != NULL); ==== //depot/projects/mpsafetty/sys/kern/tty_outq.c#3 (text+ko) ==== @@ -52,7 +52,7 @@ * output. */ -/* Statistics */ +/* Statistics. */ static long ttyoutq_nfast = 0; SYSCTL_LONG(_kern, OID_AUTO, tty_outq_nfast, CTLFLAG_RD, &ttyoutq_nfast, 0, "Unbuffered reads to userspace on output"); @@ -142,7 +142,7 @@ struct ttyoutq_block *tob; size_t cbegin, cend, clen; - /* See if there still is data */ >>> TRUNCATED FOR MAIL (1000 lines) <<<