Re: svn commit: r184251 - in head/sys: conf dev/cfi sys

2008-11-04 Thread Dag-Erling Smørgrav
John Baldwin <[EMAIL PROTECTED]> writes:
> M. Warner Losh <[EMAIL PROTECTED]> 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 - [EMAIL PROTECTED]
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


Re: svn commit: r184605 - head/sys/dev/usb

2008-11-04 Thread Christoph Mallon

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
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


svn commit: r184638 - head/libexec/rpc.rquotad

2008-11-04 Thread Dag-Erling Smorgrav
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 ([EMAIL PROTECTED])
- * 
+ *
  * 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
*qfname

svn commit: r184641 - in stable/7/sys: . kern

2008-11-04 Thread Konstantin Belousov
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.cTue Nov  4 15:47:06 2008
(r184640)
+++ stable/7/sys/kern/vfs_subr.cTue Nov  4 15:56:44 2008
(r184641)
@@ -109,7 +109,7 @@ static void vgonel(struct vnode *);
 static voidvfs_knllock(void *arg);
 static voidvfs_knlunlock(void *arg);
 static int vfs_knllocked(void *arg);
-
+static voiddestroy_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;
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


svn commit: r184634 - head/lib/libutil

2008-11-04 Thread Dag-Erling Smorgrav
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,
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


Re: svn commit: r184641 - in stable/7/sys: . kern

2008-11-04 Thread Scott Long
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.cTue Nov  4 15:47:06 2008
(r184640)
+++ stable/7/sys/kern/vfs_subr.cTue Nov  4 15:56:44 2008
(r184641)
@@ -109,7 +109,7 @@ static void vgonel(struct vnode *);
 static voidvfs_knllock(void *arg);
 static voidvfs_knlunlock(void *arg);
 static int vfs_knllocked(void *arg);
-
+static voiddestroy_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;


___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


Re: svn commit: r184625 - in head: etc sys/dev/acpi_support

2008-11-04 Thread Andrew Thompson
On Tue, Nov 04, 2008 at 11:52:50AM +, 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
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


svn commit: r184643 - head/sys/nfsserver

2008-11-04 Thread Doug Rabson
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.cTue Nov  4 16:22:14 2008
(r184642)
+++ head/sys/nfsserver/nfs_srvkrpc.cTue Nov  4 16:43:02 2008
(r184643)
@@ -60,6 +60,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


Re: svn commit: r184641 - in stable/7/sys: . kern

2008-11-04 Thread Kostik Belousov
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;


pgpHm6lgnrvcC.pgp
Description: PGP signature


Re: svn commit: r184625 - in head: etc sys/dev/acpi_support

2008-11-04 Thread Nikolay Denev

-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 +, 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-
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


svn commit: r184635 - head/lib/libutil

2008-11-04 Thread Dag-Erling Smorgrav
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"
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


Re: svn commit: r184251 - in head/sys: conf dev/cfi sys

2008-11-04 Thread John Baldwin
On Tuesday 04 November 2008 04:15:15 am Dag-Erling Smørgrav wrote:
> John Baldwin <[EMAIL PROTECTED]> writes:
> > M. Warner Losh <[EMAIL PROTECTED]> 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
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


Re: 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/us

2008-11-04 Thread Giorgos Keramidas
On Tue, 4 Nov 2008 02:31:04 + (UTC), Alfred Perlstein <[EMAIL PROTECTED]> 
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.0 +0200
+++ if_zyd2.c   2008-11-04 11:31:24.0 +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 */
%%%

___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


svn commit: r184645 - head/usr.bin/vmstat

2008-11-04 Thread Giorgos Keramidas
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.cTue Nov  4 16:45:17 2008
(r184644)
+++ head/usr.bin/vmstat/vmstat.cTue 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;
+#defineVMSTAT_DEFAULT_LINES20  /* 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 voidkreado(int, void *, size_t, size_t);
 static char*kgetstr(const char *);
 static voidneedhdr(int);
+static voidneedresize(int);
+static voiddoresize(void);
 static voidprinthdr(int, u_long);
 static voidusage(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;
-
}
 
 #defineBACKWARD_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)
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "[EMAIL 

svn commit: r184646 - head/usr.bin/vmstat

