svn commit: r249538 - head/sys/kern

2013-04-16 Thread Konstantin Belousov
Author: kib
Date: Tue Apr 16 07:11:52 2013
New Revision: 249538
URL: http://svnweb.freebsd.org/changeset/base/249538

Log:
  Some compilers issue a warning when wider integer is casted to narrow
  pointer.  Supposedly shut down the warning by casting through
  uintptr_t.
  
  Reported by:  ian

Modified:
  head/sys/kern/subr_bus_dma.c

Modified: head/sys/kern/subr_bus_dma.c
==
--- head/sys/kern/subr_bus_dma.cTue Apr 16 07:02:13 2013
(r249537)
+++ head/sys/kern/subr_bus_dma.cTue Apr 16 07:11:52 2013
(r249538)
@@ -66,8 +66,8 @@ _bus_dmamap_load_vlist(bus_dma_tag_t dma
error = 0;
for (; sglist_cnt  0; sglist_cnt--, list++) {
error = _bus_dmamap_load_buffer(dmat, map,
-   (void *)list-ds_addr, list-ds_len, pmap, flags, NULL,
-   nsegs);
+   (void *)(uintptr_t)list-ds_addr, list-ds_len, pmap,
+   flags, NULL, nsegs);
if (error)
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


Re: svn commit: r246880 - in head: lib/libsm libexec/mail.local libexec/smrsh share/mk usr.bin/vacation usr.sbin/sendmail

2013-04-16 Thread Dimitry Andric

On 2013-04-16 06:19, Γιώργος Κεραμίδας wrote:

On Sat, 16 Feb 2013 20:17:31 + (UTC), Dimitry Andric d...@freebsd.org 
wrote:

...

   Since clang 3.2 now has an option to suppress warnings about implicitly
   promoted KR parameters, remove the workarounds added for sendmail
   components in r228558.

...

The part of the commit that removes NO_WERROR.clang for usr.sbin/sendmail/
breaks the build of Sendmail with -DSASL.  I just tried rebuilding Sendmail
with the following in /etc/make.conf:

 # Build Sendmail with SASL support.
 SENDMAIL_CFLAGS ?= -I/usr/local/include -DSASL=20126
 SENDMAIL_LDFLAGS ?= -L/usr/local/lib
 SENDMAIL_LDADD ?= -lsasl2

The warnings that usersmtp.c still triggers when -DSASL is used are:

: cc -O2 -pipe  -I/usr/src/usr.sbin/sendmail/../../contrib/sendmail/src 
-I/usr/src/usr.sbin/sendmail/../../contrib/sendmail/include -I. -DNEWDB -DNIS 
-DTCPWRAPPERS -DMAP_REGEX -DDNSMAP -DNETINET6 -DSTARTTLS -D_FFR_TLS_1 
-I/usr/local/include -DSASL=20126 -std=gnu99 -Qunused-arguments 
-fstack-protector -Wsystem-headers -Wno-pointer-sign -Wno-empty-body 
-Wno-string-plus-int -Wno-tautological-compare -Wno-unused-value 
-Wno-parentheses-equality -Wno-unused-function -Wno-conversion -Wno-switch 
-Wno-switch-enum -Wno-knr-promoted-parameter -Wno-parentheses -c 
/usr/src/usr.sbin/sendmail/../../contrib/sendmail/src/usersmtp.c
: /usr/src/usr.sbin/sendmail/../../contrib/sendmail/src/usersmtp.c:1797:50: 
warning: incompatible pointer types passing 'void ()' to parameter of type 
'void (*)(char *, bool, MAILER *, struct
:   mailer_con_info *, ENVELOPE *)' [-Wincompatible-pointer-types]
: smtpresult = reply(m, mci, e, TimeOuts.to_auth, getsasldata, NULL,
: ^~~


Have you tried the patch I posted here?

http://lists.freebsd.org/pipermail/freebsd-current/2013-March/040634.html

If people feel this is the right approach, I am happy to commit it.  If
people prefer to just shut up warnings, I am happy with that too.

___
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: r249508 - in head/sys: conf geom/label

2013-04-16 Thread Jaakko Heinonen
On 2013-04-15, Ivan Voras wrote:
   Introduce glabel labels based on GEOM ident attributes. In this initial
   implementation, error on the side of conservatism and only create labels
   for GEOMs of classes DISK and MULTIPATH.

After this commit I get a panic on boot. My kernel has been compiled
with gcc.

panic: stack overflow detected; backtrace may be corrupted
cpuid = 1
KDB: enter: panic
[ thread pid 13 tid 19 ]
Stopped at  kdb_enter+0x3a: movl$0,kdb_why
db bt
Tracing pid 13 tid 19 td 0xc7322000
kdb_enter(c0f374a2,c0f374a2,c0f3a31b,c6edbabc,1,...) at kdb_enter+0x3a/frame 
0xc6edba7c
vpanic(c6edbabc,c6edbabc,c0a3ee02,c0f3a31b,c6edbb50,...) at vpanic+0x12d/frame 
0xc6edbaa4
panic(c0f3a31b,c6edbb50,c09a5d98,c6edbb90,c6edbadc,...) at panic+0x14/frame 
0xc6edbab0
__stack_chk_fail(c6edbb90,c6edbadc,c6edbad8,c6edbadc,1,...) at 
__stack_chk_fail+0x12/frame 0xc6edbabc
g_label_disk_ident_taste(c7511e40,c6edbb90,80,15e,0,...) at 
g_label_disk_ident_taste+0x138/frame 0xc6edbb50
g_label_taste(c105a5e0,c732be00,0,229,c732bd80,...) at 
g_label_taste+0x486/frame 0xc6edbc4c
g_new_provider_event(c732be00,0,c0f29730,100,80246,...) at 
g_new_provider_event+0xe8/frame 0xc6edbc6c
g_run_events(c10de890,0,c0f29f9d,79,c6edbcf4,...) at g_run_events+0x31c/frame 
0xc6edbcb0
g_event_procbody(0,c6edbd08,c0f30630,3d7,c72b92e8,...) at 
g_event_procbody+0x93/frame 0xc6edbcc8
fork_exit(c099da20,0,c6edbd08) at fork_exit+0xc0/frame 0xc6edbcf4
fork_trampoline() at fork_trampoline+0x8/frame 0xc6edbcf4
--- trap 0, eip = 0, esp = 0xc6edbd40, ebp = 0 ---

-- 
Jaakko
___
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: r249508 - in head/sys: conf geom/label

2013-04-16 Thread Ivan Voras
On 16 April 2013 11:31, Jaakko Heinonen j...@freebsd.org wrote:
 On 2013-04-15, Ivan Voras wrote:
   Introduce glabel labels based on GEOM ident attributes. In this initial
   implementation, error on the side of conservatism and only create labels
   for GEOMs of classes DISK and MULTIPATH.

 After this commit I get a panic on boot. My kernel has been compiled
 with gcc.

Thanks for the report, I'm investigating it.
___
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: r249543 - head/sys/netinet6

2013-04-16 Thread Andrey V. Elsukov
Author: ae
Date: Tue Apr 16 11:12:58 2013
New Revision: 249543
URL: http://svnweb.freebsd.org/changeset/base/249543

Log:
  Replace hardcoded numbers.

Modified:
  head/sys/netinet6/ip6_var.h

Modified: head/sys/netinet6/ip6_var.h
==
--- head/sys/netinet6/ip6_var.h Tue Apr 16 08:54:50 2013(r249542)
+++ head/sys/netinet6/ip6_var.h Tue Apr 16 11:12:58 2013(r249543)
@@ -204,9 +204,11 @@ struct ip6stat {
u_quad_t ip6s_rawout;   /* total raw ip packets generated */
u_quad_t ip6s_badscope; /* scope error */
u_quad_t ip6s_notmember;/* don't join this multicast group */
-   u_quad_t ip6s_nxthist[256]; /* next header history */
+#defineIP6S_HDRCNT 256 /* headers count */
+   u_quad_t ip6s_nxthist[IP6S_HDRCNT]; /* next header history */
u_quad_t ip6s_m1;   /* one mbuf */
-   u_quad_t ip6s_m2m[32];  /* two or more mbuf */
+#defineIP6S_M2MMAX 32
+   u_quad_t ip6s_m2m[IP6S_M2MMAX]; /* two or more mbuf */
u_quad_t ip6s_mext1;/* one ext mbuf */
u_quad_t ip6s_mext2m;   /* two or more ext mbuf */
u_quad_t ip6s_exthdrtoolong;/* ext hdr are not contiguous */
@@ -218,27 +220,29 @@ structip6stat {
 * algorithm:
 * XXX: hardcoded 16 = # of ip6 multicast scope types + 1
 */
+#defineIP6S_RULESMAX   16
+#defineIP6S_SCOPECNT   16
/* number of times that address selection fails */
u_quad_t ip6s_sources_none;
/* number of times that an address on the outgoing I/F is chosen */
-   u_quad_t ip6s_sources_sameif[16];
+   u_quad_t ip6s_sources_sameif[IP6S_SCOPECNT];
/* number of times that an address on a non-outgoing I/F is chosen */
-   u_quad_t ip6s_sources_otherif[16];
+   u_quad_t ip6s_sources_otherif[IP6S_SCOPECNT];
/*
 * number of times that an address that has the same scope
 * from the destination is chosen.
 */
-   u_quad_t ip6s_sources_samescope[16];
+   u_quad_t ip6s_sources_samescope[IP6S_SCOPECNT];
/*
 * number of times that an address that has a different scope
 * from the destination is chosen.
 */
-   u_quad_t ip6s_sources_otherscope[16];
+   u_quad_t ip6s_sources_otherscope[IP6S_SCOPECNT];
/* number of times that a deprecated address is chosen */
-   u_quad_t ip6s_sources_deprecated[16];
+   u_quad_t ip6s_sources_deprecated[IP6S_SCOPECNT];
 
/* number of times that each rule of source selection is applied. */
-   u_quad_t ip6s_sources_rule[16];
+   u_quad_t ip6s_sources_rule[IP6S_MAXRULES];
 };
 
 #ifdef _KERNEL
___
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: r249544 - head/sys/netinet6

2013-04-16 Thread Andrey V. Elsukov
Author: ae
Date: Tue Apr 16 11:19:13 2013
New Revision: 249544
URL: http://svnweb.freebsd.org/changeset/base/249544

Log:
  Use IP6S_M2MMAX macro.

Modified:
  head/sys/netinet6/ip6_input.c

Modified: head/sys/netinet6/ip6_input.c
==
--- head/sys/netinet6/ip6_input.c   Tue Apr 16 11:12:58 2013
(r249543)
+++ head/sys/netinet6/ip6_input.c   Tue Apr 16 11:19:13 2013
(r249544)
@@ -466,18 +466,16 @@ ip6_input(struct mbuf *m)
else
IP6STAT_INC(ip6s_mext1);
} else {
-#define M2MMAX (sizeof(V_ip6stat.ip6s_m2m)/sizeof(V_ip6stat.ip6s_m2m[0]))
if (m-m_next) {
if (m-m_flags  M_LOOP) {
IP6STAT_INC(ip6s_m2m[V_loif-if_index]);
-   } else if (m-m_pkthdr.rcvif-if_index  M2MMAX)
+   } else if (m-m_pkthdr.rcvif-if_index  IP6S_M2MMAX)
IP6STAT_INC(
ip6s_m2m[m-m_pkthdr.rcvif-if_index]);
else
IP6STAT_INC(ip6s_m2m[0]);
} else
IP6STAT_INC(ip6s_m1);
-#undef M2MMAX
}
 
/* drop the packet if IPv6 operation is disabled on the IF */
___
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: r249545 - head/usr.bin/netstat

2013-04-16 Thread Andrey V. Elsukov
Author: ae
Date: Tue Apr 16 11:25:45 2013
New Revision: 249545
URL: http://svnweb.freebsd.org/changeset/base/249545

Log:
  Replace hardcoded numbers. Also use interface-local scope name instead
  of node-local.

Modified:
  head/usr.bin/netstat/inet6.c

