Re: svn commit: r234577 - head/usr.bin/stat

2012-06-21 Thread Christian Brueffer

On 4/22/12 20:45 , Steve Kargl wrote:

On Sun, Apr 22, 2012 at 06:18:49PM +, Christian Brueffer wrote:

Author: brueffer
Date: Sun Apr 22 18:18:49 2012
New Revision: 234577
URL: http://svn.freebsd.org/changeset/base/234577

Log:
   Remove duplicate -l description.

   Submitted by:Rainer Hurling 
   MFC after:   1 week


The patch should have also fixed the misordering
of the -n, -qi, and -x options.



Hi Steve,

sorry for the late reply.  Could you say more specifically how you
would arrange the order?  From a small sampling of our manpages, it
seems we don't have "one true" style of ordering options (except from
alphabetically, see attached patch).

Some manpages order A-Z, then a-z, while others (Apple and OpenBSD seem 
to do this) order AaBb...Zz.


Cheers,

Chris



Index: stat.1
===
--- stat.1  (revision 237294)
+++ stat.1  (working copy)
@@ -29,7 +29,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd April 22, 2012
+.Dd June 21, 2012
 .Dt STAT 1
 .Os
 .Sh NAME
@@ -140,6 +140,15 @@
 fall back on
 .Xr lstat 2
 and report information about the link.
+.It Fl f Ar format
+Display information using the specified format.
+See the
+.Sx Formats
+section for a description of valid formats.
+.It Fl l
+Display output in
+.Nm ls Fl lT
+format.
 .It Fl n
 Do not force a newline to appear at the end of each piece of output.
 .It Fl q
@@ -151,15 +160,6 @@
 When run as
 .Nm readlink ,
 error messages are automatically suppressed.
-.It Fl f Ar format
-Display information using the specified format.
-See the
-.Sx Formats
-section for a description of valid formats.
-.It Fl l
-Display output in
-.Nm ls Fl lT
-format.
 .It Fl r
 Display raw information.
 That is, for all the fields in the
@@ -172,15 +172,15 @@
 .Dq shell output
 format,
 suitable for initializing variables.
-.It Fl x
-Display information in a more verbose way as known from some
-.Tn Linux
-distributions.
 .It Fl t Ar timefmt
 Display timestamps using the specified format.
 This format is
 passed directly to
 .Xr strftime 3 .
+.It Fl x
+Display information in a more verbose way as known from some
+.Tn Linux
+distributions.
 .El
 .Ss Formats
 Format strings are similar to
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

svn commit: r237365 - head/sys/kern

2012-06-21 Thread Konstantin Belousov
Author: kib
Date: Thu Jun 21 09:19:41 2012
New Revision: 237365
URL: http://svn.freebsd.org/changeset/base/237365

Log:
  Fix locking for f_offset, vn_read() and vn_write() cases only, for now.
  
  It seems that intended locking protocol for struct file f_offset field
  was as follows: f_offset should always be changed under the vnode lock
  (except fcntl(2) and lseek(2) did not followed the rules). Since
  read(2) uses shared vnode lock, FOFFSET_LOCKED block is additionally
  taken to serialize shared vnode lock owners.
  
  This was broken first by enabling shared lock on writes, then by
  fadvise changes, which moved f_offset assigned from under vnode lock,
  and last by vn_io_fault() doing chunked i/o. More, due to uio_offset
  not yet valid in vn_io_fault(), the range lock for reads was taken on
  the wrong region.
  
  Change the locking for f_offset to always use FOFFSET_LOCKED block,
  which is placed before rangelocks in the lock order.
  
  Extract foffset_lock() and foffset_unlock() functions which implements
  FOFFSET_LOCKED lock, and consistently lock f_offset with it in the
  vn_io_fault() both for reads and writes, even if MNTK_NO_IOPF flag is
  not set for the vnode mount. Indicate that f_offset is already valid
  for vn_read() and vn_write() calls from vn_io_fault() with FOF_OFFSET
  flag, and assert that all callers of vn_read() and vn_write() follow
  this protocol.
  
  Extract get_advice() function to calculate the POSIX_FADV_XXX value
  for the i/o region, and use it were appropriate.
  
  Reviewed by:  jhb
  Tested by:pho
  MFC after:2 weeks

Modified:
  head/sys/kern/vfs_vnops.c

Modified: head/sys/kern/vfs_vnops.c
==
--- head/sys/kern/vfs_vnops.c   Thu Jun 21 09:12:33 2012(r237364)
+++ head/sys/kern/vfs_vnops.c   Thu Jun 21 09:19:41 2012(r237365)
@@ -527,6 +527,66 @@ vn_rdwr_inchunks(rw, vp, base, len, offs
return (error);
 }
 
+static void
+foffset_lock(struct file *fp, struct uio *uio, int flags)
+{
+   struct mtx *mtxp;
+
+   if ((flags & FOF_OFFSET) != 0)
+   return;
+
+   /*
+* According to McKusick the vn lock was protecting f_offset here.
+* It is now protected by the FOFFSET_LOCKED flag.
+*/
+   mtxp = mtx_pool_find(mtxpool_sleep, fp);
+   mtx_lock(mtxp);
+   while (fp->f_vnread_flags & FOFFSET_LOCKED) {
+   fp->f_vnread_flags |= FOFFSET_LOCK_WAITING;
+   msleep(&fp->f_vnread_flags, mtxp, PUSER -1,
+   "vnread offlock", 0);
+   }
+   fp->f_vnread_flags |= FOFFSET_LOCKED;
+   uio->uio_offset = fp->f_offset;
+   mtx_unlock(mtxp);
+}
+
+static int
+get_advice(struct file *fp, struct uio *uio)
+{
+   struct mtx *mtxp;
+   int ret;
+
+   ret = POSIX_FADV_NORMAL;
+   if (fp->f_advice == NULL)
+   return (ret);
+
+   mtxp = mtx_pool_find(mtxpool_sleep, fp);
+   mtx_lock(mtxp);
+   if (uio->uio_offset >= fp->f_advice->fa_start &&
+   uio->uio_offset + uio->uio_resid <= fp->f_advice->fa_end)
+   ret = fp->f_advice->fa_advice;
+   mtx_unlock(mtxp);
+   return (ret);
+}
+
+static void
+foffset_unlock(struct file *fp, struct uio *uio, int flags)
+{
+   struct mtx *mtxp;
+
+   if ((flags & FOF_OFFSET) != 0)
+   return;
+
+   fp->f_offset = uio->uio_offset;
+   mtxp = mtx_pool_find(mtxpool_sleep, fp);
+   mtx_lock(mtxp);
+   if (fp->f_vnread_flags & FOFFSET_LOCK_WAITING)
+   wakeup(&fp->f_vnread_flags);
+   fp->f_vnread_flags = 0;
+   mtx_unlock(mtxp);
+}
+
 /*
  * File table vnode read routine.
  */
