svn commit: r250503 - in head: sbin/hastctl sbin/hastd usr.sbin/bsnmpd/modules/snmp_hast

2013-05-11 Thread Mikolaj Golub
Author: trociny
Date: Sat May 11 09:51:44 2013
New Revision: 250503
URL: http://svnweb.freebsd.org/changeset/base/250503

Log:
  Get rid of libl dependency.  We needed it only to provide yywrap.  But
  yywrap is not necessary when parsing a single hast.conf file.
  
  Suggested by: kib
  Reviewed by:  pjd

Modified:
  head/sbin/hastctl/Makefile
  head/sbin/hastd/Makefile
  head/sbin/hastd/token.l
  head/usr.sbin/bsnmpd/modules/snmp_hast/Makefile

Modified: head/sbin/hastctl/Makefile
==
--- head/sbin/hastctl/Makefile  Sat May 11 08:15:56 2013(r250502)
+++ head/sbin/hastctl/Makefile  Sat May 11 09:51:44 2013(r250503)
@@ -32,8 +32,8 @@ CFLAGS+=-DINET6
 CFLAGS+=-DYY_NO_UNPUT
 CFLAGS+=-DYY_NO_INPUT
 
-DPADD= ${LIBL} ${LIBUTIL}
-LDADD= -ll -lutil
+DPADD= ${LIBUTIL}
+LDADD= -lutil
 .if ${MK_OPENSSL} != no
 DPADD+=${LIBCRYPTO}
 LDADD+=-lcrypto

Modified: head/sbin/hastd/Makefile
==
--- head/sbin/hastd/MakefileSat May 11 08:15:56 2013(r250502)
+++ head/sbin/hastd/MakefileSat May 11 09:51:44 2013(r250503)
@@ -31,7 +31,7 @@ CFLAGS+=-DINET6
 .endif
 
 DPADD= ${LIBGEOM} ${LIBBSDXML} ${LIBSBUF} ${LIBL} ${LIBPTHREAD} ${LIBUTIL}
-LDADD= -lgeom -lbsdxml -lsbuf -ll -lpthread -lutil
+LDADD= -lgeom -lbsdxml -lsbuf -lpthread -lutil
 .if ${MK_OPENSSL} != no
 DPADD+=${LIBCRYPTO}
 LDADD+=-lcrypto

Modified: head/sbin/hastd/token.l
==
--- head/sbin/hastd/token.l Sat May 11 08:15:56 2013(r250502)
+++ head/sbin/hastd/token.l Sat May 11 09:51:44 2013(r250503)
@@ -46,6 +46,7 @@ int lineno;
 
 %option noinput
 %option nounput
+%option noyywrap
 
 %%
 control{ DP; return CONTROL; }

Modified: head/usr.sbin/bsnmpd/modules/snmp_hast/Makefile
==
--- head/usr.sbin/bsnmpd/modules/snmp_hast/Makefile Sat May 11 08:15:56 
2013(r250502)
+++ head/usr.sbin/bsnmpd/modules/snmp_hast/Makefile Sat May 11 09:51:44 
2013(r250503)
@@ -29,8 +29,8 @@ CFLAGS+=-DYY_NO_UNPUT
 CFLAGS+=-DYY_NO_INPUT
 CFLAGS+= -DSNMPTREE_TYPES
 
-DPADD= ${LIBL} ${LIBUTIL}
-LDADD= -ll -lutil
+DPADD= ${LIBUTIL}
+LDADD= -lutil
 
 XSYM=  begemotHast
 DEFS=  ${MOD}_tree.def
___
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: r250504 - in head: sys/netinet usr.sbin/arp

2013-05-11 Thread Gleb Smirnoff
Author: glebius
Date: Sat May 11 10:51:32 2013
New Revision: 250504
URL: http://svnweb.freebsd.org/changeset/base/250504

Log:
  Rate limit the number of remotely triggered ARP log messages
  to 1 log message per second.

Modified:
  head/sys/netinet/if_ether.c
  head/usr.sbin/arp/arp.4

Modified: head/sys/netinet/if_ether.c
==
--- head/sys/netinet/if_ether.c Sat May 11 09:51:44 2013(r250503)
+++ head/sys/netinet/if_ether.c Sat May 11 10:51:32 2013(r250504)
@@ -505,6 +505,9 @@ static int log_arp_wrong_iface = 1;
 static int log_arp_movements = 1;
 static int log_arp_permanent_modify = 1;
 static int allow_multicast = 0;
+static struct timeval arp_lastlog;
+static int arp_curpps;
+static int arp_maxpps = 1;
 
 SYSCTL_INT(_net_link_ether_inet, OID_AUTO, log_arp_wrong_iface, CTLFLAG_RW,
log_arp_wrong_iface, 0,
@@ -517,6 +520,15 @@ SYSCTL_INT(_net_link_ether_inet, OID_AUT
log arp replies from MACs different than the one in the permanent arp 
entry);
 SYSCTL_INT(_net_link_ether_inet, OID_AUTO, allow_multicast, CTLFLAG_RW,
allow_multicast, 0, accept multicast addresses);
+SYSCTL_INT(_net_link_ether_inet, OID_AUTO, max_log_per_second,
+   CTLFLAG_RW, arp_maxpps, 0,
+   Maximum number of remotely triggered ARP messages that can be 
+   logged per second);
+
+#defineARP_LOG(pri, ...)   do {
\
+   if (ppsratecheck(arp_lastlog, arp_curpps, arp_maxpps))\
+   log((pri), arp:  __VA_ARGS__);\
+} while (0)
 
 static void
 in_arpinput(struct mbuf *m)
@@ -546,7 +558,7 @@ in_arpinput(struct mbuf *m)
 
req_len = arphdr_len2(ifp-if_addrlen, sizeof(struct in_addr));
if (m-m_len  req_len  (m = m_pullup(m, req_len)) == NULL) {
-   log(LOG_NOTICE, in_arp: runt packet -- m_pullup failed\n);
+   ARP_LOG(LOG_NOTICE, runt packet -- m_pullup failed\n);
return;
}
 
@@ -556,13 +568,13 @@ in_arpinput(struct mbuf *m)
 * a protocol length not equal to an IPv4 address.
 */
