svn commit: r228017 - head/share/man/man4

2011-11-26 Thread Glen Barber
Author: gjb (doc committer)
Date: Sun Nov 27 06:55:57 2011
New Revision: 228017
URL: http://svn.freebsd.org/changeset/base/228017

Log:
  Remove a seemingly unnecessary [1] ellipsis from netmap.4.
  
  Spotted by:   manlint [1]

Modified:
  head/share/man/man4/netmap.4

Modified: head/share/man/man4/netmap.4
==
--- head/share/man/man4/netmap.4Sun Nov 27 02:32:08 2011
(r228016)
+++ head/share/man/man4/netmap.4Sun Nov 27 06:55:57 2011
(r228017)
@@ -155,7 +155,6 @@ Some macros support the access to object
 region. In particular:
 .Bd -literal
 struct netmap_if *nifp;
-...
 struct netmap_ring *txring = NETMAP_TXRING(nifp, i);
 struct netmap_ring *rxring = NETMAP_RXRING(nifp, i);
 int i = txring->slot[txring->cur].buf_idx;
___
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: r227873 - head/usr.bin/procstat

2011-11-26 Thread Bruce Evans

On Sat, 26 Nov 2011, Pawel Jakub Dawidek wrote:


On Wed, Nov 23, 2011 at 11:10:47AM -0800, m...@freebsd.org wrote:

I don't know if there's a style preference for 0x%lx versus %#lx,
though, or a preference for a different type for the print (uintmax_t,
for example).  There is probably a preference for using u_long rather
than unsigned long, since it's shorter.


u_long is preferred in kernel, in userland unsigned long is better.


u_long is preferred in FreeBSD code in both, but portable code cannot
use it.  Portable code is very rare.

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: r228016 - head/sys/netinet

2011-11-26 Thread Lawrence Stewart
Author: lstewart
Date: Sun Nov 27 02:32:08 2011
New Revision: 228016
URL: http://svn.freebsd.org/changeset/base/228016

Log:
  Plug a TCP reassembly UMA zone leak introduced in r226113 by only using the
  backup stack queue entry when the zone is exhausted, otherwise we leak a zone
  allocation each time we plug a hole in the reassembly queue.
  
  Reported by:  many on freebsd-stable@ (thread: "TCP Reassembly Issues")
  Tested by:many on freebsd-stable@ (thread: "TCP Reassembly Issues")
  Reviewed by:  bz (very brief sanity check)
  MFC after:3 days

Modified:
  head/sys/netinet/tcp_reass.c

Modified: head/sys/netinet/tcp_reass.c
==
--- head/sys/netinet/tcp_reass.cSun Nov 27 00:09:59 2011
(r228015)
+++ head/sys/netinet/tcp_reass.cSun Nov 27 02:32:08 2011
(r228016)
@@ -233,23 +233,28 @@ tcp_reass(struct tcpcb *tp, struct tcphd
 * when the zone is exhausted. Otherwise we may get stuck.
 */
te = uma_zalloc(V_tcp_reass_zone, M_NOWAIT);
-   if (te == NULL && th->th_seq != tp->rcv_nxt) {
-   TCPSTAT_INC(tcps_rcvmemdrop);
-   m_freem(m);
-   *tlenp = 0;
-   if ((s = tcp_log_addrs(&tp->t_inpcb->inp_inc, th, NULL, NULL))) 
{
-   log(LOG_DEBUG, "%s; %s: global zone limit reached, "
-   "segment dropped\n", s, __func__);
-   free(s, M_TCPLOG);
-   }
-   return (0);
-   } else if (th->th_seq == tp->rcv_nxt) {
-   bzero(&tqs, sizeof(struct tseg_qent));
-   te = &tqs;
-   if ((s = tcp_log_addrs(&tp->t_inpcb->inp_inc, th, NULL, NULL))) 
{
-   log(LOG_DEBUG, "%s; %s: global zone limit reached, "
-   "using stack for missing segment\n", s, __func__);
-   free(s, M_TCPLOG);
+   if (te == NULL) {
+   if (th->th_seq != tp->rcv_nxt) {
+   TCPSTAT_INC(tcps_rcvmemdrop);
+   m_freem(m);
+   *tlenp = 0;
+   if ((s = tcp_log_addrs(&tp->t_inpcb->inp_inc, th, NULL,
+   NULL))) {
+   log(LOG_DEBUG, "%s; %s: global zone limit "
+   "reached, segment dropped\n", s, __func__);
+   free(s, M_TCPLOG);
+   }
+   return (0);
+   } else {
+   bzero(&tqs, sizeof(struct tseg_qent));
+   te = &tqs;
+   if ((s = tcp_log_addrs(&tp->t_inpcb->inp_inc, th, NULL,
+   NULL))) {
+   log(LOG_DEBUG,
+   "%s; %s: global zone limit reached, using "
+   "stack for missing segment\n", s, __func__);
+   free(s, M_TCPLOG);
+   }
}
}
tp->t_segqlen++;
___
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: r228015 - head/bin/sh

2011-11-26 Thread Jilles Tjoelker
Author: jilles
Date: Sun Nov 27 00:09:59 2011
New Revision: 228015
URL: http://svn.freebsd.org/changeset/base/228015

Log:
  sh: Remove impossible evalskip check in 'for'.

Modified:
  head/bin/sh/eval.c

Modified: head/bin/sh/eval.c
==
--- head/bin/sh/eval.c  Sat Nov 26 23:57:03 2011(r228014)
+++ head/bin/sh/eval.c  Sun Nov 27 00:09:59 2011(r228015)
@@ -343,8 +343,6 @@ evalfor(union node *n, int flags)
for (argp = n->nfor.args ; argp ; argp = argp->narg.next) {
oexitstatus = exitstatus;
expandarg(argp, &arglist, EXP_FULL | EXP_TILDE);
-   if (evalskip)
-   goto out;
}
*arglist.lastp = NULL;
 
@@ -364,7 +362,6 @@ evalfor(union node *n, int flags)
}
}
loopnest--;
-out:
popstackmark(&smark);
 }
 
___
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: r228014 - head/sys/netipsec

2011-11-26 Thread Pawel Jakub Dawidek
Author: pjd
Date: Sat Nov 26 23:57:03 2011
New Revision: 228014
URL: http://svn.freebsd.org/changeset/base/228014

Log:
  Remove unused 'plen' variable.

Modified:
  head/sys/netipsec/xform_esp.c