2008-11-04 Thread Giorgos Keramidas
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.cTue Nov  4 18:02:35 2008
(r184645)
+++ head/usr.bin/vmstat/vmstat.cTue 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) {
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


svn commit: r184621 - head/sys/kern

2008-11-04 Thread Ed Schouten
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 = {
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


svn commit: r184625 - in head: etc sys/dev/acpi_support

2008-11-04 Thread Rui Paulo
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_tdev;
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 voidacpi_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 ==

svn commit: r184652 - in head/sys: dev/hwpmc fs/procfs kern

2008-11-04 Thread 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
  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.cTue Nov  4 18:56:12 2008
(r184651)
+++ head/sys/kern/kern_descrip.cTue 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
=

svn commit: r184649 - head/sys/compat/linprocfs

2008-11-04 Thread John Baldwin
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);
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


svn commit: r184650 - head/sys/fs/unionfs

2008-11-04 Thread John Baldwin
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);
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


svn commit: r184656 - head/usr.bin/du

2008-11-04 Thread Max Laier
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.cTue Nov  4 19:20:19 2008(r184655)
+++ head/usr.bin/du/du.cTue Nov  4 19:23:48 2008(r184656)
@@ -73,12 +73,12 @@ struct ignentry {
 
 static int linkchk(FTSENT *);
 static voidusage(void);
-void   prthumanval(int64_t);
-void   ignoreadd(const char *);
-void   ignoreclean(void);
-intignorep(FTSENT *);
+static voidprthumanval(int64_t);
+static voidignoreadd(const char *);
+static voidignoreclean(void);
+static int ignorep(FTSENT *);
 
-intnodumpflag = 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;
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


svn commit: r184653 - head/sys/kern

2008-11-04 Thread John Baldwin
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
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


svn commit: r184658 - head/sys/dev/usb2/wlan

2008-11-04 Thread Rink Springer
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.cTue Nov  4 19:26:39 2008
(r184657)
+++ head/sys/dev/usb2/wlan/if_zyd2.cTue 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",
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


svn commit: r184655 - head/share/misc

2008-11-04 Thread Remko Lodder
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 [EMAIL PROTECTED]
 pav [label="Pav [EMAIL PROTECTED]/08/12"]
 pgj [label="Gabor [EMAIL PROTECTED]/04/21"]
 remko [label="Remko [EMAIL PROTECTED]/10/16"]
+rene [label="Rene [EMAIL PROTECTED]/11/03"]
 roam [label="Peter [EMAIL PROTECTED]/02/14"]
 simon [label="Simon L. [EMAIL PROTECTED]/07/20"]
 trhodes [label="Tom [EMAIL PROTECTED]/03/25"]
@@ -116,6 +117,7 @@ nik -> bmah
 nik -> keramida
 
 remko -> jkois
+remko -> rene
 
 simon -> josef
 simon -> remko
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


svn commit: r184633 - head/lib/libutil

2008-11-04 Thread Dag-Erling Smorgrav
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.cTue Nov  4 13:49:18 2008
(r184632)
+++ head/lib/libutil/login_cap.cTue 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)
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


svn commit: r184654 - head/usr.bin/du

2008-11-04 Thread Max Laier
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.cTue Nov  4 19:13:53 2008(r184653)
+++ head/usr.bin/du/du.cTue 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;
longblocksize;
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);
   

svn commit: r184651 - head/sys/ufs/ufs