if (ah-ar_pln != sizeof(struct in_addr)) {
-   log(LOG_NOTICE, in_arp: requested protocol length != %zu\n,
+   ARP_LOG(LOG_NOTICE, requested protocol length != %zu\n,
sizeof(struct in_addr));
goto drop;
}
 
if (allow_multicast == 0  ETHER_IS_MULTICAST(ar_sha(ah))) {
-   log(LOG_NOTICE, arp: %*D is multicast\n,
+   ARP_LOG(LOG_NOTICE, %*D is multicast\n,
ifp-if_addrlen, (u_char *)ar_sha(ah), :);
goto drop;
}
@@ -658,9 +670,8 @@ match:
if (!bcmp(ar_sha(ah), enaddr, ifp-if_addrlen))
goto drop;  /* it's from me, ignore it. */
if (!bcmp(ar_sha(ah), ifp-if_broadcastaddr, ifp-if_addrlen)) {
-   log(LOG_NOTICE,
-   arp: link address is broadcast for IP address %s!\n,
-   inet_ntoa(isaddr));
+   ARP_LOG(LOG_NOTICE, link address is broadcast for IP address 
+   %s!\n, inet_ntoa(isaddr));
goto drop;
}
/*
@@ -671,7 +682,7 @@ match:
 */
if (!bridged  !carped  isaddr.s_addr == myaddr.s_addr 
myaddr.s_addr != 0) {
-   log(LOG_ERR, arp: %*D is using my IP address %s on %s!\n,
+   ARP_LOG(LOG_ERR, %*D is using my IP address %s on %s!\n,
   ifp-if_addrlen, (u_char *)ar_sha(ah), :,
   inet_ntoa(isaddr), ifp-if_xname);
itaddr = myaddr;
@@ -694,7 +705,7 @@ match:
/* the following is not an error when doing bridging */
if (!bridged  la-lle_tbl-llt_ifp != ifp) {
if (log_arp_wrong_iface)
-   log(LOG_WARNING, arp: %s is on %s 
+   ARP_LOG(LOG_WARNING, %s is on %s 
but got reply from %*D on %s\n,
inet_ntoa(isaddr),
la-lle_tbl-llt_ifp-if_xname,
@@ -708,8 +719,8 @@ match:
if (la-la_flags  LLE_STATIC) {
LLE_WUNLOCK(la);
if (log_arp_permanent_modify)
-   log(LOG_ERR,
-   arp: %*D attempts to modify 
+   ARP_LOG(LOG_ERR,
+   %*D attempts to modify 
permanent entry for %s on %s\n,
ifp-if_addrlen,
(u_char *)ar_sha(ah), :,
@@ -717,7 +728,7 @@ match:
goto reply;
}

svn commit: r250505 - in head/sys: fs/nullfs kern sys

2013-05-11 Thread Konstantin Belousov
Author: kib
Date: Sat May 11 11:17:44 2013
New Revision: 250505
URL: http://svnweb.freebsd.org/changeset/base/250505

Log:
  - Fix nullfs vnode reference leak in nullfs_reclaim_lowervp().  The
null_hashget() obtains the reference on the nullfs vnode, which must
be dropped.
  
  - Fix a wart which existed from the introduction of the nullfs
caching, do not unlock lower vnode in the nullfs_reclaim_lowervp().
It should be innocent, but now it is also formally safe.  Inform the
nullfs_reclaim() about this using the NULLV_NOUNLOCK flag set on
nullfs inode.
  
  - Add a callback to the upper filesystems for the lower vnode
unlinking. When inactivating a nullfs vnode, check if the lower
vnode was unlinked, indicated by nullfs flag NULLV_DROP or VV_NOSYNC
on the lower vnode, and reclaim upper vnode if so.  This allows
nullfs to purge cached vnodes for the unlinked lower vnode, avoiding
excessive caching.
  
  Reported by:  G??ran L??wkrantz goran.lowkra...@ismobile.com
  Tested by:pho
  Sponsored by: The FreeBSD Foundation
  MFC after:2 weeks

Modified:
  head/sys/fs/nullfs/null.h
  head/sys/fs/nullfs/null_subr.c
  head/sys/fs/nullfs/null_vfsops.c
  head/sys/fs/nullfs/null_vnops.c
  head/sys/kern/vfs_subr.c
  head/sys/kern/vfs_syscalls.c
  head/sys/sys/mount.h

Modified: head/sys/fs/nullfs/null.h
==
--- head/sys/fs/nullfs/null.h   Sat May 11 10:51:32 2013(r250504)
+++ head/sys/fs/nullfs/null.h   Sat May 11 11:17:44 2013(r250505)
@@ -53,8 +53,12 @@ struct null_node {
LIST_ENTRY(null_node)   null_hash;  /* Hash list */
struct vnode*null_lowervp;  /* VREFed once */
struct vnode*null_vnode;/* Back pointer */
+   u_int   null_flags;
 };
 
+#defineNULLV_NOUNLOCK  0x0001
+#defineNULLV_DROP  0x0002
+
 #defineMOUNTTONULLMOUNT(mp) ((struct null_mount *)((mp)-mnt_data))
 #defineVTONULL(vp) ((struct null_node *)(vp)-v_data)
 #defineNULLTOV(xp) ((xp)-null_vnode)

Modified: head/sys/fs/nullfs/null_subr.c
==
--- head/sys/fs/nullfs/null_subr.c  Sat May 11 10:51:32 2013
(r250504)
+++ head/sys/fs/nullfs/null_subr.c  Sat May 11 11:17:44 2013
(r250505)
@@ -247,6 +247,7 @@ null_nodeget(mp, lowervp, vpp)
 
xp-null_vnode = vp;
xp-null_lowervp = lowervp;
+   xp-null_flags = 0;
vp-v_type = lowervp-v_type;
vp-v_data = xp;
vp-v_vnlock = lowervp-v_vnlock;

Modified: head/sys/fs/nullfs/null_vfsops.c
==
--- head/sys/fs/nullfs/null_vfsops.cSat May 11 10:51:32 2013
(r250504)
+++ head/sys/fs/nullfs/null_vfsops.cSat May 11 11:17:44 2013
(r250505)
@@ -65,7 +65,6 @@ static vfs_statfs_t   nullfs_statfs;
 static vfs_unmount_t   nullfs_unmount;
 static vfs_vget_t  nullfs_vget;
 static vfs_extattrctl_tnullfs_extattrctl;
-static vfs_reclaim_lowervp_t nullfs_reclaim_lowervp;
 
 /*
  * Mount null layer
@@ -391,8 +390,37 @@ nullfs_reclaim_lowervp(struct mount *mp,
vp = null_hashget(mp, lowervp);
if (vp == NULL)
return;
+   VTONULL(vp)-null_flags |= NULLV_NOUNLOCK;
vgone(vp);
-   vn_lock(lowervp, LK_EXCLUSIVE | LK_RETRY);
+   vput(vp);
+}
+
+static void
+nullfs_unlink_lowervp(struct mount *mp, struct vnode *lowervp)
+{
+   struct vnode *vp;
+   struct null_node *xp;
+
+   vp = null_hashget(mp, lowervp);
+   if (vp == NULL)
+   return;
+   xp = VTONULL(vp);
+   xp-null_flags |= NULLV_DROP | NULLV_NOUNLOCK;
+   vhold(vp);
+   vunref(vp);
+
+   /*
+* If vunref() dropped the last use reference on the nullfs
+* vnode, it must be reclaimed, and its lock was split from
+* the lower vnode lock.  Need to do extra unlock before
+* allowing the final vdrop() to free the vnode.
+*/
+   if (vp-v_usecount == 0) {
+   KASSERT((vp-v_iflag  VI_DOOMED) != 0,
+   (not reclaimed %p, vp));
+   VOP_UNLOCK(vp, 0);
+   }
+   vdrop(vp);
 }
 
 static struct vfsops null_vfsops = {
@@ -408,6 +436,7 @@ static struct vfsops null_vfsops = {
.vfs_unmount =  nullfs_unmount,
.vfs_vget = nullfs_vget,
.vfs_reclaim_lowervp =  nullfs_reclaim_lowervp,
+   .vfs_unlink_lowervp =   nullfs_unlink_lowervp,
 };
 
 VFS_SET(null_vfsops, nullfs, VFCF_LOOPBACK | VFCF_JAIL);

Modified: head/sys/fs/nullfs/null_vnops.c
==
--- head/sys/fs/nullfs/null_vnops.c Sat May 11 10:51:32 2013
(r250504)
+++ head/sys/fs/nullfs/null_vnops.c Sat May 11 11:17:44 2013
(r250505)
@@ 

svn commit: r250508 - head/sys/cam/ata

2013-05-11 Thread Alexander Motin
Author: mav
Date: Sat May 11 13:21:31 2013
New Revision: 250508
URL: http://svnweb.freebsd.org/changeset/base/250508

Log:
  Disable sending Early R_OK on SiI3726/SiI3826 port multipliers.
  With cached read HDD testing and multiple ports busy on a SATA
  host controller, 3726/3826 PMP will very rarely drop a deferred
  R_OK that was intended for the host. Symptom will be all 5 drives
  under test will timeout, get reset, and recover.
  
  Submitted by: Rich Futyma rich.fut...@sanmina.com
  MFC after:2 weeks

Modified:
  head/sys/cam/ata/ata_pmp.c

Modified: head/sys/cam/ata/ata_pmp.c
==
--- head/sys/cam/ata/ata_pmp.c  Sat May 11 12:43:26 2013(r250507)
+++ head/sys/cam/ata/ata_pmp.c  Sat May 11 13:21:31 2013(r250508)
@@ -64,6 +64,9 @@ __FBSDID($FreeBSD$);
 typedef enum {
PMP_STATE_NORMAL,
PMP_STATE_PORTS,
+   PMP_STATE_PM_QUIRKS_1,
+   PMP_STATE_PM_QUIRKS_2,
+   PMP_STATE_PM_QUIRKS_3,
PMP_STATE_PRECONFIG,
PMP_STATE_RESET,
PMP_STATE_CONNECT,
@@ -317,7 +320,11 @@ pmpasync(void *callback_arg, u_int32_t c
if (code == AC_SENT_BDR || code == AC_BUS_RESET)
softc-found = 0; /* We have to reset everything. */
if (softc-state == PMP_STATE_NORMAL) {
-   softc-state = PMP_STATE_PRECONFIG;
+   if (softc-pm_pid == 0x37261095 ||
+   softc-pm_pid == 0x38261095)
+   softc-state = PMP_STATE_PM_QUIRKS_1;
+   else
+   softc-state = PMP_STATE_PRECONFIG;
cam_periph_acquire(periph);
xpt_schedule(periph, CAM_PRIORITY_DEV);
} else
@@ -427,7 +434,10 @@ pmpstart(struct cam_periph *periph, unio
 
if (softc-restart) {
softc-restart = 0;
-   softc-state = min(softc-state, PMP_STATE_PRECONFIG);
+   if (softc-pm_pid == 0x37261095 || softc-pm_pid == 0x38261095)
+   softc-state = min(softc-state, PMP_STATE_PM_QUIRKS_1);
+   else
+   softc-state = min(softc-state, PMP_STATE_PRECONFIG);
}
/* Fetch user wanted device speed. */
if (softc-state == PMP_STATE_RESET ||
@@ -457,6 +467,32 @@ pmpstart(struct cam_periph *periph, unio
  pmp_default_timeout * 1000);
ata_pm_read_cmd(ataio, 2, 15);
break;
+
+   case PMP_STATE_PM_QUIRKS_1:
+   case PMP_STATE_PM_QUIRKS_3:
+   cam_fill_ataio(ataio,
+ pmp_retry_count,
+ pmpdone,
+ /*flags*/CAM_DIR_NONE,
+ 0,
+ /*data_ptr*/NULL,
+ /*dxfer_len*/0,
+ pmp_default_timeout * 1000);
+   ata_pm_read_cmd(ataio, 129, 15);
+   break;
+
+   case PMP_STATE_PM_QUIRKS_2:
+   cam_fill_ataio(ataio,
+ pmp_retry_count,
+ pmpdone,
+ /*flags*/CAM_DIR_NONE,
+ 0,
+ /*data_ptr*/NULL,
+ /*dxfer_len*/0,
+ pmp_default_timeout * 1000);
+   ata_pm_write_cmd(ataio, 129, 15, softc-caps  ~0x1);
+   break;
+
case PMP_STATE_PRECONFIG:
/* Get/update host SATA capabilities. */
bzero(cts, sizeof(cts));
@@ -466,6 +502,8 @@ pmpstart(struct cam_periph *periph, unio
xpt_action((union ccb *)cts);
if (cts.xport_specific.sata.valid  CTS_SATA_VALID_CAPS)
softc-caps = cts.xport_specific.sata.caps;
+   else
+   softc-caps = 0;
cam_fill_ataio(ataio,
  pmp_retry_count,
  pmpdone,
@@ -575,7 +613,10 @@ pmpdone(struct cam_periph *periph, union
if (softc-restart) {
softc-restart = 0;
xpt_release_ccb(done_ccb);
-   softc-state = min(softc-state, PMP_STATE_PRECONFIG);
+   if (softc-pm_pid == 0x37261095 || softc-pm_pid == 0x38261095)
+   softc-state = min(softc-state, PMP_STATE_PM_QUIRKS_1);
+   else
+   softc-state = min(softc-state, PMP_STATE_PRECONFIG);
xpt_schedule(periph, priority);
return;
}
@@ -618,10 +659,48 @@ pmpdone(struct cam_periph *periph, union
printf(%s%d: %d fan-out ports\n,
periph-periph_name, periph-unit_number,
softc-pm_ports);
+   if (softc-pm_pid == 0x37261095 || softc-pm_pid == 0x38261095)
+   softc-state = PMP_STATE_PM_QUIRKS_1;
+   else
+   softc-state = 

svn commit: r250509 - head/usr.sbin/vidcontrol

2013-05-11 Thread Eitan Adler
Author: eadler
Date: Sat May 11 13:32:38 2013
New Revision: 250509
URL: http://svnweb.freebsd.org/changeset/base/250509

Log:
  The M_VESA_MODE_MAX is latest valid mode - not the first invalid.
  Permit its use in vidcontrol -i
  
  PR:   bin/119483
  Submitted by: Dan Lukes d...@obluda.cz
  Arrival-Date: Wed Jan 09 10:30:01 UTC 2008
  Reviewed by:  ed
  MFC after:3 days

Modified:
  head/usr.sbin/vidcontrol/vidcontrol.c

Modified: head/usr.sbin/vidcontrol/vidcontrol.c
==
--- head/usr.sbin/vidcontrol/vidcontrol.c   Sat May 11 13:21:31 2013
(r250508)
+++ head/usr.sbin/vidcontrol/vidcontrol.c   Sat May 11 13:32:38 2013
(r250509)
@@ -959,7 +959,7 @@ show_mode_info(void)
printf(---
   ---\n);
 
-   for (mode = 0; mode  M_VESA_MODE_MAX; ++mode) {
+   for (mode = 0; mode = M_VESA_MODE_MAX; ++mode) {
_info.vi_mode = mode;
if (ioctl(0, CONS_MODEINFO, _info))
continue;
___
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: r250510 - head

2013-05-11 Thread Antoine Brodin
Author: antoine
Date: Sat May 11 13:44:11 2013
New Revision: 250510
URL: http://svnweb.freebsd.org/changeset/base/250510

Log:
  Add compile_et to kerberos bootstrap tools.
  This makes it possible to build a regular world on a host without kerberos.
  
  PR:   conf/178421
  Submitted by: Garrett Cooper
  MFC after:1 month

Modified:
  head/Makefile.inc1

Modified: head/Makefile.inc1
==
--- head/Makefile.inc1  Sat May 11 13:32:38 2013(r250509)
+++ head/Makefile.inc1  Sat May 11 13:44:11 2013(r250510)
@@ -1176,7 +1176,8 @@ _kerberos5_bootstrap_tools= \
kerberos5/lib/libroken \
kerberos5/lib/libvers \
kerberos5/tools/asn1_compile \
-   kerberos5/tools/slc
+   kerberos5/tools/slc \
+   usr.bin/compile_et
 .endif
 
 #  Please document (add comment) why something is in 'bootstrap-tools'.
___
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: r250511 - in head: usr.bin/gcore usr.sbin/bsdinstall/distextract usr.sbin/bsdinstall/distfetch usr.sbin/bsdinstall/partedit

2013-05-11 Thread Antoine Brodin
Author: antoine
Date: Sat May 11 13:46:05 2013
New Revision: 250511
URL: http://svnweb.freebsd.org/changeset/base/250511

Log:
  Add some missing DPADD.

Modified:
  head/usr.bin/gcore/Makefile
  head/usr.sbin/bsdinstall/distextract/Makefile
  head/usr.sbin/bsdinstall/distfetch/Makefile
  head/usr.sbin/bsdinstall/partedit/Makefile

Modified: head/usr.bin/gcore/Makefile
==
--- head/usr.bin/gcore/Makefile Sat May 11 13:44:11 2013(r250510)
+++ head/usr.bin/gcore/Makefile Sat May 11 13:46:05 2013(r250511)
@@ -3,7 +3,7 @@
 
 PROG=  gcore
 SRCS=  elfcore.c gcore.c
-DPADD= ${LIBUTIL}
+DPADD= ${LIBSBUF} ${LIBUTIL}
 LDADD= -lsbuf -lutil
 
 WARNS?=1

Modified: head/usr.sbin/bsdinstall/distextract/Makefile
==
--- head/usr.sbin/bsdinstall/distextract/Makefile   Sat May 11 13:44:11 
2013(r250510)
+++ head/usr.sbin/bsdinstall/distextract/Makefile   Sat May 11 13:46:05 
2013(r250511)
@@ -2,6 +2,7 @@
 
 BINDIR= /usr/libexec/bsdinstall
 PROG=  distextract
+DPADD= ${LIBARCHIVE} ${LIBNCURSESW} ${LIBDIALOG} ${LIBM}
 LDADD= -larchive -lncursesw -ldialog -lm
 
 WARNS?=6

Modified: head/usr.sbin/bsdinstall/distfetch/Makefile
==
--- head/usr.sbin/bsdinstall/distfetch/Makefile Sat May 11 13:44:11 2013
(r250510)
+++ head/usr.sbin/bsdinstall/distfetch/Makefile Sat May 11 13:46:05 2013
(r250511)
@@ -2,6 +2,7 @@
 
 BINDIR= /usr/libexec/bsdinstall
 PROG=  distfetch
+DPADD= ${LIBFETCH} ${LIBNCURSESW} ${LIBDIALOG} ${LIBM}
 LDADD= -lfetch -lncursesw -ldialog -lm
 
 WARNS?=6

Modified: head/usr.sbin/bsdinstall/partedit/Makefile
==
--- head/usr.sbin/bsdinstall/partedit/Makefile  Sat May 11 13:44:11 2013
(r250510)
+++ head/usr.sbin/bsdinstall/partedit/Makefile  Sat May 11 13:46:05 2013
(r250511)
@@ -5,6 +5,7 @@ PROG=   partedit
 LINKS= ${BINDIR}/partedit ${BINDIR}/autopart \
${BINDIR}/partedit ${BINDIR}/scriptedpart
 SYMLINKS= ${BINDIR}/partedit /usr/sbin/sade
+DPADD= ${LIBGEOM} ${LIBNCURSESW} ${LIBUTIL} ${LIBDIALOG} ${LIBM}
 LDADD= -lgeom -lncursesw -lutil -ldialog -lm
 
 PARTEDIT_ARCH= ${MACHINE}
___
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: r250411 - in head/sys: conf kern sys

2013-05-11 Thread Attilio Rao
On Fri, May 10, 2013 at 3:52 PM, John Baldwin j...@freebsd.org wrote:
 On Thursday, May 09, 2013 4:56:33 pm Marcel Moolenaar wrote:

 On May 9, 2013, at 9:46 AM, Attilio Rao atti...@freebsd.org wrote:

  On Thu, May 9, 2013 at 6:28 PM, Marcel Moolenaar mar...@freebsd.org
 wrote:
  Author: marcel
  Date: Thu May  9 16:28:18 2013
  New Revision: 250411
  URL: http://svnweb.freebsd.org/changeset/base/250411
 
  Log:
   Add option WITNESS_NO_VNODE to suppress printing LORs between VNODE
   locks. To support this, VNODE locks are created with the LK_IS_VNODE
   flag. This flag is propagated down using the LO_IS_VNODE flag.
 
   Note that WITNESS still records the LOR. Only the printing and the
   optional entering into the kernel debugger is bypassed with the
   WITNESS_NO_VNODE option.
 
  This is the wrong way to deal with such problem and I avoided to do
  something like that on purpose.

 I disagree. We have known LOR messages between VNODE locks that
 pollute the console and so far we haven't fixed the root cause
 in some form or shape. Silencing this known case is good to
 maximize the attention LORs need to be given while still have
 witness involved to catch locking problems with vnodes that are
 of a different nature.

 
  The way to fix this is to implement LK_NOWITNESS on a per-lock basis
  into lockmgr, propagate the same concept to the vn_lock() (which
  should be basically done automatically) and finally identify the
  false-positive case and commit for them explicitely LK_NOWITNESS on a
  per-call basis, explaining in detail why the single case reported is a
  false-positive.

 This is worse. You want witness involved.

 Well, I disagree with both of you a bit.  I mostly agree with Attilio in
 that the committed change is a really large sledgehammer.  If we want to
 ignore all LORs for a large number of locks in the system we might as well
 remove WITNESS altogether.  However, I think LK_NOWITNESS is also too large
 of a sledgehammer for this as well.  AFAIK there are two vnode-related LORs
 that I can think of:

At this point I think that my e-mail is completely ambiguous because
what I'm proposing is the same way we shut down specific LOR with
mutexes using mtx_lock_flags().
I don't really understand what are you objecting about.

Attilio


--
Peace can only be achieved by understanding - A. Einstein
___
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: r250411 - in head/sys: conf kern sys

2013-05-11 Thread Attilio Rao
On Fri, May 10, 2013 at 9:33 PM, John Baldwin j...@freebsd.org wrote:
 On Friday, May 10, 2013 2:51:20 pm Marcel Moolenaar wrote:

 On May 10, 2013, at 9:11 AM, John Baldwin j...@freebsd.org wrote:

  On Friday, May 10, 2013 11:46:54 am Marcel Moolenaar wrote:
 
  2) vnode locks from a local filesystem that report a LOR with a devfs
   vnode.  Typical reports are either ufs - devfs or in some cases
   ufs - devfs - ufs.  As with 1), I would much rather tag the
   offending location than to disable all WITNESS checking on vnode locks.
 
  With more file system types in use, this will get mixed up with the
  other file systems and noise you get is rather severe. It is a big
  problem for us at Juniper.
 
  Note, it is very specific that the second lock is always devfs.  I think
  that points to this being isolated to a few specific places, not a generic
  ordering problem.

 Alas, that's not the case. These LORs are reported between ufs and unionfs,
 or ufs and isofs, etc. It's not just between something and devfs.

 Ugh, I have only seen them with devfs so had presumed them to be more
 localized (and thus more easily targeted).  In that case your change
 may be as fine-grained as we can get.  I would also like to still keep
 WITNESS checking between vnode locks and other lock types, and LK_NOWITNESS
 would remove that, so between your change and Attilio's approach I do
 prefer yours.

 I'm not sure the only options we have are to ignore the problem
 or implement a general fix. If we set out to silence witness for
 the known false positives then it's ok to handle them on a case
 by case basis. We'll see patterns soon enough and then re-code
 the solutions in terms of those patterns. If we're lucky we see
 a single general solution, but if not, then it's fine to have a
 handful of special case. The worse we can do is not address it
 at all.

 I was assuming that the reversals were far more specific, and knowing about
 other false positives like the dirhash one, I want a generic way to do more
 fine-grained marking of false positives.  If there were only a few places we
 would need to mark to fix the reversals you see, then I would prefer the
 suspend/resume approach for your case.  However, the reversals you are masking
 sound too widespread to support that.

The solution to this is what I proposed: pass down a LK_NOWITNESS for
instances where you don't want to check for witness.
This is per lock-call.
You localize the fix to the instance you want to shut down and you
skip witness for every false-positive.
When you commit the LK_NOWITNESS you mention explicitely the reason
why the reported LOR is a false positive so it is also documented on
svn.

I still don't understand what you are objecting. Marcel objections'
were completely no-sense (Don't want to involve Witness) but at least
I expect some decent one by you.

Attilio


--
Peace can only be achieved by understanding - A. Einstein
___
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: r250411 - in head/sys: conf kern sys

2013-05-11 Thread Attilio Rao
On Sat, May 11, 2013 at 4:34 PM, Attilio Rao atti...@freebsd.org wrote:
 On Fri, May 10, 2013 at 9:33 PM, John Baldwin j...@freebsd.org wrote:
 On Friday, May 10, 2013 2:51:20 pm Marcel Moolenaar wrote:

 On May 10, 2013, at 9:11 AM, John Baldwin j...@freebsd.org wrote:

  On Friday, May 10, 2013 11:46:54 am Marcel Moolenaar wrote:
 
  2) vnode locks from a local filesystem that report a LOR with a devfs
   vnode.  Typical reports are either ufs - devfs or in some cases
   ufs - devfs - ufs.  As with 1), I would much rather tag the
   offending location than to disable all WITNESS checking on vnode locks.
 
  With more file system types in use, this will get mixed up with the
  other file systems and noise you get is rather severe. It is a big
  problem for us at Juniper.
 
  Note, it is very specific that the second lock is always devfs.  I think
  that points to this being isolated to a few specific places, not a generic
  ordering problem.

 Alas, that's not the case. These LORs are reported between ufs and unionfs,
 or ufs and isofs, etc. It's not just between something and devfs.

 Ugh, I have only seen them with devfs so had presumed them to be more
 localized (and thus more easily targeted).  In that case your change
 may be as fine-grained as we can get.  I would also like to still keep
 WITNESS checking between vnode locks and other lock types, and LK_NOWITNESS
 would remove that, so between your change and Attilio's approach I do
 prefer yours.

 I'm not sure the only options we have are to ignore the problem
 or implement a general fix. If we set out to silence witness for
 the known false positives then it's ok to handle them on a case
 by case basis. We'll see patterns soon enough and then re-code
 the solutions in terms of those patterns. If we're lucky we see
 a single general solution, but if not, then it's fine to have a
 handful of special case. The worse we can do is not address it
 at all.

 I was assuming that the reversals were far more specific, and knowing about
 other false positives like the dirhash one, I want a generic way to do more
 fine-grained marking of false positives.  If there were only a few places we
 would need to mark to fix the reversals you see, then I would prefer the
 suspend/resume approach for your case.  However, the reversals you are 
 masking
 sound too widespread to support that.

 The solution to this is what I proposed: pass down a LK_NOWITNESS for
 instances where you don't want to check for witness.
 This is per lock-call.
 You localize the fix to the instance you want to shut down and you
 skip witness for every false-positive.
 When you commit the LK_NOWITNESS you mention explicitely the reason
 why the reported LOR is a false positive so it is also documented on
 svn.

 I still don't understand what you are objecting. Marcel objections'
 were completely no-sense (Don't want to involve Witness) but at least
 I expect some decent one by you.

And finally, all the logic to do this seems already implemented. I
didn't recall that.
See this:
http://svnweb.freebsd.org/base?view=revisionrevision=179554

What is missing is similar logic for sx(9) and rwlock(9). We can
simply add _flags() variant of such functions if we need it.
But Marcel's approach is not helping on that side as well, if not for
a simple red-herring effect.

Attilio


--
Peace can only be achieved by understanding - A. Einstein
___
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: r250512 - head/tools/regression/file/dup

2013-05-11 Thread Jilles Tjoelker
Author: jilles
Date: Sat May 11 15:45:44 2013
New Revision: 250512
URL: http://svnweb.freebsd.org/changeset/base/250512

Log:
  Add missing argument to fcntl(F_DUPFD) in regression test.

Modified:
  head/tools/regression/file/dup/dup.c

Modified: head/tools/regression/file/dup/dup.c
==
--- head/tools/regression/file/dup/dup.cSat May 11 13:46:05 2013
(r250511)
+++ head/tools/regression/file/dup/dup.cSat May 11 15:45:44 2013
(r250512)
@@ -144,9 +144,13 @@ main(int __unused argc, char __unused *a
printf(ok %d - dup2(2) didn't clear close-on-exec\n, test);
 
/* Does fcntl(F_DUPFD) work? */
-   if ((fd2 = fcntl(fd1, F_DUPFD))  0)
+   if ((fd2 = fcntl(fd1, F_DUPFD, 10))  0)
err(1, fcntl(F_DUPFD));
-   printf(ok %d - fcntl(F_DUPFD) works\n, ++test);
+   if (fd2  10)
+   printf(not ok %d - fcntl(F_DUPFD) returned wrong fd %d\n,
+   ++test, fd2);
+   else
+   printf(ok %d - fcntl(F_DUPFD) works\n, ++test);
 
/* Was close-on-exec cleared? */
++test;
___
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: r250518 - head/sys/netpfil/pf

2013-05-11 Thread Gleb Smirnoff
Author: glebius
Date: Sat May 11 17:57:52 2013
New Revision: 250518
URL: http://svnweb.freebsd.org/changeset/base/250518

Log:
  Invalid creatorid is always EINVAL, not only when we are in verbose mode.

Modified:
  head/sys/netpfil/pf/if_pfsync.c

Modified: head/sys/netpfil/pf/if_pfsync.c
==
--- head/sys/netpfil/pf/if_pfsync.c Sat May 11 16:47:42 2013
(r250517)
+++ head/sys/netpfil/pf/if_pfsync.c Sat May 11 17:57:52 2013
(r250518)
@@ -408,9 +408,10 @@ pfsync_state_import(struct pfsync_state 
 
PF_RULES_RASSERT();
 
-   if (sp-creatorid == 0  V_pf_status.debug = PF_DEBUG_MISC) {
-   printf(%s: invalid creator id: %08x\n, __func__,
-   ntohl(sp-creatorid));
+   if (sp-creatorid == 0) {
+   if (V_pf_status.debug = PF_DEBUG_MISC)
+   printf(%s: invalid creator id: %08x\n, __func__,
+   ntohl(sp-creatorid));
return (EINVAL);
}
 
___
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: r250519 - head/sys/netpfil/pf

2013-05-11 Thread Gleb Smirnoff
Author: glebius
Date: Sat May 11 17:58:26 2013
New Revision: 250519
URL: http://svnweb.freebsd.org/changeset/base/250519

Log:
  Fix DIOCADDSTATE operation.

Modified:
  head/sys/netpfil/pf/pf_ioctl.c

Modified: head/sys/netpfil/pf/pf_ioctl.c
==
--- head/sys/netpfil/pf/pf_ioctl.c  Sat May 11 17:57:52 2013
(r250518)
+++ head/sys/netpfil/pf/pf_ioctl.c  Sat May 11 17:58:26 2013
(r250519)
@@ -1691,7 +1691,7 @@ relock_DIOCKILLSTATES:
PF_RULES_RLOCK();
error = pfsync_state_import_ptr(sp, PFSYNC_SI_IOCTL);
PF_RULES_RUNLOCK();
-   }
+   } else
error = EOPNOTSUPP;
break;
}
___
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: r250520 - head/sys/vm

2013-05-11 Thread Alan Cox
Author: alc
Date: Sat May 11 18:01:41 2013
New Revision: 250520
URL: http://svnweb.freebsd.org/changeset/base/250520

Log:
  To reduce the amount of arithmetic performed in the various radix tree
  functions, reverse the numbering scheme for the levels.  The highest
  numbered level in the tree now appears near the root instead of the leaves.
  
  Sponsored by: EMC / Isilon Storage Division

Modified:
  head/sys/vm/vm_radix.c

Modified: head/sys/vm/vm_radix.c
==
--- head/sys/vm/vm_radix.c  Sat May 11 17:58:26 2013(r250519)
+++ head/sys/vm/vm_radix.c  Sat May 11 18:01:41 2013(r250520)
@@ -91,7 +91,7 @@ __FBSDID($FreeBSD$);
 
 /* Returns one unit associated with specified level. */
 #defineVM_RADIX_UNITLEVEL(lev) 
\
-   ((vm_pindex_t)1  ((VM_RADIX_LIMIT - (lev)) * VM_RADIX_WIDTH))
+   ((vm_pindex_t)1  ((lev) * VM_RADIX_WIDTH))
 
 struct vm_radix_node {
vm_pindex_t  rn_owner;  /* Owner of record. */
@@ -150,8 +150,7 @@ static __inline int
 vm_radix_slot(vm_pindex_t index, uint16_t level)
 {
 
-   return ((index  ((VM_RADIX_LIMIT - level) * VM_RADIX_WIDTH)) 
-   VM_RADIX_MASK);
+   return ((index  (level * VM_RADIX_WIDTH))  VM_RADIX_MASK);
 }
 
 /* Trims the key after the specified level. */
@@ -161,9 +160,9 @@ vm_radix_trimkey(vm_pindex_t index, uint
vm_pindex_t ret;
 
ret = index;
-   if (level  VM_RADIX_LIMIT) {
-   ret = (VM_RADIX_LIMIT - level) * VM_RADIX_WIDTH;
-   ret = (VM_RADIX_LIMIT - level) * VM_RADIX_WIDTH;
+   if (level  0) {
+   ret = level * VM_RADIX_WIDTH;
+   ret = level * VM_RADIX_WIDTH;
}
return (ret);
 }
@@ -234,7 +233,7 @@ vm_radix_keydiff(vm_pindex_t index1, vm_
__func__, (uintmax_t)index1));
 
index1 ^= index2;
-   for (clev = 0;; clev++)
+   for (clev = VM_RADIX_LIMIT;; clev--)
if (vm_radix_slot(index1, clev) != 0)
return (clev);
 }
@@ -247,8 +246,8 @@ static __inline boolean_t
 vm_radix_keybarr(struct vm_radix_node *rnode, vm_pindex_t idx)
 {
 
-   if (rnode-rn_clev  0) {
-   idx = vm_radix_trimkey(idx, rnode-rn_clev - 1);
+   if (rnode-rn_clev  VM_RADIX_LIMIT) {
+   idx = vm_radix_trimkey(idx, rnode-rn_clev + 1);
return (idx != rnode-rn_owner);
}
return (FALSE);
@@ -384,7 +383,7 @@ vm_radix_insert(struct vm_radix *rtree, 
__func__, (uintmax_t)index);
clev = vm_radix_keydiff(m-pindex, index);
tmp = vm_radix_node_get(vm_radix_trimkey(index,
-   clev - 1), 2, clev);
+   clev + 1), 2, clev);
*parentp = tmp;
vm_radix_addpage(tmp, index, clev, page);
vm_radix_addpage(tmp, m-pindex, clev, m);
@@ -408,7 +407,7 @@ vm_radix_insert(struct vm_radix *rtree, 
 */
newind = rnode-rn_owner;
clev = vm_radix_keydiff(newind, index);
-   tmp = vm_radix_node_get(vm_radix_trimkey(index, clev - 1), 2,
+   tmp = vm_radix_node_get(vm_radix_trimkey(index, clev + 1), 2,
clev);
*parentp = tmp;
vm_radix_addpage(tmp, index, clev, page);
@@ -545,7 +544,7 @@ ascend:
 */
goto ascend;
 descend:
-   KASSERT(rnode-rn_clev  VM_RADIX_LIMIT,
+   KASSERT(rnode-rn_clev  0,
(vm_radix_lookup_ge: pushing leaf's parent));
KASSERT(tos  VM_RADIX_LIMIT,
(vm_radix_lookup_ge: stack overflow));
@@ -658,7 +657,7 @@ ascend:
 */
goto ascend;
 descend:
-   KASSERT(rnode-rn_clev  VM_RADIX_LIMIT,
+   KASSERT(rnode-rn_clev  0,
(vm_radix_lookup_le: pushing leaf's parent));
KASSERT(tos  VM_RADIX_LIMIT,
(vm_radix_lookup_le: stack overflow));
___
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: r250521 - head/sys/netpfil/pf

2013-05-11 Thread Gleb Smirnoff
Author: glebius
Date: Sat May 11 18:03:36 2013
New Revision: 250521
URL: http://svnweb.freebsd.org/changeset/base/250521

Log:
  Better debug message.

Modified:
  head/sys/netpfil/pf/pf.c

Modified: head/sys/netpfil/pf/pf.c
==
--- head/sys/netpfil/pf/pf.cSat May 11 18:01:41 2013(r250520)
+++ head/sys/netpfil/pf/pf.cSat May 11 18:03:36 2013(r250521)
@@ -1102,7 +1102,7 @@ pf_state_insert(struct pfi_kif *kif, str
if (cur != NULL) {
PF_HASHROW_UNLOCK(ih);
if (V_pf_status.debug = PF_DEBUG_MISC) {
-   printf(pf: state insert failed: 
+   printf(pf: state ID collision: 
id: %016llx creatorid: %08x\n,
(unsigned long long)be64toh(s-id),
ntohl(s-creatorid));
___
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: r250522 - head/sys/netpfil/pf

2013-05-11 Thread Gleb Smirnoff
Author: glebius
Date: Sat May 11 18:06:51 2013
New Revision: 250522
URL: http://svnweb.freebsd.org/changeset/base/250522

Log:
  Return meaningful error code from pf_state_key_attach() and
  pf_state_insert().

Modified:
  head/sys/netpfil/pf/pf.c

Modified: head/sys/netpfil/pf/pf.c
==
--- head/sys/netpfil/pf/pf.cSat May 11 18:03:36 2013(r250521)
+++ head/sys/netpfil/pf/pf.cSat May 11 18:06:51 2013(r250522)
@@ -915,7 +915,7 @@ keyattach:
uma_zfree(V_pf_state_key_z, sk);
if (idx == PF_SK_STACK)
pf_detach_state(s);
-   return (-1);/* collision! */
+   return (EEXIST); /* collision! */
}
}
PF_HASHROW_UNLOCK(ih);
@@ -1072,6 +1072,7 @@ pf_state_insert(struct pfi_kif *kif, str
 {
struct pf_idhash *ih;
struct pf_state *cur;
+   int error;
 
KASSERT(TAILQ_EMPTY(sks-states[0])  TAILQ_EMPTY(sks-states[1]),
(%s: sks not pristine, __func__));
@@ -1090,8 +1091,8 @@ pf_state_insert(struct pfi_kif *kif, str
s-creatorid = V_pf_status.hostid;
}
 
-   if (pf_state_key_attach(skw, sks, s))
-   return (-1);
+   if ((error = pf_state_key_attach(skw, sks, s)) != 0)
+   return (error);
 
ih = V_pf_idhash[PF_IDHASH(s)];
PF_HASHROW_LOCK(ih);
@@ -1108,7 +1109,7 @@ pf_state_insert(struct pfi_kif *kif, str
ntohl(s-creatorid));
}
pf_detach_state(s);
-   return (-1);
+   return (EEXIST);
}
LIST_INSERT_HEAD(ih-states, s, entry);
/* One for keys, one for ID hash. */
___
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: r250527 - head/bin/sh

2013-05-11 Thread Jilles Tjoelker
Author: jilles
Date: Sat May 11 20:51:00 2013
New Revision: 250527
URL: http://svnweb.freebsd.org/changeset/base/250527

Log:
  sh: Remove linked list of stack marks.
  
  The linked list of stack marks may cause problems if the allocation stack is
  used between an exception and a higher-level popstackmark(), as it may then
  touch a stack mark that is local to a function which has returned.
  
  Also, the adjustment compares to a pointer passed to realloc(), which is
  undefined behaviour.
  
  Instead of adjusting stack marks when reallocating stack blocks, ensure that
  such an adjustment is never necessary by fixing a small piece of memory in
  place at a stack mark. This also simplifies the code.
  
  To avoid the problems reported in bin/175922, it remains necessary to call
  setstackmark() after popstackmark() if the stack mark remains in use.

Modified:
  head/bin/sh/memalloc.c
  head/bin/sh/memalloc.h

Modified: head/bin/sh/memalloc.c
==
--- head/bin/sh/memalloc.c  Sat May 11 19:46:15 2013(r250526)
+++ head/bin/sh/memalloc.c  Sat May 11 20:51:00 2013(r250527)
@@ -124,7 +124,6 @@ struct stack_block {
 #define SPACE(sp)  ((char*)(sp) + ALIGN(sizeof(struct stack_block)))
 
 static struct stack_block *stackp;
-static struct stackmark *markp;
 char *stacknxt;
 int stacknleft;
 char *sstrend;
@@ -186,8 +185,9 @@ setstackmark(struct stackmark *mark)
mark-stackp = stackp;
mark-stacknxt = stacknxt;
mark-stacknleft = stacknleft;
-   mark-marknext = markp;
-   markp = mark;
+   /* Ensure this block stays in place. */
+   if (stackp != NULL  stacknxt == SPACE(stackp))
+   stalloc(1);
 }
 
 
@@ -197,7 +197,6 @@ popstackmark(struct stackmark *mark)
struct stack_block *sp;
 
INTOFF;
-   markp = mark-marknext;
while (stackp != mark-stackp) {
sp = stackp;
stackp = sp-prev;
@@ -229,7 +228,6 @@ growstackblock(int min)
int oldlen;
struct stack_block *sp;
struct stack_block *oldstackp;
-   struct stackmark *xmark;
 
if (min  stacknleft)
min = stacknleft;
@@ -254,18 +252,6 @@ growstackblock(int min)
stacknxt = SPACE(sp);
stacknleft = newlen - (stacknxt - (char*)sp);
sstrend = stacknxt + stacknleft;
-
-   /*
-* Stack marks pointing to the start of the old block
-* must be relocated to point to the new block
-*/
-   xmark = markp;
-   while (xmark != NULL  xmark-stackp == oldstackp) {
-   xmark-stackp = stackp;
-   xmark-stacknxt = stacknxt;
-   xmark-stacknleft = stacknleft;
-   xmark = xmark-marknext;
-   }
INTON;
} else {
newlen -= ALIGN(sizeof(struct stack_block));

Modified: head/bin/sh/memalloc.h
==
--- head/bin/sh/memalloc.h  Sat May 11 19:46:15 2013(r250526)
+++ head/bin/sh/memalloc.h  Sat May 11 20:51:00 2013(r250527)
@@ -39,7 +39,6 @@ struct stackmark {
struct stack_block *stackp;
char *stacknxt;
int stacknleft;
-struct stackmark *marknext;
 };
 
 
___
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: r250528 - head/usr.sbin/wpa/wpa_supplicant

2013-05-11 Thread Eitan Adler
Author: eadler
Date: Sat May 11 20:55:14 2013
New Revision: 250528
URL: http://svnweb.freebsd.org/changeset/base/250528

Log:
  Teach wpa_supplicant to properly compute wireless signal strength.
  
  PR:   bin/170631
  Submitted by: Daan Vreeken d...@vitsch.nl
  Reviewed by:  adrian

Modified:
  head/usr.sbin/wpa/wpa_supplicant/driver_freebsd.c

Modified: head/usr.sbin/wpa/wpa_supplicant/driver_freebsd.c
==
--- head/usr.sbin/wpa/wpa_supplicant/driver_freebsd.c   Sat May 11 20:51:00 
2013(r250527)
+++ head/usr.sbin/wpa/wpa_supplicant/driver_freebsd.c   Sat May 11 20:55:14 
2013(r250528)
@@ -693,6 +693,11 @@ wpa_driver_bsd_add_scan_entry(struct wpa
 result-caps = sr-isr_capinfo;
 result-qual = sr-isr_rssi;
 result-noise = sr-isr_noise;
+/*
+ * the rssi value reported by the kernel is in 0.5dB steps relative to
+ * the reported noise floor. see ieee80211_node.h for details.
+ */
+result-level = sr-isr_rssi / 2 + sr-isr_noise;
 
 pos = (u8 *)(result + 1);
 
___
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: r250528 - head/usr.sbin/wpa/wpa_supplicant

2013-05-11 Thread Adrian Chadd
oh thank _god_ someone fixed this.

It's been bugging me for about a year, but I've been too slack (hah!)
to figure out why.

Next, teaching it about whether to prefer 2ghz or 5ghz APs..



Adrian

On 11 May 2013 13:55, Eitan Adler ead...@freebsd.org wrote:
 Author: eadler
 Date: Sat May 11 20:55:14 2013
 New Revision: 250528
 URL: http://svnweb.freebsd.org/changeset/base/250528

 Log:
   Teach wpa_supplicant to properly compute wireless signal strength.

   PR:   bin/170631
   Submitted by: Daan Vreeken d...@vitsch.nl
   Reviewed by:  adrian

 Modified:
   head/usr.sbin/wpa/wpa_supplicant/driver_freebsd.c

 Modified: head/usr.sbin/wpa/wpa_supplicant/driver_freebsd.c
 ==
 --- head/usr.sbin/wpa/wpa_supplicant/driver_freebsd.c   Sat May 11 20:51:00 
 2013(r250527)
 +++ head/usr.sbin/wpa/wpa_supplicant/driver_freebsd.c   Sat May 11 20:55:14 
 2013(r250528)
 @@ -693,6 +693,11 @@ wpa_driver_bsd_add_scan_entry(struct wpa
  result-caps = sr-isr_capinfo;
  result-qual = sr-isr_rssi;
  result-noise = sr-isr_noise;
 +/*
 + * the rssi value reported by the kernel is in 0.5dB steps relative 
 to
 + * the reported noise floor. see ieee80211_node.h for details.
 + */
 +result-level = sr-isr_rssi / 2 + sr-isr_noise;

  pos = (u8 *)(result + 1);

___
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: r250530 - head/tools/regression/file/dup

2013-05-11 Thread Jilles Tjoelker
Author: jilles
Date: Sat May 11 22:13:24 2013
New Revision: 250530
URL: http://svnweb.freebsd.org/changeset/base/250530

Log:
  Add simple testcases for fcntl(F_DUP2FD_CLOEXEC).

Modified:
  head/tools/regression/file/dup/dup.c

Modified: head/tools/regression/file/dup/dup.c
==
--- head/tools/regression/file/dup/dup.cSat May 11 21:23:55 2013
(r250529)
+++ head/tools/regression/file/dup/dup.cSat May 11 22:13:24 2013
(r250530)
@@ -32,6 +32,12 @@
  * Test #18: check if fcntl(F_DUPFD_CLOEXEC) works.
  * Test #19: check if fcntl(F_DUPFD_CLOEXEC) set close-on-exec flag for duped
  *   fd.
+ * Test #20: check if fcntl(F_DUP2FD_CLOEXEC) works.
+ * Test #21: check if fcntl(F_DUP2FD_CLOEXEC) returned a fd we asked for.
+ * Test #22: check if fcntl(F_DUP2FD_CLOEXEC) set close-on-exec flag for duped
+ *   fd.
+ * Test #23: check if fcntl(F_DUP2FD_CLOEXEC) to a fd  current maximum number
+ *   of open files limit work.
  */
 
 #include sys/types.h
@@ -68,7 +74,7 @@ main(int __unused argc, char __unused *a
 
orgfd = getafile();
 
-   printf(1..19\n);
+   printf(1..23\n);
 
/* If dup(2) ever work? */
if ((fd1 = dup(orgfd))  0)
@@ -251,5 +257,45 @@ main(int __unused argc, char __unused *a
printf(ok %d - fcntl(F_DUPFD_CLOEXEC) set close-on-exec\n,
test);
 
+   /* If fcntl(F_DUP2FD_CLOEXEC) ever work? */
+   if ((fd2 = fcntl(fd1, F_DUP2FD_CLOEXEC, fd1 + 1))  0)
+   err(1, fcntl(F_DUP2FD_CLOEXEC));
+   printf(ok %d - fcntl(F_DUP2FD_CLOEXEC) works\n, ++test);
+
+   /* Do we get the right fd? */
+   ++test;
+   if (fd2 != fd1 + 1)
+   printf(
+   no ok %d - fcntl(F_DUP2FD_CLOEXEC) didn't give us the 
right fd\n,
+   test);
+   else
+   printf(ok %d - fcntl(F_DUP2FD_CLOEXEC) returned a correct 
fd\n,
+   test);
+
+   /* Was close-on-exec set? */
+   ++test;
+   if (fcntl(fd2, F_GETFD) != FD_CLOEXEC)
+   printf(
+   not ok %d - fcntl(F_DUP2FD_CLOEXEC) didn't set 
close-on-exec\n,
+   test);
+   else
+   printf(ok %d - fcntl(F_DUP2FD_CLOEXEC) set close-on-exec\n,
+   test);
+
+   /*
+* It is unclear what F_DUP2FD_CLOEXEC should do when duplicating a
+* file descriptor onto itself.
+*/
+
+   ++test;
+   if (getrlimit(RLIMIT_NOFILE, rlp)  0)
+   err(1, getrlimit);
+   if ((fd2 = fcntl(fd1, F_DUP2FD_CLOEXEC, rlp.rlim_cur + 1)) = 0)
+   printf(not ok %d - fcntl(F_DUP2FD_CLOEXEC) bypassed NOFILE 
limit\n,
+   test);
+   else
+   printf(ok %d - fcntl(F_DUP2FD_CLOEXEC) didn't bypass NOFILE 
limit\n,
+   test);
+
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


svn commit: r250531 - head/sys/arm/arm

2013-05-11 Thread Tim Kientzle
Author: kientzle
Date: Sat May 11 22:32:43 2013
New Revision: 250531
URL: http://svnweb.freebsd.org/changeset/base/250531

Log:
  Don't use the old stack-walking code with
  EABI ARM kernels or clang-compiled ARM kernels.
  
  This fixes a crash seen in clang-compiled ARM
  kernels that include WITNESS.
  
  This code could be easily modified to walk the stack
  for current clang-generated code (including EABI)
  but Andrew Turner has raised concerns that the
  stack frame currently emitted by clang isn't actually
  required by EABI so such a change might cause problems
  down the road.
  
  In case anyone wants to experiment, the change
  to support current clang-compiled kernels
  involves simply setting FR_RFP=0 and FR_SCP=1.

Modified:
  head/sys/arm/arm/stack_machdep.c

Modified: head/sys/arm/arm/stack_machdep.c
==
--- head/sys/arm/arm/stack_machdep.cSat May 11 22:13:24 2013
(r250530)
+++ head/sys/arm/arm/stack_machdep.cSat May 11 22:32:43 2013
(r250531)
@@ -39,17 +39,16 @@ __FBSDID($FreeBSD$);
 static void
 stack_capture(struct stack *st, u_int32_t *frame)
 {
+#if !defined(__ARM_EABI__)  !defined(__clang__)
vm_offset_t callpc;
 
-   stack_zero(st);
-   while (1) {
-   if (!INKERNEL(frame))
-   break;
+   while (INKERNEL(frame)) {
callpc = frame[FR_SCP];
if (stack_put(st, callpc) == -1)
break;
frame = (u_int32_t *)(frame[FR_RFP]);
}
+#endif
 }
 
 void
@@ -63,6 +62,7 @@ stack_save_td(struct stack *st, struct t
panic(stack_save_td: running);
 
frame = (u_int32_t *)td-td_pcb-un_32.pcb32_r11;
+   stack_zero(st);
stack_capture(st, frame);
 }
 
@@ -72,5 +72,6 @@ stack_save(struct stack *st)
u_int32_t *frame;
 
frame = (u_int32_t *)__builtin_frame_address(0);
+   stack_zero(st);
stack_capture(st, frame);
 }
___
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: r250532 - head/sys/cam/ata

2013-05-11 Thread Eitan Adler
Author: eadler
Date: Sat May 11 23:13:49 2013
New Revision: 250532
URL: http://svnweb.freebsd.org/changeset/base/250532

Log:
  Intel's 320-series and 510-series SSDs advertise 512-byte sectors
  sizes for both logical and physical. Add ADA_Q_4K quirks
  for both.
  
  PR:   kern/178040
  Submitted by: Jeremy Chadwick j...@koitsu.org

Modified:
  head/sys/cam/ata/ata_da.c

Modified: head/sys/cam/ata/ata_da.c
==
--- head/sys/cam/ata/ata_da.c   Sat May 11 22:32:43 2013(r250531)
+++ head/sys/cam/ata/ata_da.c   Sat May 11 23:13:49 2013(r250532)
@@ -350,6 +350,14 @@ static struct ada_quirk_entry ada_quirk_
},
{
/*
+* Intel 320 Series SSDs
+* 4k optimised  trim only works in 4k requests + 4k aligned
+*/
+   { T_DIRECT, SIP_MEDIA_FIXED, *, INTEL SSDSA2CW*, * },
+   /*quirks*/ADA_Q_4K
+   },
+   {
+   /*
 * Intel 330 Series SSDs
 * 4k optimised  trim only works in 4k requests + 4k aligned
 * Submitted by: Steven Hartland 
steven.hartl...@multiplay.co.uk
@@ -360,6 +368,14 @@ static struct ada_quirk_entry ada_quirk_
},
{
/*
+* Intel 510 Series SSDs
+* 4k optimised  trim only works in 4k requests + 4k aligned
+*/
+   { T_DIRECT, SIP_MEDIA_FIXED, *, INTEL SSDSC2MH*, * },
+   /*quirks*/ADA_Q_4K
+   },
+   {
+   /*
 * OCZ Deneva R Series SSDs
 * 4k optimised  trim only works in 4k requests + 4k aligned
 * Submitted by: Steven Hartland 
steven.hartl...@multiplay.co.uk
___
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: r250533 - in head: etc/periodic/daily tools/build/mk

2013-05-11 Thread Eitan Adler
Author: eadler
Date: Sat May 11 23:55:43 2013
New Revision: 250533
URL: http://svnweb.freebsd.org/changeset/base/250533

Log:
  Unconditionally install 210.backup-aliases as many MTAs other than
  sendmail support the use of /etc/aliases.
  
  PR:   conf/176098
  Submitted by: ak
  MFC after:2 weeks

Modified:
  head/etc/periodic/daily/Makefile
  head/tools/build/mk/OptionalObsoleteFiles.inc

Modified: head/etc/periodic/daily/Makefile
==
--- head/etc/periodic/daily/MakefileSat May 11 23:13:49 2013
(r250532)
+++ head/etc/periodic/daily/MakefileSat May 11 23:55:43 2013
(r250533)
@@ -6,6 +6,7 @@ FILES=  100.clean-disks \
110.clean-tmps \
120.clean-preserve \
200.backup-passwd \
+   210.backup-aliases \
330.news \
400.status-disks \
401.status-graid \
@@ -51,7 +52,6 @@ FILES+=   140.clean-rwho \
 
 .if ${MK_SENDMAIL} != no
 FILES+=150.clean-hoststat \
-   210.backup-aliases \
440.status-mailq \
460.status-mail-rejects \
500.queuerun

Modified: head/tools/build/mk/OptionalObsoleteFiles.inc
==
--- head/tools/build/mk/OptionalObsoleteFiles.inc   Sat May 11 23:13:49 
2013(r250532)
+++ head/tools/build/mk/OptionalObsoleteFiles.inc   Sat May 11 23:55:43 
2013(r250533)
@@ -4017,7 +4017,6 @@ OLD_FILES+=usr/share/man/man8/rtquery.8.
 
 .if ${MK_SENDMAIL} == no
 OLD_FILES+=etc/periodic/daily/150.clean-hoststat
-OLD_FILES+=etc/periodic/daily/210.backup-aliases
 OLD_FILES+=etc/periodic/daily/440.status-mailq
 OLD_FILES+=etc/periodic/daily/460.status-mail-rejects
 OLD_FILES+=etc/periodic/daily/500.queuerun
___
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: r250535 - head/usr.sbin/bsdconfig/share/media

2013-05-11 Thread Devin Teske
Author: dteske
Date: Sun May 12 00:39:25 2013
New Revision: 250535
URL: http://svnweb.freebsd.org/changeset/base/250535

Log:
  Whitespace.

Modified:
  head/usr.sbin/bsdconfig/share/media/any.subr

Modified: head/usr.sbin/bsdconfig/share/media/any.subr
==
--- head/usr.sbin/bsdconfig/share/media/any.subrSun May 12 00:35:57 
2013(r250534)
+++ head/usr.sbin/bsdconfig/share/media/any.subrSun May 12 00:39:25 
2013(r250535)
@@ -72,8 +72,8 @@ f_media_get_type()
local menu_list size
 
menu_list=
-   '1 $msg_cd_dvd''$msg_install_from_a_freebsd_cd_dvd'
-   '2 $msg_ftp'   '$msg_install_from_an_ftp_server'
+   '1 $msg_cd_dvd''$msg_install_from_a_freebsd_cd_dvd'
+   '2 $msg_ftp'   '$msg_install_from_an_ftp_server'
'3 $msg_ftp_passive'
'$msg_install_from_an_ftp_server_thru_firewall'
'4 $msg_http'  '$msg_install_from_an_ftp_server_thru_proxy'
___
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: r250536 - head/usr.sbin/bsdconfig/share/packages

2013-05-11 Thread Devin Teske
Author: dteske
Date: Sun May 12 00:40:49 2013
New Revision: 250536
URL: http://svnweb.freebsd.org/changeset/base/250536

Log:
  Comments.

Modified:
  head/usr.sbin/bsdconfig/share/packages/categories.subr

Modified: head/usr.sbin/bsdconfig/share/packages/categories.subr
==
--- head/usr.sbin/bsdconfig/share/packages/categories.subr  Sun May 12 
00:39:25 2013(r250535)
+++ head/usr.sbin/bsdconfig/share/packages/categories.subr  Sun May 12 
00:40:49 2013(r250536)
@@ -99,7 +99,11 @@ f_category_desc_set()
  MAIN
 
 #
-# Load descriptions for package categories
+# Load descriptions for package categories. Note that we don't internationalize
+# category names because this would be confusing for people used to that browse
+# the FTP mirrors or are otherwise familiar with an interface that does not
+# provide internationalized names. The descriptions can be used to provide i18n
+# users a description of the non-i18n category name.
 #
 f_category() { f_category_desc_set $1 $2; }
 f_category All   $msg_all_available_packages_in_all_categories
___
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: r250537 - in head/usr.sbin/bsdconfig: include share/packages

2013-05-11 Thread Devin Teske
Author: dteske
Date: Sun May 12 00:44:40 2013
New Revision: 250537
URL: http://svnweb.freebsd.org/changeset/base/250537

Log:
  Remove duplicated string.

Modified:
  head/usr.sbin/bsdconfig/include/messages.subr
  head/usr.sbin/bsdconfig/share/packages/categories.subr

Modified: head/usr.sbin/bsdconfig/include/messages.subr
==
--- head/usr.sbin/bsdconfig/include/messages.subr   Sun May 12 00:40:49 
2013(r250536)
+++ head/usr.sbin/bsdconfig/include/messages.subr   Sun May 12 00:44:40 
2013(r250537)
@@ -36,7 +36,6 @@ msg_accept_continue=Accept/Continue
 msg_accessibility_desc=Ports to help disabled users.
 msg_afterstep_desc=Ports to support the AfterStep window manager.
 msg_all=All
-msg_all_available_packages_in_all_categories=All available packages in all 
categories.
 msg_all_desc=All available packages in all categories.
 msg_always_try_sudo_when_run_as=Always try sudo(8) when run as %s
 msg_arabic_desc=Ported software for Arab countries.

Modified: head/usr.sbin/bsdconfig/share/packages/categories.subr
==
--- head/usr.sbin/bsdconfig/share/packages/categories.subr  Sun May 12 
00:40:49 2013(r250536)
+++ head/usr.sbin/bsdconfig/share/packages/categories.subr  Sun May 12 
00:44:40 2013(r250537)
@@ -106,7 +106,7 @@ f_category_desc_set()
 # users a description of the non-i18n category name.
 #
 f_category() { f_category_desc_set $1 $2; }
-f_category All   $msg_all_available_packages_in_all_categories
+f_category All   $msg_all_desc
 f_category accessibility $msg_accessibility_desc
 f_category afterstep $msg_afterstep_desc
 f_category arabic$msg_arabic_desc
___
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: r250538 - in head/usr.sbin/bsdconfig: include share/packages

2013-05-11 Thread Devin Teske
Author: dteske
Date: Sun May 12 00:46:18 2013
New Revision: 250538
URL: http://svnweb.freebsd.org/changeset/base/250538

Log:
  Fix i18n violations in the package management module. A few words like
  `packages', `installed', and `selected' were not internationalized.

Modified:
  head/usr.sbin/bsdconfig/include/messages.subr
  head/usr.sbin/bsdconfig/share/packages/index.subr
  head/usr.sbin/bsdconfig/share/packages/packages.subr

Modified: head/usr.sbin/bsdconfig/include/messages.subr
==
--- head/usr.sbin/bsdconfig/include/messages.subr   Sun May 12 00:44:40 
2013(r250537)
+++ head/usr.sbin/bsdconfig/include/messages.subr   Sun May 12 00:46:18 
2013(r250538)
@@ -164,6 +164,7 @@ msg_install_from_an_ftp_server_thru_prox
 msg_install_from_the_existing_filesystem=Install from the existing filesystem
 msg_install_over_nfs=Install over NFS
 msg_installed=Installed
+msg_installed_lc=installed
 msg_installed_desc=Leave package as-is, installed
 msg_invalid_gateway_ipv4_address_specified=Invalid gateway IPv4 address 
specified
 msg_invalid_hostname_value=Invalid hostname value
@@ -248,6 +249,7 @@ msg_options=Options
 msg_options_editor=Options Editor
 msg_other=other
 msg_package_temp=Package Temp
+msg_packages=packages
 msg_page_of_npages=(Page %s of %s)
 msg_palm_desc=Software support for the Palm(tm) series.
 msg_parallel_desc=Applications dealing with parallelism in computing.
@@ -318,6 +320,7 @@ msg_secure_mode_requires_x11=Secure-mod
 msg_security_desc=System security software.
 msg_select=Select
 msg_select_a_site_thats_close=Select a site that's close!
+msg_selected=selected
 msg_server_error_when_requesting_url=Server error when requesting %s, you 
could try an other server
 msg_shells_desc=Various shells (tcsh, bash, etc).
 msg_singapore=Singapore

Modified: head/usr.sbin/bsdconfig/share/packages/index.subr
==
--- head/usr.sbin/bsdconfig/share/packages/index.subr   Sun May 12 00:44:40 
2013(r250537)
+++ head/usr.sbin/bsdconfig/share/packages/index.subr   Sun May 12 00:46:18 
2013(r250538)
@@ -112,6 +112,7 @@ f_index_read()
export msg_no_description_provided
export msg_all msg_all_desc
export VALID_VARNAME_CHARS
+   export msg_packages
 
eval $( debug= f_getvar $var_to_get | awk -F'|' '
function asorti(src, dest)
@@ -140,12 +141,13 @@ f_index_read()
# cached (also acting as a visitation indicator)
if ( ENVIRON[_index_page_ varcat _1] )
cat = cat *
-   printf '\''%s'\'' '\''%s packages'\'' '\''%s'\''\n,
+   printf '\''%s'\'' '\''%s  packages '\'' '\''%s'\''\n,
   cat, npkgs, desc
}
BEGIN {
valid_chars = ENVIRON[VALID_VARNAME_CHARS]
default_desc = ENVIRON[msg_no_description_provided]
+   packages = ENVIRON[msg_packages]
tpkgs = 0
prefix = 
}
@@ -221,11 +223,12 @@ f_index_extract_pages()
debug= f_getvar $var_to_get | awk -F'|' \
-v cat=$category \
-v pagesize=$pagesize \
-   -v var_basename=$var_basename '
+   -v var_basename=$var_basename \
+   -v i18n_all=$msg_all '
BEGIN { n = page = 0 }
/'\''/{ gsub(/'\''/, '\''\\'\'\'') }
{
-   if ( cat !~ /(^$|^All$)/  $7 !~ \
+   if ( cat !~ (^$|^ i18n_all $)  $7 !~ \
 (^|[[:space:]]) cat ([[:space:]]|$) ) next
starting_new_page = (n++ == (pagesize * page))
if ( starting_new_page )

Modified: head/usr.sbin/bsdconfig/share/packages/packages.subr
==
--- head/usr.sbin/bsdconfig/share/packages/packages.subrSun May 12 
00:44:40 2013(r250537)
+++ head/usr.sbin/bsdconfig/share/packages/packages.subrSun May 12 
00:46:18 2013(r250538)
@@ -78,20 +78,28 @@ f_package_accent_category_menu()
while [ $# -gt 0 ]; do
cat=${1%\*} desc=${2%%; *} help=$3
shift 3 # cat/desc/help
-   f_str2varname ${cat# } varcat
 
-   # Add an asterisk to the category if its index has been cached
-   f_isset _index_page_${varcat}_1  cat=$cat*
+   cat=${cat# } # Trim leading space inserted by sort-method
+   f_str2varname $cat varcat
 
# Add number of installed packages for this category (if any)
n=0
-   debug= f_getvar _${varcat}_ninstalled n 
-   [ $n -ge 1 ]  desc=$desc; $n installed
+   case $cat in
+

Re: svn commit: r250411 - in head/sys: conf kern sys

2013-05-11 Thread Jeff Roberson

On Thu, 9 May 2013, Marcel Moolenaar wrote:


Author: marcel
Date: Thu May  9 16:28:18 2013
New Revision: 250411
URL: http://svnweb.freebsd.org/changeset/base/250411

Log:
 Add option WITNESS_NO_VNODE to suppress printing LORs between VNODE
 locks. To support this, VNODE locks are created with the LK_IS_VNODE
 flag. This flag is propagated down using the LO_IS_VNODE flag.

 Note that WITNESS still records the LOR. Only the printing and the
 optional entering into the kernel debugger is bypassed with the
 WITNESS_NO_VNODE option.


I'm replying to the original commit because the resulting thread got way 
out of hand.  We need to all take a deep breath and take a pragmatic 
approach to solving the problem at hand.


Let me first say I understand the utility here as this is also coming up 
in my organization.  Test, and users, do not want to see erroneous warning 
messages.  I understand that.  Let's find a solution.


Secondly, I think this project has grown too far for us to commit changes 
like this without some focused discussion.  We need to be more mindful of 
the size of the impact and the number of people who are interested in a 
particular area.  I'm not picking on you Marcel because this sort of thing 
has been coming up lately and we have all been guilty of it from time to 
time.  There are more companies and individuals than ever trying to push 
work into the repository and we're having some growing pains.


I am intimately familiar with the problems that lead to these erroneous 
witness messages as I have tracked down many of them and am even 
responsible for the code that generates them in some cases.  Let me first 
outline a handful of generic problems.  The root cause is that witness can 
not determine the real order between two locks due to relationships too 
complex to describe with a pair of strings.


One example, which has been brought up, is the hierarchical nature of 
vnode locks.  This impacts vnodes within one filesystem but it also 
involves vnodes between two different filesystems as you cross mount 
points.  We can construct perfectly valid and deadlock free chains of 
mount points that have two different filesystem types in different orders 
which will LOR at the boundaries.  We already skip duplicates to avoid 
this problem within each filesystem.  We need to skip cross-filesystem 
duplicates, most desirably at the few specific places where this happens. 
This problem comes up especially for devfs because we lock devvps while 
file vnodes are locked but we lock devfs directories after the rootfs lock 
when crossing mountpoints in lookup.


A second example, is locks of a fundamentally different type that have a 
complex ordering relationship.  For example, a vnode lock may be acquired 
after a buf lock belonging to the parent's directory block.  A cg buf lock 
may be acquired after any file buf lock.  Here we want to ignore 
interactions between these two specific types at this particular location 
but not others as they may be unsafe.


The third example, is a complex locking pattern with shared locks as 
presented by dirhash.  We are seeing a similar pattern develop in the vm 
where we are going to use an exclusive object lock to protect pages or a 
shared object lock + a page lock.  The semantics only get more complex as 
we push for more scalability.  I expect to see more of these patterns 
develop.


None of these problems can be solved with names alone.  So far we've 
just lived with the warnings and we're no longer willing to accept that. 
What we need is a solution that blesses the specific instances and the 
specific lock classes involved without silencing legitimate warnings that 
may only occur after new code is added.  For example, it may be safe to 
add a sx lock around some vnode code but you may not notice that you LOR 
if you silence all witness warnings related to the vnode lock site.


I believe that the perfect solution would be a mechanism that could teach 
witness about and enforce these specific relationships.  However, that may 
be computationally prohibitive and too complex to code.  A more reasonable 
option would be to bless the specific relationships at the specific call 
sites.  Turning all witness off at particular sites or with particular 
types renders important infrastructure useless for very large functional 
areas.  It's also important to distinguish between squelching the error 
message from eliminating the other state that is saved at lock sites.


We already have lock names and types.  What I would propose we do is make 
the type 'vnode' for all vnodes and 'buf' for all bufs with the names used 
for the specific filesystems.  Then you could specify a DUPOK that 
automatically blesses any filesystem to filesystem related LORs.  In this 
way witness still records the call sites and unrelated LORs or panics 
still have the acquisition information.  You could eventually unwind this 
to only DUPOK at the specific currently known places that we 

svn commit: r250539 - head/usr.sbin/bsdconfig/share/packages

2013-05-11 Thread Devin Teske
Author: dteske
Date: Sun May 12 00:50:18 2013
New Revision: 250539
URL: http://svnweb.freebsd.org/changeset/base/250539

Log:
  Comment.

Modified:
  head/usr.sbin/bsdconfig/share/packages/categories.subr

Modified: head/usr.sbin/bsdconfig/share/packages/categories.subr
==
--- head/usr.sbin/bsdconfig/share/packages/categories.subr  Sun May 12 
00:46:18 2013(r250538)
+++ head/usr.sbin/bsdconfig/share/packages/categories.subr  Sun May 12 
00:50:18 2013(r250539)
@@ -100,7 +100,7 @@ f_category_desc_set()
 
 #
 # Load descriptions for package categories. Note that we don't internationalize
-# category names because this would be confusing for people used to that browse
+# category names because this would be confusing for people used to browsing
 # the FTP mirrors or are otherwise familiar with an interface that does not
 # provide internationalized names. The descriptions can be used to provide i18n
 # users a description of the non-i18n category name.
___
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: r250540 - head/sys/contrib/octeon-sdk

2013-05-11 Thread Warner Losh
Author: imp
Date: Sun May 12 01:29:18 2013
New Revision: 250540
URL: http://svnweb.freebsd.org/changeset/base/250540

Log:
  Turns out that there really isn't an RTC chip on this board, at all.

Modified:
  head/sys/contrib/octeon-sdk/cvmx-rtc.h

Modified: head/sys/contrib/octeon-sdk/cvmx-rtc.h
==
--- head/sys/contrib/octeon-sdk/cvmx-rtc.h  Sun May 12 00:50:18 2013
(r250539)
+++ head/sys/contrib/octeon-sdk/cvmx-rtc.h  Sun May 12 01:29:18 2013
(r250540)
@@ -90,9 +90,6 @@ static inline cvmx_rtc_options_t cvmx_rt
case CVMX_BOARD_TYPE_EBH3000:
case CVMX_BOARD_TYPE_CN3010_EVB_HS5:
case CVMX_BOARD_TYPE_EBH5200:
-#if defined(OCTEON_VENDOR_GEFES)
-   case CVMX_BOARD_TYPE_CUST_W63XX:
-#endif
supported = CVMX_RTC_READ | CVMX_RTC_WRITE | CVMX_RTC_TIME_CAL;
break;
 
___
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: r250544 - head/sys/amd64/compile head/sys/amd64/conf head/sys/arm/compile head/sys/arm/conf head/sys/i386/compile head/sys/i386/conf head/sys/ia64/compile head/sys/ia64/conf head/sys/mi...

2013-05-11 Thread Peter Wemm
Author: peter
Date: Sun May 12 01:53:47 2013
New Revision: 250544
URL: http://svnweb.freebsd.org/changeset/base/250544

Log:
  Tidy up some CVS workarounds.

Deleted:
  head/sys/amd64/compile/.cvsignore
  head/sys/amd64/conf/.cvsignore
  head/sys/arm/compile/.cvsignore
  head/sys/arm/conf/.cvsignore
  head/sys/i386/compile/.cvsignore
  head/sys/i386/conf/.cvsignore
  head/sys/ia64/compile/.cvsignore
  head/sys/ia64/conf/.cvsignore
  head/sys/mips/compile/.cvsignore
  head/sys/mips/conf/.cvsignore
  head/sys/pc98/compile/.cvsignore
  head/sys/pc98/conf/.cvsignore
  head/sys/powerpc/compile/.cvsignore
  head/sys/powerpc/conf/.cvsignore
  head/sys/sparc64/compile/.cvsignore
  head/sys/sparc64/conf/.cvsignore
  head/tools/regression/geom_uzip/.cvsignore

Changes in other areas also in this revision:
Deleted:
  stable/2.0.5/sys/compile/.keep_me
  stable/2.1/sys/compile/.keep_me
  stable/2.2/sys/compile/.keep_me
  stable/3/sys/compile/.keep_me
  stable/4/sys/compile/.keep_me
  stable/5/crypto/openssh/.cvsignore
  stable/5/crypto/openssh/openbsd-compat/.cvsignore
  stable/5/crypto/openssh/scard/.cvsignore
  stable/5/sys/alpha/compile/.cvsignore
  stable/5/sys/amd64/compile/.cvsignore
  stable/5/sys/i386/compile/.cvsignore
  stable/5/sys/ia64/compile/.cvsignore
  stable/5/sys/pc98/compile/.cvsignore
  stable/5/sys/sparc64/compile/.cvsignore
  stable/5/tools/regression/geom_uzip/.cvsignore
  stable/6/sys/alpha/compile/.cvsignore
  stable/6/sys/alpha/conf/.cvsignore
  stable/6/sys/amd64/compile/.cvsignore
  stable/6/sys/amd64/conf/.cvsignore
  stable/6/sys/arm/compile/.cvsignore
  stable/6/sys/arm/conf/.cvsignore
  stable/6/sys/i386/compile/.cvsignore
  stable/6/sys/i386/conf/.cvsignore
  stable/6/sys/ia64/compile/.cvsignore
  stable/6/sys/ia64/conf/.cvsignore
  stable/6/sys/pc98/compile/.cvsignore
  stable/6/sys/pc98/conf/.cvsignore
  stable/6/sys/powerpc/compile/.cvsignore
  stable/6/sys/powerpc/conf/.cvsignore
  stable/6/sys/sparc64/compile/.cvsignore
  stable/6/sys/sparc64/conf/.cvsignore
  stable/6/tools/regression/geom_uzip/.cvsignore
  stable/7/sys/amd64/compile/.cvsignore
  stable/7/sys/amd64/conf/.cvsignore
  stable/7/sys/arm/compile/.cvsignore
  stable/7/sys/arm/conf/.cvsignore
  stable/7/sys/i386/compile/.cvsignore
  stable/7/sys/i386/conf/.cvsignore
  stable/7/sys/ia64/compile/.cvsignore
  stable/7/sys/ia64/conf/.cvsignore
  stable/7/sys/pc98/compile/.cvsignore
  stable/7/sys/pc98/conf/.cvsignore
  stable/7/sys/powerpc/compile/.cvsignore
  stable/7/sys/powerpc/conf/.cvsignore
  stable/7/sys/sparc64/compile/.cvsignore
  stable/7/sys/sparc64/conf/.cvsignore
  stable/7/sys/sun4v/compile/.cvsignore
  stable/7/sys/sun4v/conf/.cvsignore
  stable/7/tools/regression/geom_uzip/.cvsignore
  stable/8/sys/amd64/compile/.cvsignore
  stable/8/sys/amd64/conf/.cvsignore
  stable/8/sys/arm/compile/.cvsignore
  stable/8/sys/arm/conf/.cvsignore
  stable/8/sys/i386/compile/.cvsignore
  stable/8/sys/i386/conf/.cvsignore
  stable/8/sys/ia64/compile/.cvsignore
  stable/8/sys/ia64/conf/.cvsignore
  stable/8/sys/mips/compile/.cvsignore
  stable/8/sys/mips/conf/.cvsignore
  stable/8/sys/pc98/compile/.cvsignore
  stable/8/sys/pc98/conf/.cvsignore
  stable/8/sys/powerpc/compile/.cvsignore
  stable/8/sys/powerpc/conf/.cvsignore
  stable/8/sys/sparc64/compile/.cvsignore
  stable/8/sys/sparc64/conf/.cvsignore
  stable/8/sys/sun4v/compile/.cvsignore
  stable/8/sys/sun4v/conf/.cvsignore
  stable/8/tools/regression/geom_uzip/.cvsignore
  stable/9/sys/amd64/compile/.cvsignore
  stable/9/sys/amd64/conf/.cvsignore
  stable/9/sys/arm/compile/.cvsignore
  stable/9/sys/arm/conf/.cvsignore
  stable/9/sys/i386/compile/.cvsignore
  stable/9/sys/i386/conf/.cvsignore
  stable/9/sys/ia64/compile/.cvsignore
  stable/9/sys/ia64/conf/.cvsignore
  stable/9/sys/mips/compile/.cvsignore
  stable/9/sys/mips/conf/.cvsignore
  stable/9/sys/pc98/compile/.cvsignore
  stable/9/sys/pc98/conf/.cvsignore
  stable/9/sys/powerpc/compile/.cvsignore
  stable/9/sys/powerpc/conf/.cvsignore
  stable/9/sys/sparc64/compile/.cvsignore
  stable/9/sys/sparc64/conf/.cvsignore
  stable/9/tools/regression/geom_uzip/.cvsignore
___
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: r250545 - head/usr.sbin/newsyslog

2013-05-11 Thread Mark Johnston
Author: markj
Date: Sun May 12 01:58:04 2013
New Revision: 250545
URL: http://svnweb.freebsd.org/changeset/base/250545

Log:
  Some filesystems (NFS in particular) do not fill out the d_type field when
  returning directory entries through readdir(3). In this case we need to
  obtain the file type ourselves; otherwise newsyslog -t will not be able to
  find archived log files and will fail to both delete old log files and to
  do interval-based rotations properly.
  
  Reported by:  jilles
  Reviewed by:  jilles
  MFC after:2 weeks

Modified:
  head/usr.sbin/newsyslog/newsyslog.c

Modified: head/usr.sbin/newsyslog/newsyslog.c
==
--- head/usr.sbin/newsyslog/newsyslog.c Sun May 12 01:53:47 2013
(r250544)
+++ head/usr.sbin/newsyslog/newsyslog.c Sun May 12 01:58:04 2013
(r250545)
@@ -1452,16 +1452,27 @@ oldlog_entry_compare(const void *a, cons
  * tm if this is the case; otherwise return false.
  */
 static int
-validate_old_timelog(const struct dirent *dp, const char *logfname, struct tm 
*tm)
+validate_old_timelog(int fd, const struct dirent *dp, const char *logfname,
+struct tm *tm)
 {
+   struct stat sb;
size_t logfname_len;
char *s;
int c;
 
logfname_len = strlen(logfname);
 
-   if (dp-d_type != DT_REG)
-   return (0);
+   if (dp-d_type != DT_REG) {
+   /*
+* Some filesystems (e.g. NFS) don't fill out the d_type field
+* and leave it set to DT_UNKNOWN; in this case we must obtain
+* the file type ourselves.
+*/
+   if (dp-d_type != DT_UNKNOWN ||
+   fstatat(fd, dp-d_name, sb, AT_SYMLINK_NOFOLLOW) != 0 ||
+   !S_ISREG(sb.st_mode))
+   return (0);
+   }
/* Ignore everything but files with our logfile prefix. */
if (strncmp(dp-d_name, logfname, logfname_len) != 0)
return (0);
@@ -1547,7 +1558,7 @@ delete_oldest_timelog(const struct conf_
err(1, Cannot open log directory '%s', dir);
dir_fd = dirfd(dirp);
while ((dp = readdir(dirp)) != NULL) {
-   if (validate_old_timelog(dp, logfname, tm) == 0)
+   if (validate_old_timelog(dir_fd, dp, logfname, tm) == 0)
continue;
 
/*
@@ -2312,10 +2323,10 @@ mtime_old_timelog(const char *file)
dir_fd = dirfd(dirp);
/* Open the archive dir and find the most recent archive of logfname. */
while ((dp = readdir(dirp)) != NULL) {
-   if (validate_old_timelog(dp, logfname, tm) == 0)
+   if (validate_old_timelog(dir_fd, dp, logfname, tm) == 0)
continue;
 
-   if (fstatat(dir_fd, logfname, sb, 0) == -1) {
+   if (fstatat(dir_fd, logfname, sb, AT_SYMLINK_NOFOLLOW) == -1) {
warn(Cannot stat '%s', file);
continue;
}
___
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: r250431 - head/usr.bin/xargs

2013-05-11 Thread Julian Elischer

On 5/10/13 3:21 AM, smc...@internode.on.net wrote:
  
  
On Fri 10/05/13 17:50 , Juli Mallett jmall...@freebsd.org sent:

Eitan,
  
Are other changes coming to xargs for which these style changes make

sense?  If not, I'd say that style changes which only adjust vertical
whitespace, especially those which mostly add vertical whitespace at
the start of functions with no local variables (which is one of the
most archaic and unusual things style(9) requires), are probably the
most gratuitous and silly style changes to make.  That doesn't even
rise to being a style change, it's just a whitespace change.  And I
really do believe that vertical whitespace changes are much, much
sillier than horizontal whitespace changes.
  
Juli, it seems we're bothered by the same thing here: that at least

some of the vertical white space requirements of style(9) are
silly and (rightly) widely ignored.  So I think we should change
the guide to fix this rather than damaging a lot of perfectly
readable code.
  
I'd like to emphasise that I'm not even slightly cranky at Eitan for

his commit since we committers are presumed to have agreed to follow
style(9) and he's just changing code to match the official style.  My
complaint is that the official style isn't useful in this small regard
and should be changed.
  

(Watch for standalone commits from people who used to be
very active developers who have recently hit the threshold for getting
commit bit reaper E-Mails.  They're fairly instructive in the art of
making occasional insignificant changes for the sake of making
changes.)
  
Well, I used to be a low activity developer and have transitioned to

being a very low activity developer, so I know the reaper and the
temptation of a quick fix to get it off your back.  However it's better
to let the reaper pester you than to make a low quality commit.  After
all, if you haven't anything new and interesting to add, there is always
that convenient list of bugs that could be fixed...


enters bikeshed. with green brush..

Most of the rules there are for a reason.. sometimes the reason is out 
dated.
The single blank line at the top (of a function, not a block) when 
there are no locals
has annoyed me sometimes but most of the other rules I've got to like 
and I'm loath to

change that one just for the sake of change.

  
Cheers,
  
Stephen.






___
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: r250550 - head/contrib/gcc

2013-05-11 Thread Pedro F. Giffuni
Author: pfg
Date: Sun May 12 03:36:28 2013
New Revision: 250550
URL: http://svnweb.freebsd.org/changeset/base/250550

Log:
  Update the gcc43 changelog.
  
  The issue solved in r250392 actually originated upstream and was
  fixed in upstream gcc43 branch in 2006/10/24 (under GPLv2).
  
  Register it in the appropriate ChangeLog for reference.
  
  MFC after:3 days

Modified:
  head/contrib/gcc/ChangeLog.gcc43

Modified: head/contrib/gcc/ChangeLog.gcc43
==
--- head/contrib/gcc/ChangeLog.gcc43Sun May 12 02:19:05 2013
(r250549)
+++ head/contrib/gcc/ChangeLog.gcc43Sun May 12 03:36:28 2013
(r250550)
@@ -182,6 +182,10 @@
 
* doc/invoke.texi: Document -mssse3/-mno-ssse3 switches.
 
+2006-10-22  H.J. Lu  hongjiu...@intel.com
+
+   * config/i386/tmmintrin.h: Remove the duplicated content.
+
 2006-10-21  Richard Guenther  rguent...@suse.de (r117932)
 
PR tree-optimization/3511
___
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: r250551 - in head/sys: conf kern sys

2013-05-11 Thread Jeff Roberson
Author: jeff
Date: Sun May 12 04:05:01 2013
New Revision: 250551
URL: http://svnweb.freebsd.org/changeset/base/250551

Log:
   - Add a new general purpose path-compressed radix trie which can be used
 with any structure containing a uint64_t index.  The tree code
 auto-generates type safe wrappers.
   - Eliminate the buf splay and replace it with pctrie.  This is not only
 significantly faster with large files but also allows for the possibility
 of shared locking.
  
  Reviewed by:alc, attilio
  Sponsored by:   EMC / Isilon Storage Division

Added:
  head/sys/kern/subr_pctrie.c   (contents, props changed)
  head/sys/sys/_pctrie.h
 - copied, changed from r249323, head/sys/vm/_vm_radix.h
  head/sys/sys/pctrie.h   (contents, props changed)
Modified:
  head/sys/conf/files
  head/sys/kern/vfs_subr.c
  head/sys/sys/buf.h
  head/sys/sys/bufobj.h

Modified: head/sys/conf/files
==
--- head/sys/conf/files Sun May 12 03:36:28 2013(r250550)
+++ head/sys/conf/files Sun May 12 04:05:01 2013(r250551)
@@ -2760,6 +2760,7 @@ kern/subr_module.cstandard
 kern/subr_msgbuf.c standard
 kern/subr_param.c  standard
 kern/subr_pcpu.c   standard
+kern/subr_pctrie.c standard
 kern/subr_power.c  standard
 kern/subr_prf.cstandard
 kern/subr_prof.c   standard

Added: head/sys/kern/subr_pctrie.c
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/kern/subr_pctrie.c Sun May 12 04:05:01 2013(r250551)
@@ -0,0 +1,705 @@
+/*
+ * Copyright (c) 2013 EMC Corp.
+ * Copyright (c) 2011 Jeffrey Roberson j...@freebsd.org
+ * Copyright (c) 2008 Mayur Shardul mayur.shar...@gmail.com
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ */
+
+/*
+ * Path-compressed radix trie implementation.
+ *
+ * The implementation takes into account the following rationale:
+ * - Size of the nodes should be as small as possible but still big enough
+ *   to avoid a large maximum depth for the trie.  This is a balance
+ *   between the necessity to not wire too much physical memory for the nodes
+ *   and the necessity to avoid too much cache pollution during the trie
+ *   operations.
+ * - There is not a huge bias toward the number of lookup operations over
+ *   the number of insert and remove operations.  This basically implies
+ *   that optimizations supposedly helping one operation but hurting the
+ *   other might be carefully evaluated.
+ * - On average not many nodes are expected to be fully populated, hence
+ *   level compression may just complicate things.
+ */
+
+#include sys/cdefs.h
+__FBSDID($FreeBSD$);
+
+#include opt_ddb.h
+
+#include sys/param.h
+#include sys/systm.h
+#include sys/kernel.h
+#include sys/pctrie.h
+
+#ifdef DDB
+#include ddb/ddb.h
+#endif
+
+/*
+ * These widths should allow the pointers to a node's children to fit within
+ * a single cache line.  The extra levels from a narrow width should not be
+ * a problem thanks to path compression.
+ */
+#ifdef __LP64__
+#definePCTRIE_WIDTH4
+#else
+#definePCTRIE_WIDTH3
+#endif
+
+#definePCTRIE_COUNT(1  PCTRIE_WIDTH)
+#definePCTRIE_MASK (PCTRIE_COUNT - 1)
+#definePCTRIE_LIMIT(howmany((sizeof(uint64_t) * NBBY), 
PCTRIE_WIDTH) - 1)
+
+/* Flag bits stored in node pointers. */
+#definePCTRIE_ISLEAF   0x1
+#definePCTRIE_FLAGS0x1
+#definePCTRIE_PAD  PCTRIE_FLAGS
+
+/* Returns one unit associated with specified 

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

2013-05-11 Thread Bruce Evans

On Fri, 10 May 2013, John Baldwin wrote:


On Thursday, May 09, 2013 11:05:46 pm Bruce Evans wrote:

On Mon, 6 May 2013, John Baldwin wrote:
...

static int
vn_ioctl(fp, com, data, active_cred, td)
struct file *fp;
u_long com;
void *data;
struct ucred *active_cred;
struct thread *td;
{
struct vnode *vp = fp-f_vnode;
struct vattr vattr;

switch (vp-v_type) {
case VREG:
case VDIR:
switch (com) {
case FIONREAD:
vn_lock(vp, LK_SHARED | LK_RETRY);
error = VOP_GETATTR(vp, vattr, active_cred);
VOP_UNLOCK(vp, 0);
if (!error)
*(int *)data = vattr.va_size - fp-f_offset;
return (error);
case FIONBIO:
case FIOASYNC:
return (0); /* XXX */
default:
return (VOP_IOCTL(vp, com, data, fp-f_flag,
active_cred, td));
}
default:
return (ENOTTY);
}
}

...

(The 'XXX' comment could perhaps be expanded to something along the lines of
'Allow fcntl() to toggle FNONBLOCK and FASYNC.')


Is that what it is about?  IIRC, upper layers do some partial handling
and then call lower layers to possibly do some more handling.  But here
and in some other places there is nothing more to be done.  No comment
is needed, but maybe the XXX's were reminders to clean up the layering.
FreeBSD has cleaned up the layering a bit, by using differnt fops for
different file types.


The problem is this code in fcntl() which I ran into when working on a
tutorial for writing character devices:

case F_SETFL:
error = fget_unlocked(fdp, fd, CAP_FCNTL, F_SETFL, fp, NULL);
if (error != 0)
break;
do {
tmp = flg = fp-f_flag;
tmp = ~FCNTLFLAGS;
tmp |= FFLAGS(arg  ~O_ACCMODE)  FCNTLFLAGS;
} while(atomic_cmpset_int(fp-f_flag, flg, tmp) == 0);
tmp = fp-f_flag  FNONBLOCK;
error = fo_ioctl(fp, FIONBIO, tmp, td-td_ucred, td);
if (error != 0) {
fdrop(fp, td);
break;
}
tmp = fp-f_flag  FASYNC;
error = fo_ioctl(fp, FIOASYNC, tmp, td-td_ucred, td);
if (error == 0) {
fdrop(fp, td);
break;
}
atomic_clear_int(fp-f_flag, FNONBLOCK);
tmp = 0;
(void)fo_ioctl(fp, FIONBIO, tmp, td-td_ucred, td);
fdrop(fp, td);
break;

Hmm, this seems to have the bug that if you had FNONBLOCK set and
tried to set FASYNC via fcntl() but FIOASYNC isn't supported,
FNONBLOCK is cleared.  It seems we should only clear FNONBLOCK
if it wasn't set in 'flg'.  I think this would fix that:


sys_socket.c mishandles this differently by voiding the result of
all fo_ioctls().  The above only assumes that since the first
fo_ioctl() for FIONBIO succeeded, the second one will too.

I now remember more about this bad code:
- it is still very broken for devices.  ioctls are inherently per-device,
   but file flags aren't even per-file -- they are per-file-descriptor
   -- so the device state becomes inconsistent with the file descriptor
   state if more than 1 fd is open on a device and any non-null change
   of the file flags is made using one of the fd's (applications might
   be able to keep the file flags fairly consistent by doing fcntl for
   all the fd's (including ones shared across processes), but the file
   flags would be at least transiently inconsistent.  Only the FNONBLOCK
   (O_NONBLOCK) and FASYNC (O_ASYNC) flags are passed down.  O_NONBLOCK
   works right for some devices because it is also passed to open() and
   read()/write() (so it will work right for ioctl() if the device
   driver ignores it then).  There are related not so bad cases for
   F_GETFL, F_GETOWN and F_SETOWN.  F_GETFL returns per-fd flags.  There
   are no per-fd ownerships, so F_GETOWN has to use an ioctl to fetch
   a non-per-fd ownership (the one set by F_SETOWN) which is at least
   consistently not per-fd.

Most drivers/file types are actually non-broken for FIONBIO and do nothing
except return 0 for it (I only grepped for FIONBIO; not for O_NONBLOCK
or FNONBLOCK).  This return is sometimes XXX'ed, but it really
shouldn't be.  Returning 0 and not doing anything means that the driver
supports O_NONBLOCK correctly (by checking it per-fd in the flag passed
to open() and read/write()).  It is the drivers that do something which
deserve an XXX.  The only broken ioctl routines for FIONBIO are now:
- subr_bus.c: devioctl()
- sys_socket.c: 

svn commit: r250553 - head/share/syscons/fonts

2013-05-11 Thread Eitan Adler
Author: eadler
Date: Sun May 12 04:34:55 2013
New Revision: 250553
URL: http://svnweb.freebsd.org/changeset/base/250553

Log:
  Add the letter 'x' to the font iso05-8x16.fnt
  
  PR:   169797
  Submitted by: Takefu tak...@airport.fm
  MFC after:3 days

Modified:
  head/share/syscons/fonts/iso04-wide-8x16.fnt

Modified: head/share/syscons/fonts/iso04-wide-8x16.fnt
==
--- head/share/syscons/fonts/iso04-wide-8x16.fntSun May 12 04:24:25 
2013(r250552)
+++ head/share/syscons/fonts/iso04-wide-8x16.fntSun May 12 04:34:55 
2013(r250553)
@@ -42,7 +42,7 @@ MS'@``.!@8!F9FQX;9FY@`X!@8!@8!@
 MP\/#``#9F9F9F9F9@``?,;QL;QGP``-YC
 M8V-C8V-^8/![QL;QL;?@8/WG-C8!@8/``
 M`'SP'`!L9\```P,##\,#`P,#`V'```QL;QL;QGL`
-M`,;QL;N?#@0``##P]O;V]O_9@``
+M`,;QL;N?#@0``##P]O;V]O_9@``QNY\.#A\[L8`
 M`,/#9F8\!@P,.#^Q@P8,#_@`.!@8'!P!@8
 M`X`!@8!@8!@8!@8`'`8!@8'AX8!@8`!VW```
 M
___
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: r250554 - head/lib/libc/gen

2013-05-11 Thread Sergey Kandaurov
Author: pluknet
Date: Sun May 12 05:54:58 2013
New Revision: 250554
URL: http://svnweb.freebsd.org/changeset/base/250554

Log:
  Typo.

Modified:
  head/lib/libc/gen/posix_spawn_file_actions_addopen.3

Modified: head/lib/libc/gen/posix_spawn_file_actions_addopen.3
==
--- head/lib/libc/gen/posix_spawn_file_actions_addopen.3Sun May 12 
04:34:55 2013(r250553)
+++ head/lib/libc/gen/posix_spawn_file_actions_addopen.3Sun May 12 
05:54:58 2013(r250554)
@@ -190,7 +190,7 @@ is equal to
 .Fa newfildes
 (clearing
 .Dv FD_CLOEXEC ) .
-A future update of the Standard is expected to require this behavior,
+A future update of the Standard is expected to require this behavior.
 .Sh HISTORY
 The
 .Fn posix_spawn_file_actions_addopen ,
___
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