@@ -539,44 +599,22 @@ vn_read(fp, uio, active_cred, flags, td)
struct thread *td;
 {
struct vnode *vp;
-   int error, ioflag;
struct mtx *mtxp;
+   int error, ioflag;
int advice, vfslocked;
off_t offset, start, end;
 
KASSERT(uio->uio_td == td, ("uio_td %p is not td %p",
uio->uio_td, td));
-   mtxp = NULL;
+   KASSERT(flags & FOF_OFFSET, ("No FOF_OFFSET"));
vp = fp->f_vnode;
ioflag = 0;
if (fp->f_flag & FNONBLOCK)
ioflag |= IO_NDELAY;
if (fp->f_flag & O_DIRECT)
ioflag |= IO_DIRECT;
-   advice = POSIX_FADV_NORMAL;
+   advice = get_advice(fp, uio);
vfslocked = VFS_LOCK_GIANT(vp->v_mount);
-   /*
-* According to McKusick the vn lock was protecting f_offset here.
-* It is now protected by the FOFFSET_LOCKED flag.
-*/
-   if ((flags & FOF_OFFSET) == 0 || fp->f_advice != NULL) {
-   mtxp = mtx_pool_find(mtxpool_sleep, fp);
-   mtx_lock(mtxp);
-   if ((flags & FOF_OFFSET) == 0) {
-   while (fp->f_vnread_flags & FOFFSET_LOCKED) {
-   fp->f_vnread_flags |= FOFFSET_LOCK_WAITING;
-

svn commit: r237366 - head/sys/ufs/ffs

2012-06-21 Thread Konstantin Belousov
Author: kib
Date: Thu Jun 21 09:20:07 2012
New Revision: 237366
URL: http://svn.freebsd.org/changeset/base/237366

Log:
  Fix unbounded-length malloc, controlled from usermode. The added check
  is performed before exact size of the buffer is calculated, but the
  buffer cannot have size greater then the total space allocated for
  extended attributes. The existing check is executing with precise
  size, but it is too late, since buffer needs to be allocated in
  advance.
  
  Also, adapt to uio_resid being of ssize_t type.  Use lblktosize instead of
  multiplying by fs block size by hand as well.
  
  Reported and tested by: pho
  MFC after:   1 week

Modified:
  head/sys/ufs/ffs/ffs_vnops.c

Modified: head/sys/ufs/ffs/ffs_vnops.c
==
--- head/sys/ufs/ffs/ffs_vnops.cThu Jun 21 09:19:41 2012
(r237365)
+++ head/sys/ufs/ffs/ffs_vnops.cThu Jun 21 09:20:07 2012
(r237366)
@@ -1648,7 +1648,8 @@ vop_setextattr {
struct inode *ip;
struct fs *fs;
uint32_t ealength, ul;
-   int ealen, olen, eapad1, eapad2, error, i, easize;
+   ssize_t ealen;
+   int olen, eapad1, eapad2, error, i, easize;
u_char *eae, *p;
 
ip = VTOI(ap->a_vp);
@@ -1667,6 +1668,10 @@ vop_setextattr {
if (ap->a_vp->v_mount->mnt_flag & MNT_RDONLY)
return (EROFS);
 
+   ealen = ap->a_uio->uio_resid;
+   if (ealen < 0 || ealen > lblktosize(fs, NXADDR))
+   return (EINVAL);
+
error = extattr_check_cred(ap->a_vp, ap->a_attrnamespace,
ap->a_cred, ap->a_td, VWRITE);
if (error) {
@@ -1684,7 +1689,6 @@ vop_setextattr {
if (error)
return (error);
 
-   ealen = ap->a_uio->uio_resid;
ealength = sizeof(uint32_t) + 3 + strlen(ap->a_name);
eapad1 = 8 - (ealength % 8);
if (eapad1 == 8)
@@ -1712,7 +1716,7 @@ vop_setextattr {
easize += (ealength - ul);
}
}
-   if (easize > NXADDR * fs->fs_bsize) {
+   if (easize > lblktosize(fs, NXADDR)) {
free(eae, M_TEMP);
ffs_close_ea(ap->a_vp, 0, ap->a_cred, ap->a_td);
if (ip->i_ea_area != NULL && ip->i_ea_error == 0)
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r237367 - head/sys/fs/nfsclient

2012-06-21 Thread Konstantin Belousov
Author: kib
Date: Thu Jun 21 09:26:06 2012
New Revision: 237367
URL: http://svn.freebsd.org/changeset/base/237367

Log:
  Enable deadlock avoidance code for NFS client.
  
  MFC after:2 weeks

Modified:
  head/sys/fs/nfsclient/nfs_clbio.c
  head/sys/fs/nfsclient/nfs_clvfsops.c

Modified: head/sys/fs/nfsclient/nfs_clbio.c
==
--- head/sys/fs/nfsclient/nfs_clbio.c   Thu Jun 21 09:20:07 2012
(r237366)
+++ head/sys/fs/nfsclient/nfs_clbio.c   Thu Jun 21 09:26:06 2012
(r237367)
@@ -722,7 +722,7 @@ ncl_bioread(struct vnode *vp, struct uio
};
 
if (n > 0) {
-   error = uiomove(bp->b_data + on, (int)n, uio);
+   error = vn_io_fault_uiomove(bp->b_data + on, (int)n, uio);
}
if (vp->v_type == VLNK)
n = 0;
@@ -1203,7 +1203,7 @@ again:
}
 
local_resid = uio->uio_resid;
-   error = uiomove((char *)bp->b_data + on, n, uio);
+   error = vn_io_fault_uiomove((char *)bp->b_data + on, n, uio);
 
if (error != 0 && !bp_cached) {
/*

Modified: head/sys/fs/nfsclient/nfs_clvfsops.c
==
--- head/sys/fs/nfsclient/nfs_clvfsops.cThu Jun 21 09:20:07 2012
(r237366)
+++ head/sys/fs/nfsclient/nfs_clvfsops.cThu Jun 21 09:26:06 2012
(r237367)
@@ -1136,7 +1136,8 @@ nfs_mount(struct mount *mp)
 out:
if (!error) {
MNT_ILOCK(mp);
-   mp->mnt_kern_flag |= (MNTK_MPSAFE|MNTK_LOOKUP_SHARED);
+   mp->mnt_kern_flag |= MNTK_MPSAFE | MNTK_LOOKUP_SHARED |
+   MNTK_NO_IOPF;
MNT_IUNLOCK(mp);
}
return (error);
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r237335 - head/sys/cam/scsi

2012-06-21 Thread Sergey Kandaurov
On 20 June 2012 22:25, Alexander Motin  wrote:
> Author: mav
> Date: Wed Jun 20 18:25:51 2012
> New Revision: 237335
> URL: http://svn.freebsd.org/changeset/base/237335
>
> Log:
>  Check status of cam_periph_hold() inside cdclose().  If cd device was
>  invalidated while open, cam_periph_hold() will return error and won't
>  get the reference.  Following reference release will crash the system.
>
>  Sponsored by: iXsystems, Inc.
>  MFC after:    3 days
>
> Modified:
>  head/sys/cam/scsi/scsi_cd.c
>
> Modified: head/sys/cam/scsi/scsi_cd.c
> ==
> --- head/sys/cam/scsi/scsi_cd.c Wed Jun 20 18:00:26 2012        (r237334)
> +++ head/sys/cam/scsi/scsi_cd.c Wed Jun 20 18:25:51 2012        (r237335)
> @@ -1041,6 +1041,7 @@ cdclose(struct disk *dp)
>  {
>        struct  cam_periph *periph;
>        struct  cd_softc *softc;
> +       int error;
>
>        periph = (struct cam_periph *)dp->d_drv1;
>        if (periph == NULL)
> @@ -1049,7 +1050,11 @@ cdclose(struct disk *dp)
>        softc = (struct cd_softc *)periph->softc;
>
>        cam_periph_lock(periph);
> -       cam_periph_hold(periph, PRIBIO);
> +       if ((error = cam_periph_hold(periph, PRIBIO)) != 0) {
> +               cam_periph_unlock(periph);
> +               cam_periph_release(periph);
> +               return (0);
> +       }
>
>        CAM_DEBUG(periph->path, CAM_DEBUG_TRACE | CAM_DEBUG_PERIPH,
>            ("cdclose\n"));


Hi.

Does it fix the reported crash with cd refcount underflow? It seems so.
http://lists.freebsd.org/pipermail/freebsd-stable/2012-June/068175.html

-- 
wbr,
pluknet
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r237335 - head/sys/cam/scsi

2012-06-21 Thread Alexander Motin

On 06/21/12 12:30, Sergey Kandaurov wrote:

On 20 June 2012 22:25, Alexander Motin  wrote:

Author: mav
Date: Wed Jun 20 18:25:51 2012
New Revision: 237335
URL: http://svn.freebsd.org/changeset/base/237335

Log:
  Check status of cam_periph_hold() inside cdclose().  If cd device was
  invalidated while open, cam_periph_hold() will return error and won't
  get the reference.  Following reference release will crash the system.

  Sponsored by: iXsystems, Inc.
  MFC after:3 days

Modified:
  head/sys/cam/scsi/scsi_cd.c

Modified: head/sys/cam/scsi/scsi_cd.c
==
--- head/sys/cam/scsi/scsi_cd.c Wed Jun 20 18:00:26 2012(r237334)
+++ head/sys/cam/scsi/scsi_cd.c Wed Jun 20 18:25:51 2012(r237335)
@@ -1041,6 +1041,7 @@ cdclose(struct disk *dp)
  {
struct  cam_periph *periph;
struct  cd_softc *softc;
+   int error;

periph = (struct cam_periph *)dp->d_drv1;
if (periph == NULL)
@@ -1049,7 +1050,11 @@ cdclose(struct disk *dp)
softc = (struct cd_softc *)periph->softc;

cam_periph_lock(periph);
-   cam_periph_hold(periph, PRIBIO);
+   if ((error = cam_periph_hold(periph, PRIBIO)) != 0) {
+   cam_periph_unlock(periph);
+   cam_periph_release(periph);
+   return (0);
+   }

CAM_DEBUG(periph->path, CAM_DEBUG_TRACE | CAM_DEBUG_PERIPH,
("cdclose\n"));


Does it fix the reported crash with cd refcount underflow? It seems so.
http://lists.freebsd.org/pipermail/freebsd-stable/2012-June/068175.html


Yes, I think it should. At least diagnostics looks very alike.

--
Alexander Motin
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r237328 - in head/sys/cam: . scsi

2012-06-21 Thread Bjoern A. Zeeb

On 20. Jun 2012, at 17:08 , Kenneth D. Merry wrote:

> Author: ken
> Date: Wed Jun 20 17:08:00 2012
> New Revision: 237328
> URL: http://svn.freebsd.org/changeset/base/237328
> 
> Log:
>  Fix several reference counting and object lifetime issues between
>  the pass(4) and enc(4) drivers and devfs.

Just as a hint for the archives:  enc(4) is completely unrelated to this
commit as it's the "encapsulation device"  used along with IPsec and has
nothing to do with scsi_enc.

-- 
Bjoern A. Zeeb You have to have visions!
   It does not matter how good you are. It matters what good you do!

___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r237392 - head/sys/netinet

2012-06-21 Thread Michael Tuexen
Author: tuexen
Date: Thu Jun 21 12:51:24 2012
New Revision: 237392
URL: http://svn.freebsd.org/changeset/base/237392

Log:
  Remove redundant #ifdef. Reported by gnn@.
  
  MFC after: 3 days

Modified:
  head/sys/netinet/sctp_usrreq.c

Modified: head/sys/netinet/sctp_usrreq.c
==
--- head/sys/netinet/sctp_usrreq.c  Thu Jun 21 12:47:21 2012
(r237391)
+++ head/sys/netinet/sctp_usrreq.c  Thu Jun 21 12:51:24 2012
(r237392)
@@ -6476,7 +6476,6 @@ sctp_peeraddr(struct socket *so, struct 
return (0);
 }
 
-#ifdef INET
 struct pr_usrreqs sctp_usrreqs = {
.pru_abort = sctp_abort,
.pru_accept = sctp_accept,
@@ -6499,4 +6498,3 @@ struct pr_usrreqs sctp_usrreqs = {
 };
 
 #endif
-#endif
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r237393 - head/lib/libc/string

2012-06-21 Thread Isabell Long
Author: issyl0 (doc committer)
Date: Thu Jun 21 12:52:15 2012
New Revision: 237393
URL: http://svn.freebsd.org/changeset/base/237393

Log:
  Add more locale-specific functions to the relevant man pages:
  - libc/string/strcoll.3
  - libc/string/strstr.3
  - libc/string/strxfrm.3
  - libc/string/strcasecmp.3
  
  Reviewed by:  theraven, gabor
  Approved by:  gabor (mentor)
  MFC after:5 days

Modified:
  head/lib/libc/string/strcasecmp.3
  head/lib/libc/string/strcoll.3
  head/lib/libc/string/strstr.3
  head/lib/libc/string/strxfrm.3

Modified: head/lib/libc/string/strcasecmp.3
==
--- head/lib/libc/string/strcasecmp.3   Thu Jun 21 12:51:24 2012
(r237392)
+++ head/lib/libc/string/strcasecmp.3   Thu Jun 21 12:52:15 2012
(r237393)
@@ -45,6 +45,12 @@
 .Fn strcasecmp "const char *s1" "const char *s2"
 .Ft int
 .Fn strncasecmp "const char *s1" "const char *s2" "size_t len"
+.In string.h
+.In xlocale.h
+.Ft int
+.Fn strcasecmp_l "const char *s1" "const char *s2" "locale_t loc"
+.Ft int
+.Fn strncasecmp_l "const char *s1" "const char *s2" "site_t len" "locale_t loc"
 .Sh DESCRIPTION
 The
 .Fn strcasecmp
@@ -58,16 +64,22 @@ and
 .Pp
 The
 .Fn strncasecmp
-compares at most
+function compares at most
 .Fa len
 characters.
-.Sh RETURN VALUES
 The
+.Fn strcasecmp_l
+and
+.Fn strncasecmp_l
+functions do the same as their non-locale versions above, but take an
+explicit locale rather than using the current locale.
+.Sh RETURN VALUES
+The functions
 .Fn strcasecmp
 and
 .Fn strncasecmp
 return an integer greater than, equal to, or less than 0,
-according as
+depending on whether
 .Fa s1
 is lexicographically greater than, equal to, or less than
 .Fa s2
@@ -77,6 +89,11 @@ The comparison is done using unsigned ch
 .Sq Li \e200
 is greater than
 .Ql \e0 .
+The functions
+.Fn strcasecmp_l
+and
+.Fn strncasecmp_l
+do the same but take explicit locales.
 .Sh SEE ALSO
 .Xr bcmp 3 ,
 .Xr memcmp 3 ,

Modified: head/lib/libc/string/strcoll.3
==
--- head/lib/libc/string/strcoll.3  Thu Jun 21 12:51:24 2012
(r237392)
+++ head/lib/libc/string/strcoll.3  Thu Jun 21 12:52:15 2012
(r237393)
@@ -44,6 +44,8 @@
 .In string.h
 .Ft int
 .Fn strcoll "const char *s1" "const char *s2"
+.Ft int
+.Fn strcoll_l "const char *s1" "const char *s2" "locale_t loc"
 .Sh DESCRIPTION
 The
 .Fn strcoll
@@ -54,7 +56,7 @@ and
 .Fa s2
 according to the current locale collation
 and returns an integer greater than, equal to, or less than 0,
-according as
+depending on whether
 .Fa s1
 is greater than, equal to, or less than
 .Fa s2 .
@@ -62,6 +64,9 @@ If information about the current locale 
 the value of
 .Fn strcmp s1 s2
 is returned.
+The
+.Fn strcoll_l
+function uses an explicit locale argument rather than the system locale.
 .Sh SEE ALSO
 .Xr setlocale 3 ,
 .Xr strcmp 3 ,
@@ -70,6 +75,9 @@ is returned.
 .Sh STANDARDS
 The
 .Fn strcoll
-function
-conforms to
+function conforms to
 .St -isoC .
+The
+.Fn strcoll_l
+function conforms to
+.St -p1003.1-2008 .

Modified: head/lib/libc/string/strstr.3
==
--- head/lib/libc/string/strstr.3   Thu Jun 21 12:51:24 2012
(r237392)
+++ head/lib/libc/string/strstr.3   Thu Jun 21 12:52:15 2012
(r237393)
@@ -49,6 +49,10 @@
 .Fn strcasestr "const char *big" "const char *little"
 .Ft char *
 .Fn strnstr "const char *big" "const char *little" "size_t len"
+.In string.h
+.In xlocale.h
+.Ft char *
+.Fn strcasestr_l "const char *big" "const char *little" "locale_t loc"
 .Sh DESCRIPTION
 The
 .Fn strstr
@@ -65,6 +69,12 @@ function is similar to
 but ignores the case of both strings.
 .Pp
 The
+.Fn strcasestr_l
+function does the same as
+.Fn strcasestr
+but takes an explicit locale rather than using the current locale.
+.Pp
+The
 .Fn strnstr
 function
 locates the first occurrence of the null-terminated string

Modified: head/lib/libc/string/strxfrm.3
==
--- head/lib/libc/string/strxfrm.3  Thu Jun 21 12:51:24 2012
(r237392)
+++ head/lib/libc/string/strxfrm.3  Thu Jun 21 12:52:15 2012
(r237393)
@@ -44,6 +44,8 @@
 .In string.h
 .Ft size_t
 .Fn strxfrm "char * restrict dst" "const char * restrict src" "size_t n"
+.Ft size_t
+.Fn strxfrm_l "char * restrict dst" "const char *restrict src" "size_t n" 
"locale_t loc"
 .Sh DESCRIPTION
 The
 .Fn strxfrm
@@ -73,10 +75,16 @@ after
 is equal to comparing
 two original strings with
 .Fn strcoll .
+.Pp
+.Fn strxfrm_l
+does the same, however takes an explicit locale rather than the global
+locale.
 .Sh RETURN VALUES
 Upon successful completion,
 .Fn strxfrm
-returns the length of the transformed string not including
+and
+.Fn strxfrm_l
+return the length of the transformed string not including
 the terminating

Re: svn commit: r234577 - head/usr.bin/stat

2012-06-21 Thread Steve Kargl
On Thu, Jun 21, 2012 at 10:45:41AM +0200, Christian Brueffer wrote:
> On 4/22/12 20:45 , Steve Kargl wrote:
> >On Sun, Apr 22, 2012 at 06:18:49PM +, Christian Brueffer wrote:
> >>Author: brueffer
> >>Date: Sun Apr 22 18:18:49 2012
> >>New Revision: 234577
> >>URL: http://svn.freebsd.org/changeset/base/234577
> >>
> >>Log:
> >>   Remove duplicate -l description.
> >>
> >>   Submitted by:Rainer Hurling 
> >>   MFC after:   1 week
> >
> >The patch should have also fixed the misordering
> >of the -n, -qi, and -x options.
> >
> 
> Hi Steve,
> 
> sorry for the late reply.  Could you say more specifically how you
> would arrange the order?  From a small sampling of our manpages, it
> seems we don't have "one true" style of ordering options (except from
> alphabetically, see attached patch).
> 
> Some manpages order A-Z, then a-z, while others (Apple and OpenBSD seem 
> to do this) order AaBb...Zz.
> 

Upon further inspection, the order of the description of the
options follows the order of the option in the SYNOPSIS.  I
suppose the manpage is fine.

-- 
Steve
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r237398 - head/sys/cam

2012-06-21 Thread Alexander Motin
Author: mav
Date: Thu Jun 21 14:35:46 2012
New Revision: 237398
URL: http://svn.freebsd.org/changeset/base/237398

Log:
  In camisr() clear CAM_SIM_ON_DONEQ flag after camisr_runqueue() purged SIM
  done queue. Clearing it before caused extra SIM queueing in some cases.
  It was invisible during normal operation, but during USB device unplug and
  respective SIM destruction it could keep pointer on SIM without having
  counted reference and as result crash the system by use afer free.
  
  Reported by:  hselasky
  MFC after:1 week

Modified:
  head/sys/cam/cam_xpt.c

Modified: head/sys/cam/cam_xpt.c
==
--- head/sys/cam/cam_xpt.c  Thu Jun 21 13:53:28 2012(r237397)
+++ head/sys/cam/cam_xpt.c  Thu Jun 21 14:35:46 2012(r237398)
@@ -5005,8 +5005,8 @@ camisr(void *dummy)
while ((sim = TAILQ_FIRST(&queue)) != NULL) {
TAILQ_REMOVE(&queue, sim, links);
CAM_SIM_LOCK(sim);
-   sim->flags &= ~CAM_SIM_ON_DONEQ;
camisr_runqueue(&sim->sim_doneq);
+   sim->flags &= ~CAM_SIM_ON_DONEQ;
CAM_SIM_UNLOCK(sim);
}
mtx_lock(&cam_simq_lock);
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r237401 - head/sys/cam

2012-06-21 Thread Alexander Motin
Author: mav
Date: Thu Jun 21 15:14:51 2012
New Revision: 237401
URL: http://svn.freebsd.org/changeset/base/237401

Log:
  Make cam_periph_hold() behavior consistent: drop taken reference and
  return ENXIO if periph was invalidated while we were waiting for it.
  
  MFC after:1 week

Modified:
  head/sys/cam/cam_periph.c

Modified: head/sys/cam/cam_periph.c
==
--- head/sys/cam/cam_periph.c   Thu Jun 21 14:55:35 2012(r237400)
+++ head/sys/cam/cam_periph.c   Thu Jun 21 15:14:51 2012(r237401)
@@ -440,6 +440,10 @@ cam_periph_hold(struct cam_periph *perip
cam_periph_release_locked(periph);
return (error);
}
+   if (periph->flags & CAM_PERIPH_INVALID) {
+   cam_periph_release_locked(periph);
+   return (ENXIO);
+   }
}
 
periph->flags |= CAM_PERIPH_LOCKED;
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r237402 - head/lib/libc/net

2012-06-21 Thread David E. O'Brien
Author: obrien
Date: Thu Jun 21 15:47:06 2012
New Revision: 237402
URL: http://svn.freebsd.org/changeset/base/237402

Log:
  Be explicit about the dependency on nsparser.h.

Modified:
  head/lib/libc/net/Makefile.inc

Modified: head/lib/libc/net/Makefile.inc
==
--- head/lib/libc/net/Makefile.inc  Thu Jun 21 15:14:51 2012
(r237401)
+++ head/lib/libc/net/Makefile.inc  Thu Jun 21 15:47:06 2012
(r237402)
@@ -36,7 +36,7 @@ LFLAGS+=-P_nsyy
 
 CLEANFILES+=nslexer.c
 
-nslexer.c: nslexer.l
+nslexer.c: nslexer.l nsparser.h
${LEX} ${LFLAGS} -o/dev/stdout ${.IMPSRC} | \
sed -e '/YY_BUF_SIZE/s/16384/1024/' >${.TARGET}
 
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r237404 - head/sys/amd64/amd64

2012-06-21 Thread Alan Cox
Author: alc
Date: Thu Jun 21 16:37:36 2012
New Revision: 237404
URL: http://svn.freebsd.org/changeset/base/237404

Log:
  Update the PV stats in free_pv_entry() using atomics.  After which, it is
  no longer necessary for free_pv_entry() to be serialized by the pvh global
  lock.
  
  Retire pmap_insert_entry() and pmap_remove_entry().  Once upon a time,
  these functions were called from multiple places within the pmap.  Now,
  each has only one caller.

Modified:
  head/sys/amd64/amd64/pmap.c

Modified: head/sys/amd64/amd64/pmap.c
==
--- head/sys/amd64/amd64/pmap.c Thu Jun 21 16:21:31 2012(r237403)
+++ head/sys/amd64/amd64/pmap.c Thu Jun 21 16:37:36 2012(r237404)
@@ -275,9 +275,6 @@ static int pmap_remove_pte(pmap_t pmap, 
 static void pmap_remove_pt_page(pmap_t pmap, vm_page_t mpte);
 static void pmap_remove_page(pmap_t pmap, vm_offset_t va, pd_entry_t *pde,
 vm_page_t *free);
-static void pmap_remove_entry(struct pmap *pmap, vm_page_t m,
-   vm_offset_t va);
-static void pmap_insert_entry(pmap_t pmap, vm_offset_t va, vm_page_t m);
 static boolean_t pmap_try_insert_pv_entry(pmap_t pmap, vm_offset_t va,
 vm_page_t m, struct rwlock **lockp);
 static void pmap_update_pde(pmap_t pmap, vm_offset_t va, pd_entry_t *pde,
@@ -2207,10 +2204,10 @@ free_pv_entry(pmap_t pmap, pv_entry_t pv
struct pv_chunk *pc;
int idx, field, bit;
 
-   rw_assert(&pvh_global_lock, RA_WLOCKED);
+   rw_assert(&pvh_global_lock, RA_LOCKED);
PMAP_LOCK_ASSERT(pmap, MA_OWNED);
-   PV_STAT(pv_entry_frees++);
-   PV_STAT(pv_entry_spare++);
+   PV_STAT(atomic_add_long(&pv_entry_frees, 1));
+   PV_STAT(atomic_add_int(&pv_entry_spare, 1));
PV_STAT(atomic_subtract_long(&pv_entry_count, 1));
pc = pv_to_chunk(pv);
idx = pv - &pc->pc_pventry[0];
@@ -2372,7 +2369,9 @@ pmap_pv_demote_pde(pmap_t pmap, vm_offse
KASSERT((m->oflags & VPO_UNMANAGED) == 0,
("pmap_pv_demote_pde: page %p is not managed", m));
va += PAGE_SIZE;
-   pmap_insert_entry(pmap, va, m);
+   pv = get_pv_entry(pmap, FALSE);
+   pv->pv_va = va;
+   TAILQ_INSERT_TAIL(&m->md.pv_list, pv, pv_list);
} while (va < va_last);
 }
 
@@ -2430,36 +2429,6 @@ pmap_pvh_free(struct md_page *pvh, pmap_
free_pv_entry(pmap, pv);
 }
 
-static void
-pmap_remove_entry(pmap_t pmap, vm_page_t m, vm_offset_t va)
-{
-   struct md_page *pvh;
-
-   rw_assert(&pvh_global_lock, RA_WLOCKED);
-   pmap_pvh_free(&m->md, pmap, va);
-   if (TAILQ_EMPTY(&m->md.pv_list) && (m->flags & PG_FICTITIOUS) == 0) {
-   pvh = pa_to_pvh(VM_PAGE_TO_PHYS(m));
-   if (TAILQ_EMPTY(&pvh->pv_list))
-   vm_page_aflag_clear(m, PGA_WRITEABLE);
-   }
-}
-
-/*
- * Create a pv entry for page at pa for
- * (pmap, va).
- */
-static void
-pmap_insert_entry(pmap_t pmap, vm_offset_t va, vm_page_t m)
-{
-   pv_entry_t pv;
-
-   rw_assert(&pvh_global_lock, RA_WLOCKED);
-   PMAP_LOCK_ASSERT(pmap, MA_OWNED);
-   pv = get_pv_entry(pmap, FALSE);
-   pv->pv_va = va;
-   TAILQ_INSERT_TAIL(&m->md.pv_list, pv, pv_list);
-}
-
 /*
  * Conditionally create a pv entry.
  */
@@ -2711,6 +2680,7 @@ static int
 pmap_remove_pte(pmap_t pmap, pt_entry_t *ptq, vm_offset_t va, 
 pd_entry_t ptepde, vm_page_t *free)
 {
+   struct md_page *pvh;
pt_entry_t oldpte;
vm_page_t m;
 
@@ -2725,7 +2695,13 @@ pmap_remove_pte(pmap_t pmap, pt_entry_t 
vm_page_dirty(m);
if (oldpte & PG_A)
vm_page_aflag_set(m, PGA_REFERENCED);
-   pmap_remove_entry(pmap, m, va);
+   pmap_pvh_free(&m->md, pmap, va);
+   if (TAILQ_EMPTY(&m->md.pv_list) &&
+   (m->flags & PG_FICTITIOUS) == 0) {
+   pvh = pa_to_pvh(VM_PAGE_TO_PHYS(m));
+   if (TAILQ_EMPTY(&pvh->pv_list))
+   vm_page_aflag_clear(m, PGA_WRITEABLE);
+   }
}
return (pmap_unuse_pt(pmap, va, ptepde, free));
 }
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r234577 - head/usr.bin/stat

2012-06-21 Thread Bruce Evans

On Thu, 21 Jun 2012, Steve Kargl wrote:


On Thu, Jun 21, 2012 at 10:45:41AM +0200, Christian Brueffer wrote:

On 4/22/12 20:45 , Steve Kargl wrote:

On Sun, Apr 22, 2012 at 06:18:49PM +, Christian Brueffer wrote:

Author: brueffer
Date: Sun Apr 22 18:18:49 2012
New Revision: 234577
URL: http://svn.freebsd.org/changeset/base/234577

Log:
  Remove duplicate -l description.

  Submitted by: Rainer Hurling 
  MFC after:1 week


The patch should have also fixed the misordering
of the -n, -qi, and -x options.


sorry for the late reply.  Could you say more specifically how you
would arrange the order?  From a small sampling of our manpages, it
seems we don't have "one true" style of ordering options (except from
alphabetically, see attached patch).

Some manpages order A-Z, then a-z, while others (Apple and OpenBSD seem
to do this) order AaBb...Zz.


I think the latter is more common and correct for FreeBSD too.  ps uses
it.  But ls uses A-Za-z0-9.


Upon further inspection, the order of the description of the
options follows the order of the option in the SYNOPSIS.  I
suppose the manpage is fine.


No, SYNOPSEs (and usage) normally put options with parameters last.
DESCRIPTIONs of options shouldn't do that.  For ls, there is only 1
option with a parameter (-D).  This is sorted into A-Z in the
DESCRIPTION section.  For ps, there are many options with parameters.
These used to be sorted after the ones without args in the SYNOPSEs,
but -O and -o are now unsorted before all other options with parameters.
The DESCRIPTION section in ps used to be sorted, but -c was added out
of order.

stat(1) has a sorted SYNOPSIS, with complications for -f that require
grouping it with options that don't take pararmeters.  These complications
affect the DESCRIPTION section too much.  Man pages like chmod(1) don't
unsort the DESCRIPTION section for similar things (the SYNOPSIS says
[-R [-H | -L | -P][, but the DESCRIPTION uses alphabetical ordering for
-HLPR.

Bruce
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r237406 - head/contrib/gcc

2012-06-21 Thread Pedro F. Giffuni
Author: pfg
Date: Thu Jun 21 16:49:20 2012
New Revision: 237406
URL: http://svn.freebsd.org/changeset/base/237406

Log:
  Bring a couple of fixes for gcc optimizations.
  
  The GCC4.3 branch contains some optimization fixes
  that were not considered regressions and therefore
  were never backported. We are bringing a couple of
  them that are under GPLv2 since they were made
  before the license switch upstream.
  
  While here, add the GCC revision numbers in the
  log.
  
  Discussed with: jkim
  MFC after:1 week

Modified:
  head/contrib/gcc/ChangeLog.gcc43
  head/contrib/gcc/fold-const.c
  head/contrib/gcc/gimplify.c
  head/contrib/gcc/tree-ssa-ccp.c
  head/contrib/gcc/tree-ssa-pre.c

Modified: head/contrib/gcc/ChangeLog.gcc43
==
--- head/contrib/gcc/ChangeLog.gcc43Thu Jun 21 16:48:56 2012
(r237405)
+++ head/contrib/gcc/ChangeLog.gcc43Thu Jun 21 16:49:20 2012
(r237406)
@@ -5,6 +5,18 @@
with SSE3 instruction set support.
* doc/invoke.texi: Likewise.
 
+2007-04-12  Richard Guenther   (r123736)
+
+   PR tree-optimization/24689
+   PR tree-optimization/31307
+   * fold-const.c (operand_equal_p): Compare INTEGER_CST array
+   indices by value.
+   * gimplify.c (canonicalize_addr_expr): To be consistent with
+   gimplify_compound_lval only set operands two and three of
+   ARRAY_REFs if they are not gimple_min_invariant.  This makes
+   it never at this place.
+   * tree-ssa-ccp.c (maybe_fold_offset_to_array_ref): Likewise.
+
 2007-04-07  H.J. Lu   (r123639)
 
* config/i386/i386.c (ix86_handle_option): Handle SSSE3.
@@ -96,7 +108,7 @@
 
* doc/invoke.texi: Add entry about geode processor.
 
-2006-10-24  Richard Guenther  
+2006-10-24  Richard Guenther   (r118001)
 
PR middle-end/28796
* builtins.c (fold_builtin_classify): Use HONOR_INFINITIES
@@ -170,7 +182,13 @@
 
* doc/invoke.texi: Document -mssse3/-mno-ssse3 switches.
 
-2006-10-21  Richard Guenther  
+2006-10-21  Richard Guenther   (r117932)
+
+   PR tree-optimization/3511
+   * tree-ssa-pre.c (phi_translate): Fold CALL_EXPRs that
+   got new invariant arguments during PHI translation.
+
+2006-10-21  Richard Guenther   (r117929)
 
* builtins.c (fold_builtin_classify): Fix typo.
 

Modified: head/contrib/gcc/fold-const.c
==
--- head/contrib/gcc/fold-const.c   Thu Jun 21 16:48:56 2012
(r237405)
+++ head/contrib/gcc/fold-const.c   Thu Jun 21 16:49:20 2012
(r237406)
@@ -2802,9 +2802,13 @@ operand_equal_p (tree arg0, tree arg1, u
 
case ARRAY_REF:
case ARRAY_RANGE_REF:
- /* Operands 2 and 3 may be null.  */
+ /* Operands 2 and 3 may be null.
+Compare the array index by value if it is constant first as we
+may have different types but same value here.  */
  return (OP_SAME (0)
- && OP_SAME (1)
+ && (tree_int_cst_equal (TREE_OPERAND (arg0, 1),
+ TREE_OPERAND (arg1, 1))
+ || OP_SAME (1))
  && OP_SAME_WITH_NULL (2)
  && OP_SAME_WITH_NULL (3));
 

Modified: head/contrib/gcc/gimplify.c
==
--- head/contrib/gcc/gimplify.c Thu Jun 21 16:48:56 2012(r237405)
+++ head/contrib/gcc/gimplify.c Thu Jun 21 16:49:20 2012(r237406)
@@ -1600,9 +1600,7 @@ canonicalize_addr_expr (tree *expr_p)
   /* All checks succeeded.  Build a new node to merge the cast.  */
   *expr_p = build4 (ARRAY_REF, dctype, obj_expr,
TYPE_MIN_VALUE (TYPE_DOMAIN (datype)),
-   TYPE_MIN_VALUE (TYPE_DOMAIN (datype)),
-   size_binop (EXACT_DIV_EXPR, TYPE_SIZE_UNIT (dctype),
-   size_int (TYPE_ALIGN_UNIT (dctype;
+   NULL_TREE, NULL_TREE);
   *expr_p = build1 (ADDR_EXPR, ctype, *expr_p);
 }
 

Modified: head/contrib/gcc/tree-ssa-ccp.c
==
--- head/contrib/gcc/tree-ssa-ccp.c Thu Jun 21 16:48:56 2012
(r237405)
+++ head/contrib/gcc/tree-ssa-ccp.c Thu Jun 21 16:49:20 2012
(r237406)
@@ -1621,9 +1621,7 @@ maybe_fold_offset_to_array_ref (tree bas
   if (!integer_zerop (elt_offset))
 idx = int_const_binop (PLUS_EXPR, idx, elt_offset, 0);
 
-  return build4 (ARRAY_REF, orig_type, base, idx, min_idx,
-size_int (tree_low_cst (elt_size, 1)
-  / (TYPE_ALIGN_UNIT (elt_type;
+  return build4 (ARRAY_REF, orig_type, base, idx, NULL_TREE, NULL_TREE);
 }
 
 

Modified: head/contrib/gcc/tree-ssa-pre.c
==
--- head/contrib/gc

Re: svn commit: r237406 - head/contrib/gcc

2012-06-21 Thread Niclas Zeising

On 06/21/12 18:49, Pedro F. Giffuni wrote:

Author: pfg
Date: Thu Jun 21 16:49:20 2012
New Revision: 237406
URL: http://svn.freebsd.org/changeset/base/237406

Log:
   Bring a couple of fixes for gcc optimizations.

   The GCC4.3 branch contains some optimization fixes
   that were not considered regressions and therefore
   were never backported. We are bringing a couple of
   them that are under GPLv2 since they were made
   before the license switch upstream.

   While here, add the GCC revision numbers in the
   log.

   Discussed with: jkim
   MFC after:   1 week

Modified:
   head/contrib/gcc/ChangeLog.gcc43
   head/contrib/gcc/fold-const.c
   head/contrib/gcc/gimplify.c
   head/contrib/gcc/tree-ssa-ccp.c
   head/contrib/gcc/tree-ssa-pre.c

Modified: head/contrib/gcc/ChangeLog.gcc43
==
--- head/contrib/gcc/ChangeLog.gcc43Thu Jun 21 16:48:56 2012
(r237405)
+++ head/contrib/gcc/ChangeLog.gcc43Thu Jun 21 16:49:20 2012
(r237406)
@@ -5,6 +5,18 @@
with SSE3 instruction set support.
* doc/invoke.texi: Likewise.

+2007-04-12  Richard Guenther  (r123736)
+
+   PR tree-optimization/24689
+   PR tree-optimization/31307
+   * fold-const.c (operand_equal_p): Compare INTEGER_CST array
+   indices by value.
+   * gimplify.c (canonicalize_addr_expr): To be consistent with
+   gimplify_compound_lval only set operands two and three of
+   ARRAY_REFs if they are not gimple_min_invariant.  This makes
+   it never at this place.
+   * tree-ssa-ccp.c (maybe_fold_offset_to_array_ref): Likewise.
+
  2007-04-07  H.J. Lu  (r123639)

* config/i386/i386.c (ix86_handle_option): Handle SSSE3.
@@ -96,7 +108,7 @@

* doc/invoke.texi: Add entry about geode processor.

-2006-10-24  Richard Guenther
+2006-10-24  Richard Guenther  (r118001)

PR middle-end/28796
* builtins.c (fold_builtin_classify): Use HONOR_INFINITIES
@@ -170,7 +182,13 @@

* doc/invoke.texi: Document -mssse3/-mno-ssse3 switches.

-2006-10-21  Richard Guenther
+2006-10-21  Richard Guenther  (r117932)
+
+   PR tree-optimization/3511
+   * tree-ssa-pre.c (phi_translate): Fold CALL_EXPRs that
+   got new invariant arguments during PHI translation.
+
+2006-10-21  Richard Guenther  (r117929)

* builtins.c (fold_builtin_classify): Fix typo.


Modified: head/contrib/gcc/fold-const.c
==
--- head/contrib/gcc/fold-const.c   Thu Jun 21 16:48:56 2012
(r237405)
+++ head/contrib/gcc/fold-const.c   Thu Jun 21 16:49:20 2012
(r237406)
@@ -2802,9 +2802,13 @@ operand_equal_p (tree arg0, tree arg1, u

case ARRAY_REF:
case ARRAY_RANGE_REF:
- /* Operands 2 and 3 may be null.  */
+ /* Operands 2 and 3 may be null.
+Compare the array index by value if it is constant first as we
+may have different types but same value here.  */
  return (OP_SAME (0)
-   &&  OP_SAME (1)
+   &&  (tree_int_cst_equal (TREE_OPERAND (arg0, 1),
+ TREE_OPERAND (arg1, 1))
+ || OP_SAME (1))
&&  OP_SAME_WITH_NULL (2)
&&  OP_SAME_WITH_NULL (3));


Modified: head/contrib/gcc/gimplify.c
==
--- head/contrib/gcc/gimplify.c Thu Jun 21 16:48:56 2012(r237405)
+++ head/contrib/gcc/gimplify.c Thu Jun 21 16:49:20 2012(r237406)
@@ -1600,9 +1600,7 @@ canonicalize_addr_expr (tree *expr_p)
/* All checks succeeded.  Build a new node to merge the cast.  */
*expr_p = build4 (ARRAY_REF, dctype, obj_expr,
TYPE_MIN_VALUE (TYPE_DOMAIN (datype)),
-   TYPE_MIN_VALUE (TYPE_DOMAIN (datype)),
-   size_binop (EXACT_DIV_EXPR, TYPE_SIZE_UNIT (dctype),
-   size_int (TYPE_ALIGN_UNIT (dctype;
+   NULL_TREE, NULL_TREE);
*expr_p = build1 (ADDR_EXPR, ctype, *expr_p);
  }


Modified: head/contrib/gcc/tree-ssa-ccp.c
==
--- head/contrib/gcc/tree-ssa-ccp.c Thu Jun 21 16:48:56 2012
(r237405)
+++ head/contrib/gcc/tree-ssa-ccp.c Thu Jun 21 16:49:20 2012
(r237406)
@@ -1621,9 +1621,7 @@ maybe_fold_offset_to_array_ref (tree bas
if (!integer_zerop (elt_offset))
  idx = int_const_binop (PLUS_EXPR, idx, elt_offset, 0);

-  return build4 (ARRAY_REF, orig_type, base, idx, min_idx,
-size_int (tree_low_cst (elt_size, 1)
-  / (TYPE_ALIGN_UNIT (elt_type;
+  return build4 (ARRAY_REF, orig_type, base, idx, NULL_TREE, NULL_TREE);
  }



Modified: head/contrib/gcc/tree-ssa-pre.c
=

svn commit: r237409 - head/lib/libc/string

2012-06-21 Thread Isabell Long
Author: issyl0 (doc committer)
Date: Thu Jun 21 18:28:48 2012
New Revision: 237409
URL: http://svn.freebsd.org/changeset/base/237409

Log:
  Add the functions documented in the man pages in commit 237393 to the
  relevant Makefile.
  
  Reminded by:  gavin
  Approved by:  gabor (mentor)
  MFC after:5 days

Modified:
  head/lib/libc/string/Makefile.inc

Modified: head/lib/libc/string/Makefile.inc
==
--- head/lib/libc/string/Makefile.inc   Thu Jun 21 18:22:50 2012
(r237408)
+++ head/lib/libc/string/Makefile.inc   Thu Jun 21 18:28:48 2012
(r237409)
@@ -42,10 +42,13 @@ MLINKS+=ffs.3 ffsl.3 \
ffs.3 flsll.3
 MLINKS+=index.3 rindex.3
 MLINKS+=memchr.3 memrchr.3
-MLINKS+=strcasecmp.3 strncasecmp.3
+MLINKS+=strcasecmp.3 strncasecmp.3 \
+   strcasecmp.3 strcasecmp_l.3 \
+   strcasecmp.3 strncasecmp_l.3
 MLINKS+=strcat.3 strncat.3
 MLINKS+=strchr.3 strrchr.3
 MLINKS+=strcmp.3 strncmp.3
+MLINKS+=strcoll.3 strcoll_l.3
 MLINKS+=strcpy.3 stpcpy.3 \
strcpy.3 stpncpy.3 \
strcpy.3 strncpy.3
@@ -57,8 +60,10 @@ MLINKS+=strerror.3 perror.3 \
 MLINKS+=strlcpy.3 strlcat.3
 MLINKS+=strlen.3 strnlen.3
 MLINKS+=strstr.3 strcasestr.3 \
-   strstr.3 strnstr.3
+   strstr.3 strnstr.3 \
+   strstr.3 strcasestr_l.3
 MLINKS+=strtok.3 strtok_r.3
+MLINKS+=strxfrm.3 strxfrm_l.3
 MLINKS+=wmemchr.3 wcpcpy.3 \
wmemchr.3 wcpncpy.3 \
wmemchr.3 wcscasecmp.3 \
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r237406 - head/contrib/gcc

2012-06-21 Thread Pedro Giffuni
Hi Niclas;

--- Gio 21/6/12, Niclas Zeising  ha scritto:

> On 06/21/12 18:49, Pedro F. Giffuni wrote:
> > Author: pfg
> > Date: Thu Jun 21 16:49:20 2012
> > New Revision: 237406
> > URL: http://svn.freebsd.org/changeset/base/237406
> >
> > Log:
> >    Bring a couple of fixes for gcc
> optimizations.
> >
> >    The GCC4.3 branch contains some optimization fixes
> >    that were not considered regressions and therefore
> >    were never backported. We are bringing a couple of
> >    them that are under GPLv2 since they were made
> >    before the license switch upstream.
> >
...
> 
> Could this fix the issues with mozilla ports not compiling
> on -O2?


I don't think so :(.

These are issues that would generate non-optimal code
but will not fix anything that doesn't compile.

Sorry,

Pedro.

___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r237406 - head/contrib/gcc

2012-06-21 Thread Niclas Zeising

On 06/21/12 20:28, Pedro Giffuni wrote:

Hi Niclas;

--- Gio 21/6/12, Niclas Zeising  ha scritto:


On 06/21/12 18:49, Pedro F. Giffuni wrote:

Author: pfg
Date: Thu Jun 21 16:49:20 2012
New Revision: 237406
URL: http://svn.freebsd.org/changeset/base/237406

Log:
 Bring a couple of fixes for gcc

optimizations.


 The GCC4.3 branch contains some optimization fixes
 that were not considered regressions and therefore
 were never backported. We are bringing a couple of
 them that are under GPLv2 since they were made
 before the license switch upstream.


...


Could this fix the issues with mozilla ports not compiling
on -O2?



I don't think so :(.

These are issues that would generate non-optimal code
but will not fix anything that doesn't compile.

Sorry,

Pedro.



Ok.
Something in g++ between FreeBSD 8 and current has broken something in 
the compile of mozilla related stuff on -O2. I haven't been able to 
figure out exactly which commit though.

Regards!
--
Niclas Zeising
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r237410 - in head: lib/libstand lib/libz lib/libz/contrib lib/libz/contrib/asm686 lib/libz/contrib/gcc_gvmat64 lib/libz/doc lib/libz/test sys/boot/userboot/libstand usr.bin/minigzip

2012-06-21 Thread Xin LI
Author: delphij
Date: Thu Jun 21 21:47:08 2012
New Revision: 237410
URL: http://svn.freebsd.org/changeset/base/237410

Log:
  MFV: Update zlib to 1.2.7.
  
  (x86 assembler optimization disabled for now because it
  requires the new .cfi_* directives that is not supported
  by base system binutils).
  
  MFC after:1 week

Added:
  head/lib/libz/test/
 - copied from r237252, vendor/libz/dist/test/
Deleted:
  head/lib/libz/example.c
  head/lib/libz/minigzip.c
Modified:
  head/lib/libstand/Makefile
  head/lib/libz/ChangeLog
  head/lib/libz/FAQ
  head/lib/libz/FREEBSD-upgrade   (contents, props changed)
  head/lib/libz/Makefile   (contents, props changed)
  head/lib/libz/README
  head/lib/libz/Symbol.map   (contents, props changed)
  head/lib/libz/Versions.def   (contents, props changed)
  head/lib/libz/adler32.c
  head/lib/libz/contrib/asm686/match.S   (contents, props changed)
  head/lib/libz/crc32.c
  head/lib/libz/crc32.h
  head/lib/libz/deflate.c
  head/lib/libz/deflate.h
  head/lib/libz/doc/algorithm.txt   (contents, props changed)
  head/lib/libz/gzguts.h   (contents, props changed)
  head/lib/libz/gzlib.c
  head/lib/libz/gzread.c
  head/lib/libz/gzwrite.c
  head/lib/libz/infback.c
  head/lib/libz/inffixed.h
  head/lib/libz/inflate.c
  head/lib/libz/inftrees.c
  head/lib/libz/trees.c
  head/lib/libz/zconf.h
  head/lib/libz/zlib.3
  head/lib/libz/zlib.h
  head/lib/libz/zopen.c   (contents, props changed)
  head/lib/libz/zutil.c
  head/lib/libz/zutil.h
  head/sys/boot/userboot/libstand/Makefile
  head/usr.bin/minigzip/Makefile
Directory Properties:
  head/lib/libz/   (props changed)
  head/lib/libz/contrib/   (props changed)
  head/lib/libz/contrib/README.contrib   (props changed)
  head/lib/libz/contrib/asm686/   (props changed)
  head/lib/libz/contrib/asm686/README.686   (props changed)
  head/lib/libz/contrib/gcc_gvmat64/   (props changed)
  head/lib/libz/contrib/gcc_gvmat64/gvmat64.S   (props changed)
  head/lib/libz/doc/   (props changed)
  head/lib/libz/doc/rfc1950.txt   (props changed)
  head/lib/libz/doc/rfc1951.txt   (props changed)
  head/lib/libz/doc/rfc1952.txt   (props changed)
  head/lib/libz/doc/txtvsbin.txt   (props changed)
  head/lib/libz/gzclose.c   (props changed)
  head/lib/libz/test/example.c   (props changed)
  head/lib/libz/test/infcover.c   (props changed)
  head/lib/libz/test/minigzip.c   (props changed)

Modified: head/lib/libstand/Makefile
==
--- head/lib/libstand/Makefile  Thu Jun 21 18:28:48 2012(r237409)
+++ head/lib/libstand/Makefile  Thu Jun 21 21:47:08 2012(r237410)
@@ -38,7 +38,7 @@ CFLAGS+=  -msoft-float -D_STANDALONE
 .endif
 
 # standalone components and stuff we have modified locally
-SRCS+= zutil.h __main.c assert.c bcd.c bswap.c environment.c getopt.c gets.c \
+SRCS+= gzguts.h zutil.h __main.c assert.c bcd.c bswap.c environment.c getopt.c 
gets.c \
globals.c pager.c printf.c strdup.c strerror.c strtol.c random.c \
sbrk.c twiddle.c zalloc.c zalloc_malloc.c
 
@@ -118,23 +118,29 @@ libstand_bzlib_private.h: bzlib_private.
 # decompression functionality from libz
 .PATH: ${.CURDIR}/../libz
 CFLAGS+=-DHAVE_MEMCPY -I${.CURDIR}/../libz
-SRCS+= adler32.c crc32.c libstand_zutil.h
+SRCS+= adler32.c crc32.c libstand_zutil.h libstand_gzguts.h
 
 .for file in infback.c inffast.c inflate.c inftrees.c zutil.c
 SRCS+= _${file}
 CLEANFILES+=   _${file}
 
 _${file}: ${file}
-   sed "s|zutil\.h|libstand_zutil.h|" ${.ALLSRC} > ${.TARGET}
+   sed -e "s|zutil\.h|libstand_zutil.h|" \
+   -e "s|gzguts\.h|libstand_gzguts.h|" \
+   ${.ALLSRC} > ${.TARGET}
 .endfor
 
 # depend on stand.h being able to be included multiple times
-CLEANFILES+= libstand_zutil.h
-libstand_zutil.h: zutil.h
-   sed -e 's||"stand.h"|' \
+.for file in zutil.h gzguts.h
+CLEANFILES+= libstand_${file}
+libstand_${file}: ${file}
+   sed -e 's||"stand.h"|' \
+   -e 's||"stand.h"|' \
-e 's||"stand.h"|' \
+   -e 's||"stand.h"|' \
-e 's||"stand.h"|' \
${.ALLSRC} > ${.TARGET}
+.endfor
 
 # io routines
 SRCS+= closeall.c dev.c ioctl.c nullfs.c stat.c \

Modified: head/lib/libz/ChangeLog
==
--- head/lib/libz/ChangeLog Thu Jun 21 18:28:48 2012(r237409)
+++ head/lib/libz/ChangeLog Thu Jun 21 21:47:08 2012(r237410)
@@ -1,12 +1,213 @@
 
 ChangeLog file for zlib
 
+Changes in 1.2.7 (2 May 2012)
+- Replace use of memmove() with a simple copy for portability
+- Test for existence of strerror
+- Restore gzgetc_ for backward compatibility with 1.2.6
+- Fix build with non-GNU make on Solaris
+- Require gcc 4.0 or later on Mac OS X to use the hidden attribute
+- Include unistd.h for Watcom C
+- Use __WATCOMC__ instead of __WATCOM__
+- Do not use the visibility attribute if NO_VIZ defined
+- Improve the detection of no hidde

svn commit: r237411 - head/sys/dev/drm2

2012-06-21 Thread Ed Maste
Author: emaste
Date: Thu Jun 21 22:06:57 2012
New Revision: 237411
URL: http://svn.freebsd.org/changeset/base/237411

Log:
  Add PCI IDs for Ivy Bridge

Modified:
  head/sys/dev/drm2/drm_pciids.h

Modified: head/sys/dev/drm2/drm_pciids.h
==
--- head/sys/dev/drm2/drm_pciids.h  Thu Jun 21 21:47:08 2012
(r237410)
+++ head/sys/dev/drm2/drm_pciids.h  Thu Jun 21 22:06:57 2012
(r237411)
@@ -566,6 +566,12 @@
{0x8086, 0x0116, CHIP_I9XX|CHIP_I915, "Intel SandyBridge (M)"}, \
{0x8086, 0x0126, CHIP_I9XX|CHIP_I915, "Intel SandyBridge (M)"}, \
{0x8086, 0x010A, CHIP_I9XX|CHIP_I915, "Intel SandyBridge (M)"}, \
+   {0x8086, 0x0152, CHIP_I9XX|CHIP_I915, "Intel IvyBridge"}, \
+   {0x8086, 0x0162, CHIP_I9XX|CHIP_I915, "Intel IvyBridge"}, \
+   {0x8086, 0x0156, CHIP_I9XX|CHIP_I915, "Intel IvyBridge (M)"}, \
+   {0x8086, 0x0166, CHIP_I9XX|CHIP_I915, "Intel IvyBridge (M)"}, \
+   {0x8086, 0x015A, CHIP_I9XX|CHIP_I915, "Intel IvyBridge (S)"}, \
+   {0x8086, 0x016A, CHIP_I9XX|CHIP_I915, "Intel IvyBridge (S)"}, \
{0x8086, 0xA001, CHIP_I9XX|CHIP_I965, "Intel Pineview"}, \
{0x8086, 0xA011, CHIP_I9XX|CHIP_I965, "Intel Pineview (M)"}, \
{0, 0, 0, NULL}
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r237412 - in head: sys/contrib/dev/acpica sys/contrib/dev/acpica/common sys/contrib/dev/acpica/compiler sys/contrib/dev/acpica/components/debugger sys/contrib/dev/acpica/components/disa...

2012-06-21 Thread Jung-uk Kim
Author: jkim
Date: Fri Jun 22 00:40:44 2012
New Revision: 237412
URL: http://svn.freebsd.org/changeset/base/237412

Log:
  Merge ACPICA 20120620.

Added:
  head/sys/contrib/dev/acpica/common/ahpredef.c
 - copied, changed from r237408, 
vendor-sys/acpica/dist/source/common/ahpredef.c
Modified:
  head/sys/contrib/dev/acpica/changes.txt   (contents, props changed)
  head/sys/contrib/dev/acpica/common/dmextern.c
  head/sys/contrib/dev/acpica/common/dmrestag.c
  head/sys/contrib/dev/acpica/compiler/aslcompile.c
  head/sys/contrib/dev/acpica/compiler/aslerror.c
  head/sys/contrib/dev/acpica/compiler/aslfiles.c
  head/sys/contrib/dev/acpica/compiler/asllookup.c
  head/sys/contrib/dev/acpica/compiler/aslmain.c
  head/sys/contrib/dev/acpica/compiler/aslsupport.l
  head/sys/contrib/dev/acpica/compiler/aslutils.c
  head/sys/contrib/dev/acpica/compiler/dttemplate.c
  head/sys/contrib/dev/acpica/components/debugger/dbdisply.c
  head/sys/contrib/dev/acpica/components/debugger/dbexec.c
  head/sys/contrib/dev/acpica/components/debugger/dbutils.c
  head/sys/contrib/dev/acpica/components/disassembler/dmopcode.c
  head/sys/contrib/dev/acpica/components/disassembler/dmwalk.c
  head/sys/contrib/dev/acpica/components/dispatcher/dsfield.c
  head/sys/contrib/dev/acpica/components/dispatcher/dsopcode.c
  head/sys/contrib/dev/acpica/components/events/evgpe.c
  head/sys/contrib/dev/acpica/components/events/evgpeutil.c
  head/sys/contrib/dev/acpica/components/events/evxfgpe.c
  head/sys/contrib/dev/acpica/components/executer/exconfig.c
  head/sys/contrib/dev/acpica/components/utilities/utmisc.c
  head/sys/contrib/dev/acpica/include/acdebug.h
  head/sys/contrib/dev/acpica/include/acdisasm.h
  head/sys/contrib/dev/acpica/include/acglobal.h
  head/sys/contrib/dev/acpica/include/aclocal.h
  head/sys/contrib/dev/acpica/include/acpixf.h
  head/sys/contrib/dev/acpica/include/acpredef.h
  head/sys/contrib/dev/acpica/include/acutils.h
  head/usr.sbin/acpi/iasl/Makefile
Directory Properties:
  head/sys/contrib/dev/acpica/   (props changed)
  head/sys/contrib/dev/acpica/common/   (props changed)
  head/sys/contrib/dev/acpica/compiler/   (props changed)
  head/sys/contrib/dev/acpica/components/debugger/   (props changed)
  head/sys/contrib/dev/acpica/components/disassembler/   (props changed)
  head/sys/contrib/dev/acpica/components/dispatcher/   (props changed)
  head/sys/contrib/dev/acpica/components/events/   (props changed)
  head/sys/contrib/dev/acpica/components/executer/   (props changed)
  head/sys/contrib/dev/acpica/components/utilities/   (props changed)
  head/sys/contrib/dev/acpica/include/   (props changed)

Modified: head/sys/contrib/dev/acpica/changes.txt
==
--- head/sys/contrib/dev/acpica/changes.txt Thu Jun 21 22:06:57 2012
(r237411)
+++ head/sys/contrib/dev/acpica/changes.txt Fri Jun 22 00:40:44 2012
(r237412)
@@ -1,4 +1,68 @@
 
+20 June 2012. Summary of changes for version 20120620:
+
+This release is available at https://www.acpica.org/downloads
+The ACPI 5.0 specification is available at www.acpi.info
+
+1) ACPICA Kernel-resident Subsystem:
+
+Implemented support to expand the "implicit notify" feature to allow multiple 
+devices to be notified by a single GPE. This feature automatically generates a 
+runtime device notification in the absence of a BIOS-provided GPE control 
+method (_Lxx/_Exx) or a host-installed handler for the GPE. Implicit notify is 
+provided by ACPICA for Windows compatibility, and is a workaround for BIOS AML 
+code errors. See the description of the AcpiSetupGpeForWake interface in the 
+APCICA reference. Bob Moore, Rafael Wysocki. ACPICA BZ 918.
+
+Changed some comments and internal function names to simplify and ensure 
+correctness of the Linux code translation. No functional changes.
+
+Example Code and Data Size: These are the sizes for the OS-independent 
+acpica.lib produced by the Microsoft Visual C++ 9.0 32-bit compiler. The debug 
+version of the code includes the debug output trace mechanism and has a much 
+larger code and data size.
+
+  Previous Release:
+Non-Debug Version:  93.0K Code, 25.1K Data, 118.1K Total
+Debug Version: 172.7K Code, 73.6K Data, 246.3K Total
+  Current Release:
+Non-Debug Version:  93.1K Code, 25.1K Data, 118.2K Total
+Debug Version: 172.9K Code, 73.6K Data, 246.5K Total
+
+
+2) iASL Compiler/Disassembler and Tools:
+
+Disassembler: Added support to emit short, commented descriptions for the ACPI 
+predefined names in order to improve the readability of the disassembled 
+output. ACPICA BZ 959. Changes include:
+  1) Emit descriptions for all standard predefined names (_INI, _STA, _PRW, 
+etc.)
+  2) Emit generic descriptions for the special names (_Exx, _Qxx, etc.)
+  3) Emit descriptions for the resource descriptor names (_MIN, _LEN, etc.)
+
+AcpiSrc: Fixed several long-standing Linux code transla

svn commit: r237414 - head/sys/amd64/amd64

2012-06-21 Thread Alan Cox
Author: alc
Date: Fri Jun 22 05:01:36 2012
New Revision: 237414
URL: http://svn.freebsd.org/changeset/base/237414

Log:
  Introduce CHANGE_PV_LIST_LOCK_TO_{PHYS,VM_PAGE}() to avoid duplication of
  code.

Modified:
  head/sys/amd64/amd64/pmap.c

Modified: head/sys/amd64/amd64/pmap.c
==
--- head/sys/amd64/amd64/pmap.c Fri Jun 22 00:41:37 2012(r237413)
+++ head/sys/amd64/amd64/pmap.c Fri Jun 22 05:01:36 2012(r237414)
@@ -173,6 +173,22 @@ __FBSDID("$FreeBSD$");
 #definePHYS_TO_PV_LIST_LOCK(pa)\
(&pv_list_locks[pa_index(pa) % NPV_LIST_LOCKS])
 
+#defineCHANGE_PV_LIST_LOCK_TO_PHYS(lockp, pa)  do {\
+   struct rwlock **_lockp = (lockp);   \
+   struct rwlock *_new_lock;   \
+   \
+   _new_lock = PHYS_TO_PV_LIST_LOCK(pa);   \
+   if (_new_lock != *_lockp) { \
+   if (*_lockp != NULL)\
+   rw_wunlock(*_lockp);\
+   *_lockp = _new_lock;\
+   rw_wlock(*_lockp);  \
+   }   \
+} while (0)
+
+#defineCHANGE_PV_LIST_LOCK_TO_VM_PAGE(lockp, m)\
+   CHANGE_PV_LIST_LOCK_TO_PHYS(lockp, VM_PAGE_TO_PHYS(m))
+
 #defineVM_PAGE_TO_PV_LIST_LOCK(m)  \
PHYS_TO_PV_LIST_LOCK(VM_PAGE_TO_PHYS(m))
 
@@ -2436,20 +2452,13 @@ static boolean_t
 pmap_try_insert_pv_entry(pmap_t pmap, vm_offset_t va, vm_page_t m,
 struct rwlock **lockp)
 {
-   struct rwlock *new_lock;
pv_entry_t pv;
 
rw_assert(&pvh_global_lock, RA_LOCKED);
PMAP_LOCK_ASSERT(pmap, MA_OWNED);
if ((pv = get_pv_entry(pmap, TRUE)) != NULL) {
pv->pv_va = va;
-   new_lock = VM_PAGE_TO_PV_LIST_LOCK(m);
-   if (new_lock != *lockp) {
-   if (*lockp != NULL)
-   rw_wunlock(*lockp);
-   *lockp = new_lock;
-   rw_wlock(*lockp);
-   }
+   CHANGE_PV_LIST_LOCK_TO_VM_PAGE(lockp, m);
TAILQ_INSERT_TAIL(&m->md.pv_list, pv, pv_list);
return (TRUE);
} else
@@ -2464,19 +2473,12 @@ pmap_pv_insert_pde(pmap_t pmap, vm_offse
 struct rwlock **lockp)
 {
struct md_page *pvh;
-   struct rwlock *new_lock;
pv_entry_t pv;
 
rw_assert(&pvh_global_lock, RA_LOCKED);
if ((pv = get_pv_entry(pmap, TRUE)) != NULL) {
pv->pv_va = va;
-   new_lock = PHYS_TO_PV_LIST_LOCK(pa);
-   if (new_lock != *lockp) {
-   if (*lockp != NULL)
-   rw_wunlock(*lockp);
-   *lockp = new_lock;
-   rw_wlock(*lockp);
-   }
+   CHANGE_PV_LIST_LOCK_TO_PHYS(lockp, pa);
pvh = pa_to_pvh(pa);
TAILQ_INSERT_TAIL(&pvh->pv_list, pv, pv_list);
return (TRUE);
@@ -4159,7 +4161,7 @@ pmap_remove_pages(pmap_t pmap)
pv_entry_t pv;
struct md_page *pvh;
struct pv_chunk *pc, *npc;
-   struct rwlock *lock, *new_lock;
+   struct rwlock *lock;
int64_t bit;
uint64_t inuse, bitmask;
int allfree, field, freed, idx;
@@ -4229,13 +4231,7 @@ pmap_remove_pages(pmap_t pmap)
vm_page_dirty(m);
}
 
-   new_lock = VM_PAGE_TO_PV_LIST_LOCK(m);
-   if (new_lock != lock) {
-   if (lock != NULL)
-   rw_wunlock(lock);
-   lock = new_lock;
-   rw_wlock(lock);
-   }
+   CHANGE_PV_LIST_LOCK_TO_VM_PAGE(&lock, m);
 
/* Mark free */
pc->pc_map[field] |= bitmask;
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r237429 - head/sys/arm/at91

2012-06-21 Thread Warner Losh
Author: imp
Date: Fri Jun 22 05:54:34 2012
New Revision: 237429
URL: http://svn.freebsd.org/changeset/base/237429

Log:
  Move these #defines to at91reg.h (where I should have put them in the
  first place).

Modified:
  head/sys/arm/at91/at91_machdep.c
  head/sys/arm/at91/at91reg.h

Modified: head/sys/arm/at91/at91_machdep.c
==
--- head/sys/arm/at91/at91_machdep.cFri Jun 22 05:48:53 2012
(r237428)
+++ head/sys/arm/at91/at91_machdep.cFri Jun 22 05:54:34 2012
(r237429)
@@ -281,9 +281,6 @@ static const char *soc_subtype_name[] = 
[AT91_ST_SAM9X35] = "at91sam9x35",
 };
 
-#define AT91_DBGU0 0x0200  /* Most */
-#define AT91_DBGU1 0x0fffee00  /* SAM9263, CAP9, and SAM9G45 */
-
 struct at91_soc_info soc_data;
 
 /*

Modified: head/sys/arm/at91/at91reg.h
==
--- head/sys/arm/at91/at91reg.h Fri Jun 22 05:48:53 2012(r237428)
+++ head/sys/arm/at91/at91reg.h Fri Jun 22 05:54:34 2012(r237429)
@@ -46,6 +46,9 @@
 #defineAT91_SYS_BASE   0x000
 #defineAT91_SYS_SIZE   0x1000
 
+#define AT91_DBGU0 0x0200  /* Most */
+#define AT91_DBGU1 0x0fffee00  /* SAM9263, CAP9, and SAM9G45 */
+
 #defineAT91_DBGU_SIZE  0x200
 #defineDBGU_C1R(64) /* Chip ID1 Register */
 #defineDBGU_C2R(68) /* Chip ID2 Register */
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r237430 - in head/sys: amd64/include arm/include i386/include ia64/include mips/include powerpc/include sparc64/include

2012-06-21 Thread Konstantin Belousov
Author: kib
Date: Fri Jun 22 06:38:31 2012
New Revision: 237430
URL: http://svn.freebsd.org/changeset/base/237430

Log:
  Reserve AT_TIMEKEEP auxv entry for providing usermode the pointer to
  timekeeping information.
  
  MFC after:  1 week

Modified:
  head/sys/amd64/include/elf.h
  head/sys/arm/include/elf.h
  head/sys/i386/include/elf.h
  head/sys/ia64/include/elf.h
  head/sys/mips/include/elf.h
  head/sys/powerpc/include/elf.h
  head/sys/sparc64/include/elf.h

Modified: head/sys/amd64/include/elf.h
==
--- head/sys/amd64/include/elf.hFri Jun 22 05:54:34 2012
(r237429)
+++ head/sys/amd64/include/elf.hFri Jun 22 06:38:31 2012
(r237430)
@@ -94,6 +94,7 @@ __ElfType(Auxinfo);
 #defineAT_NCPUS19  /* Number of CPUs. */
 #defineAT_PAGESIZES20  /* Pagesizes. */
 #defineAT_PAGESIZESLEN 21  /* Number of pagesizes. */
+#defineAT_TIMEKEEP 22  /* Pointer to timehands. */
 #defineAT_STACKPROT23  /* Initial stack protection. */
 
 #defineAT_COUNT24  /* Count of defined aux entry types. */

Modified: head/sys/arm/include/elf.h
==
--- head/sys/arm/include/elf.h  Fri Jun 22 05:54:34 2012(r237429)
+++ head/sys/arm/include/elf.h  Fri Jun 22 06:38:31 2012(r237430)
@@ -82,6 +82,7 @@ __ElfType(Auxinfo);
 #defineAT_NCPUS19  /* Number of CPUs. */
 #defineAT_PAGESIZES20  /* Pagesizes. */
 #defineAT_PAGESIZESLEN 21  /* Number of pagesizes. */
+#defineAT_TIMEKEEP 22  /* Pointer to timehands. */
 #defineAT_STACKPROT23  /* Initial stack protection. */
 
 #define AT_COUNT24  /* Count of defined aux entry types. */

Modified: head/sys/i386/include/elf.h
==
--- head/sys/i386/include/elf.h Fri Jun 22 05:54:34 2012(r237429)
+++ head/sys/i386/include/elf.h Fri Jun 22 06:38:31 2012(r237430)
@@ -96,6 +96,7 @@ __ElfType(Auxinfo);
 #defineAT_NCPUS19  /* Number of CPUs. */
 #defineAT_PAGESIZES20  /* Pagesizes. */
 #defineAT_PAGESIZESLEN 21  /* Number of pagesizes. */
+#defineAT_TIMEKEEP 22  /* Pointer to timehands. */
 #defineAT_STACKPROT23  /* Initial stack protection. */
 
 #defineAT_COUNT24  /* Count of defined aux entry types. */

Modified: head/sys/ia64/include/elf.h
==
--- head/sys/ia64/include/elf.h Fri Jun 22 05:54:34 2012(r237429)
+++ head/sys/ia64/include/elf.h Fri Jun 22 06:38:31 2012(r237430)
@@ -95,6 +95,7 @@ __ElfType(Auxinfo);
 #defineAT_NCPUS19  /* Number of CPUs. */
 #defineAT_PAGESIZES20  /* Pagesizes. */
 #defineAT_PAGESIZESLEN 21  /* Number of pagesizes. */
+#defineAT_TIMEKEEP 22  /* Pointer to timehands. */
 #defineAT_STACKPROT23  /* Initial stack protection. */
 
 #defineAT_COUNT24  /* Count of defined aux entry types. */

Modified: head/sys/mips/include/elf.h
==
--- head/sys/mips/include/elf.h Fri Jun 22 05:54:34 2012(r237429)
+++ head/sys/mips/include/elf.h Fri Jun 22 06:38:31 2012(r237430)
@@ -278,6 +278,7 @@ __ElfType(Auxinfo);
 #defineAT_NCPUS19  /* Number of CPUs. */
 #defineAT_PAGESIZES20  /* Pagesizes. */
 #defineAT_PAGESIZESLEN 21  /* Number of pagesizes. */
+#defineAT_TIMEKEEP 22  /* Pointer to timehands. */
 #defineAT_STACKPROT23  /* Initial stack protection. */
 
 #defineAT_COUNT24  /* Count of defined aux entry types. */

Modified: head/sys/powerpc/include/elf.h
==
--- head/sys/powerpc/include/elf.h  Fri Jun 22 05:54:34 2012
(r237429)
+++ head/sys/powerpc/include/elf.h  Fri Jun 22 06:38:31 2012
(r237430)
@@ -106,8 +106,9 @@ __ElfType(Auxinfo);
 #defineAT_PAGESIZES18  /* Pagesizes. */
 #defineAT_PAGESIZESLEN 19  /* Number of pagesizes. */
 #defineAT_STACKPROT21  /* Initial stack protection. */
+#defineAT_TIMEKEEP 22  /* Pointer to timehands. */
 
-#defineAT_COUNT22  /* Count of defined aux entry types. */
+#defineAT_COUNT23  /* Count of defined aux entry types. */
 
 /*
  * Relocation types.

Modified: head/sys/sparc64/include/elf.h
==
--- head/sys/sparc64/include/elf.h  Fri Jun 22 05:5

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

2012-06-21 Thread Konstantin Belousov
Author: kib
Date: Fri Jun 22 06:39:28 2012
New Revision: 237431
URL: http://svn.freebsd.org/changeset/base/237431

Log:
  Enchance the shared page chunk allocator.
  
  Do not rely on the busy state of the page from which we allocate the
  chunk, to protect allocator state. Use statically allocated sx lock
  instead.
  
  Provide more flexible KPI. In particular, allow to allocate chunk
  without providing initial data, and allow writes into existing
  allocation. Allow to get an sf buf which temporary maps the chunk, to
  allow sequential updates to shared page content without unmapping in
  between.
  
  Reviewed by:  jhb
  Tested by:flo
  MFC after:1 month

Modified:
  head/sys/kern/kern_exec.c
  head/sys/sys/sysent.h

Modified: head/sys/kern/kern_exec.c
==
--- head/sys/kern/kern_exec.c   Fri Jun 22 06:38:31 2012(r237430)
+++ head/sys/kern/kern_exec.c   Fri Jun 22 06:39:28 2012(r237431)
@@ -1512,33 +1512,81 @@ exec_unregister(execsw_arg)
return (0);
 }
 
+static struct sx shared_page_alloc_sx;
 static vm_object_t shared_page_obj;
 static int shared_page_free;
 
-int
-shared_page_fill(int size, int align, const char *data)
+struct sf_buf *
+shared_page_write_start(int base)
 {
vm_page_t m;
struct sf_buf *s;
+
+   VM_OBJECT_LOCK(shared_page_obj);
+   m = vm_page_grab(shared_page_obj, OFF_TO_IDX(base), VM_ALLOC_RETRY);
+   VM_OBJECT_UNLOCK(shared_page_obj);
+   s = sf_buf_alloc(m, SFB_DEFAULT);
+   return (s);
+}
+
+void
+shared_page_write_end(struct sf_buf *sf)
+{
+   vm_page_t m;
+
+   m = sf_buf_page(sf);
+   sf_buf_free(sf);
+   VM_OBJECT_LOCK(shared_page_obj);
+   vm_page_wakeup(m);
+   VM_OBJECT_UNLOCK(shared_page_obj);
+}
+
+void
+shared_page_write(int base, int size, const void *data)
+{
+   struct sf_buf *sf;
vm_offset_t sk;
+
+   sf = shared_page_write_start(base);
+   sk = sf_buf_kva(sf);
+   bcopy(data, (void *)(sk + (base & PAGE_MASK)), size);
+   shared_page_write_end(sf);
+}
+
+static int
+shared_page_alloc_locked(int size, int align)
+{
int res;
 
-   VM_OBJECT_LOCK(shared_page_obj);
-   m = vm_page_grab(shared_page_obj, 0, VM_ALLOC_RETRY);
res = roundup(shared_page_free, align);
if (res + size >= IDX_TO_OFF(shared_page_obj->size))
res = -1;
-   else {
-   VM_OBJECT_UNLOCK(shared_page_obj);
-   s = sf_buf_alloc(m, SFB_DEFAULT);
-   sk = sf_buf_kva(s);
-   bcopy(data, (void *)(sk + res), size);
+   else
shared_page_free = res + size;
-   sf_buf_free(s);
-   VM_OBJECT_LOCK(shared_page_obj);
-   }
-   vm_page_wakeup(m);
-   VM_OBJECT_UNLOCK(shared_page_obj);
+   return (res);
+}
+
+int
+shared_page_alloc(int size, int align)
+{
+   int res;
+
+   sx_xlock(&shared_page_alloc_sx);
+   res = shared_page_alloc_locked(size, align);
+   sx_xunlock(&shared_page_alloc_sx);
+   return (res);
+}
+
+int
+shared_page_fill(int size, int align, const void *data)
+{
+   int res;
+
+   sx_xlock(&shared_page_alloc_sx);
+   res = shared_page_alloc_locked(size, align);
+   if (res != -1)
+   shared_page_write(res, size, data);
+   sx_xunlock(&shared_page_alloc_sx);
return (res);
 }
 
@@ -1547,6 +1595,7 @@ shared_page_init(void *dummy __unused)
 {
vm_page_t m;
 
+   sx_init(&shared_page_alloc_sx, "shpsx");
shared_page_obj = vm_pager_allocate(OBJT_PHYS, 0, PAGE_SIZE,
VM_PROT_DEFAULT, 0, NULL);
VM_OBJECT_LOCK(shared_page_obj);

Modified: head/sys/sys/sysent.h
==
--- head/sys/sys/sysent.h   Fri Jun 22 06:38:31 2012(r237430)
+++ head/sys/sys/sysent.h   Fri Jun 22 06:39:28 2012(r237431)
@@ -256,8 +256,13 @@ intlkmressys(struct thread *, struct no
 intsyscall_thread_enter(struct thread *td, struct sysent *se);
 void   syscall_thread_exit(struct thread *td, struct sysent *se);
 
-int shared_page_fill(int size, int align, const char *data);
+struct sf_buf;
+int shared_page_alloc(int size, int align);
+int shared_page_fill(int size, int align, const void *data);
+void shared_page_write(int base, int size, const void *data);
 void exec_sysvec_init(void *param);
+struct sf_buf *shared_page_write_start(int base);
+void shared_page_write_end(struct sf_buf *sf);
 
 #define INIT_SYSENTVEC(name, sv)   \
 SYSINIT(name, SI_SUB_EXEC, SI_ORDER_ANY,   \
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r237432 - head/sys/arm/at91

2012-06-21 Thread Warner Losh
Author: imp
Date: Fri Jun 22 06:44:22 2012
New Revision: 237432
URL: http://svn.freebsd.org/changeset/base/237432

Log:
  Fix a stray debug that I committed accidentally years ago...

Modified:
  head/sys/arm/at91/at91_twi.c

Modified: head/sys/arm/at91/at91_twi.c
==
--- head/sys/arm/at91/at91_twi.cFri Jun 22 06:39:28 2012
(r237431)
+++ head/sys/arm/at91/at91_twi.cFri Jun 22 06:44:22 2012
(r237432)
@@ -284,7 +284,6 @@ at91_twi_rst_card(device_t dev, u_char s
WR4(sc, TWI_CR, TWI_CR_SWRST);
WR4(sc, TWI_CR, TWI_CR_MSEN | TWI_CR_SVDIS);
WR4(sc, TWI_CWGR, sc->cwgr);
-   printf("setting cwgr to %#x\n", sc->cwgr);
AT91_TWI_UNLOCK(sc);
 
return 0;
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"