2008-11-04 Thread John Baldwin
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);
}
/*
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


Re: svn commit: r184625 - in head: etc sys/dev/acpi_support

2008-11-04 Thread Renato Botelho
On Tue, Nov 4, 2008 at 9:52 AM, Rui Paulo <[EMAIL PROTECTED]> 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
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


svn commit: r184659 - head/sys/dev/usb2/wlan

2008-11-04 Thread Rink Springer
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.cTue Nov  4 19:28:19 2008
(r184658)
+++ head/sys/dev/usb2/wlan/if_zyd2.cTue 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:
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


Re: svn commit: r184645 - head/usr.bin/vmstat

2008-11-04 Thread 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.

  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@
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


Re: svn commit: r184199 - in head/sys: kern sys

2008-11-04 Thread John Baldwin
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
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


Re: svn commit: r184216 - head/sys/kern

2008-11-04 Thread John Baldwin
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
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


svn commit: r184629 - head/sys/ufs/ufs

2008-11-04 Thread Edward Tomasz Napierala
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;
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


Re: svn commit: r184645 - head/usr.bin/vmstat

2008-11-04 Thread Ivan Voras
2008/11/4 Diomidis Spinellis <[EMAIL PROTECTED]>:
> 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.
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


Re: svn commit: r184652 - in head/sys: dev/hwpmc fs/procfs kern

2008-11-04 Thread Ivan Voras
2008/11/4 John Baldwin <[EMAIL PROTECTED]>:
> 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).
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


svn commit: r184660 - head/sys/security/audit

2008-11-04 Thread John Baldwin
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.cTue Nov  4 20:57:39 2008
(r184659)
+++ head/sys/security/audit/audit_bsm_klib.cTue 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;
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


svn commit: r184661 - in head/sys: kern security/audit

2008-11-04 Thread John Baldwin
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.cTue Nov  4 22:30:24 2008
(r184660)
+++ head/sys/kern/vfs_syscalls.cTue 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);
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


Re: svn commit: r184217 - head/sys/kern

2008-11-04 Thread John Baldwin
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
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


svn commit: r184662 - stable/7/lib/libcam

2008-11-04 Thread Marius Strobl
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.cTue Nov  4 22:31:04 2008
(r184661)
+++ stable/7/lib/libcam/camlib.cTue 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);
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


Re: svn commit: r184216 - head/sys/kern

2008-11-04 Thread Peter Wemm
On Tue, Nov 4, 2008 at 2:07 PM, John Baldwin <[EMAIL PROTECTED]> 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 0xff00a4037000 (turnstile lock) held by
0xff01045746e0 (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 - [EMAIL PROTECTED]; [EMAIL PROTECTED]; [EMAIL PROTECTED]; 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
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


svn commit: r184663 - head/etc

2008-11-04 Thread Xin LI
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";
 };
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


Re: svn commit: r184652 - in head/sys: dev/hwpmc fs/procfs kern

2008-11-04 Thread John Baldwin
On Tuesday 04 November 2008 05:22:47 pm Ivan Voras wrote:
> 2008/11/4 John Baldwin <[EMAIL PROTECTED]>:
> > 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
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


Re: svn commit: r184217 - head/sys/kern

2008-11-04 Thread David Xu

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 ?
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


Re: svn commit: r184645 - head/usr.bin/vmstat

2008-11-04 Thread Giorgos Keramidas
On Tue, 4 Nov 2008 22:30:07 +0200, Diomidis Spinellis <[EMAIL PROTECTED]> 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.

___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


Re: svn commit: r184645 - head/usr.bin/vmstat

2008-11-04 Thread Giorgos Keramidas
On Tue, 4 Nov 2008 23:16:39 +0100, "Ivan Voras" <[EMAIL PROTECTED]> wrote:
> 2008/11/4 Diomidis Spinellis <[EMAIL PROTECTED]>:
>> 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 :)

___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


svn commit: r184667 - in head/sys: kern sys

2008-11-04 Thread David Xu
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.cTue Nov  4 23:38:08 2008(r184666)
+++ head/sys/kern/kern_sig.cWed 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 +,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();
@@ -

Re: svn commit: r184605 - head/sys/dev/usb

2008-11-04 Thread Carlos A. M. dos Santos
On Mon, Nov 3, 2008 at 8:54 PM, Joerg Sonnenberger
<[EMAIL PROTECTED]> 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
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


Re: svn commit: r184625 - in head: etc sys/dev/acpi_support

2008-11-04 Thread M. Warner Losh
In message: <[EMAIL PROTECTED]>
Andrew Thompson <[EMAIL PROTECTED]> writes:
: On Tue, Nov 04, 2008 at 11:52:50AM +, 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
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


svn commit: r184668 - head/usr.bin/tar/test

2008-11-04 Thread Tim Kientzle
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.cWed Nov  5 03:01:23 2008
(r184667)
+++ head/usr.bin/tar/test/main.cWed 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);
}
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


Re: svn commit: r184668 - head/usr.bin/tar/test

2008-11-04 Thread Xin LI
-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 <[EMAIL PROTECTED]>  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-
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


svn commit: r184669 - head/usr.bin/tar/test

2008-11-04 Thread Tim Kientzle
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.cWed Nov  5 05:26:11 2008
(r184668)
+++ head/usr.bin/tar/test/main.cWed 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);
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


Re: svn commit: r184668 - head/usr.bin/tar/test

2008-11-04 Thread Tim Kientzle

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

___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


Re: svn commit: r184645 - head/usr.bin/vmstat

2008-11-04 Thread Diomidis Spinellis

Giorgos Keramidas wrote:

On Tue, 4 Nov 2008 22:30:07 +0200, Diomidis Spinellis <[EMAIL PROTECTED]> 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.

___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "[EMAIL PROTECTED]"