Modified: head/usr.bin/netstat/inet6.c
==
--- head/usr.bin/netstat/inet6.cTue Apr 16 11:19:13 2013
(r249544)
+++ head/usr.bin/netstat/inet6.cTue Apr 16 11:25:45 2013
(r249545)
@@ -408,7 +408,7 @@ ip6_stats(u_long off, const char *name, 
p(ip6s_cantfrag, \t%ju datagram%s that can't be fragmented\n);
p(ip6s_badscope, \t%ju packet%s that violated scope rules\n);
p(ip6s_notmember, \t%ju multicast packet%s which we don't join\n);
-   for (first = 1, i = 0; i  256; i++)
+   for (first = 1, i = 0; i  IP6S_HDRCNT; i++)
if (ip6stat.ip6s_nxthist[i] != 0) {
if (first) {
printf(\tInput histogram:\n);
@@ -419,7 +419,7 @@ ip6_stats(u_long off, const char *name, 
}
printf(\tMbuf statistics:\n);
printf(\t\t%ju one mbuf\n, (uintmax_t)ip6stat.ip6s_m1);
-   for (first = 1, i = 0; i  32; i++) {
+   for (first = 1, i = 0; i  IP6S_M2MMAX; i++) {
char ifbuf[IFNAMSIZ];
if (ip6stat.ip6s_m2m[i] != 0) {
if (first) {
@@ -445,7 +445,7 @@ ip6_stats(u_long off, const char *name, 
 #definePRINT_SCOPESTAT(s,i) do {\
switch(i) { /* XXX hardcoding in each case */\
case 1:\
-   p(s, \t\t%ju node-local%s\n);\
+   p(s, \t\t%ju interface-local%s\n);\
break;\
case 2:\
p(s,\t\t%ju link-local%s\n);\
@@ -464,7 +464,7 @@ ip6_stats(u_long off, const char *name, 
 
p(ip6s_sources_none,
  \t%ju failure%s of source address selection\n);
-   for (first = 1, i = 0; i  16; i++) {
+   for (first = 1, i = 0; i  IP6S_SCOPECNT; i++) {
if (ip6stat.ip6s_sources_sameif[i]) {
if (first) {
printf(\tsource addresses on an outgoing 
I/F\n);
@@ -473,7 +473,7 @@ ip6_stats(u_long off, const char *name, 
PRINT_SCOPESTAT(ip6s_sources_sameif[i], i);
}
}
-   for (first = 1, i = 0; i  16; i++) {
+   for (first = 1, i = 0; i  IP6S_SCOPECNT; i++) {
if (ip6stat.ip6s_sources_otherif[i]) {
if (first) {
printf(\tsource addresses on a non-outgoing 
I/F\n);
@@ -482,7 +482,7 @@ ip6_stats(u_long off, const char *name, 
PRINT_SCOPESTAT(ip6s_sources_otherif[i], i);
}
}
-   for (first = 1, i = 0; i  16; i++) {
+   for (first = 1, i = 0; i  IP6S_SCOPECNT; i++) {
if (ip6stat.ip6s_sources_samescope[i]) {
if (first) {
printf(\tsource addresses of same scope\n);
@@ -491,7 +491,7 @@ ip6_stats(u_long off, const char *name, 
PRINT_SCOPESTAT(ip6s_sources_samescope[i], i);
}
}
-   for (first = 1, i = 0; i  16; i++) {
+   for (first = 1, i = 0; i  IP6S_SCOPECNT; i++) {
if (ip6stat.ip6s_sources_otherscope[i]) {
if (first) {
printf(\tsource addresses of a different 
scope\n);
@@ -500,7 +500,7 @@ ip6_stats(u_long off, const char *name, 
PRINT_SCOPESTAT(ip6s_sources_otherscope[i], i);
}
}
-   for (first = 1, i = 0; i  16; i++) {
+   for (first = 1, i = 0; i  IP6S_SCOPECNT; i++) {
if (ip6stat.ip6s_sources_deprecated[i]) {
if (first) {
printf(\tdeprecated source addresses\n);
@@ -511,7 +511,7 @@ ip6_stats(u_long off, const char *name, 
}
 
printf(\tSource addresses selection rule applied:\n);
-   for (i = 0; i  16; i++) {
+   for (i = 0; i  IP6S_RULESMAX; i++) {
if (ip6stat.ip6s_sources_rule[i])
printf(\t\t%ju %s\n,
   (uintmax_t)ip6stat.ip6s_sources_rule[i],
___
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: r249546 - head/sys/netinet6

2013-04-16 Thread Andrey V. Elsukov
Author: ae
Date: Tue Apr 16 11:31:26 2013
New Revision: 249546
URL: http://svnweb.freebsd.org/changeset/base/249546

Log:
  Fix accounting after the r249528, also add several another counters to
  the statistics.

Modified:
  head/sys/netinet6/in6_src.c

Modified: head/sys/netinet6/in6_src.c
==
--- head/sys/netinet6/in6_src.c Tue Apr 16 11:25:45 2013(r249545)
+++ head/sys/netinet6/in6_src.c Tue Apr 16 11:31:26 2013(r249546)
@@ -151,6 +151,7 @@ static struct in6_addrpolicy *match_addr
  * an entry to the caller for later use.
  */
 #define REPLACE(r) do {\
+   IP6STAT_INC(ip6s_sources_rule[(r)]); \
rule = (r); \
/* { \
char ip6buf[INET6_ADDRSTRLEN], ip6b[INET6_ADDRSTRLEN]; \
@@ -166,6 +167,7 @@ static struct in6_addrpolicy *match_addr
goto next;  /* XXX: we can't use 'continue' here */ \
 } while(0)
 #define BREAK(r) do { \
+   IP6STAT_INC(ip6s_sources_rule[(r)]); \
rule = (r); \
goto out;   /* XXX: we can't use 'break' here */ \
 } while(0)
@@ -506,8 +508,17 @@ in6_selectsrc(struct sockaddr_in6 *dstso
*ifpp = ifp;
 
bcopy(tmp, srcp, sizeof(*srcp));
+   if (ia-ia_ifp == ifp)
+   IP6STAT_INC(ip6s_sources_sameif[best_scope]);
+   else
+   IP6STAT_INC(ip6s_sources_otherif[best_scope]);
+   if (dst_scope == best_scope)
+   IP6STAT_INC(ip6s_sources_samescope[best_scope]);
+   else
+   IP6STAT_INC(ip6s_sources_otherscope[best_scope]);
+   if (IFA6_IS_DEPRECATED(ia))
+   IP6STAT_INC(ip6s_sources_deprecated[best_scope]);
IN6_IFADDR_RUNLOCK();
-   IP6STAT_INC(ip6s_sources_rule[rule]);
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


Re: svn commit: r246880 - in head: lib/libsm libexec/mail.local libexec/smrsh share/mk usr.bin/vacation usr.sbin/sendmail

2013-04-16 Thread Bruce Evans

On Tue, 16 Apr 2013, Dimitry Andric wrote:


On 2013-04-16 06:19, ?? ?? wrote:

...
The warnings that usersmtp.c still triggers when -DSASL is used are:

: cc -O2 -pipe  -I/usr/src/usr.sbin/sendmail/../../contrib/sendmail/src 
-I/usr/src/usr.sbin/sendmail/../../contrib/sendmail/include -I. -DNEWDB 
-DNIS -DTCPWRAPPERS -DMAP_REGEX -DDNSMAP -DNETINET6 -DSTARTTLS -D_FFR_TLS_1 
-I/usr/local/include -DSASL=20126 -std=gnu99 -Qunused-arguments 
-fstack-protector -Wsystem-headers -Wno-pointer-sign -Wno-empty-body 
-Wno-string-plus-int -Wno-tautological-compare -Wno-unused-value 
-Wno-parentheses-equality -Wno-unused-function -Wno-conversion -Wno-switch 
-Wno-switch-enum -Wno-knr-promoted-parameter -Wno-parentheses -c 
/usr/src/usr.sbin/sendmail/../../contrib/sendmail/src/usersmtp.c
: /usr/src/usr.sbin/sendmail/../../contrib/sendmail/src/usersmtp.c:1797:50: 
warning: incompatible pointer types passing 'void ()' to parameter of type 
'void (*)(char *, bool, MAILER *, struct

:   mailer_con_info *, ENVELOPE *)' [-Wincompatible-pointer-types]
: smtpresult = reply(m, mci, e, TimeOuts.to_auth, getsasldata, 
NULL,

: ^~~


Have you tried the patch I posted here?

http://lists.freebsd.org/pipermail/freebsd-current/2013-March/040634.html

If people feel this is the right approach, I am happy to commit it.  If
people prefer to just shut up warnings, I am happy with that too.


stdbool is certainly incompatible with simple use of __P(()), but why does
the error message say that the function type is 'void ()', and why doesn't
it say that the prototype doesn't match the function?  The function is
declared as:

@ static void getsasldata __P((char *, bool, MAILER *, MCI *, ENVELOPE *));

This says that the function type is the same as the parameter type.

@ static void
@ getsasldata(line, firstline, m, mci, e)
@   char *line;
@   bool firstline;
@   MAILER *m;
@   register MCI *mci;
@   ENVELOPE *e;
@ {

This says that the function type is different from what the function's
prototype is, at least if the bool is smaller than int or otherwise
magic, which it is on at least amd64.

clang prints a good error message in the following simplified example:

@ #include stdbool.h
@ 
@ void foo(bool first);
@ 
@ void

@ foo(first)
@   bool first;
@ {
@ }

@ z.c:7:7: warning: promoted type 'int' of KR function parameter is not 
compatible with the parameter type 'bool' declared in a previous prototype 
[-Wknr-promoted-parameter]
@ bool first;
@  ^
@ z.c:3:15: note: previous declaration is here
@ void foo(bool first);
@   ^
@ 1 warning generated.

This happens with plain cc -c.

gcc of course turns the undefined behaviour from this into a portability
problem by accepting the bad code.  It takes gcc -pedantic to get a warning.

The correct prototype on amd64 is 'void foo(int first);'.  This is MD.
Unfortunately, the correct way to declare this is unsupported AFAIK.  It
is 'void foo(__promoteof(bool) first);'.  __P(()) is really hard to use,
since to use it you first have to modify compilers to support
__promoteof(), then use it on the type of all integer args whose type is
not int or larger, or do this using MD ifdefs.

Extending the example a little gives the answer to my question:

@ #include stdbool.h
@ 
@ typedef void vb(bool first);
@ 
@ vb foo;

@ void bar(vb *p);
@ 
@ void

@ foo(first)
@   bool first;
@ {
@   bar(foo);
@ }

@ z.c:10:7: warning: promoted type 'int' of KR function parameter is not 
compatible with the parameter type 'bool' declared in a previous prototype 
[-Wknr-promoted-parameter]
@ bool first;
@  ^
@ z.c:5:4: note: previous declaration is here
@ vb foo;
@^
@ z.c:12:6: warning: incompatible pointer types passing 'void ()' to parameter 
of type 'vb *' (aka 'void (*)(bool)') [-Wincompatible-pointer-types]
@ bar(foo);
@ ^~~
@ z.c:6:14: note: passing argument to parameter 'p' here
@ void bar(vb *p);
@  ^
@ 2 warnings generated.

Apparently clang ignores the mismatched prototype after printing a warning
about it, and also throws away the type info that it learns by compiling
the KR function, so it is left with only 'void ()' for the type.  Then
the warnings for some reason emphasize the secondary warnings from this.

The first warning should be an error.  It is only a warning for gcc -pedantic
too.

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: r249547 - head/cddl/contrib/opensolaris/lib/libzfs/common

2013-04-16 Thread Pawel Jakub Dawidek
Author: pjd
Date: Tue Apr 16 12:31:16 2013
New Revision: 249547
URL: http://svnweb.freebsd.org/changeset/base/249547

Log:
  Correct error message.
  
  Reported by:  Dirk Engling erdge...@erdgeist.org

Modified:
  head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c

Modified: head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c
==
--- head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.cTue Apr 
16 11:31:26 2013(r249546)
+++ head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.cTue Apr 
16 12:31:16 2013(r249547)
@@ -4590,7 +4590,7 @@ zfs_jail(zfs_handle_t *zhp, int jailid, 
dgettext(TEXT_DOMAIN, cannot jail '%s'), zhp-zfs_name);
} else {
(void) snprintf(errbuf, sizeof (errbuf),
-   dgettext(TEXT_DOMAIN, cannot jail '%s'), zhp-zfs_name);
+   dgettext(TEXT_DOMAIN, cannot unjail '%s'), zhp-zfs_name);
}
 
switch (zhp-zfs_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


Re: svn commit: r249543 - head/sys/netinet6

2013-04-16 Thread Tijl Coosemans
On 2013-04-16 13:12, Andrey V. Elsukov wrote:
 Author: ae
 Date: Tue Apr 16 11:12:58 2013
 New Revision: 249543
 URL: http://svnweb.freebsd.org/changeset/base/249543
 
 Log:
   Replace hardcoded numbers.
 
 Modified:
   head/sys/netinet6/ip6_var.h
 
 Modified: head/sys/netinet6/ip6_var.h
 ==
 --- head/sys/netinet6/ip6_var.h   Tue Apr 16 08:54:50 2013
 (r249542)
 +++ head/sys/netinet6/ip6_var.h   Tue Apr 16 11:12:58 2013
 (r249543)
 @@ -204,9 +204,11 @@ struct   ip6stat {
   u_quad_t ip6s_rawout;   /* total raw ip packets generated */
   u_quad_t ip6s_badscope; /* scope error */
   u_quad_t ip6s_notmember;/* don't join this multicast group */
 - u_quad_t ip6s_nxthist[256]; /* next header history */
 +#define  IP6S_HDRCNT 256 /* headers count */
 + u_quad_t ip6s_nxthist[IP6S_HDRCNT]; /* next header history */
   u_quad_t ip6s_m1;   /* one mbuf */
 - u_quad_t ip6s_m2m[32];  /* two or more mbuf */
 +#define  IP6S_M2MMAX 32
 + u_quad_t ip6s_m2m[IP6S_M2MMAX]; /* two or more mbuf */
   u_quad_t ip6s_mext1;/* one ext mbuf */
   u_quad_t ip6s_mext2m;   /* two or more ext mbuf */
   u_quad_t ip6s_exthdrtoolong;/* ext hdr are not contiguous */
 @@ -218,27 +220,29 @@ struct  ip6stat {
* algorithm:
* XXX: hardcoded 16 = # of ip6 multicast scope types + 1
*/
 +#define  IP6S_RULESMAX   16
 +#define  IP6S_SCOPECNT   16
   /* number of times that address selection fails */
   u_quad_t ip6s_sources_none;
   /* number of times that an address on the outgoing I/F is chosen */
 - u_quad_t ip6s_sources_sameif[16];
 + u_quad_t ip6s_sources_sameif[IP6S_SCOPECNT];
   /* number of times that an address on a non-outgoing I/F is chosen */
 - u_quad_t ip6s_sources_otherif[16];
 + u_quad_t ip6s_sources_otherif[IP6S_SCOPECNT];
   /*
* number of times that an address that has the same scope
* from the destination is chosen.
*/
 - u_quad_t ip6s_sources_samescope[16];
 + u_quad_t ip6s_sources_samescope[IP6S_SCOPECNT];
   /*
* number of times that an address that has a different scope
* from the destination is chosen.
*/
 - u_quad_t ip6s_sources_otherscope[16];
 + u_quad_t ip6s_sources_otherscope[IP6S_SCOPECNT];
   /* number of times that a deprecated address is chosen */
 - u_quad_t ip6s_sources_deprecated[16];
 + u_quad_t ip6s_sources_deprecated[IP6S_SCOPECNT];
  
   /* number of times that each rule of source selection is applied. */
 - u_quad_t ip6s_sources_rule[16];
 + u_quad_t ip6s_sources_rule[IP6S_MAXRULES];

This breaks buildworld because IP6S_MAXRULES is undefined. It's called
IP6S_RULESMAX above.



signature.asc
Description: OpenPGP digital signature


Re: svn commit: r246880 - in head: lib/libsm libexec/mail.local libexec/smrsh share/mk usr.bin/vacation usr.sbin/sendmail

2013-04-16 Thread Giorgos Keramidas
On Tue, 16 Apr 2013 21:28:36 +1000 (EST), Bruce Evans b...@optusnet.com.au 
wrote:
On Tue, 16 Apr 2013, Dimitry Andric wrote:
 Have you tried the patch I posted here?

 http://lists.freebsd.org/pipermail/freebsd-current/2013-March/040634.html

 If people feel this is the right approach, I am happy to commit it.  If
 people prefer to just shut up warnings, I am happy with that too.

Hi Dimitry,

I haven't but I will right now.  Thanks for pointing me to it :)

Also Bruce, thanks for the very detailed explanation.  I admit I was a
bit confused when a similar small test program I wrote failed to trigger
the warning in clang:

  #include stdio.h

  void foo(int code, const char *text);

  void
  foo(code, text)
int code;
const char *text;
  {
  printf(error %d: %s, code, text);
  }

  int
  main(void)
  {
  foo(0, unknown error);
  return 0;
  }

But now -- having read all the details you wrote -- using stdbool.h and
changing the type of 'code' to bool, *does* trigger the promotion and
the warning:

  #include stdbool.h
  #include stdio.h

  void foo(bool code, const char *text);

  void
  foo(code, text)
  bool code;
  const char *text;
  {
  if (code != false)
 printf(error: %s, text);
  }

  int
  main(void)
  {
  foo(false, unknown error);
  return 0;
  }

% cc -O2 -pipe  -std=gnu99 -Qunused-arguments -fstack-protector  -c

  proto.c
  proto.c:8:10: warning: promoted type 'int' of KR function parameter is
  not compatible with the parameter type 'bool' declared in a previous
  prototype
[-Wknr-promoted-parameter]
  bool code;
   ^
  proto.c:4:15: note: previous declaration is here
  void foo(bool code, const char *text);
^
  1 warning generated.

 stdbool is certainly incompatible with simple use of __P(()), but why does
 the error message say that the function type is 'void ()', and why doesn't
 it say that the prototype doesn't match the function?  The function is
 declared as:

 @ static void getsasldata __P((char *, bool, MAILER *, MCI *, ENVELOPE *));

 This says that the function type is the same as the parameter type.

 @ static void
 @ getsasldata(line, firstline, m, mci, e)
 @ char *line;
 @ bool firstline;
 @ MAILER *m;
 @ register MCI *mci;
 @ ENVELOPE *e;
 @ {

 This says that the function type is different from what the function's
 prototype is, at least if the bool is smaller than int or otherwise
 magic, which it is on at least amd64.

 clang prints a good error message in the following simplified example:

 @ #include stdbool.h
 @ @ void foo(bool first);
 @ @ void
 @ foo(first)
 @ bool first;
 @ {
 @ }

 @ z.c:7:7: warning: promoted type 'int' of KR function parameter is not 
 compatible with the parameter type 'bool' declared in a previous prototype 
 [-Wknr-promoted-parameter]
 @ bool first;
 @  ^
 @ z.c:3:15: note: previous declaration is here
 @ void foo(bool first);
 @   ^
 @ 1 warning generated.

 This happens with plain cc -c.

 gcc of course turns the undefined behaviour from this into a portability
 problem by accepting the bad code.  It takes gcc -pedantic to get a warning.

 The correct prototype on amd64 is 'void foo(int first);'.  This is MD.
 Unfortunately, the correct way to declare this is unsupported AFAIK.  It
 is 'void foo(__promoteof(bool) first);'.  __P(()) is really hard to use,
 since to use it you first have to modify compilers to support
 __promoteof(), then use it on the type of all integer args whose type is
 not int or larger, or do this using MD ifdefs.

 Extending the example a little gives the answer to my question:

 @ #include stdbool.h
 @ @ typedef void vb(bool first);
 @ @ vb foo;
 @ void bar(vb *p);
 @ @ void
 @ foo(first)
 @ bool first;
 @ {
 @ bar(foo);
 @ }

 @ z.c:10:7: warning: promoted type 'int' of KR function parameter is not 
 compatible with the parameter type 'bool' declared in a previous prototype 
 [-Wknr-promoted-parameter]
 @ bool first;
 @  ^
 @ z.c:5:4: note: previous declaration is here
 @ vb foo;
 @^
 @ z.c:12:6: warning: incompatible pointer types passing 'void ()' to 
 parameter of type 'vb *' (aka 'void (*)(bool)') [-Wincompatible-pointer-types]
 @ bar(foo);
 @ ^~~
 @ z.c:6:14: note: passing argument to parameter 'p' here
 @ void bar(vb *p);
 @  ^
 @ 2 warnings generated.

 Apparently clang ignores the mismatched prototype after printing a warning
 about it, and also throws away the type info that it learns by compiling
 the KR function, so it is left with only 'void ()' for the type.  Then
 the warnings for some reason emphasize the secondary warnings from this.

 The first warning should be an error.  It is only a warning for gcc -pedantic
 too.

 Bruce

--
Giorgos Keramidas; gkerami...@gmail.com
___
svn-src-head@freebsd.org mailing list

Re: svn commit: r246880 - in head: lib/libsm libexec/mail.local libexec/smrsh share/mk usr.bin/vacation usr.sbin/sendmail

2013-04-16 Thread Giorgos Keramidas
On Tue, 16 Apr 2013 11:03:01 +0200, Dimitry Andric d...@freebsd.org wrote:
 On 2013-04-16 06:19, Γιώργος Κεραμίδας wrote:
 On Sat, 16 Feb 2013 20:17:31 + (UTC), Dimitry Andric d...@freebsd.org 
 wrote:
 ...
Since clang 3.2 now has an option to suppress warnings about implicitly
promoted KR parameters, remove the workarounds added for sendmail
components in r228558.
 ...
 The part of the commit that removes NO_WERROR.clang for usr.sbin/sendmail/
 breaks the build of Sendmail with -DSASL.  I just tried rebuilding Sendmail
 with the following in /etc/make.conf:

  # Build Sendmail with SASL support.
  SENDMAIL_CFLAGS ?= -I/usr/local/include -DSASL=20126
  SENDMAIL_LDFLAGS ?= -L/usr/local/lib
  SENDMAIL_LDADD ?= -lsasl2

 The warnings that usersmtp.c still triggers when -DSASL is used are:

 : cc -O2 -pipe -I/usr/src/usr.sbin/sendmail/../../contrib/sendmail/src
 -I/usr/src/usr.sbin/sendmail/../../contrib/sendmail/include
 -I. -DNEWDB -DNIS -DTCPWRAPPERS -DMAP_REGEX -DDNSMAP -DNETINET6
 -DSTARTTLS -D_FFR_TLS_1 -I/usr/local/include -DSASL=20126 -std=gnu99
 -Qunused-arguments -fstack-protector -Wsystem-headers
 -Wno-pointer-sign -Wno-empty-body -Wno-string-plus-int
 -Wno-tautological-compare -Wno-unused-value -Wno-parentheses-equality
 -Wno-unused-function -Wno-conversion -Wno-switch -Wno-switch-enum
 -Wno-knr-promoted-parameter -Wno-parentheses -c
 /usr/src/usr.sbin/sendmail/../../contrib/sendmail/src/usersmtp.c
 :
 /usr/src/usr.sbin/sendmail/../../contrib/sendmail/src/usersmtp.c:1797:50:
 warning: incompatible pointer types passing 'void ()' to parameter of
 type 'void (*)(char *, bool, MAILER *, struct
 :   mailer_con_info *, ENVELOPE *)' [-Wincompatible-pointer-types]
 : smtpresult = reply(m, mci, e, TimeOuts.to_auth, getsasldata, NULL,
 : ^~~

 Have you tried the patch I posted here?

 http://lists.freebsd.org/pipermail/freebsd-current/2013-March/040634.html

 If people feel this is the right approach, I am happy to commit it.  If
 people prefer to just shut up warnings, I am happy with that too.

Confirmed.  This fixes the build of usr.sbin/sendmail even without the
NO_WERROR.clang= option.

Thanks :-)

___
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: r249484 - head/lib

2013-04-16 Thread Tijl Coosemans
On 2013-04-14 21:13, Tim Kientzle wrote:
 Author: kientzle
 Date: Sun Apr 14 19:13:51 2013
 New Revision: 249484
 URL: http://svnweb.freebsd.org/changeset/base/249484
 
 Log:
   Install a symlink
 /usr/lib/include == /usr/include
   
   This fixes -print-file-name=include in clang (and is
   arguably a better way to fix the same issue in GCC than
   the change I made in r231336).
   
   MFC after:  1 week
 
 Modified:
   head/lib/Makefile
 
 Modified: head/lib/Makefile
 ==
 --- head/lib/Makefile Sun Apr 14 18:36:30 2013(r249483)
 +++ head/lib/Makefile Sun Apr 14 19:13:51 2013(r249484)
 @@ -252,4 +252,7 @@ _libusbhid=   libusbhid
  _libusb= libusb
  .endif
  
 +afterinstall:
 + ln -fs ../include ${DESTDIR}/usr/lib/include
 +
  .include bsd.subdir.mk

This breaks with -DNO_CLEAN defined, because then
${DESTDIR}/usr/lib/include/include is created.

I'm not that fond of this patch by the way, but I don't fully
understand the problem it's trying to solve so I won't object.
It just looks too much like a hack to me.



signature.asc
Description: OpenPGP digital signature


Re: svn commit: r246880 - in head: lib/libsm libexec/mail.local libexec/smrsh share/mk usr.bin/vacation usr.sbin/sendmail

2013-04-16 Thread Dimitry Andric

On 2013-04-16 13:28, Bruce Evans wrote:

On Tue, 16 Apr 2013, Dimitry Andric wrote:

On 2013-04-16 06:19, Γιώργος Κεραμίδας wrote:

...

: cc -O2 -pipe  -I/usr/src/usr.sbin/sendmail/../../contrib/sendmail/src
-I/usr/src/usr.sbin/sendmail/../../contrib/sendmail/include -I. -DNEWDB
-DNIS -DTCPWRAPPERS -DMAP_REGEX -DDNSMAP -DNETINET6 -DSTARTTLS -D_FFR_TLS_1
-I/usr/local/include -DSASL=20126 -std=gnu99 -Qunused-arguments
-fstack-protector -Wsystem-headers -Wno-pointer-sign -Wno-empty-body
-Wno-string-plus-int -Wno-tautological-compare -Wno-unused-value
-Wno-parentheses-equality -Wno-unused-function -Wno-conversion -Wno-switch
-Wno-switch-enum -Wno-knr-promoted-parameter -Wno-parentheses -c
/usr/src/usr.sbin/sendmail/../../contrib/sendmail/src/usersmtp.c
: /usr/src/usr.sbin/sendmail/../../contrib/sendmail/src/usersmtp.c:1797:50:
warning: incompatible pointer types passing 'void ()' to parameter of type
'void (*)(char *, bool, MAILER *, struct
:   mailer_con_info *, ENVELOPE *)' [-Wincompatible-pointer-types]
: smtpresult = reply(m, mci, e, TimeOuts.to_auth, getsasldata,
NULL,
: ^~~

...

stdbool is certainly incompatible with simple use of __P(()), but why does
the error message say that the function type is 'void ()', and why doesn't
it say that the prototype doesn't match the function?


Because we pass -Wno-knr-promoted-parameter to suppress the warning.
Before clang grew this flag, we had to set NO_WERROR to make it
non-fatal.


...

Extending the example a little gives the answer to my question:

@ #include stdbool.h
@
@ typedef void vb(bool first);
@
@ vb foo;
@ void bar(vb *p);
@
@ void
@ foo(first)
@   bool first;
@ {
@   bar(foo);
@ }

@ z.c:10:7: warning: promoted type 'int' of KR function parameter is not 
compatible with the parameter type 'bool' declared in a previous prototype 
[-Wknr-promoted-parameter]
@ bool first;
@  ^
@ z.c:5:4: note: previous declaration is here
@ vb foo;
@^
@ z.c:12:6: warning: incompatible pointer types passing 'void ()' to parameter 
of type 'vb *' (aka 'void (*)(bool)') [-Wincompatible-pointer-types]
@ bar(foo);
@ ^~~
@ z.c:6:14: note: passing argument to parameter 'p' here
@ void bar(vb *p);
@  ^
@ 2 warnings generated.

Apparently clang ignores the mismatched prototype after printing a warning
about it, and also throws away the type info that it learns by compiling
the KR function, so it is left with only 'void ()' for the type.


Yes, this is basically what happens.  The actual definition of the
function overrides the prototype, if it comes before the invocation.

For example, in the original problem case, the warning could also be
worked around by moving the getsasldata() definition to below
attemptauth(), where it is invoked.  This still counts as cheating,
though. :-)

___
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: r249548 - head/sys/kern

2013-04-16 Thread Rick Macklem
Author: rmacklem
Date: Tue Apr 16 14:22:16 2013
New Revision: 249548
URL: http://svnweb.freebsd.org/changeset/base/249548

Log:
  Allow the vnode to be unlocked for the weird case of
  LK_EXCLOTHER. LK_EXCLOTHER is only used to acquire a
  usecount on a vnode during NFSv4 recovery from an
  expired lease.
  
  Reported and tested by:   pho
  MFC after:2 weeks

Modified:
  head/sys/kern/vfs_subr.c

Modified: head/sys/kern/vfs_subr.c
==
--- head/sys/kern/vfs_subr.cTue Apr 16 12:31:16 2013(r249547)
+++ head/sys/kern/vfs_subr.cTue Apr 16 14:22:16 2013(r249548)
@@ -4123,7 +4123,7 @@ vop_lock_post(void *ap, int rc)
struct vop_lock1_args *a = ap;
 
ASSERT_VI_UNLOCKED(a-a_vp, VOP_LOCK);
-   if (rc == 0)
+   if (rc == 0  (a-a_flags  LK_EXCLOTHER) == 0)
ASSERT_VOP_LOCKED(a-a_vp, VOP_LOCK);
 #endif
 }
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


Re: svn commit: r246880 - in head: lib/libsm libexec/mail.local libexec/smrsh share/mk usr.bin/vacation usr.sbin/sendmail

2013-04-16 Thread Giorgos Keramidas
On Tue, 16 Apr 2013 15:44:36 +0200, Dimitry Andric d...@freebsd.org wrote:
 On 2013-04-16 13:28, Bruce Evans wrote:
 Extending the example a little gives the answer to my question:

 @ #include stdbool.h
 @
 @ typedef void vb(bool first);
 @
 @ vb foo;
 @ void bar(vb *p);
 @
 @ void
 @ foo(first)
 @bool first;
 @ {
 @bar(foo);
 @ }

 @ z.c:10:7: warning: promoted type 'int' of KR function parameter is
 not compatible with the parameter type 'bool' declared in a previous
 prototype [-Wknr-promoted-parameter]
 @ bool first;
 @  ^
 @ z.c:5:4: note: previous declaration is here
 @ vb foo;
 @^
 @ z.c:12:6: warning: incompatible pointer types passing 'void ()' to 
 parameter of type 'vb *' (aka 'void (*)(bool)') 
 [-Wincompatible-pointer-types]
 @ bar(foo);
 @ ^~~
 @ z.c:6:14: note: passing argument to parameter 'p' here
 @ void bar(vb *p);
 @  ^
 @ 2 warnings generated.

 Apparently clang ignores the mismatched prototype after printing a warning
 about it, and also throws away the type info that it learns by compiling
 the KR function, so it is left with only 'void ()' for the type.

 Yes, this is basically what happens.  The actual definition of the
 function overrides the prototype, if it comes before the invocation.

 For example, in the original problem case, the warning could also be
 worked around by moving the getsasldata() definition to below
 attemptauth(), where it is invoked.  This still counts as cheating,
 though. :-)

And that's precisely why other functions, like esmtp_check() do not have
the same problem, even though they have exactly the same signature and
they are used in the same way!

___
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: r246880 - in head: lib/libsm libexec/mail.local libexec/smrsh share/mk usr.bin/vacation usr.sbin/sendmail

2013-04-16 Thread Gregory Shapiro
Just a quick comment that I will be committing a fix to the sendmail
source tree on FreeBSD to avoid this issue.  It will avoid loading
stdbool.h when clang is in use, thereby turning all bools to ints.
It will be checked in this weekend (currently being tested before
release).

/*
**  SM_CONF_STDBOOL_H is 1 if stdbool.h exists
**
**  Note, unlike gcc, clang doesn't apply full prototypes to KR definitions.
*/

# ifndef SM_CONF_STDBOOL_H
#  if !defined(__clang__)  defined(__STDC_VERSION__)  __STDC_VERSION__ = 
199901L
#   define SM_CONF_STDBOOL_H1
#  else /* !defined(__clang__)  defined(__STDC_VERSION__)  __STDC_VERSION__ 
= 199901L */
#   define SM_CONF_STDBOOL_H0
#  endif /* !defined(__clang__)  defined(__STDC_VERSION__)  
__STDC_VERSION__ = 199901L */
# endif /* ! SM_CONF_STDBOOL_H */
___
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: r249551 - head/sys/mips/include

2013-04-16 Thread Warner Losh
Author: imp
Date: Tue Apr 16 16:54:37 2013
New Revision: 249551
URL: http://svnweb.freebsd.org/changeset/base/249551

Log:
  Point to regdef.h. May need to dig up references to the N32 standard
  that support this usage (which may be a bit rough, since different
  parts of the standard say mutually contradictory things).

Modified:
  head/sys/mips/include/regnum.h

Modified: head/sys/mips/include/regnum.h
==
--- head/sys/mips/include/regnum.h  Tue Apr 16 16:35:48 2013
(r249550)
+++ head/sys/mips/include/regnum.h  Tue Apr 16 16:54:37 2013
(r249551)
@@ -125,7 +125,7 @@
 
 /*
  * Pseudo registers so we save a complete set of registers regardless of
- * the ABI
+ * the ABI. See regdef.h for a more complete explanation.
  */
 #if defined(__mips_n32) || defined(__mips_n64)
 #defineTA0 8
___
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: r249552 - head/sys/netinet6

2013-04-16 Thread Tijl Coosemans
Author: tijl
Date: Tue Apr 16 16:59:29 2013
New Revision: 249552
URL: http://svnweb.freebsd.org/changeset/base/249552

Log:
  Fix build after r249543.

Modified:
  head/sys/netinet6/ip6_var.h

Modified: head/sys/netinet6/ip6_var.h
==
--- head/sys/netinet6/ip6_var.h Tue Apr 16 16:54:37 2013(r249551)
+++ head/sys/netinet6/ip6_var.h Tue Apr 16 16:59:29 2013(r249552)
@@ -242,7 +242,7 @@ struct  ip6stat {
u_quad_t ip6s_sources_deprecated[IP6S_SCOPECNT];
 
/* number of times that each rule of source selection is applied. */
-   u_quad_t ip6s_sources_rule[IP6S_MAXRULES];
+   u_quad_t ip6s_sources_rule[IP6S_RULESMAX];
 };
 
 #ifdef _KERNEL
___
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: r249553 - head/lib/libstand/mips

2013-04-16 Thread Robert Watson
Author: rwatson
Date: Tue Apr 16 17:03:35 2013
New Revision: 249553
URL: http://svnweb.freebsd.org/changeset/base/249553

Log:
  Adapt libstand's setjmp/longjmp MIPS support to be portable across 32-bit
  and 64-bit MIPS.  Don't use the floating-point coprocessor in the libstand
  context for MIPS.
  
  Reviewed by:  imp
  MFC after:3 days
  Sponsored by: DARPA, AFRL

Modified:
  head/lib/libstand/mips/_setjmp.S

Modified: head/lib/libstand/mips/_setjmp.S
==
--- head/lib/libstand/mips/_setjmp.STue Apr 16 16:59:29 2013
(r249552)
+++ head/lib/libstand/mips/_setjmp.STue Apr 16 17:03:35 2013
(r249553)
@@ -59,33 +59,20 @@
 
 LEAF(_setjmp)
.setnoreorder
-   li  v0, 0xACEDBADE  # sigcontext magic number
-   sw  ra, (2 * 4)(a0) # sc_pc = return address
-   sw  v0, (3 * 4)(a0) #   saved in sc_regs[0]
-   sw  s0, ((S0 + 3) * 4)(a0)
-   sw  s1, ((S1 + 3) * 4)(a0)
-   sw  s2, ((S2 + 3) * 4)(a0)
-   sw  s3, ((S3 + 3) * 4)(a0)
-   sw  s4, ((S4 + 3) * 4)(a0)
-   sw  s5, ((S5 + 3) * 4)(a0)
-   sw  s6, ((S6 + 3) * 4)(a0)
-   sw  s7, ((S7 + 3) * 4)(a0)
-   sw  sp, ((SP + 3) * 4)(a0)
-   sw  s8, ((S8 + 3) * 4)(a0)
-   cfc1v0, $31 # too bad cant check if FP used
-   swc1$f20, ((20 + 38) * 4)(a0)
-   swc1$f21, ((21 + 38) * 4)(a0)
-   swc1$f22, ((22 + 38) * 4)(a0)
-   swc1$f23, ((23 + 38) * 4)(a0)
-   swc1$f24, ((24 + 38) * 4)(a0)
-   swc1$f25, ((25 + 38) * 4)(a0)
-   swc1$f26, ((26 + 38) * 4)(a0)
-   swc1$f27, ((27 + 38) * 4)(a0)
-   swc1$f28, ((28 + 38) * 4)(a0)
-   swc1$f29, ((29 + 38) * 4)(a0)
-   swc1$f30, ((30 + 38) * 4)(a0)
-   swc1$f31, ((31 + 38) * 4)(a0)
-   sw  v0, ((32 + 38) * 4)(a0)
+   REG_LI  v0, 0xACEDBADE  # sigcontext magic number
+   REG_S   ra, (2 * SZREG)(a0) # sc_pc = return address
+   REG_S   v0, (3 * SZREG)(a0) #   saved in sc_regs[0]
+   REG_S   s0, ((S0 + 3) * SZREG)(a0)
+   REG_S   s1, ((S1 + 3) * SZREG)(a0)
+   REG_S   s2, ((S2 + 3) * SZREG)(a0)
+   REG_S   s3, ((S3 + 3) * SZREG)(a0)
+   REG_S   s4, ((S4 + 3) * SZREG)(a0)
+   REG_S   s5, ((S5 + 3) * SZREG)(a0)
+   REG_S   s6, ((S6 + 3) * SZREG)(a0)
+   REG_S   s7, ((S7 + 3) * SZREG)(a0)
+   REG_S   sp, ((SP + 3) * SZREG)(a0)
+   REG_S   s8, ((S8 + 3) * SZREG)(a0)
+   REG_S   v0, ((32 + 38) * SZREG)(a0)
j   ra
movev0, zero
 END(_setjmp)
@@ -96,38 +83,22 @@ LEAF(_longjmp)
.cprestore 16
 #endif  
.setnoreorder
-   lw  v0, (3 * 4)(a0) # get magic number
-   lw  ra, (2 * 4)(a0)
+   REG_L   v0, (3 * SZREG)(a0) # get magic number
+   REG_L   ra, (2 * SZREG)(a0)
bne v0, 0xACEDBADE, botch   # jump if error
 
addusp, sp, 32  # does not matter, sanity
-   lw  s0, ((S0 + 3) * 4)(a0)
-   lw  s1, ((S1 + 3) * 4)(a0)
-   lw  s2, ((S2 + 3) * 4)(a0)
-   lw  s3, ((S3 + 3) * 4)(a0)
-   lw  s4, ((S4 + 3) * 4)(a0)
-   lw  s5, ((S5 + 3) * 4)(a0)
-   lw  s6, ((S6 + 3) * 4)(a0)
-   lw  s7, ((S7 + 3) * 4)(a0)
-   lw  v0, ((32 + 38) * 4)(a0) # get fpu status
-   lw  sp, ((SP + 3) * 4)(a0)
-   lw  s8, ((S8 + 3) * 4)(a0)
-/* Octeon does not have an FPU */
-#if !defined(_MIPS_ARCH_OCTEON)
-   ctc1v0, $31
-   lwc1$f20, ((20 + 38) * 4)(a0)
-   lwc1$f21, ((21 + 38) * 4)(a0)
-   lwc1$f22, ((22 + 38) * 4)(a0)
-   lwc1$f23, ((23 + 38) * 4)(a0)
-   lwc1$f24, ((24 + 38) * 4)(a0)
-   lwc1$f25, ((25 + 38) * 4)(a0)
-   lwc1$f26, ((26 + 38) * 4)(a0)
-   lwc1$f27, ((27 + 38) * 4)(a0)
-   lwc1$f28, ((28 + 38) * 4)(a0)
-   lwc1$f29, ((29 + 38) * 4)(a0)
-   lwc1$f30, ((30 + 38) * 4)(a0)
-   lwc1$f31, ((31 + 38) * 4)(a0)
-#endif /*  _MIPS_ARCH_OCTEON */
+   REG_L   s0, ((S0 + 3) * SZREG)(a0)
+   REG_L   s1, ((S1 + 3) * SZREG)(a0)
+   REG_L   s2, ((S2 + 3) * SZREG)(a0)
+   REG_L   s3, ((S3 + 3) * SZREG)(a0)
+   REG_L   s4, ((S4 + 3) * SZREG)(a0)
+   REG_L   s5, ((S5 + 3) * SZREG)(a0)
+   REG_L   s6, ((S6 + 3) * SZREG)(a0)
+   REG_L   s7, ((S7 + 3) * SZREG)(a0)
+   REG_L   v0, ((32 + 38) * SZREG)(a0) # get fpu status
+   REG_L   sp, ((SP + 3) * SZREG)(a0)
+   REG_L   s8, ((S8 + 3) * SZREG)(a0)
 
j   ra
movev0, a1
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to 

Re: svn commit: r249461 - head/sys/dev/ips

2013-04-16 Thread John Baldwin
On Saturday, April 13, 2013 10:42:40 pm Hiren Panchasara wrote:
 Author: hiren
 Date: Sun Apr 14 02:42:40 2013
 New Revision: 249461
 URL: http://svnweb.freebsd.org/changeset/base/249461
 
 Log:
   Fixing a clang warning indicating uninitialized variable usage.
   
   PR: kern/177164
   Approved by:sbruno (mentor)

Hmm, I always thought that dmatags and maps were opaque types and not 
necessarily known in consumers to be pointers.  (Some drivers do check tehm 
against NULL implicitly via 'if (map)' or 'if (tag)', but well-behaved drivers 
use other means (flags, etc.) to know if they are valid.)

-- 
John Baldwin
___
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: r249489 - head/etc/rc.d

2013-04-16 Thread John Baldwin
On Sunday, April 14, 2013 5:11:20 pm Bryan Drewery wrote:
 Author: bdrewery (ports committer)
 Date: Sun Apr 14 21:11:19 2013
 New Revision: 249489
 URL: http://svnweb.freebsd.org/changeset/base/249489
 
 Log:
   Run configtest before restarting so that the system is not
   left without a running sshd.
   
   Approved by:des
   MFC after:  1 week
 
 Modified:
   head/etc/rc.d/sshd

Maybe do the same for 'reload' as well?

-- 
John Baldwin
___
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: r249554 - head/lib/libstand

2013-04-16 Thread Robert Watson
Author: rwatson
Date: Tue Apr 16 17:20:52 2013
New Revision: 249554
URL: http://svnweb.freebsd.org/changeset/base/249554

Log:
  Use a suitable code generation when building libstand for MIPS.
  
  Reviewed by:  imp
  Sponsored by: DARPA, AFRL
  MFC after:3 days

Modified:
  head/lib/libstand/Makefile

Modified: head/lib/libstand/Makefile
==
--- head/lib/libstand/Makefile  Tue Apr 16 17:03:35 2013(r249553)
+++ head/lib/libstand/Makefile  Tue Apr 16 17:20:52 2013(r249554)
@@ -36,6 +36,9 @@ CFLAGS+=  -m32 -I.
 .if ${MACHINE_CPUARCH} == arm
 CFLAGS+=   -msoft-float -D_STANDALONE
 .endif
+.if ${MACHINE_CPUARCH} == mips
+CFLAGS+=   -G0 -fno-pic -mno-abicalls
+.endif
 
 # standalone components and stuff we have modified locally
 SRCS+= gzguts.h zutil.h __main.c assert.c bcd.c bswap.c environment.c getopt.c 
gets.c \
___
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: r249555 - head/etc/rc.d

2013-04-16 Thread Bryan Drewery
Author: bdrewery (ports committer)
Date: Tue Apr 16 17:30:13 2013
New Revision: 249555
URL: http://svnweb.freebsd.org/changeset/base/249555

Log:
  Also call configtest before reload to ensure working config.
  
  Approved by:  jhb
  MFC after:1 week
  X-MFC-With:   r249489

Modified:
  head/etc/rc.d/sshd

Modified: head/etc/rc.d/sshd
==
--- head/etc/rc.d/sshd  Tue Apr 16 17:20:52 2013(r249554)
+++ head/etc/rc.d/sshd  Tue Apr 16 17:30:13 2013(r249555)
@@ -14,6 +14,7 @@ rcvar=sshd_enable
 command=/usr/sbin/${name}
 keygen_cmd=sshd_keygen
 start_precmd=sshd_precmd
+reload_precmd=sshd_configtest
 restart_precmd=sshd_configtest
 configtest_cmd=sshd_configtest
 pidfile=/var/run/${name}.pid
___
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: r249489 - head/etc/rc.d

2013-04-16 Thread Bryan Drewery
On 4/16/2013 11:20 AM, John Baldwin wrote:
 On Sunday, April 14, 2013 5:11:20 pm Bryan Drewery wrote:
 Author: bdrewery (ports committer)
 Date: Sun Apr 14 21:11:19 2013
 New Revision: 249489
 URL: http://svnweb.freebsd.org/changeset/base/249489

 Log:
   Run configtest before restarting so that the system is not
   left without a running sshd.
   
   Approved by:   des
   MFC after: 1 week

 Modified:
   head/etc/rc.d/sshd
 
 Maybe do the same for 'reload' as well?
 

Done.

-- 
Regards,
Bryan Drewery



signature.asc
Description: OpenPGP digital signature


svn commit: r249556 - head/sys/geom

2013-04-16 Thread Brooks Davis
Author: brooks
Date: Tue Apr 16 17:47:13 2013
New Revision: 249556
URL: http://svnweb.freebsd.org/changeset/base/249556

Log:
  Partial MFP4 of 222836:
  
  Only look for FDT partitions if our potential parent is a DISK device.
  
  Excluding direct recursion on the flashmap geoms was insufficient
  because it did not prevent the underlying device from being retrieved if
  flashmap geoms were further partitioned.
  
  Reviewed by:  imp
  Sponsored by: DARPA, AFRL

Modified:
  head/sys/geom/geom_flashmap.c

Modified: head/sys/geom/geom_flashmap.c
==
--- head/sys/geom/geom_flashmap.c   Tue Apr 16 17:30:13 2013
(r249555)
+++ head/sys/geom/geom_flashmap.c   Tue Apr 16 17:47:13 2013
(r249556)
@@ -174,7 +174,7 @@ g_flashmap_taste(struct g_class *mp, str
g_topology_assert();
 
if (flags == G_TF_NORMAL 
-   !strcmp(pp-geom-class-name, FLASHMAP_CLASS_NAME))
+   strcmp(pp-geom-class-name, G_DISK_CLASS_NAME) != 0)
return (NULL);
 
gp = g_slice_new(mp, FLASH_SLICES_MAX_NUM, pp, cp, NULL, 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: r249558 - in head/sys: kern sys

2013-04-16 Thread Mikolaj Golub
Author: trociny
Date: Tue Apr 16 19:19:14 2013
New Revision: 249558
URL: http://svnweb.freebsd.org/changeset/base/249558

Log:
  Add a new set of notes to a process core dump to store procstat data.
  
  The notes format is a header of sizeof(int), which stores the size of
  the corresponding data structure to provide some versioning, and data
  in the format as it is returned by a related sysctl call.
  
  The userland tools (procstat(1)) will be taught to extract this data,
  providing additional info for postmortem analysis.
  
  PR:   kern/173723
  Suggested by: jhb
  Discussed with:   jhb, kib
  Reviewed by:  jhb (initial version), kib
  MFC after:1 month

Modified:
  head/sys/kern/imgact_elf.c
  head/sys/sys/elf_common.h

Modified: head/sys/kern/imgact_elf.c
==
--- head/sys/kern/imgact_elf.c  Tue Apr 16 17:50:20 2013(r249557)
+++ head/sys/kern/imgact_elf.c  Tue Apr 16 19:19:14 2013(r249558)
@@ -66,6 +66,7 @@ __FBSDID($FreeBSD$);
 #include sys/vnode.h
 #include sys/syslog.h
 #include sys/eventhandler.h
+#include sys/user.h
 
 #include net/zlib.h
 
@@ -1062,12 +1063,22 @@ static void __elfN(puthdr)(struct thread
 static void __elfN(putnote)(struct note_info *, struct sbuf *);
 static size_t register_note(struct note_info_list *, int, outfunc_t, void *);
 static int sbuf_drain_core_output(void *, const char *, int);
+static int sbuf_drain_count(void *arg, const char *data, int len);
 
 static void __elfN(note_fpregset)(void *, struct sbuf *, size_t *);
 static void __elfN(note_prpsinfo)(void *, struct sbuf *, size_t *);
 static void __elfN(note_prstatus)(void *, struct sbuf *, size_t *);
 static void __elfN(note_threadmd)(void *, struct sbuf *, size_t *);
 static void __elfN(note_thrmisc)(void *, struct sbuf *, size_t *);
+static void __elfN(note_procstat_auxv)(void *, struct sbuf *, size_t *);
+static void __elfN(note_procstat_proc)(void *, struct sbuf *, size_t *);
+static void __elfN(note_procstat_psstrings)(void *, struct sbuf *, size_t *);
+static void note_procstat_files(void *, struct sbuf *, size_t *);
+static void note_procstat_groups(void *, struct sbuf *, size_t *);
+static void note_procstat_osrel(void *, struct sbuf *, size_t *);
+static void note_procstat_rlimit(void *, struct sbuf *, size_t *);
+static void note_procstat_umask(void *, struct sbuf *, size_t *);
+static void note_procstat_vmmap(void *, struct sbuf *, size_t *);
 
 #ifdef COMPRESS_USER_CORES
 extern int compress_user_cores;
@@ -1113,9 +1124,21 @@ static int
 sbuf_drain_core_output(void *arg, const char *data, int len)
 {
struct sbuf_drain_core_params *p;
-   int error;
+   int error, locked;
 
p = (struct sbuf_drain_core_params *)arg;
+
+   /*
+* Some kern_proc out routines that print to this sbuf may
+* call us with the process lock held. Draining with the
+* non-sleepable lock held is unsafe. The lock is needed for
+* those routines when dumping a live process. In our case we
+* can safely release the lock before draining and acquire
+* again after.
+*/
+   locked = PROC_LOCKED(p-td-td_proc);
+   if (locked)
+   PROC_UNLOCK(p-td-td_proc);
 #ifdef COMPRESS_USER_CORES
if (p-gzfile != Z_NULL)
error = compress_core(p-gzfile, NULL, __DECONST(char *, data),
@@ -1126,12 +1149,27 @@ sbuf_drain_core_output(void *arg, const 
__DECONST(void *, data), len, p-offset, UIO_SYSSPACE,
IO_UNIT | IO_DIRECT, p-active_cred, p-file_cred, NULL,
p-td);
+   if (locked)
+   PROC_LOCK(p-td-td_proc);
if (error != 0)
return (-error);
p-offset += len;
return (len);
 }
 
+/*
+ * Drain into a counter.
+ */
+static int
+sbuf_drain_count(void *arg, const char *data __unused, int len)
+{
+   size_t *sizep;
+
+   sizep = (size_t *)arg;
+   *sizep += len;
+   return (len);
+}
+
 int
 __elfN(coredump)(struct thread *td, struct vnode *vp, off_t limit, int flags)
 {
@@ -1436,6 +1474,25 @@ __elfN(prepare_notes)(struct thread *td,
thr = TAILQ_NEXT(thr, td_plist);
}
 
+   size += register_note(list, NT_PROCSTAT_PROC,
+   __elfN(note_procstat_proc), p);
+   size += register_note(list, NT_PROCSTAT_FILES,
+   note_procstat_files, p);
+   size += register_note(list, NT_PROCSTAT_VMMAP,
+   note_procstat_vmmap, p);
+   size += register_note(list, NT_PROCSTAT_GROUPS,
+   note_procstat_groups, p);
+   size += register_note(list, NT_PROCSTAT_UMASK,
+   note_procstat_umask, p);
+   size += register_note(list, NT_PROCSTAT_RLIMIT,
+   note_procstat_rlimit, p);
+   size += register_note(list, NT_PROCSTAT_OSREL,
+   note_procstat_osrel, p);
+   size += register_note(list, NT_PROCSTAT_PSSTRINGS,
+

svn commit: r249559 - head/sys/netinet

2013-04-16 Thread Xin LI
Author: delphij
Date: Tue Apr 16 19:25:41 2013
New Revision: 249559
URL: http://svnweb.freebsd.org/changeset/base/249559

Log:
  Don't leak lock when returning.
  
  PR:   kern/177888
  Submitted by: Sven-Thorsten Dietrich sven vyatta com
  MFC after:1 week

Modified:
  head/sys/netinet/ip_mroute.c

Modified: head/sys/netinet/ip_mroute.c
==
--- head/sys/netinet/ip_mroute.cTue Apr 16 19:19:14 2013
(r249558)
+++ head/sys/netinet/ip_mroute.cTue Apr 16 19:25:41 2013
(r249559)
@@ -824,6 +824,7 @@ set_api_config(uint32_t *apival)
 
 for (i = 0; i  mfchashsize; i++) {
if (LIST_FIRST(V_mfchashtbl[i]) != NULL) {
+   MFC_UNLOCK();
*apival = 0;
return EPERM;
}
___
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: r249562 - head/sys/netinet

2013-04-16 Thread Xin LI
Author: delphij
Date: Tue Apr 16 19:32:12 2013
New Revision: 249562
URL: http://svnweb.freebsd.org/changeset/base/249562

Log:
  Fix incomplete printf.
  
  PR:   kern/177889
  Submitted by: Sven-Thorsten Dietrich sven vyatta com
  MFC after:1 week

Modified:
  head/sys/netinet/ip_mroute.c

Modified: head/sys/netinet/ip_mroute.c
==
--- head/sys/netinet/ip_mroute.cTue Apr 16 19:28:00 2013
(r249561)
+++ head/sys/netinet/ip_mroute.cTue Apr 16 19:32:12 2013
(r249562)
@@ -2846,7 +2846,8 @@ ip_mroute_modevent(module_t mod, int typ
if_detach_event_tag = EVENTHANDLER_REGISTER(ifnet_departure_event, 
if_detached_event, NULL, EVENTHANDLER_PRI_ANY);
if (if_detach_event_tag == NULL) {
-   printf(ip_mroute: unable to ifnet_deperture_even handler\n);
+   printf(ip_mroute: unable to register 
+   ifnet_departure_event handler\n);
MROUTER_LOCK_DESTROY();
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: r249563 - in head/cddl/contrib/opensolaris: cmd/dtrace/test/tst/common/print lib/libdtrace/common

2013-04-16 Thread Pedro F. Giffuni
Author: pfg
Date: Tue Apr 16 19:39:27 2013
New Revision: 249563
URL: http://svnweb.freebsd.org/changeset/base/249563

Log:
  DTrace: print() should try to resolve function pointers
  
  Merge changes from illumos:
  
  3675 DTrace print() should try to resolve function pointers
  3676 dt_print_enum hardcodes a value of zero
  
  Illumos Revision: b1fa6326238973aeaf12c34fcda75985b6c06be1
  
  Reference:
  https://www.illumos.org/issues/3675
  https://www.illumos.org/issues/3676
  
  Obtained from:Illumos
  MFC after:1 month

Added:
  head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/print/tst.enum.d
 - copied unchanged from r249443, 
vendor/illumos/dist/cmd/dtrace/test/tst/common/print/tst.enum.d
  head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/print/tst.enum.d.out
 - copied unchanged from r249443, 
vendor/illumos/dist/cmd/dtrace/test/tst/common/print/tst.enum.d.out
Modified:
  head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_print.c

Copied: 
head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/print/tst.enum.d (from 
r249443, vendor/illumos/dist/cmd/dtrace/test/tst/common/print/tst.enum.d)
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/print/tst.enum.d   
Tue Apr 16 19:39:27 2013(r249563, copy of r249443, 
vendor/illumos/dist/cmd/dtrace/test/tst/common/print/tst.enum.d)
@@ -0,0 +1,33 @@
+/*
+ * This file and its contents are supplied under the terms of the
+ * Common Development and Distribution License (CDDL), version 1.0.
+ * You may only use this file in accordance with the terms of version
+ * 1.0 of the CDDL.
+ *
+ * A full copy of the text of the CDDL should have accompanied this
+ * source.  A copy of the CDDL is also available via the Internet at
+ * http://www.illumos.org/license/CDDL.
+ */
+/*
+ * Copyright (c) 2013, Joyent, Inc.  All rights reserved.
+ */
+
+#pragma D option quiet
+
+enum simpson {
+   homer,
+   marge,
+   bart,
+   lisa,
+   maggie,
+   snowball_ii,
+   santas_little_helper
+};
+
+BEGIN
+{
+   print(bart);
+   print((enum simpson)4);
+   print(snowball_ii);
+   exit(0);
+}

Copied: 
head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/print/tst.enum.d.out 
(from r249443, 
vendor/illumos/dist/cmd/dtrace/test/tst/common/print/tst.enum.d.out)
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ 
head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/print/tst.enum.d.out   
Tue Apr 16 19:39:27 2013(r249563, copy of r249443, 
vendor/illumos/dist/cmd/dtrace/test/tst/common/print/tst.enum.d.out)
@@ -0,0 +1,4 @@
+enum simpson bart
+enum simpson maggie
+enum simpson snowball_ii
+

Modified: head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_print.c
==
--- head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_print.c   Tue Apr 
16 19:32:12 2013(r249562)
+++ head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_print.c   Tue Apr 
16 19:39:27 2013(r249563)
@@ -25,6 +25,9 @@
 /*
  * Copyright (c) 2011 by Delphix. All rights reserved.
  */
+/*
+ * Copyright (c) 2013, Joyent, Inc.  All rights reserved.
+ */
 
 /*
  * DTrace print() action
@@ -93,6 +96,7 @@
  * Print structure passed down recursively through printing algorithm.
  */
 typedef struct dt_printarg {
+   dtrace_hdl_t*pa_dtp;/* libdtrace handle */
caddr_t pa_addr;/* base address of trace data */
ctf_file_t  *pa_ctfp;   /* CTF container */
int pa_depth;   /* member depth */
@@ -303,8 +307,8 @@ dt_print_float(ctf_id_t base, ulong_t of
 }
 
 /*
- * A pointer is printed as a fixed-size integer.  This is used both for
- * pointers and functions.
+ * A pointer is generally printed as a fixed-size integer.  If we have a
+ * function pointer, we try to look up its name.
  */
 static void
 dt_print_ptr(ctf_id_t base, ulong_t off, dt_printarg_t *pap)
@@ -313,8 +317,23 @@ dt_print_ptr(ctf_id_t base, ulong_t off,
ctf_file_t *ctfp = pap-pa_ctfp;
caddr_t addr = pap-pa_addr + off / NBBY;
size_t size = ctf_type_size(ctfp, base);
-
-   dt_print_hex(fp, addr, size);
+   ctf_id_t bid = ctf_type_reference(ctfp, base);
+   uint64_t pc;
+   dtrace_syminfo_t dts;
+   GElf_Sym sym;
+
+   if (bid == CTF_ERR || ctf_type_kind(ctfp, bid) != CTF_K_FUNCTION) {
+   dt_print_hex(fp, addr, size);
+   } else {
+   /* LINTED - alignment */
+   pc = *((uint64_t *)addr);
+   if (dtrace_lookup_by_addr(pap-pa_dtp, pc, sym, dts) != 0) {
+   dt_print_hex(fp, addr, size);
+   } else {
+   

svn commit: r249564 - head/sys/geom/label

2013-04-16 Thread Ivan Voras
Author: ivoras
Date: Tue Apr 16 19:58:24 2013
New Revision: 249564
URL: http://svnweb.freebsd.org/changeset/base/249564

Log:
  Fix the buffer-overflow-fixing fixes.
  
  Pointy-hat to: me, for not realizing snprintf() is available in kernel.
  Thanks to: jh, for bringing me the good news of snprintf(), Pawel Worach, for
 noting that the panic can be provoked in i386 and not in amd64

Modified:
  head/sys/geom/label/g_label_disk_ident.c

Modified: head/sys/geom/label/g_label_disk_ident.c
==
--- head/sys/geom/label/g_label_disk_ident.cTue Apr 16 19:39:27 2013
(r249563)
+++ head/sys/geom/label/g_label_disk_ident.cTue Apr 16 19:58:24 2013
(r249564)
@@ -40,38 +40,41 @@ __FBSDID($FreeBSD$);
 
 #define G_LABEL_DISK_IDENT_DIR diskid
 
-static char* classes_pass[] = { G_DISK_CLASS_NAME, G_MULTIPATH_CLASS_NAME, 
NULL };
+static char* classes_pass[] = { G_DISK_CLASS_NAME, G_MULTIPATH_CLASS_NAME,
+NULL };
 
 static void
 g_label_disk_ident_taste(struct g_consumer *cp, char *label, size_t size)
 {
struct g_class *cls;
char ident[100];
-   int ident_len = sizeof(ident);
+   int ident_len, found, i;
 
g_topology_assert_not();
label[0] = '\0';
 
cls = cp-provider-geom-class;
 
-   /* Get the GEOM::ident string and construct a label in the format 
CLASS_NAME-ident */
+   /* 
+* Get the GEOM::ident string, and construct a label in the format
+* CLASS_NAME-ident
+*/
+   ident_len = sizeof(ident);
if (g_io_getattr(GEOM::ident, cp, ident_len, ident) == 0) {
-   int i, found = 0;
-
if (ident_len == 0 || ident[0] == '\0')
return;
-   for (i = 0; classes_pass[i] != NULL; i++)
-   if (strcmp(classes_pass[i], cls-name) == 0)
+   for (i = 0, found = 0; classes_pass[i] != NULL; i++)
+   if (strcmp(classes_pass[i], cls-name) == 0) {
found = 1;
+   break;
+   }
if (!found)
return;
-   if (strlen(cls-name) + ident_len + 2  size)
-   ident[ident_len - strlen(cls-name) - 2] = '\0';
-   else
-   ident[ident_len] = '\0';
-   strcpy(label, cls-name);
-   strcat(label, -);
-   strcat(label, ident);
+   /*
+* We can safely ignore the result of strncpy; the label will
+* simply be truncated, which at most is only annoying.
+*/
+   (void)snprintf(label, size, %s-%s, cls-name, ident);
}
 }
 
@@ -81,4 +84,5 @@ struct g_label_desc g_label_disk_ident =
.ld_enabled = 1
 };
 
-G_LABEL_INIT(disk_ident, g_label_disk_ident, Create device nodes for drives 
which export a disk identification string);
+G_LABEL_INIT(disk_ident, g_label_disk_ident, Create device nodes for drives 
+which export a disk identification string);
___
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: r249564 - head/sys/geom/label

2013-04-16 Thread Dimitry Andric
On Apr 16, 2013, at 21:58, Ivan Voras ivo...@freebsd.org wrote:
 Author: ivoras
 Date: Tue Apr 16 19:58:24 2013
 New Revision: 249564
 URL: http://svnweb.freebsd.org/changeset/base/249564
 
 Log:
  Fix the buffer-overflow-fixing fixes.
...
 + /*
 +  * We can safely ignore the result of strncpy; the label will
 +  * simply be truncated, which at most is only annoying.
 +  */
 + (void)snprintf(label, size, %s-%s, cls-name, ident);

s/strncpy/snprintf/ ? :-)

___
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: r249565 - head/sys/dev/ath

2013-04-16 Thread Adrian Chadd
Author: adrian
Date: Tue Apr 16 20:21:02 2013
New Revision: 249565
URL: http://svnweb.freebsd.org/changeset/base/249565

Log:
  Use a per-RX-queue deferred list, rather than a single deferred list for
  both queues.
  
  Since ath_rx_pkt() does multi-mbuf frame recombining based on the RX queue,
  this needs to occur.
  
  Tested:
  
  * AR9380 (XB112), hostap mode

Modified:
  head/sys/dev/ath/if_ath.c
  head/sys/dev/ath/if_ath_rx_edma.c
  head/sys/dev/ath/if_athvar.h

Modified: head/sys/dev/ath/if_ath.c
==
--- head/sys/dev/ath/if_ath.c   Tue Apr 16 19:58:24 2013(r249564)
+++ head/sys/dev/ath/if_ath.c   Tue Apr 16 20:21:02 2013(r249565)
@@ -842,7 +842,8 @@ ath_attach(u_int16_t devid, struct ath_s
/*
 * Initialise the deferred completed RX buffer list.
 */
-   TAILQ_INIT(sc-sc_rx_rxlist);
+   TAILQ_INIT(sc-sc_rx_rxlist[HAL_RX_QUEUE_HP]);
+   TAILQ_INIT(sc-sc_rx_rxlist[HAL_RX_QUEUE_LP]);
 
/*
 * Indicate we need the 802.11 header padded to a

Modified: head/sys/dev/ath/if_ath_rx_edma.c
==
--- head/sys/dev/ath/if_ath_rx_edma.c   Tue Apr 16 19:58:24 2013
(r249564)
+++ head/sys/dev/ath/if_ath_rx_edma.c   Tue Apr 16 20:21:02 2013
(r249565)
@@ -398,7 +398,7 @@ ath_edma_recv_proc_queue(struct ath_soft
 * queue.
 */
re-m_fifo[re-m_fifo_head] = NULL;
-   TAILQ_INSERT_TAIL(sc-sc_rx_rxlist, bf, bf_list);
+   TAILQ_INSERT_TAIL(sc-sc_rx_rxlist[qtype], bf, bf_list);
 
/* Bump the descriptor FIFO stats */
INCR(re-m_fifo_head, re-m_fifolen);
@@ -451,8 +451,15 @@ ath_edma_flush_deferred_queue(struct ath
struct ath_buf *bf, *next;
 
ATH_RX_LOCK_ASSERT(sc);
+
/* Free in one set, inside the lock */
-   TAILQ_FOREACH_SAFE(bf, sc-sc_rx_rxlist, bf_list, next) {
+   TAILQ_FOREACH_SAFE(bf,
+   sc-sc_rx_rxlist[HAL_RX_QUEUE_LP], bf_list, next) {
+   /* Free the buffer/mbuf */
+   ath_edma_rxbuf_free(sc, bf);
+   }
+   TAILQ_FOREACH_SAFE(bf,
+   sc-sc_rx_rxlist[HAL_RX_QUEUE_HP], bf_list, next) {
/* Free the buffer/mbuf */
ath_edma_rxbuf_free(sc, bf);
}
@@ -482,7 +489,7 @@ ath_edma_recv_proc_deferred_queue(struct
 
/* Copy the list over */
ATH_RX_LOCK(sc);
-   TAILQ_CONCAT(rxlist, sc-sc_rx_rxlist, bf_list);
+   TAILQ_CONCAT(rxlist, sc-sc_rx_rxlist[qtype], bf_list);
ATH_RX_UNLOCK(sc);
 
/* Handle the completed descriptors */

Modified: head/sys/dev/ath/if_athvar.h
==
--- head/sys/dev/ath/if_athvar.hTue Apr 16 19:58:24 2013
(r249564)
+++ head/sys/dev/ath/if_athvar.hTue Apr 16 20:21:02 2013
(r249565)
@@ -542,6 +542,7 @@ struct ath_softc {
 
struct ath_rx_methods   sc_rx;
struct ath_rx_edma  sc_rxedma[HAL_NUM_RX_QUEUES];   /* HP/LP queues 
*/
+   ath_bufhead sc_rx_rxlist[HAL_NUM_RX_QUEUES];/* 
deferred RX completion */
struct ath_tx_methods   sc_tx;
struct ath_tx_edma_fifo sc_txedma[HAL_NUM_TX_QUEUES];
 
@@ -700,7 +701,6 @@ struct ath_softc {
 
struct ath_descdma  sc_rxdma;   /* RX descriptors */
ath_bufhead sc_rxbuf;   /* receive buffer */
-   ath_bufhead sc_rx_rxlist;   /* deferred RX completion */
u_int32_t   *sc_rxlink; /* link ptr in last RX desc */
struct task sc_rxtask;  /* rx int processing */
u_int8_tsc_defant;  /* current default antenna */
___
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: r249566 - in head: lib/libc/gen sys/kern

2013-04-16 Thread John Baldwin
Author: jhb
Date: Tue Apr 16 20:26:31 2013
New Revision: 249566
URL: http://svnweb.freebsd.org/changeset/base/249566

Log:
  - Document that sem_wait() can fail with EINTR if it is interrupted by a
signal.
  - Fix the old ksem implementation for POSIX semaphores to not restart
sem_wait() or sem_timedwait() if interrupted by a signal.
  
  MFC after:1 week

Modified:
  head/lib/libc/gen/sem_wait.3
  head/sys/kern/uipc_sem.c

Modified: head/lib/libc/gen/sem_wait.3
==
--- head/lib/libc/gen/sem_wait.3Tue Apr 16 20:21:02 2013
(r249565)
+++ head/lib/libc/gen/sem_wait.3Tue Apr 16 20:26:31 2013
(r249566)
@@ -27,7 +27,7 @@
 .\
 .\ $FreeBSD$
 .\
-.Dd February 15, 2000
+.Dd April 16, 2013
 .Dt SEM_WAIT 3
 .Os
 .Sh NAME
@@ -75,6 +75,14 @@ points to an invalid semaphore.
 .El
 .Pp
 Additionally,
+.Fn sem_wait
+will fail if:
+.Bl -tag -width Er
+.Pp
+.It Bq Er EINTR
+A signal interrupted this function.
+.El
+Additionally,
 .Fn sem_trywait
 will fail if:
 .Bl -tag -width Er

Modified: head/sys/kern/uipc_sem.c
==
--- head/sys/kern/uipc_sem.cTue Apr 16 20:21:02 2013(r249565)
+++ head/sys/kern/uipc_sem.cTue Apr 16 20:26:31 2013(r249566)
@@ -846,6 +846,8 @@ kern_sem_wait(struct thread *td, semid_t
 err:
mtx_unlock(sem_lock);
fdrop(fp, td);
+   if (error == ERESTART)
+   error = EINTR;
DP(( kern_sem_wait leaving, pid=%d, error = %d\n,
(int)td-td_proc-p_pid, error));
return (error);
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


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

2013-04-16 Thread Joel Dahl
Author: joel (doc committer)
Date: Tue Apr 16 20:31:15 2013
New Revision: 249567
URL: http://svnweb.freebsd.org/changeset/base/249567

Log:
  mdoc: remove superfluous paragraph macro.

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

Modified: head/lib/libc/gen/sem_wait.3
==
--- head/lib/libc/gen/sem_wait.3Tue Apr 16 20:26:31 2013
(r249566)
+++ head/lib/libc/gen/sem_wait.3Tue Apr 16 20:31:15 2013
(r249567)
@@ -78,7 +78,6 @@ Additionally,
 .Fn sem_wait
 will fail if:
 .Bl -tag -width Er
-.Pp
 .It Bq Er EINTR
 A signal interrupted this function.
 .El
___
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: r249568 - head/sys/net80211

2013-04-16 Thread Adrian Chadd
Author: adrian
Date: Tue Apr 16 20:36:32 2013
New Revision: 249568
URL: http://svnweb.freebsd.org/changeset/base/249568

Log:
  Implement a utility function to return the current TX power cap for
  the given node.
  
  This takes into account the per-node cap, the ic cap and the
  per-channel regulatory caps.
  
  This is designed to replace references to ni_txpower in various net80211
  drivers - ni_txpower doesn't necessarily reflect the actual cap for
  the given node (eg if the node has the default value of 50dBm (100) and
  the administrator has manually configured a lower TX power.)

Modified:
  head/sys/net80211/ieee80211_var.h

Modified: head/sys/net80211/ieee80211_var.h
==
--- head/sys/net80211/ieee80211_var.h   Tue Apr 16 20:31:15 2013
(r249567)
+++ head/sys/net80211/ieee80211_var.h   Tue Apr 16 20:36:32 2013
(r249568)
@@ -822,6 +822,28 @@ ieee80211_htchanflags(const struct ieee8
 }
 
 /*
+ * Fetch the current TX power (cap) for the given node.
+ *
+ * This includes the node and ic/vap TX power limit as needed,
+ * but it doesn't take into account any per-rate limit.
+ */
+static __inline uint16_t
+ieee80211_get_node_txpower(struct ieee80211_node *ni)
+{
+   struct ieee80211com *ic = ni-ni_ic;
+   uint16_t txpower;
+
+   txpower = ni-ni_txpower;
+   txpower = MIN(txpower, ic-ic_txpowlimit);
+   if (ic-ic_curchan != NULL) {
+   txpower = MIN(txpower, 2 * ic-ic_curchan-ic_maxregpower);
+   txpower = MIN(txpower, ic-ic_curchan-ic_maxpower);
+   }
+
+   return (txpower);
+}
+
+/*
  * Debugging facilities compiled in when IEEE80211_DEBUG is defined.
  *
  * The intent is that any problem in the net80211 layer can be
___
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: r249566 - in head: lib/libc/gen sys/kern

2013-04-16 Thread Jilles Tjoelker
On Tue, Apr 16, 2013 at 08:26:31PM +, John Baldwin wrote:
 Author: jhb
 Date: Tue Apr 16 20:26:31 2013
 New Revision: 249566
 URL: http://svnweb.freebsd.org/changeset/base/249566

 Log:
   - Document that sem_wait() can fail with EINTR if it is interrupted by a
 signal.
   - Fix the old ksem implementation for POSIX semaphores to not restart
 sem_wait() or sem_timedwait() if interrupted by a signal.

   MFC after:  1 week

 Modified:
   head/lib/libc/gen/sem_wait.3
   head/sys/kern/uipc_sem.c

 Modified: head/lib/libc/gen/sem_wait.3
 ==
 --- head/lib/libc/gen/sem_wait.3  Tue Apr 16 20:21:02 2013
 (r249565)
 +++ head/lib/libc/gen/sem_wait.3  Tue Apr 16 20:26:31 2013
 (r249566)
 @@ -27,7 +27,7 @@
  .\
  .\ $FreeBSD$
  .\
 -.Dd February 15, 2000
 +.Dd April 16, 2013
  .Dt SEM_WAIT 3
  .Os
  .Sh NAME
 @@ -75,6 +75,14 @@ points to an invalid semaphore.
  .El
  .Pp
  Additionally,
 +.Fn sem_wait
 +will fail if:
 +.Bl -tag -width Er
 +.Pp
 +.It Bq Er EINTR
 +A signal interrupted this function.
 +.El
 +Additionally,
  .Fn sem_trywait
  will fail if:
  .Bl -tag -width Er
 
 Modified: head/sys/kern/uipc_sem.c
 ==
 --- head/sys/kern/uipc_sem.c  Tue Apr 16 20:21:02 2013(r249565)
 +++ head/sys/kern/uipc_sem.c  Tue Apr 16 20:26:31 2013(r249566)
 @@ -846,6 +846,8 @@ kern_sem_wait(struct thread *td, semid_t
  err:
   mtx_unlock(sem_lock);
   fdrop(fp, td);
 + if (error == ERESTART)
 + error = EINTR;
   DP(( kern_sem_wait leaving, pid=%d, error = %d\n,
   (int)td-td_proc-p_pid, error));
   return (error);

It would normally be expected (and required by POSIX) that a signal with
SA_RESTART set does not cause a function to fail with [EINTR], so more
rationale is needed here.

Also, the timeouts passed to these functions are absolute and also are
at the system call level except UMTX_OP_SEM_WAIT which can take a
relative or an absolute timeout but libc passed it an absolute timeout.
So there is no need for a caller to see [EINTR] to avoid overlong
timeouts.

Given the number of times people call sem_wait() without checking the
return value, call sem_wait() and assume any error is fatal or call
sem_timedwait() and assume any error is a timeout, I think it may be
better to go the other way and never fail with [EINTR], just like the
pthread functions. POSIX explicitly permits this: the [EINTR] error for
sem_wait(), sem_trywait() and sem_timedwait() is may fail rather than
the usual shall fail (note that SA_RESTART overrides such a shall
fail unless there is a relative timeout or it is explicitly excluded
with the function).

I realize that this reduces functionality, but relying on [EINTR] here
introduces a race condition anyway (because the signal handler may be
called just before sem_wait() blocks). I suggest pthread cancellation,
not returning from the signal handler or leaving the default
action in place (if it is termination). The racy functionality can be
kept by leaving [EINTR] and [ERESTART] from the sleep function as they
are except for changing [ERESTART] to [EINTR] when UMTX_OP_SEM_WAIT was
passed a relative timeout. Breakage in programs that check sem_wait()'s
return value incorrectly will then be less frequent and only present
when POSIX permits it.

-- 
Jilles Tjoelker
___
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: r249569 - head/sys/dev/ath

2013-04-16 Thread Adrian Chadd
Author: adrian
Date: Tue Apr 16 21:26:44 2013
New Revision: 249569
URL: http://svnweb.freebsd.org/changeset/base/249569

Log:
  Use the new net80211 method to fetch the node TX power, rather than
  directly referencing ni-ni_txpower.
  
  This provides the hardware with a slightly more accurate idea of
  the maximum TX power to be using.
  
  This is part of a series to get per-packet TPC to work (better).
  
  Tested:
  
  * AR5416, hostap mode

Modified:
  head/sys/dev/ath/if_ath_beacon.c
  head/sys/dev/ath/if_ath_tx.c

Modified: head/sys/dev/ath/if_ath_beacon.c
==
--- head/sys/dev/ath/if_ath_beacon.cTue Apr 16 20:36:32 2013
(r249568)
+++ head/sys/dev/ath/if_ath_beacon.cTue Apr 16 21:26:44 2013
(r249569)
@@ -322,7 +322,7 @@ ath_beacon_setup(struct ath_softc *sc, s
, m-m_len + IEEE80211_CRC_LEN  /* frame length */
, sizeof(struct ieee80211_frame)/* header length */
, HAL_PKT_TYPE_BEACON   /* Atheros packet type */
-   , ni-ni_txpower/* txpower XXX */
+   , ieee80211_get_node_txpower(ni)/* txpower XXX */
, rate, 1   /* series 0 rate/tries */
, HAL_TXKEYIX_INVALID   /* no encryption */
, antenna   /* antenna mode */

Modified: head/sys/dev/ath/if_ath_tx.c
==
--- head/sys/dev/ath/if_ath_tx.cTue Apr 16 20:36:32 2013
(r249568)
+++ head/sys/dev/ath/if_ath_tx.cTue Apr 16 21:26:44 2013
(r249569)
@@ -1722,7 +1722,7 @@ ath_tx_normal_setup(struct ath_softc *sc
if (isfrag)
sc-sc_tx_th.wt_flags |= IEEE80211_RADIOTAP_F_FRAG;
sc-sc_tx_th.wt_rate = sc-sc_hwmap[rix].ieeerate;
-   sc-sc_tx_th.wt_txpower = ni-ni_txpower;
+   sc-sc_tx_th.wt_txpower = ieee80211_get_node_txpower(ni);
sc-sc_tx_th.wt_antenna = sc-sc_txantenna;
 
ieee80211_radiotap_tx(vap, m0);
@@ -1743,7 +1743,7 @@ ath_tx_normal_setup(struct ath_softc *sc
bf-bf_state.bfs_pktlen = pktlen;
bf-bf_state.bfs_hdrlen = hdrlen;
bf-bf_state.bfs_atype = atype;
-   bf-bf_state.bfs_txpower = ni-ni_txpower;
+   bf-bf_state.bfs_txpower = ieee80211_get_node_txpower(ni);
bf-bf_state.bfs_txrate0 = txrate;
bf-bf_state.bfs_try0 = try0;
bf-bf_state.bfs_keyix = keyix;
@@ -2088,7 +2088,8 @@ ath_tx_raw_start(struct ath_softc *sc, s
if (m0-m_flags  M_FRAG)
sc-sc_tx_th.wt_flags |= IEEE80211_RADIOTAP_F_FRAG;
sc-sc_tx_th.wt_rate = sc-sc_hwmap[rix].ieeerate;
-   sc-sc_tx_th.wt_txpower = ni-ni_txpower;
+   sc-sc_tx_th.wt_txpower = MIN(params-ibp_power,
+   ieee80211_get_node_txpower(ni));
sc-sc_tx_th.wt_antenna = sc-sc_txantenna;
 
ieee80211_radiotap_tx(vap, m0);
@@ -2104,7 +2105,8 @@ ath_tx_raw_start(struct ath_softc *sc, s
bf-bf_state.bfs_pktlen = pktlen;
bf-bf_state.bfs_hdrlen = hdrlen;
bf-bf_state.bfs_atype = atype;
-   bf-bf_state.bfs_txpower = params-ibp_power;
+   bf-bf_state.bfs_txpower = MIN(params-ibp_power,
+   ieee80211_get_node_txpower(ni));
bf-bf_state.bfs_txrate0 = txrate;
bf-bf_state.bfs_try0 = try0;
bf-bf_state.bfs_keyix = keyix;
___
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: r249570 - head/sys/kern

2013-04-16 Thread Warner Losh
Author: imp
Date: Tue Apr 16 22:09:08 2013
New Revision: 249570
URL: http://svnweb.freebsd.org/changeset/base/249570

Log:
  r249408 and r249436 cause a NULL pointer dereference on the CUBIEBOARD
  since it doesn't set the kernel envrionment at all. Work around this
  by making sure kern_envp is non-NULL before dereferencing it.

Modified:
  head/sys/kern/kern_environment.c

Modified: head/sys/kern/kern_environment.c
==
--- head/sys/kern/kern_environment.cTue Apr 16 21:26:44 2013
(r249569)
+++ head/sys/kern/kern_environment.cTue Apr 16 22:09:08 2013
(r249570)
@@ -231,7 +231,7 @@ init_dynamic_kenv(void *data __unused)
kenvp = malloc((KENV_SIZE + 1) * sizeof(char *), M_KENV,
M_WAITOK | M_ZERO);
i = 0;
-   if (*kern_envp != '\0') {
+   if (kern_envp  *kern_envp != '\0') {
for (cp = kern_envp; cp != NULL; cp = kernenv_next(cp)) {
len = strlen(cp) + 1;
if (len  KENV_MNAMELEN + 1 + KENV_MVALLEN + 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: r249571 - head/sys/geom/label

2013-04-16 Thread Ivan Voras
Author: ivoras
Date: Tue Apr 16 22:42:40 2013
New Revision: 249571
URL: http://svnweb.freebsd.org/changeset/base/249571

Log:
  Comment typo fix.
  
  Is aware of the importance of comments: dim

Modified:
  head/sys/geom/label/g_label_disk_ident.c

Modified: head/sys/geom/label/g_label_disk_ident.c
==
--- head/sys/geom/label/g_label_disk_ident.cTue Apr 16 22:09:08 2013
(r249570)
+++ head/sys/geom/label/g_label_disk_ident.cTue Apr 16 22:42:40 2013
(r249571)
@@ -71,8 +71,8 @@ g_label_disk_ident_taste(struct g_consum
if (!found)
return;
/*
-* We can safely ignore the result of strncpy; the label will
-* simply be truncated, which at most is only annoying.
+* We can safely ignore the result of snprintf(): the label
+* will simply be truncated, which at most is only annoying.
 */
(void)snprintf(label, size, %s-%s, cls-name, ident);
}
___
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: r249564 - head/sys/geom/label

2013-04-16 Thread Ivan Voras
On 16 April 2013 22:01, Dimitry Andric d...@freebsd.org wrote:
 On Apr 16, 2013, at 21:58, Ivan Voras ivo...@freebsd.org wrote:
 Author: ivoras
 Date: Tue Apr 16 19:58:24 2013
 New Revision: 249564
 URL: http://svnweb.freebsd.org/changeset/base/249564

 Log:
  Fix the buffer-overflow-fixing fixes.
 ...
 + /*
 +  * We can safely ignore the result of strncpy; the label will
 +  * simply be truncated, which at most is only annoying.
 +  */
 + (void)snprintf(label, size, %s-%s, cls-name, ident);

 s/strncpy/snprintf/ ? :-)

The typo fairy is strong this day :) Thanks!
___
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: r249572 - head/usr.sbin/bhyve

2013-04-16 Thread Neel Natu
Author: neel
Date: Wed Apr 17 02:03:12 2013
New Revision: 249572
URL: http://svnweb.freebsd.org/changeset/base/249572

Log:
  Setup accesses to the memory hole below 4GB to return all 1's on read and
  consume all writes without any side effects.
  
  Obtained from:NetApp

Modified:
  head/usr.sbin/bhyve/pci_emul.c

Modified: head/usr.sbin/bhyve/pci_emul.c
==
--- head/usr.sbin/bhyve/pci_emul.c  Tue Apr 16 22:42:40 2013
(r249571)
+++ head/usr.sbin/bhyve/pci_emul.c  Wed Apr 17 02:03:12 2013
(r249572)
@@ -88,8 +88,6 @@ static struct lirqinfo {
 
 SET_DECLARE(pci_devemu_set, struct pci_devemu);
 
-static uint32_tpci_hole_startaddr;
-
 static uint64_t pci_emul_iobase;
 static uint64_t pci_emul_membase32;
 static uint64_t pci_emul_membase64;
@@ -977,13 +975,12 @@ init_pci(struct vmctx *ctx)
struct mem_range memp;
struct pci_devemu *pde;
struct slotinfo *si;
+   size_t lowmem;
int slot, func;
int error;
 
-   pci_hole_startaddr = vm_get_lowmem_limit(ctx);
-
pci_emul_iobase = PCI_EMUL_IOBASE;
-   pci_emul_membase32 = pci_hole_startaddr;
+   pci_emul_membase32 = vm_get_lowmem_limit(ctx);
pci_emul_membase64 = PCI_EMUL_MEMBASE64;
 
for (slot = 0; slot  MAXSLOTS; slot++) {
@@ -1010,14 +1007,23 @@ init_pci(struct vmctx *ctx)
lirq[15].li_generic = 1;
 
/*
-* Setup the PCI hole to return 0xff's when accessed in a region
-* with no devices
+* The guest physical memory map looks like the following:
+* [0,  lowmem) guest system memory
+* [lowmem, lowmem_limit)   memory hole (may be absent)
+* [lowmem_limit,   4GB)PCI hole (32-bit BAR allocation)
+* [4GB,4GB + highmem)
+*
+* Accesses to memory addresses that are not allocated to system
+* memory or PCI devices return 0xff's.
 */
+   error = vm_get_memory_seg(ctx, 0, lowmem);
+   assert(error == 0);
+
memset(memp, 0, sizeof(struct mem_range));
memp.name = PCI hole;
memp.flags = MEM_F_RW;
-   memp.base = pci_hole_startaddr;
-   memp.size = (4ULL * 1024 * 1024 * 1024) - pci_hole_startaddr;
+   memp.base = lowmem;
+   memp.size = (4ULL * 1024 * 1024 * 1024) - lowmem;
memp.handler = pci_emul_fallback_handler;
 
error = register_mem_fallback(memp);
___
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: r249573 - in head: cddl/contrib/opensolaris/cmd/dtrace cddl/contrib/opensolaris/cmd/dtrace/test/cmd/scripts cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/aggs cddl/contrib/opensol...

2013-04-16 Thread Pedro F. Giffuni
Author: pfg
Date: Wed Apr 17 02:20:17 2013
New Revision: 249573
URL: http://svnweb.freebsd.org/changeset/base/249573

Log:
  DTrace: Revert r249367
  
  The following change from illumos brought caused DTrace to
  pause in an interactive environment:
  
  3026 libdtrace should set LD_NOLAZYLOAD=1 to help the pid provider
  
  This was not detected during testing because it doesn't
  affect scripts.
  
  We shouldn't be changing the environment, especially since the
  LD_NOLAZYLOAD option doesn't apply to our (GNU) ld.
  Unfortunately the change from upstream was made in such a way
  that it is very difficult to separate this change from the
  others so, at least for now, it's better to just revert
  everything.
  
  Reference:
  https://www.illumos.org/issues/3026
  
  Reported by:  Navdeep Parhar and Mark Johnston

Added:
  
head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/arithmetic/tst.complex.d
 - copied unchanged from r249366, 
head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/arithmetic/tst.complex.d
  
head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/predicates/tst.predcache.ksh
 - copied unchanged from r249366, 
head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/predicates/tst.predcache.ksh
  
head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/print/err.D_PRINT_DYN.bad.d
 - copied unchanged from r249366, 
head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/print/err.D_PRINT_DYN.bad.d
  
head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/translators/man.TestTransStability.d
 - copied unchanged from r249366, 
head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/translators/man.TestTransStability.d
Deleted:
  head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/aggs/tst.sizedkeys.d
  
head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/aggs/tst.sizedkeys.d.out
  
head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/arithmetic/tst.basics.d.out
  
head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/arithmetic/tst.compcast.d
  
head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/arithmetic/tst.compcast.d.out
  
head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/arithmetic/tst.compnarrowassign.d
  
head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/arithmetic/tst.compnarrowassign.d.out
  
head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/arithmetic/tst.execcast.d
  
head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/arithmetic/tst.execcast.d.out
  head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/cg/
  
head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pointers/tst.assigncast1.d
  
head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pointers/tst.assigncast2.d
  
head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pragma/tst.temporal.ksh
  
head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pragma/tst.temporal2.ksh
  
head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pragma/tst.temporal3.d
  head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/print/tst.dyn.d
  head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/print/tst.xlate.d
  head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/print/tst.xlate.d.out
  head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/tst.signs.d
  
head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/tst.signs.d.out
  head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/trace/tst.dyn.d
  
head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/translators/tst.TestTransStability1.ksh
  
head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/translators/tst.TestTransStability1.ksh.out
  
head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/translators/tst.TestTransStability2.ksh
  
head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/translators/tst.TestTransStability2.ksh.out
  head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_pq.c
  head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_pq.h
Modified:
  head/cddl/contrib/opensolaris/cmd/dtrace/dtrace.c
  head/cddl/contrib/opensolaris/cmd/dtrace/test/cmd/scripts/dtest.pl
  head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/buffering/tst.fill1.d
  head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/buffering/tst.ring3.d
  head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/tst.newprobes.ksh
  head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/tst.ints.d.out
  
head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/speculation/err.BufSizeVariations1.d
  
head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/speculation/tst.SpecSizeVariations3.d
  head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_aggregate.c
  head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_cc.c
  head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_cg.c
  head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_consume.c
  head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_dis.c
  

svn commit: r249574 - head/sys/dev/aic7xxx

2013-04-16 Thread Neel Natu
Author: neel
Date: Wed Apr 17 02:33:56 2013
New Revision: 249574
URL: http://svnweb.freebsd.org/changeset/base/249574

Log:
  Correct misleading bootverbose output: ahc_isa_probe - ahc_isa_identify

Modified:
  head/sys/dev/aic7xxx/ahc_isa.c

Modified: head/sys/dev/aic7xxx/ahc_isa.c
==
--- head/sys/dev/aic7xxx/ahc_isa.c  Wed Apr 17 02:20:17 2013
(r249573)
+++ head/sys/dev/aic7xxx/ahc_isa.c  Wed Apr 17 02:33:56 2013
(r249574)
@@ -98,7 +98,7 @@ ahc_isa_identify(driver_t *driver, devic
  RF_ACTIVE);
if (regs == NULL) {
if (bootverbose)
-   printf(ahc_isa_probe %d: ioport 0x%x 
+   printf(ahc_isa_identify %d: ioport 0x%x 
   alloc failed\n, slot, iobase);
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: r249575 - in head/cddl/contrib/opensolaris: cmd/dtrace/test/tst/common/funcs cmd/dtrace/test/tst/common/pointers cmd/dtrace/test/tst/common/print cmd/dtrace/test/tst/common/safety cmd/d...

2013-04-16 Thread Pedro F. Giffuni
Author: pfg
Date: Wed Apr 17 02:40:07 2013
New Revision: 249575
URL: http://svnweb.freebsd.org/changeset/base/249575

Log:
  DTrace: Revert r249426
  
  This change actually depends on r249367 which had to be reverted
  
  Pointy Hat:   pfg

Deleted:
  
head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/print/err.D_PRINT_AGG.bad.d
  
head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/trace/err.D_TRACE_AGG.bad.d
  head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/types/tst.const.d
Modified:
  head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/funcs/tst.strjoin.d
  
head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pointers/err.BadAlign.d
  
head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pointers/err.InvalidAddress2.d
  
head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pointers/err.InvalidAddress3.d
  
head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pointers/err.InvalidAddress4.d
  
head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/print/err.D_PRINT_VOID.bad.d
  
head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/print/err.D_PROTO_LEN.bad.d
  head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/safety/tst.copyin.d
  
head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/speculation/err.BufSizeVariations2.d
  
head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/trace/err.D_PROTO_LEN.bad.d
  
head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/trace/err.D_TRACE_VOID.bad.d
  head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_cc.c
  head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_decl.c
  head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_errtags.h

Modified: 
head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/funcs/tst.strjoin.d
==
--- 
head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/funcs/tst.strjoin.d
Wed Apr 17 02:33:56 2013(r249574)
+++ 
head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/funcs/tst.strjoin.d
Wed Apr 17 02:40:07 2013(r249575)
@@ -24,9 +24,7 @@
  * Use is subject to license terms.
  */
 
-/*
- * Copyright (c) 2012 by Delphix. All rights reserved.
- */
+#pragma ident  %Z%%M% %I% %E% SMI
 
 #pragma D option quiet
 
@@ -38,8 +36,3 @@ BEGIN
printf(%s\n, strjoin(, ));
exit(0);
 }
-
-BEGIN
-{
-   exit(1);
-}

Modified: 
head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pointers/err.BadAlign.d
==
--- 
head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pointers/err.BadAlign.d
Wed Apr 17 02:33:56 2013(r249574)
+++ 
head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pointers/err.BadAlign.d
Wed Apr 17 02:40:07 2013(r249575)
@@ -24,9 +24,7 @@
  * Use is subject to license terms.
  */
 
-/*
- * Copyright (c) 2012 by Delphix. All rights reserved.
- */
+#pragma ident  %Z%%M% %I% %E% SMI
 
 /*
  * ASSERTION: This test reproduces the alignment error.
@@ -41,10 +39,9 @@
 
 BEGIN
 {
-   x = (int *)64;
+   x = (int *) 64;
y = *x;
trace(y);
-   exit(0);
 }
 
 ERROR

Modified: 
head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pointers/err.InvalidAddress2.d
==
--- 
head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pointers/err.InvalidAddress2.d
 Wed Apr 17 02:33:56 2013(r249574)
+++ 
head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pointers/err.InvalidAddress2.d
 Wed Apr 17 02:40:07 2013(r249575)
@@ -24,9 +24,7 @@
  * Use is subject to license terms.
  */
 
-/*
- * Copyright (c) 2012 by Delphix. All rights reserved.
- */
+#pragma ident  %Z%%M% %I% %E% SMI
 
 /*
  * ASSERTION: D pointers do not allow invalid pointer accesses.
@@ -46,7 +44,6 @@ BEGIN
y = (int *) (x - 3300778156056);
*y = 3;
trace(*y);
-   exit(0);
 }
 
 ERROR

Modified: 
head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pointers/err.InvalidAddress3.d
==
--- 
head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pointers/err.InvalidAddress3.d
 Wed Apr 17 02:33:56 2013(r249574)
+++ 
head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pointers/err.InvalidAddress3.d
 Wed Apr 17 02:40:07 2013(r249575)
@@ -24,9 +24,7 @@
  * Use is subject to license terms.
  */
 
-/*
- * Copyright (c) 2012 by Delphix. All rights reserved.
- */
+#pragma ident  %Z%%M% %I% %E% SMI
 
 /*
  * ASSERTION: D pointers do not allow invalid pointer accesses.
@@ -41,10 +39,9 @@
 
 BEGIN
 {
-   y = (int *)-33007;
+   y = (int *) (-33007);
*y = 3;
trace(*y);
-   exit(0);
 }
 
 ERROR

Modified: 
head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pointers/err.InvalidAddress4.d