Modified: head/sys/netipsec/xform_esp.c
==
--- head/sys/netipsec/xform_esp.c   Sat Nov 26 23:28:31 2011
(r228013)
+++ head/sys/netipsec/xform_esp.c   Sat Nov 26 23:57:03 2011
(r228014)
@@ -669,7 +669,7 @@ esp_output(
 {
struct enc_xform *espx;
struct auth_hash *esph;
-   int hlen, rlen, plen, padding, blks, alen, i, roff;
+   int hlen, rlen, padding, blks, alen, i, roff;
struct mbuf *mo = (struct mbuf *) NULL;
struct tdb_crypto *tc;
struct secasvar *sav;
@@ -701,7 +701,6 @@ esp_output(
 
/* XXX clamp padding length a la KAME??? */
padding = ((blks - ((rlen + 2) % blks)) % blks) + 2;
-   plen = rlen + padding;  /* Padded payload length. */
 
if (esph)
switch (esph->type) {
___
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: r228013 - head/bin/sh

2011-11-26 Thread Jilles Tjoelker
Author: jilles
Date: Sat Nov 26 23:28:31 2011
New Revision: 228013
URL: http://svn.freebsd.org/changeset/base/228013

Log:
  sh: Reduce one level of evaltree() recursion when executing 'case'.
  Free expanded case text before executing commands.
  Remove impossible evalskip checks (expanding an argument cannot set
  evalskip anymore since $(break) and the like are properly executed in a
  subshell environment).

Modified:
  head/bin/sh/eval.c

Modified: head/bin/sh/eval.c
==
--- head/bin/sh/eval.c  Sat Nov 26 23:27:41 2011(r228012)
+++ head/bin/sh/eval.c  Sat Nov 26 23:28:31 2011(r228013)
@@ -89,7 +89,7 @@ int oexitstatus;  /* saved exit status *
 
 static void evalloop(union node *, int);
 static void evalfor(union node *, int);
-static void evalcase(union node *, int);
+static union node *evalcase(union node *, int);
 static void evalsubshell(union node *, int);
 static void evalredir(union node *, int);
 static void expredir(union node *);
@@ -256,7 +256,7 @@ evaltree(union node *n, int flags)
evalfor(n, flags & ~EV_EXIT);
break;
case NCASE:
-   evalcase(n, flags);
+   next = evalcase(n, flags);
break;
case NDEFUN:
defun(n->narg.text, n->narg.next);
@@ -370,7 +370,7 @@ out:
 
 
 
-static void
+static union node *
 evalcase(union node *n, int flags)
 {
union node *cp;
@@ -383,26 +383,24 @@ evalcase(union node *n, int flags)
oexitstatus = exitstatus;
exitstatus = 0;
expandarg(n->ncase.expr, &arglist, EXP_TILDE);
-   for (cp = n->ncase.cases ; cp && evalskip == 0 ; cp = cp->nclist.next) {
+   for (cp = n->ncase.cases ; cp ; cp = cp->nclist.next) {
for (patp = cp->nclist.pattern ; patp ; patp = patp->narg.next) 
{
if (casematch(patp, arglist.list->text)) {
+   popstackmark(&smark);
while (cp->nclist.next &&
cp->type == NCLISTFALLTHRU) {
-   if (evalskip != 0)
-   break;
evaltree(cp->nclist.body,
flags & ~EV_EXIT);
+   if (evalskip != 0)
+   return (NULL);
cp = cp->nclist.next;
}
-   if (evalskip == 0) {
-   evaltree(cp->nclist.body, flags);
-   }
-   goto out;
+   return (cp->nclist.body);
}
}
}
-out:
popstackmark(&smark);
+   return (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: r228012 - head/sys/netipsec

2011-11-26 Thread Pawel Jakub Dawidek
Author: pjd
Date: Sat Nov 26 23:27:41 2011
New Revision: 228012
URL: http://svn.freebsd.org/changeset/base/228012

Log:
  The esp_max_ivlen global variable is not needed, we can just use
  EALG_MAX_BLOCK_LEN.

Modified:
  head/sys/netipsec/xform_esp.c

Modified: head/sys/netipsec/xform_esp.c
==
--- head/sys/netipsec/xform_esp.c   Sat Nov 26 23:18:19 2011
(r228011)
+++ head/sys/netipsec/xform_esp.c   Sat Nov 26 23:27:41 2011
(r228012)
@@ -76,8 +76,6 @@
 #include 
 #include 
 
-static int esp_max_ivlen;  /* max iv length over all algorithms */
-
 VNET_DEFINE(int, esp_enable) = 1;
 VNET_DEFINE(struct espstat, espstat);
 
@@ -146,7 +144,7 @@ esp_hdrsiz(struct secasvar *sav)
 * + sizeof (next header field)
 * + max icv supported.
 */
-   size = sizeof (struct newesp) + esp_max_ivlen + 9 + 16;
+   size = sizeof (struct newesp) + EALG_MAX_BLOCK_LEN + 9 + 16;
}
return size;
 }
@@ -1020,20 +1018,7 @@ static struct xformsw esp_xformsw = {
 static void
 esp_attach(void)
 {
-#defineMAXIV(xform)\
-   if (xform.blocksize > esp_max_ivlen)\
-   esp_max_ivlen = xform.blocksize \
-
-   MAXIV(enc_xform_des);   /* SADB_EALG_DESCBC */
-   MAXIV(enc_xform_3des);  /* SADB_EALG_3DESCBC */
-   MAXIV(enc_xform_rijndael128);   /* SADB_X_EALG_AES */
-   MAXIV(enc_xform_blf);   /* SADB_X_EALG_BLOWFISHCBC */
-   MAXIV(enc_xform_cast5); /* SADB_X_EALG_CAST128CBC */
-   MAXIV(enc_xform_skipjack);  /* SADB_X_EALG_SKIPJACK */
-   MAXIV(enc_xform_null);  /* SADB_EALG_NULL */
-   MAXIV(enc_xform_camellia);  /* SADB_X_EALG_CAMELLIACBC */
 
xform_register(&esp_xformsw);
-#undef MAXIV
 }
 SYSINIT(esp_xform_init, SI_SUB_PROTO_DOMAIN, SI_ORDER_MIDDLE, esp_attach, 
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: r228011 - head/sys/netipsec

2011-11-26 Thread Pawel Jakub Dawidek
Author: pjd
Date: Sat Nov 26 23:18:19 2011
New Revision: 228011
URL: http://svn.freebsd.org/changeset/base/228011

Log:
  malloc(M_WAITOK) never fails, so there is no need to check for NULL.

Modified:
  head/sys/netipsec/xform_esp.c

Modified: head/sys/netipsec/xform_esp.c
==
--- head/sys/netipsec/xform_esp.c   Sat Nov 26 23:15:28 2011
(r228010)
+++ head/sys/netipsec/xform_esp.c   Sat Nov 26 23:18:19 2011
(r228011)
@@ -195,10 +195,6 @@ esp_init(struct secasvar *sav, struct xf
 */
sav->ivlen = (txform == &enc_xform_null ? 0 : txform->blocksize);
sav->iv = (caddr_t) malloc(sav->ivlen, M_XDATA, M_WAITOK);
-   if (sav->iv == NULL) {
-   DPRINTF(("%s: no memory for IV\n", __func__));
-   return EINVAL;
-   }
key_randomfill(sav->iv, sav->ivlen);/*XXX*/
 
/*
___
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: r228010 - head/sys/netipsec

2011-11-26 Thread Pawel Jakub Dawidek
Author: pjd
Date: Sat Nov 26 23:15:28 2011
New Revision: 228010
URL: http://svn.freebsd.org/changeset/base/228010

Log:
  Eliminate 'err' variable and just use existing 'error'.

Modified:
  head/sys/netipsec/xform_ah.c
  head/sys/netipsec/xform_esp.c

Modified: head/sys/netipsec/xform_ah.c
==
--- head/sys/netipsec/xform_ah.cSat Nov 26 23:13:30 2011
(r228009)
+++ head/sys/netipsec/xform_ah.cSat Nov 26 23:15:28 2011
(r228010)
@@ -1135,7 +1135,6 @@ ah_output_cb(struct cryptop *crp)
struct secasvar *sav;
struct mbuf *m;
caddr_t ptr;
-   int err;
 
tc = (struct tdb_crypto *) crp->crp_opaque;
IPSEC_ASSERT(tc != NULL, ("null opaque data area!"));
@@ -1205,10 +1204,10 @@ ah_output_cb(struct cryptop *crp)
 #endif
 
/* NB: m is reclaimed by ipsec_process_done. */
-   err = ipsec_process_done(m, isr);
+   error = ipsec_process_done(m, isr);
KEY_FREESAV(&sav);
IPSECREQUEST_UNLOCK(isr);
-   return err;
+   return error;
 bad:
if (sav)
KEY_FREESAV(&sav);

Modified: head/sys/netipsec/xform_esp.c
==
--- head/sys/netipsec/xform_esp.c   Sat Nov 26 23:13:30 2011
(r228009)
+++ head/sys/netipsec/xform_esp.c   Sat Nov 26 23:15:28 2011
(r228010)
@@ -918,7 +918,7 @@ esp_output_cb(struct cryptop *crp)
struct ipsecrequest *isr;
struct secasvar *sav;
struct mbuf *m;
-   int err, error;
+   int error;
 
tc = (struct tdb_crypto *) crp->crp_opaque;
IPSEC_ASSERT(tc != NULL, ("null opaque data area!"));
@@ -1000,10 +1000,10 @@ esp_output_cb(struct cryptop *crp)
 #endif
 
/* NB: m is reclaimed by ipsec_process_done. */
-   err = ipsec_process_done(m, isr);
+   error = ipsec_process_done(m, isr);
KEY_FREESAV(&sav);
IPSECREQUEST_UNLOCK(isr);
-   return err;
+   return error;
 bad:
if (sav)
KEY_FREESAV(&sav);
___
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: r228009 - head/sys/netipsec

2011-11-26 Thread Pawel Jakub Dawidek
Author: pjd
Date: Sat Nov 26 23:13:30 2011
New Revision: 228009
URL: http://svn.freebsd.org/changeset/base/228009

Log:
  Simplify code a bit.

Modified:
  head/sys/netipsec/xform_ah.c
  head/sys/netipsec/xform_esp.c

Modified: head/sys/netipsec/xform_ah.c
==
--- head/sys/netipsec/xform_ah.cSat Nov 26 23:11:41 2011
(r228008)
+++ head/sys/netipsec/xform_ah.cSat Nov 26 23:13:30 2011
(r228009)
@@ -770,10 +770,8 @@ ah_input_cb(struct cryptop *crp)
if (sav->tdb_cryptoid != 0)
sav->tdb_cryptoid = crp->crp_sid;
 
-   if (crp->crp_etype == EAGAIN) {
-   error = crypto_dispatch(crp);
-   return error;
-   }
+   if (crp->crp_etype == EAGAIN)
+   return (crypto_dispatch(crp));
 
V_ahstat.ahs_noxform++;
DPRINTF(("%s: crypto error %d\n", __func__, crp->crp_etype));
@@ -1164,8 +1162,7 @@ ah_output_cb(struct cryptop *crp)
 
if (crp->crp_etype == EAGAIN) {
IPSECREQUEST_UNLOCK(isr);
-   error = crypto_dispatch(crp);
-   return error;
+   return (crypto_dispatch(crp));
}
 
V_ahstat.ahs_noxform++;

Modified: head/sys/netipsec/xform_esp.c
==
--- head/sys/netipsec/xform_esp.c   Sat Nov 26 23:11:41 2011
(r228008)
+++ head/sys/netipsec/xform_esp.c   Sat Nov 26 23:13:30 2011
(r228009)
@@ -495,10 +495,8 @@ esp_input_cb(struct cryptop *crp)
if (sav->tdb_cryptoid != 0)
sav->tdb_cryptoid = crp->crp_sid;
 
-   if (crp->crp_etype == EAGAIN) {
-   error = crypto_dispatch(crp);
-   return error;
-   }
+   if (crp->crp_etype == EAGAIN)
+   return (crypto_dispatch(crp));
 
V_espstat.esps_noxform++;
DPRINTF(("%s: crypto error %d\n", __func__, crp->crp_etype));
@@ -947,8 +945,7 @@ esp_output_cb(struct cryptop *crp)
 
if (crp->crp_etype == EAGAIN) {
IPSECREQUEST_UNLOCK(isr);
-   error = crypto_dispatch(crp);
-   return error;
+   return (crypto_dispatch(crp));
}
 
V_espstat.esps_noxform++;
___
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: r228008 - head/sys/netipsec

2011-11-26 Thread Pawel Jakub Dawidek
Author: pjd
Date: Sat Nov 26 23:11:41 2011
New Revision: 228008
URL: http://svn.freebsd.org/changeset/base/228008

Log:
  There is no need to virtualize esp_max_ivlen.

Modified:
  head/sys/netipsec/xform_esp.c

Modified: head/sys/netipsec/xform_esp.c
==
--- head/sys/netipsec/xform_esp.c   Sat Nov 26 22:28:25 2011
(r228007)
+++ head/sys/netipsec/xform_esp.c   Sat Nov 26 23:11:41 2011
(r228008)
@@ -76,6 +76,8 @@
 #include 
 #include 
 
+static int esp_max_ivlen;  /* max iv length over all algorithms */
+
 VNET_DEFINE(int, esp_enable) = 1;
 VNET_DEFINE(struct espstat, espstat);
 
@@ -85,9 +87,6 @@ SYSCTL_VNET_INT(_net_inet_esp, OID_AUTO,
 SYSCTL_VNET_STRUCT(_net_inet_esp, IPSECCTL_STATS,
stats,  CTLFLAG_RD, &VNET_NAME(espstat),espstat, "");
 
-static VNET_DEFINE(int, esp_max_ivlen);/* max iv length over all 
algorithms */
-#defineV_esp_max_ivlen VNET(esp_max_ivlen)
-
 static int esp_input_cb(struct cryptop *op);
 static int esp_output_cb(struct cryptop *crp);
 
@@ -147,7 +146,7 @@ esp_hdrsiz(struct secasvar *sav)
 * + sizeof (next header field)
 * + max icv supported.
 */
-   size = sizeof (struct newesp) + V_esp_max_ivlen + 9 + 16;
+   size = sizeof (struct newesp) + esp_max_ivlen + 9 + 16;
}
return size;
 }
@@ -1029,8 +1028,8 @@ static void
 esp_attach(void)
 {
 #defineMAXIV(xform)\
-   if (xform.blocksize > V_esp_max_ivlen)  \
-   V_esp_max_ivlen = xform.blocksize   \
+   if (xform.blocksize > esp_max_ivlen)\
+   esp_max_ivlen = xform.blocksize \
 
MAXIV(enc_xform_des);   /* SADB_EALG_DESCBC */
MAXIV(enc_xform_3des);  /* SADB_EALG_3DESCBC */
___
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: r227873 - head/usr.bin/procstat

2011-11-26 Thread Pawel Jakub Dawidek
On Wed, Nov 23, 2011 at 11:10:47AM -0800, m...@freebsd.org wrote:
> I don't know if there's a style preference for 0x%lx versus %#lx,
> though, or a preference for a different type for the print (uintmax_t,
> for example).  There is probably a preference for using u_long rather
> than unsigned long, since it's shorter.

u_long is preferred in kernel, in userland unsigned long is better.

-- 
Pawel Jakub Dawidek   http://www.wheelsystems.com
FreeBSD committer http://www.FreeBSD.org
Am I Evil? Yes, I Am! http://yomoli.com


pgpVWCRu5LHcK.pgp
Description: PGP signature


svn commit: r228007 - head/tools/regression/bin/sh/builtins

2011-11-26 Thread Jilles Tjoelker
Author: jilles
Date: Sat Nov 26 22:28:25 2011
New Revision: 228007
URL: http://svn.freebsd.org/changeset/base/228007

Log:
  sh: Add tests for some corner cases of 'case' exit status.
  
  These already work properly.

Added:
  head/tools/regression/bin/sh/builtins/case11.0   (contents, props changed)
  head/tools/regression/bin/sh/builtins/case12.0   (contents, props changed)

Added: head/tools/regression/bin/sh/builtins/case11.0
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/tools/regression/bin/sh/builtins/case11.0  Sat Nov 26 22:28:25 
2011(r228007)
@@ -0,0 +1,6 @@
+# $FreeBSD$
+
+false
+case x in
+*)
+esac

Added: head/tools/regression/bin/sh/builtins/case12.0
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/tools/regression/bin/sh/builtins/case12.0  Sat Nov 26 22:28:25 
2011(r228007)
@@ -0,0 +1,6 @@
+# $FreeBSD$
+
+false
+case x in
+y)
+esac
___
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: r228004 - in head: contrib/libcxxrt lib/libcxxrt

2011-11-26 Thread David Schultz
On Sat, Nov 26, 2011, Bjoern A. Zeeb wrote:
> On Sat, 26 Nov 2011, David Chisnall wrote:
> 
> >Author: theraven
> >Date: Sat Nov 26 18:46:33 2011
> >New Revision: 228004
> >URL: http://svn.freebsd.org/changeset/base/228004
> >
> >Log:
> > Update libcxxrt to remove the pthread dependency.
> >
> > Also add the license from upstream to contrib.
> 
> Did the license really come in this format with long lines?  It would
> be great, given it looks very close to a 2-clause BSD license to make
> it as close as we can get to our standard license template.

It looks like the license file came from the vendor branch.  If
it's published by the vendor that way, we shouldn't be introducing
gratuitous style differences.
___
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: r227987 - in head: . lib share/mk

2011-11-26 Thread Bjoern A. Zeeb

On Sat, 26 Nov 2011, Dimitry Andric wrote:


Author: dim
Date: Sat Nov 26 03:26:06 2011
New Revision: 227987
URL: http://svn.freebsd.org/changeset/base/227987

Log:
 Fix breakage after r227983; lib/libcxxrt still got built, because it was
 not disabled in the usual way (by adding it to __DEFAULT_NO_OPTIONS in
 share/mk/bsd.own.mk), and because the test for MK_LIBCPLUSPLUS in
 Makefile.inc1 was incorrect.

 Pointy hat to: dim


Can you please also add an tools/build/options/ entry and re-gen
src.conf(5)?



Modified:
 head/Makefile.inc1
 head/lib/Makefile
 head/share/mk/bsd.own.mk

Modified: head/Makefile.inc1
==
--- head/Makefile.inc1  Sat Nov 26 01:44:37 2011(r227986)
+++ head/Makefile.inc1  Sat Nov 26 03:26:06 2011(r227987)
@@ -1218,7 +1218,7 @@ _startup_libs+=   lib/csu/${MACHINE_CPUARC
_startup_libs+= gnu/lib/libgcc
_startup_libs+= lib/libcompiler_rt
_startup_libs+= lib/libc
-.if defined(MK_LIBCPLUSPLUS)
+.if ${MK_LIBCPLUSPLUS} != "no"
_startup_libs+= lib/libcxxrt
.endif


Modified: head/lib/Makefile
==
--- head/lib/Makefile   Sat Nov 26 01:44:37 2011(r227986)
+++ head/lib/Makefile   Sat Nov 26 03:26:06 2011(r227987)
@@ -48,13 +48,9 @@ SUBDIR_ORDERED=  ${_csu} \
libsbuf \
libtacplus \
libutil \
-   ${_libypclnt}
-
-.if ${MK_LIBCPLUSPLUS} != "no"
-SUBDIR_ORDERED+=libcxxrt\
-   libc++
-.endif
-
+   ${_libypclnt} \
+   ${_libcxxrt} \
+   ${_libcplusplus}

SUBDIR= ${SUBDIR_ORDERED} \
libalias \
@@ -209,6 +205,11 @@ _libsmb=   libsmb
_libmp= libmp
.endif

+.if ${MK_LIBCPLUSPLUS} != "no"
+_libcxxrt= libcxxrt
+_libcplusplus= libc++
+.endif
+
.if ${MK_PMC} != "no"
_libpmc=libpmc
.endif

Modified: head/share/mk/bsd.own.mk
==
--- head/share/mk/bsd.own.mkSat Nov 26 01:44:37 2011(r227986)
+++ head/share/mk/bsd.own.mkSat Nov 26 03:26:06 2011(r227987)
@@ -413,6 +413,7 @@ __DEFAULT_NO_OPTIONS = \
HESIOD \
ICONV \
IDEA \
+LIBCPLUSPLUS \
OFED

#
@@ -553,8 +554,6 @@ MK_GCC:=no
MK_GDB:=no
.endif

-MK_LIBCPLUSPLUS?= no
-
#
# Set defaults for the MK_*_SUPPORT variables.
#



--
Bjoern A. Zeeb You have to have visions!
 Stop bit received. Insert coin for new address family.
___
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: r228004 - in head: contrib/libcxxrt lib/libcxxrt

2011-11-26 Thread Bjoern A. Zeeb

On Sat, 26 Nov 2011, David Chisnall wrote:


Author: theraven
Date: Sat Nov 26 18:46:33 2011
New Revision: 228004
URL: http://svn.freebsd.org/changeset/base/228004

Log:
 Update libcxxrt to remove the pthread dependency.

 Also add the license from upstream to contrib.


Did the license really come in this format with long lines?  It would
be great, given it looks very close to a 2-clause BSD license to make
it as close as we can get to our standard license template.



 Approved by:   dim (mentor)

Added:
 head/contrib/libcxxrt/LICENSE
- copied unchanged from r227996, vendor/libcxxrt/dist/LICENSE
Modified:
 head/contrib/libcxxrt/exception.cc
 head/contrib/libcxxrt/memory.cc
 head/lib/libcxxrt/Makefile
Directory Properties:
 head/contrib/libcxxrt/   (props changed)

Copied: head/contrib/libcxxrt/LICENSE (from r227996, 
vendor/libcxxrt/dist/LICENSE)
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/contrib/libcxxrt/LICENSE   Sat Nov 26 18:46:33 2011
(r228004, copy of r227996, vendor/libcxxrt/dist/LICENSE)
@@ -0,0 +1,14 @@
+The BSD License
+
+Copyright 2010-2011 PathScale, Inc. 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 COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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.
+
+The views and conclusions contained in the software and documentation are 
those of the authors and should not be interpreted as representing official 
policies, either expressed or implied, of PathScale, Inc.

Modified: head/contrib/libcxxrt/exception.cc
==
--- head/contrib/libcxxrt/exception.cc  Sat Nov 26 18:02:39 2011
(r228003)
+++ head/contrib/libcxxrt/exception.cc  Sat Nov 26 18:46:33 2011
(r228004)
@@ -8,6 +8,17 @@
#include "dwarf_eh.h"
#include "cxxabi.h"

+#pragma weak pthread_key_create
+#pragma weak pthread_setspecific
+#pragma weak pthread_getspecific
+#pragma weak pthread_once
+#pragma weak pthread_once
+#pragma weak pthread_cond_signal
+#pragma weak pthread_cond_wait
+#pragma weak pthread_mutex_lock
+#pragma weak pthread_mutex_unlock
+
+
using namespace ABI_NAMESPACE;

/**
@@ -289,11 +300,31 @@ static void thread_cleanup(void* thread_
static pthread_once_t once_control = PTHREAD_ONCE_INIT;

/**
+ * We may not be linked against a full pthread implementation.  If we're not,
+ * then we need to fake the thread-local storage by storing 'thread-local'
+ * things in a global.
+ */
+static bool fakeTLS;
+/**
+ * Thread-local storage for a single-threaded program.
+ */
+static __cxa_thread_info singleThreadInfo;
+/**
 * Initialise eh_key.
 */
static void init_key(void)
{
+   if ((0 == pthread_key_create) ||
+   (0 == pthread_setspecific) ||
+   (0 == pthread_getspecific))
+   {
+   fakeTLS = true;
+   return;
+   }
pthread_key_create(&eh_key, thread_cleanup);
+   pthread_setspecific(eh_key, (void*)0x42);
+   fakeTLS = (pthread_getspecific(eh_key) != (void*)0x42);
+   pthread_setspecific(eh_key, 0);
}

/**
@@ -301,7 +332,11 @@ static void init_key(void)
 */
static __cxa_thread_info *thread_info()
{
-   pthread_once(&once_control, init_key);
+   if ((0 == pthread_once) || pthread_once(&once_control, init_key))
+   {
+   fakeTLS = true;
+   }
+   if (fakeTLS) { return &singleThreadInfo; }
__cxa_thread_info *info = 
(__cxa_thread_info*)pthread_getspecific(eh_key);
if (0 == info)
{
@@ -316,6 +351,7 @@ static __cxa_thread_info *thread_info()
 */
static __cxa_thread_info *thread_info_fast()
{
+   if (fakeTLS) { return &singleThreadInfo; }
return (__cxa_thread_info*)pthread_getspecific(eh_key);
}
/**
@@ -367,7 +403,10 @@ stati

svn commit: r228005 - head/sys/mips/conf

2011-11-26 Thread Marius Strobl
Author: marius
Date: Sat Nov 26 18:47:09 2011
New Revision: 228005
URL: http://svn.freebsd.org/changeset/base/228005

Log:
  Change another instance of amd(4) to esp(4) missed in r227006.
  
  Submitted by: Garrett Cooper
  MFC after:3 days

Modified:
  head/sys/mips/conf/OCTEON1

Modified: head/sys/mips/conf/OCTEON1
==
--- head/sys/mips/conf/OCTEON1  Sat Nov 26 18:46:33 2011(r228004)
+++ head/sys/mips/conf/OCTEON1  Sat Nov 26 18:47:09 2011(r228005)
@@ -114,7 +114,7 @@ options AHC_REG_PRETTY_PRINT# Print re
 device ahd # AHA39320/29320 and onboard AIC79xx devices
 optionsAHD_REG_PRETTY_PRINT# Print register bitfields in debug
# output.  Adds ~215k to driver.
-device amd # AMD 53C974 (Tekram DC-390(T))
+device esp # AMD Am53C974 (Tekram DC-390(T))
 device hptiop  # Highpoint RocketRaid 3xxx series
 device isp # Qlogic family
 #deviceispfw   # Firmware for QLogic HBAs- normally a 
module
___
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: r228004 - in head: contrib/libcxxrt lib/libcxxrt

2011-11-26 Thread David Chisnall
Author: theraven
Date: Sat Nov 26 18:46:33 2011
New Revision: 228004
URL: http://svn.freebsd.org/changeset/base/228004

Log:
  Update libcxxrt to remove the pthread dependency.
  
  Also add the license from upstream to contrib.
  
  Approved by:  dim (mentor)

Added:
  head/contrib/libcxxrt/LICENSE
 - copied unchanged from r227996, vendor/libcxxrt/dist/LICENSE
Modified:
  head/contrib/libcxxrt/exception.cc
  head/contrib/libcxxrt/memory.cc
  head/lib/libcxxrt/Makefile
Directory Properties:
  head/contrib/libcxxrt/   (props changed)

Copied: head/contrib/libcxxrt/LICENSE (from r227996, 
vendor/libcxxrt/dist/LICENSE)
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/contrib/libcxxrt/LICENSE   Sat Nov 26 18:46:33 2011
(r228004, copy of r227996, vendor/libcxxrt/dist/LICENSE)
@@ -0,0 +1,14 @@
+The BSD License
+
+Copyright 2010-2011 PathScale, Inc. 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 COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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.
+
+The views and conclusions contained in the software and documentation are 
those of the authors and should not be interpreted as representing official 
policies, either expressed or implied, of PathScale, Inc.

Modified: head/contrib/libcxxrt/exception.cc
==
--- head/contrib/libcxxrt/exception.cc  Sat Nov 26 18:02:39 2011
(r228003)
+++ head/contrib/libcxxrt/exception.cc  Sat Nov 26 18:46:33 2011
(r228004)
@@ -8,6 +8,17 @@
 #include "dwarf_eh.h"
 #include "cxxabi.h"
 
+#pragma weak pthread_key_create
+#pragma weak pthread_setspecific
+#pragma weak pthread_getspecific
+#pragma weak pthread_once
+#pragma weak pthread_once
+#pragma weak pthread_cond_signal
+#pragma weak pthread_cond_wait
+#pragma weak pthread_mutex_lock
+#pragma weak pthread_mutex_unlock
+
+
 using namespace ABI_NAMESPACE;
 
 /**
@@ -289,11 +300,31 @@ static void thread_cleanup(void* thread_
 static pthread_once_t once_control = PTHREAD_ONCE_INIT;
 
 /**
+ * We may not be linked against a full pthread implementation.  If we're not,
+ * then we need to fake the thread-local storage by storing 'thread-local'
+ * things in a global.
+ */
+static bool fakeTLS;
+/**
+ * Thread-local storage for a single-threaded program.
+ */
+static __cxa_thread_info singleThreadInfo;
+/**
  * Initialise eh_key.
  */
 static void init_key(void)
 {
+   if ((0 == pthread_key_create) ||
+   (0 == pthread_setspecific) ||
+   (0 == pthread_getspecific))
+   {
+   fakeTLS = true;
+   return;
+   }
pthread_key_create(&eh_key, thread_cleanup);
+   pthread_setspecific(eh_key, (void*)0x42);
+   fakeTLS = (pthread_getspecific(eh_key) != (void*)0x42);
+   pthread_setspecific(eh_key, 0);
 }
 
 /**
@@ -301,7 +332,11 @@ static void init_key(void)
  */
 static __cxa_thread_info *thread_info()
 {
-   pthread_once(&once_control, init_key);
+   if ((0 == pthread_once) || pthread_once(&once_control, init_key))
+   {
+   fakeTLS = true;
+   }
+   if (fakeTLS) { return &singleThreadInfo; }
__cxa_thread_info *info = 
(__cxa_thread_info*)pthread_getspecific(eh_key);
if (0 == info)
{
@@ -316,6 +351,7 @@ static __cxa_thread_info *thread_info()
  */
 static __cxa_thread_info *thread_info_fast()
 {
+   if (fakeTLS) { return &singleThreadInfo; }
return (__cxa_thread_info*)pthread_getspecific(eh_key);
 }
 /**
@@ -367,7 +403,10 @@ static char *emergency_malloc(size_t siz
// Only 4 emergency buffers allowed per thread!
if (info->emergencyBuffersHeld > 3) { return 0; }
 
-   pthread_mutex_lock(&emergency_malloc_lock);
+   if

Re: svn commit: r227873 - head/usr.bin/procstat

2011-11-26 Thread Kostik Belousov
On Sat, Nov 26, 2011 at 06:13:14PM +, Robert N. M. Watson wrote:
> 
> On 26 Nov 2011, at 17:48, Kostik Belousov wrote:
> 
> >> in138:~% procstat -x 2008
> >>  PID COMM AUXV VALUE   
> >> 2008 nginxAT_PHDR  0x400040
> >> 2008 nginxAT_PHENT 56
> >> 2008 nginxAT_PHNUM 8
> >> 2008 nginxAT_PAGESZ4096
> >> 2008 nginxAT_FLAGS 0
> >> 2008 nginxAT_ENTRY 0x40de00
> >> 2008 nginxAT_BASE  0x800689000
> >> 2008 nginxAT_EXECPATH  0x7fffefca
> >> 2008 nginxAT_OSRELDATE 101
> >> 2008 nginxAT_CANARY0x7fffef8a
> >> 2008 nginxAT_CANARYLEN 64
> >> 2008 nginxAT_NCPUS 2
> >> 2008 nginxAT_PAGESIZES 0x7fffef72
> >> 2008 nginxAT_PAGESIZESLEN  24
> >> 2008 nginxAT_STACKPROT VM_PROT_ALL
> > I like this output much better. The only thing I am unsure of is
> > the pretty-printing of AT_STACKPROT. Might be, change it to
> > EXECUTABLE/NONEXECUTABLE printout.
> 
> On a related note, I wouldn't mind if we stripped AT_ and lower-cased the 
> rest of the field name to make it slightly easier on the eyes. :-)

It would then need some explanation what the names mean.
For my, AT_SOMETHING has a unique meaning, while something does not.


pgpn1SXGnbk5J.pgp
Description: PGP signature


Re: svn commit: r227873 - head/usr.bin/procstat

2011-11-26 Thread Robert N. M. Watson

On 26 Nov 2011, at 17:48, Kostik Belousov wrote:

>> in138:~% procstat -x 2008
>>  PID COMM AUXV VALUE   
>> 2008 nginxAT_PHDR  0x400040
>> 2008 nginxAT_PHENT 56
>> 2008 nginxAT_PHNUM 8
>> 2008 nginxAT_PAGESZ4096
>> 2008 nginxAT_FLAGS 0
>> 2008 nginxAT_ENTRY 0x40de00
>> 2008 nginxAT_BASE  0x800689000
>> 2008 nginxAT_EXECPATH  0x7fffefca
>> 2008 nginxAT_OSRELDATE 101
>> 2008 nginxAT_CANARY0x7fffef8a
>> 2008 nginxAT_CANARYLEN 64
>> 2008 nginxAT_NCPUS 2
>> 2008 nginxAT_PAGESIZES 0x7fffef72
>> 2008 nginxAT_PAGESIZESLEN  24
>> 2008 nginxAT_STACKPROT VM_PROT_ALL
> I like this output much better. The only thing I am unsure of is
> the pretty-printing of AT_STACKPROT. Might be, change it to
> EXECUTABLE/NONEXECUTABLE printout.

On a related note, I wouldn't mind if we stripped AT_ and lower-cased the rest 
of the field name to make it slightly easier on the eyes. :-)

Robert___
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: r228003 - in head/sys: conf i386/conf

2011-11-26 Thread Marius Strobl
Author: marius
Date: Sat Nov 26 18:02:39 2011
New Revision: 228003
URL: http://svn.freebsd.org/changeset/base/228003

Log:
  Remove some more occurrences of amd(4) missed in r227982.

Modified:
  head/sys/conf/NOTES
  head/sys/i386/conf/PAE

Modified: head/sys/conf/NOTES
==
--- head/sys/conf/NOTES Sat Nov 26 16:49:25 2011(r228002)
+++ head/sys/conf/NOTES Sat Nov 26 18:02:39 2011(r228003)
@@ -1510,7 +1510,6 @@ hint.aic.0.at="isa"
 device ahb
 device ahc
 device ahd
-device amd
 device esp
 device iscsi_initiator
 device isp

Modified: head/sys/i386/conf/PAE
==
--- head/sys/i386/conf/PAE  Sat Nov 26 16:49:25 2011(r228002)
+++ head/sys/i386/conf/PAE  Sat Nov 26 18:02:39 2011(r228003)
@@ -24,7 +24,6 @@ deviceispfw
 # than 4 gigabytes of memory.
 
 nodevice   ahb
-nodevice   amd
 nodevice   sym
 nodevice   trm
 
___
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: r227873 - head/usr.bin/procstat

2011-11-26 Thread Kostik Belousov
On Sat, Nov 26, 2011 at 06:43:01PM +0200, Mikolaj Golub wrote:
> 
> On Thu, 24 Nov 2011 09:12:35 +0200 Mikolaj Golub wrote:
> 
>  MG> On Wed, 23 Nov 2011 11:10:47 -0800 m...@freebsd.org wrote:
> 
>  >>>                        printf(" AT_IGNORE=0x%lu",
>  >>> -                           (unsigned long)aux->a_un.a_val);
>  >>> +                           (unsigned long)auxv[i].a_un.a_val);
> 
>  m>> I didn't see this before, but this gives very misleading output.  The
>  m>> 0x prefix implies the output will be hex, but it's printed as decimal,
>  m>> here and below.
> 
>  MG> Oh. Thanks! Will fix.
> 
>  m>> I don't know if there's a style preference for 0x%lx versus %#lx,
>  m>> though, or a preference for a different type for the print (uintmax_t,
>  m>> for example).  There is probably a preference for using u_long rather
>  m>> than unsigned long, since it's shorter.
> 
>  MG> It looks like both 0x%lx and %#lx are widely spread in our source, I 
> like %#lx
>  MG> a little more. It looks for me that (u_long) will be ok for now, so the 
> chage
>  MG> for the printf above would be:
> 
>  MG> printf(" AT_IGNORE=%#lx", (u_long)auxv[i].a_un.a_val);
> 
>  MG> Anyway, printing all values in the same format was considered by me as a
>  MG> temporary solution. I am going to have format depending on a_type, so 
> e.g.
>  MG> AT_PAGESZ will be 4096, not 0x1000.
> 
>  MG> Also, now they are printed as one string for a process:
> 
>  MG>   PID COMM AUXV
>  MG>  2520 firefox-bin  AT_PHDR=0x400040 AT_PHENT=0x38 AT_PHNUM=0x7 
> AT_PAGESZ=0x1000 ...
> 
>  MG> I am considering changing this too, to something like below:
> 
>  MG>   PID COMM AUXVVALUE
>  MG>  2520 firefox-bin  AT_PHDR 0x400040
>  MG>  2520 firefox-bin  AT_PHENT56
>  MG>  2520 firefox-bin  AT_PHNUM7
>  MG> ...
> 
> I am going to commit this patch if nobody has any other suggestions.
> 
> The typical output:
> 
> in138:~% procstat -x 2008
>   PID COMM AUXV VALUE   
>  2008 nginxAT_PHDR  0x400040
>  2008 nginxAT_PHENT 56
>  2008 nginxAT_PHNUM 8
>  2008 nginxAT_PAGESZ4096
>  2008 nginxAT_FLAGS 0
>  2008 nginxAT_ENTRY 0x40de00
>  2008 nginxAT_BASE  0x800689000
>  2008 nginxAT_EXECPATH  0x7fffefca
>  2008 nginxAT_OSRELDATE 101
>  2008 nginxAT_CANARY0x7fffef8a
>  2008 nginxAT_CANARYLEN 64
>  2008 nginxAT_NCPUS 2
>  2008 nginxAT_PAGESIZES 0x7fffef72
>  2008 nginxAT_PAGESIZESLEN  24
>  2008 nginxAT_STACKPROT VM_PROT_ALL
I like this output much better. The only thing I am unsure of is
the pretty-printing of AT_STACKPROT. Might be, change it to
EXECUTABLE/NONEXECUTABLE printout.


pgpE1rj3IAs6B.pgp
Description: PGP signature


svn commit: r228002 - head/lib/libc/gen

2011-11-26 Thread David Chisnall
Author: theraven
Date: Sat Nov 26 16:49:25 2011
New Revision: 228002
URL: http://svn.freebsd.org/changeset/base/228002

Log:
  style(9) fix.
  
  Approved by:  dim (mentor)

Modified:
  head/lib/libc/gen/_pthread_stubs.c

Modified: head/lib/libc/gen/_pthread_stubs.c
==
--- head/lib/libc/gen/_pthread_stubs.c  Sat Nov 26 16:38:49 2011
(r228001)
+++ head/lib/libc/gen/_pthread_stubs.c  Sat Nov 26 16:49:25 2011
(r228002)
@@ -297,7 +297,7 @@ stub_self(void)
 static int
 stub_fail(void)
 {
-   return ENOSYS;
+   return (ENOSYS);
 }
 
 static int
___
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: r227873 - head/usr.bin/procstat

2011-11-26 Thread Mikolaj Golub

On Thu, 24 Nov 2011 09:12:35 +0200 Mikolaj Golub wrote:

 MG> On Wed, 23 Nov 2011 11:10:47 -0800 m...@freebsd.org wrote:

 >>>                        printf(" AT_IGNORE=0x%lu",
 >>> -                           (unsigned long)aux->a_un.a_val);
 >>> +                           (unsigned long)auxv[i].a_un.a_val);

 m>> I didn't see this before, but this gives very misleading output.  The
 m>> 0x prefix implies the output will be hex, but it's printed as decimal,
 m>> here and below.

 MG> Oh. Thanks! Will fix.

 m>> I don't know if there's a style preference for 0x%lx versus %#lx,
 m>> though, or a preference for a different type for the print (uintmax_t,
 m>> for example).  There is probably a preference for using u_long rather
 m>> than unsigned long, since it's shorter.

 MG> It looks like both 0x%lx and %#lx are widely spread in our source, I like 
%#lx
 MG> a little more. It looks for me that (u_long) will be ok for now, so the 
chage
 MG> for the printf above would be:

 MG> printf(" AT_IGNORE=%#lx", (u_long)auxv[i].a_un.a_val);

 MG> Anyway, printing all values in the same format was considered by me as a
 MG> temporary solution. I am going to have format depending on a_type, so e.g.
 MG> AT_PAGESZ will be 4096, not 0x1000.

 MG> Also, now they are printed as one string for a process:

 MG>   PID COMM AUXV
 MG>  2520 firefox-bin  AT_PHDR=0x400040 AT_PHENT=0x38 AT_PHNUM=0x7 
AT_PAGESZ=0x1000 ...

 MG> I am considering changing this too, to something like below:

 MG>   PID COMM AUXVVALUE
 MG>  2520 firefox-bin  AT_PHDR 0x400040
 MG>  2520 firefox-bin  AT_PHENT56
 MG>  2520 firefox-bin  AT_PHNUM7
 MG> ...

I am going to commit this patch if nobody has any other suggestions.

The typical output:

in138:~% procstat -x 2008
  PID COMM AUXV VALUE   
 2008 nginxAT_PHDR  0x400040
 2008 nginxAT_PHENT 56
 2008 nginxAT_PHNUM 8
 2008 nginxAT_PAGESZ4096
 2008 nginxAT_FLAGS 0
 2008 nginxAT_ENTRY 0x40de00
 2008 nginxAT_BASE  0x800689000
 2008 nginxAT_EXECPATH  0x7fffefca
 2008 nginxAT_OSRELDATE 101
 2008 nginxAT_CANARY0x7fffef8a
 2008 nginxAT_CANARYLEN 64
 2008 nginxAT_NCPUS 2
 2008 nginxAT_PAGESIZES 0x7fffef72
 2008 nginxAT_PAGESIZESLEN  24
 2008 nginxAT_STACKPROT VM_PROT_ALL

-- 
Mikolaj Golub

Index: usr.bin/procstat/procstat_auxv.c
===
--- usr.bin/procstat/procstat_auxv.c	(revision 227989)
+++ usr.bin/procstat/procstat_auxv.c	(working copy)
@@ -27,9 +27,12 @@
  */
 
 #include 
+#include 
 #include 
 #include 
 
+#include 
+
 #include 
 #include 
 #include 
@@ -38,12 +41,79 @@
 #include 
 #include 
 
-#include 
-
 #include "procstat.h"
 
 static Elf_Auxinfo auxv[256];
+static char prefix[256];
 
+#define	PRINT(name, spec, val)		\
+	printf("%s %-16s " #spec "\n", prefix, #name, (val))
+#define	PRINT_UNKNOWN(type, val)	\
+	printf("%s %16ld %#lx\n", prefix, (long)type, (u_long)(val))
+
+static const char*
+stack_protection(u_long protection)
+{
+	size_t size;
+	int n;
+	char *p;
+	const char *delimiter;
+	static char buf[256];
+
+	buf[0] = '\0';
+
+	if (protection == VM_PROT_NONE) {
+		snprintf(buf, sizeof(buf), "%s", "VM_PROT_NONE");
+	} else if (protection == VM_PROT_ALL) {
+		snprintf(buf, sizeof(buf), "%s", "VM_PROT_ALL");
+	} else if (protection == VM_PROT_RW) {
+		snprintf(buf, sizeof(buf), "%s", "VM_PROT_RW");
+	} else {
+		size = sizeof(buf);
+		p = buf;
+		delimiter = "";
+
+		if (size > 0 && (protection & VM_PROT_READ) != 0) {
+			n = snprintf(p, size, "%s%s", delimiter,
+			"VM_PROT_READ");
+			protection &= ~VM_PROT_READ;
+			delimiter = " | ";
+			p += n;
+			size -= n;
+		}
+		if (size > 0 && (protection & VM_PROT_WRITE) != 0) {
+			n = snprintf(p, size, "%s%s", delimiter,
+			"VM_PROT_WRITE");
+			protection &= ~VM_PROT_WRITE;
+			delimiter = " | ";
+			p += n;
+			size -= n;
+		}
+		if (size > 0 && (protection & VM_PROT_EXECUTE) != 0) {
+			n = snprintf(p, size, "%s%s", delimiter,
+			"VM_PROT_EXECUTE");
+			protection &= ~VM_PROT_EXECUTE;
+			delimiter = " | ";
+			p += n;
+			size -= n;
+		}
+		if (size > 0 && (protection & VM_PROT_COPY) != 0) {
+			n = snprintf(p, size, "%s%s", delimiter,
+			"VM_PROT_COPY");
+			protection &= ~VM_PROT_COPY;
+			delimiter = " | ";
+			p += n;
+			size -= n;
+		}
+		if (size > 0 && protection != VM_PROT_NONE) {
+			n = snprintf(p, size, "%s%#lx", delimiter,
+			protection);
+		}
+	}
+
+	return buf;
+}
+
 void
 procstat_auxv(struct kinfo_proc *kipp)
 {
@@ -51,7 +121,7 @@
 	size_t len, i;
 
 	if (!hflag)
-		printf("%5s %-16s %-53s\n", "PID", "COMM", "AUXV");
+		printf("%5s %-16s %-16s %-16s\n", "PID", "COMM", "A

svn commit: r227999 - head/lib/libc/gen

2011-11-26 Thread David Chisnall
Author: theraven
Date: Sat Nov 26 15:57:09 2011
New Revision: 227999
URL: http://svn.freebsd.org/changeset/base/227999

Log:
  Return not-implemented from pthread_once and pthread_key_create, rather
  than silently failing and returning success.
  
  Without this, code calls pthread_once(), receives a return value of
  success, and thinks that the passed function has been called.
  
  Approved by:  dim (mentor)

Modified:
  head/lib/libc/gen/_pthread_stubs.c

Modified: head/lib/libc/gen/_pthread_stubs.c
==
--- head/lib/libc/gen/_pthread_stubs.c  Sat Nov 26 14:26:37 2011
(r227998)
+++ head/lib/libc/gen/_pthread_stubs.c  Sat Nov 26 15:57:09 2011
(r227999)
@@ -30,6 +30,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 
 #include "libc_private.h"
 
@@ -53,6 +54,7 @@ static intstub_main(void);
 static void*stub_null(void);
 static struct pthread  *stub_self(void);
 static int stub_zero(void);
+static int stub_fail(void);
 static int stub_true(void);
 static voidstub_exit(void);
 
@@ -93,7 +95,7 @@ pthread_func_entry_t __thr_jtable[PJT_MA
{PJT_DUAL_ENTRY(stub_exit)},/* PJT_EXIT */
{PJT_DUAL_ENTRY(stub_null)},/* PJT_GETSPECIFIC */
{PJT_DUAL_ENTRY(stub_zero)},/* PJT_JOIN */
-   {PJT_DUAL_ENTRY(stub_zero)},/* PJT_KEY_CREATE */
+   {PJT_DUAL_ENTRY(stub_fail)},/* PJT_KEY_CREATE */
{PJT_DUAL_ENTRY(stub_zero)},/* PJT_KEY_DELETE */
{PJT_DUAL_ENTRY(stub_zero)},/* PJT_KILL */
{PJT_DUAL_ENTRY(stub_main)},/* PJT_MAIN_NP */
@@ -105,7 +107,7 @@ pthread_func_entry_t __thr_jtable[PJT_MA
{PJT_DUAL_ENTRY(stub_zero)},/* PJT_MUTEX_LOCK */
{PJT_DUAL_ENTRY(stub_zero)},/* PJT_MUTEX_TRYLOCK */
{PJT_DUAL_ENTRY(stub_zero)},/* PJT_MUTEX_UNLOCK */
-   {PJT_DUAL_ENTRY(stub_zero)},/* PJT_ONCE */
+   {PJT_DUAL_ENTRY(stub_fail)},/* PJT_ONCE */
{PJT_DUAL_ENTRY(stub_zero)},/* PJT_RWLOCK_DESTROY */
{PJT_DUAL_ENTRY(stub_zero)},/* PJT_RWLOCK_INIT */
{PJT_DUAL_ENTRY(stub_zero)},/* PJT_RWLOCK_RDLOCK */
@@ -293,6 +295,12 @@ stub_self(void)
 }
 
 static int
+stub_fail(void)
+{
+   return ENOSYS;
+}
+
+static int
 stub_main(void)
 {
return (-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: r227982 - in head: . release/doc/en_US.ISO8859-1/hardware share/man/man4 sys/conf sys/dev/amd sys/modules sys/modules/amd

2011-11-26 Thread Garrett Cooper
On Fri, Nov 25, 2011 at 11:29 AM, Marius Strobl  wrote:
> Author: marius
> Date: Fri Nov 25 19:29:21 2011
> New Revision: 227982
> URL: http://svn.freebsd.org/changeset/base/227982
>
> Log:
>  Deorbit the broken amd(4) (see PR 124667), which was superseded by esp(4)
>  as of r227006.

This commit broke tinderbox on i386/PAE and MIPS/OCTEON1. The
following change should unbreak things if the driver compiles
properly:
Thanks,
-Garrett

$ svn diff `ls sys/*/conf/* | grep -v BAYONETTA`
Index: sys/i386/conf/PAE
===
--- sys/i386/conf/PAE   (revision 227998)
+++ sys/i386/conf/PAE   (working copy)
@@ -24,7 +24,6 @@
 # than 4 gigabytes of memory.

 nodevice   ahb
-nodevice   amd
 nodevice   sym
 nodevice   trm

Index: sys/mips/conf/OCTEON1
===
--- sys/mips/conf/OCTEON1   (revision 227998)
+++ sys/mips/conf/OCTEON1   (working copy)
@@ -114,7 +114,7 @@
 device ahd # AHA39320/29320 and onboard AIC79xx devices
 optionsAHD_REG_PRETTY_PRINT# Print register bitfields in debug
# output.  Adds ~215k to driver.
-device amd # AMD 53C974 (Tekram DC-390(T))
+device esp # AMD Am53C974 (Tekram DC-390(T))
 device hptiop  # Highpoint RocketRaid 3xxx series
 device isp # Qlogic family
 #deviceispfw   # Firmware for QLogic HBAs-
normally a module
___
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: r227992 - head/sys/dev/acpica

2011-11-26 Thread Jean-Sebastien Pedron
Author: dumbbell
Date: Sat Nov 26 13:43:50 2011
New Revision: 227992
URL: http://svn.freebsd.org/changeset/base/227992

Log:
  Prevent a division by zero with some broken batteries
  
  This problem was seen on a laptop with a dead battery.

Modified:
  head/sys/dev/acpica/acpi_battery.c

Modified: head/sys/dev/acpica/acpi_battery.c
==
--- head/sys/dev/acpica/acpi_battery.c  Sat Nov 26 08:23:25 2011
(r227991)
+++ head/sys/dev/acpica/acpi_battery.c  Sat Nov 26 13:43:50 2011
(r227992)
@@ -205,6 +205,14 @@ acpi_battery_get_battinfo(device_t dev, 
bif->lfcap = (bif->lfcap * bif->dvol) / 1000;
}
 
+   /*
+* The calculation above may set bif->lfcap to zero. This was
+* seen on a laptop with a broken battery. The result of the
+* division was rounded to zero.
+*/
+   if (!acpi_battery_bif_valid(bif))
+   continue;
+
/* Calculate percent capacity remaining. */
bi[i].cap = (100 * bst[i].cap) / bif->lfcap;
 
___
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"