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

2013-05-22 Thread Luigi Rizzo
On Wed, May 22, 2013 at 04:55:51PM -0700, Adrian Chadd wrote:
> Odd, this reads like one of those things that's better off being
> time-capped, rather than packet-count capped.

this is in fact how it works: the control loop in the polling
code dynamically adjusts the actual number of packets so that the
fraction of CPU cycles spent in the polling routine
does not exceed the threshold (100 - kern.polling.user_frac).
Working in batches avoids reading the clock and calling
the poll method at every packet, which would be too expensive.

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


svn commit: r250926 - in head: contrib/openbsm/bin/auditdistd usr.bin/ar usr.bin/bc usr.bin/m4 usr.bin/mklocale usr.sbin/bluetooth/bthidd usr.sbin/config usr.sbin/jail

2013-05-22 Thread Jung-uk Kim
Author: jkim
Date: Thu May 23 05:42:35 2013
New Revision: 250926
URL: http://svnweb.freebsd.org/changeset/base/250926

Log:
  Work around build breakages with GCC 4.2.
  
  Reported by:  tinderbox

Modified:
  head/contrib/openbsm/bin/auditdistd/token.l
  head/usr.bin/ar/acplex.l
  head/usr.bin/bc/scan.l
  head/usr.bin/m4/tokenizer.l
  head/usr.bin/mklocale/lex.l
  head/usr.sbin/bluetooth/bthidd/lexer.l
  head/usr.sbin/config/lang.l
  head/usr.sbin/jail/jaillex.l

Modified: head/contrib/openbsm/bin/auditdistd/token.l
==
--- head/contrib/openbsm/bin/auditdistd/token.l Thu May 23 01:37:34 2013
(r250925)
+++ head/contrib/openbsm/bin/auditdistd/token.l Thu May 23 05:42:35 2013
(r250926)
@@ -52,6 +52,7 @@ int depth;
 int lineno;
 
 #defineDP  do { } while (0)
+#defineYY_DECL int yylex(void)
 %}
 
 %option noinput

Modified: head/usr.bin/ar/acplex.l
==
--- head/usr.bin/ar/acplex.lThu May 23 01:37:34 2013(r250925)
+++ head/usr.bin/ar/acplex.lThu May 23 05:42:35 2013(r250926)
@@ -40,6 +40,8 @@ int lineno = 1;
 
 intyylex(void);
 
+#defineYY_DECL int yylex(void)
+
 %}
 
 %option nounput

Modified: head/usr.bin/bc/scan.l
==
--- head/usr.bin/bc/scan.l  Thu May 23 01:37:34 2013(r250925)
+++ head/usr.bin/bc/scan.l  Thu May 23 05:42:35 2013(r250926)
@@ -46,6 +46,7 @@ static voidinit_strbuf(void);
 static void add_str(const char *);
 static int  bc_yyinput(char *, int);
 
+#define YY_DECLint yylex(void)
 #define YY_NO_INPUT
 #undef YY_INPUT
 #define YY_INPUT(buf,retval,max) \

Modified: head/usr.bin/m4/tokenizer.l
==
--- head/usr.bin/m4/tokenizer.l Thu May 23 01:37:34 2013(r250925)
+++ head/usr.bin/m4/tokenizer.l Thu May 23 05:42:35 2013(r250926)
@@ -31,6 +31,8 @@ extern int32_t yylval;
 int32_t number(void);
 int32_t parse_radix(void);
 extern int yylex(void);
+
+#defineYY_DECL int yylex(void)
 %}
 
 delim  [ \t\n]

Modified: head/usr.bin/mklocale/lex.l
==
--- head/usr.bin/mklocale/lex.l Thu May 23 01:37:34 2013(r250925)
+++ head/usr.bin/mklocale/lex.l Thu May 23 05:42:35 2013(r250926)
@@ -47,6 +47,8 @@ __FBSDID("$FreeBSD$");
 #include "ldef.h"
 #include "y.tab.h"
 #include "extern.h"
+
+#defineYY_DECL int yylex(void)
 %}
 
 ODIGIT [0-7]

Modified: head/usr.sbin/bluetooth/bthidd/lexer.l
==
--- head/usr.sbin/bluetooth/bthidd/lexer.l  Thu May 23 01:37:34 2013
(r250925)
+++ head/usr.sbin/bluetooth/bthidd/lexer.l  Thu May 23 05:42:35 2013
(r250926)
@@ -37,6 +37,8 @@
 #include "parser.h"
 
int yylex   (void);
+
+#defineYY_DECL int yylex(void)
 %}
 
 %option yylineno noyywrap nounput noinput

Modified: head/usr.sbin/config/lang.l
==
--- head/usr.sbin/config/lang.l Thu May 23 01:37:34 2013(r250925)
+++ head/usr.sbin/config/lang.l Thu May 23 05:42:35 2013(r250926)
@@ -93,6 +93,7 @@ unsigned int octal(const char *);
 unsigned int hex(const char *);
 int yyerror(const char *);
 
+#define YY_DECL int yylex(void)
 %}
 
 %option nounput

Modified: head/usr.sbin/jail/jaillex.l
==
--- head/usr.sbin/jail/jaillex.lThu May 23 01:37:34 2013
(r250925)
+++ head/usr.sbin/jail/jaillex.lThu May 23 05:42:35 2013
(r250926)
@@ -42,6 +42,8 @@ static ssize_t text2lval(size_t triml, s
 
 static int instr;
 static int lineno = 1;
+
+#define YY_DECL int yylex(void)
 %}
 
 %option noinput
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r250881 - in head: . sys/sys usr.bin/lex usr.bin/lex/lib

2013-05-22 Thread Glen Barber
On Wed, May 22, 2013 at 01:45:42PM -0400, Jung-uk Kim wrote:
> > I think this commit breaks head/.
> > 
> > http://tinderbox.freebsd.org/tinderbox-head-build-HEAD-powerpc-powerpc.full
> 
> It should be fixed with r250914.
> 
> Sorry for the breakage.
> 

There are more...

===> usr.bin/ar (all)
cc  -O -pipe -G0  -I. -I/src/usr.bin/ar -std=gnu99 -Wsystem-headers
-Werror -Wall -Wno-format-y2k -W -Wno-unused-parameter
-Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Wreturn-type
-Wcast-qual -Wwrite-strings -Wswitch -Wshadow -Wunused-parameter
-Wcast-align -Wchar-subscripts -Winline -Wnested-externs
-Wredundant-decls -Wold-style-definition -Wno-pointer-sign -c
/src/usr.bin/ar/ar.c
cc  -O -pipe -G0  -I. -I/src/usr.bin/ar -std=gnu99 -Wsystem-headers
-Werror -Wall -Wno-format-y2k -W -Wno-unused-parameter
-Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Wreturn-type
-Wcast-qual -Wwrite-strings -Wswitch -Wshadow -Wunused-parameter
-Wcast-align -Wchar-subscripts -Winline -Wnested-externs
-Wredundant-decls -Wold-style-definition -Wno-pointer-sign -c acplex.c
cc1: warnings being treated as errors
:752: warning: redundant redeclaration of 'yylex'
/src/usr.bin/ar/acplex.l:41: warning: previous declaration of 'yylex'
was here
*** Error code 1

http://tinderbox.freebsd.org/tinderbox-head-build-HEAD-mips64-mips.full

Glen

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


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

2013-05-22 Thread Adrian Chadd
Odd, this reads like one of those things that's better off being
time-capped, rather than packet-count capped.

Good find, though.



Adrian

On 22 May 2013 09:32, Luigi Rizzo  wrote:
> Author: luigi
> Date: Wed May 22 16:32:18 2013
> New Revision: 250911
> URL: http://svnweb.freebsd.org/changeset/base/250911
>
> Log:
>   Increase the (arbitrary) limit for the number of packets per tick
>   from 1k to 20k The previous value was good 10 years ago, but not
>   anymore now.
>
>   More importantly, lots of good surprises:
>   polling is incredibly effective under virtualization, and not only
>   prevents livelock but also saves most of the VM exit overhead in
>   receive mode.
>
>   Using polling, a FreeBSD instance under qemu-kvm remains perfectly
>   responsive even when bombed with 10 Mpps over an emulated e1000,
>   and happily processes 1.7 Mpps through ipfw.
>
>   Note that some incompatibilities still remain: e.g. polling is not
>   (yet) compatible with netmap, and seems to freeze the guest when
>   kern.polling.idle_poll=1
>
>   MFC after:3 days
>
> Modified:
>   head/sys/kern/kern_poll.c
>
> Modified: head/sys/kern/kern_poll.c
> ==
> --- head/sys/kern/kern_poll.c   Wed May 22 15:15:05 2013(r250910)
> +++ head/sys/kern/kern_poll.c   Wed May 22 16:32:18 2013(r250911)
> @@ -87,12 +87,11 @@ static struct mtx   poll_mtx;
>   * The following constraints hold
>   *
>   * 1 <= poll_each_burst <= poll_burst <= poll_burst_max
> - * 0 <= poll_each_burst
>   * MIN_POLL_BURST_MAX <= poll_burst_max <= MAX_POLL_BURST_MAX
>   */
>
>  #define MIN_POLL_BURST_MAX 10
> -#define MAX_POLL_BURST_MAX 1000
> +#define MAX_POLL_BURST_MAX 2
>
>  static uint32_t poll_burst = 5;
>  static uint32_t poll_burst_max = 150;  /* good for 100Mbit net and HZ=1000 */
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r250919 - in head/share/i18n: csmapper esdb

2013-05-22 Thread Ed Schouten
Author: ed
Date: Wed May 22 22:34:48 2013
New Revision: 250919
URL: http://svnweb.freebsd.org/changeset/base/250919

Log:
  Don't depend on the touch binary being present.
  
  We can simply create an empty file by doing a no-op and redirecting stdout.

Modified:
  head/share/i18n/csmapper/Makefile
  head/share/i18n/esdb/Makefile

Modified: head/share/i18n/csmapper/Makefile
==
--- head/share/i18n/csmapper/Makefile   Wed May 22 22:34:09 2013
(r250918)
+++ head/share/i18n/csmapper/Makefile   Wed May 22 22:34:48 2013
(r250919)
@@ -7,7 +7,7 @@ SUBDIR= APPLE AST BIG5 CNS CP EBCDIC GB 
KAZAKH KOI KS MISC TCVN
 
 mapper.dir: ${SUBDIR}
-   touch ${.TARGET}
+   > ${.TARGET}
 .for i in ${SUBDIR}
cat ${i}/mapper.dir.${i} >> ${.TARGET}
 .endfor
@@ -18,7 +18,7 @@ FILES+=   mapper.dir mapper.dir.db
 CLEANFILES+= mapper.dir mapper.dir.db
 
 charset.pivot: ${SUBDIR}
-   touch ${.TARGET}
+   > ${.TARGET}
 .for i in ${SUBDIR}
cat ${i}/charset.pivot.${i} >> ${.TARGET}
 .endfor

Modified: head/share/i18n/esdb/Makefile
==
--- head/share/i18n/esdb/Makefile   Wed May 22 22:34:09 2013
(r250918)
+++ head/share/i18n/esdb/Makefile   Wed May 22 22:34:48 2013
(r250919)
@@ -10,7 +10,7 @@ FILES+=   esdb.dir esdb.dir.db esdb.alias 
 CLEANFILES= ${FILES}
 
 esdb.dir: ${SUBDIR}
-   touch $@
+   > $@
 .for i in ${SUBDIR}
cat ${i}/esdb.dir.${i} >>${.TARGET}
 .endfor
@@ -18,7 +18,7 @@ esdb.dir.db: esdb.dir
${MKESDB} -m -o ${.TARGET} ${.ALLSRC}
 
 esdb.alias: ${SUBDIR}
-   touch $@
+   > $@
 .for i in ${SUBDIR}
cat ${i}/esdb.alias.${i} >>${.TARGET}
 .endfor
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r250883 - in head: include include/xlocale lib/libc/locale sys/sys tools/regression/lib/libc/locale

2013-05-22 Thread Glen Barber
Hi Ed,

On Wed, May 22, 2013 at 10:14:00PM +0200, Ed Schouten wrote:
> Hi Glen,
> 
> 2013/5/22 Glen Barber :
> > This fails to build for me with GCC.
> >
> > /usr/src/lib/libc/locale/c16rtomb.c:73: error: too many arguments to 
> > function 'c32rtomb[21/1924]
> > /usr/src/lib/libc/locale/c16rtomb.c: At top level:
> > /usr/src/lib/libc/locale/c16rtomb.c:77: error: expected declaration 
> > specifiers or '...' before ' char16_t'
> > /usr/src/lib/libc/locale/c16rtomb.c: In function 'c16rtomb': 
> > /usr/src/lib/libc/locale/c16rtomb.c:80: error: 'c16' undeclared (first use 
> > in this function)
> > /usr/src/lib/libc/locale/c16rtomb.c:80: warning: passing argument 3 of 
> > 'c16rtomb_l' from incompa
> > tible pointer type
> > /usr/src/lib/libc/locale/c16rtomb.c:80: error: too many arguments to 
> > function 'c16rtomb_l'
> 
> Sorry, but it seems I cannot reproduce this. On my FreeBSD 9.1-STABLE
> box I ran the following:
> 
> make buildworld WITHOUT_CLANG=
> 
> Could you pleae let me know a bit more about your setup?
> 
> (P.S.: In the mean time I'm looking for a way to elegantly solve the
> character set issues. More on that later.)
> 

I have a feeling this is ccache-related.  Taking my ccache entries from
src.conf allows the build to continue.  Sorry for the noise. :(

Glen



pgpFrxGDqnyol.pgp
Description: PGP signature


Re: svn commit: r250883 - in head: include include/xlocale lib/libc/locale sys/sys tools/regression/lib/libc/locale

2013-05-22 Thread Ed Schouten
Hi Glen,

2013/5/22 Glen Barber :
> This fails to build for me with GCC.
>
> /usr/src/lib/libc/locale/c16rtomb.c:73: error: too many arguments to function 
> 'c32rtomb[21/1924]
> /usr/src/lib/libc/locale/c16rtomb.c: At top level:
> /usr/src/lib/libc/locale/c16rtomb.c:77: error: expected declaration 
> specifiers or '...' before ' char16_t'
> /usr/src/lib/libc/locale/c16rtomb.c: In function 'c16rtomb': 
> /usr/src/lib/libc/locale/c16rtomb.c:80: error: 'c16' undeclared (first use in 
> this function)
> /usr/src/lib/libc/locale/c16rtomb.c:80: warning: passing argument 3 of 
> 'c16rtomb_l' from incompa
> tible pointer type
> /usr/src/lib/libc/locale/c16rtomb.c:80: error: too many arguments to function 
> 'c16rtomb_l'

Sorry, but it seems I cannot reproduce this. On my FreeBSD 9.1-STABLE
box I ran the following:

make buildworld WITHOUT_CLANG=

Could you pleae let me know a bit more about your setup?

(P.S.: In the mean time I'm looking for a way to elegantly solve the
character set issues. More on that later.)

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


Re: svn commit: r250883 - in head: include include/xlocale lib/libc/locale sys/sys tools/regression/lib/libc/locale

2013-05-22 Thread Glen Barber
On Tue, May 21, 2013 at 07:59:37PM +, Ed Schouten wrote:
> Author: ed
> Date: Tue May 21 19:59:37 2013
> New Revision: 250883
> URL: http://svnweb.freebsd.org/changeset/base/250883
> 
> Log:
>   Add .
>   
>   The  header, part of C11, adds a small number of utility
>   functions for 16/32-bit "universal" characters, which may or may not be
>   UTF-16/32. As our wchar_t is already ISO 10646, simply add light-weight
>   wrappers around wcrtomb() and mbrtowc().
>   
>   While there, also add (non-yet-standard) _l functions, similar to the
>   ones we already have for the other locale-dependent functions.
>   
>   Reviewed by:theraven
> 
> Added:
>   head/include/uchar.h   (contents, props changed)
>   head/include/xlocale/_uchar.h   (contents, props changed)
>   head/lib/libc/locale/c16rtomb.c   (contents, props changed)
>   head/lib/libc/locale/c32rtomb.c   (contents, props changed)
>   head/lib/libc/locale/mbrtoc16.c   (contents, props changed)
>   head/lib/libc/locale/mbrtoc32.c   (contents, props changed)
>   head/tools/regression/lib/libc/locale/test-c16rtomb.c   (contents, props 
> changed)
>   head/tools/regression/lib/libc/locale/test-mbrtoc16.c   (contents, props 
> changed)
> Modified:
>   head/include/Makefile
>   head/include/stdatomic.h
>   head/include/xlocale/Makefile
>   head/lib/libc/locale/Makefile.inc
>   head/lib/libc/locale/Symbol.map
>   head/lib/libc/locale/mbrtowc.3
>   head/lib/libc/locale/wcrtomb.3
>   head/lib/libc/locale/xlocale_private.h
>   head/sys/sys/_types.h
>   head/tools/regression/lib/libc/locale/Makefile
> 

This fails to build for me with GCC.

/usr/src/lib/libc/locale/c16rtomb.c:73: error: too many arguments to function 
'c32rtomb[21/1924]
/usr/src/lib/libc/locale/c16rtomb.c: At top level:
/usr/src/lib/libc/locale/c16rtomb.c:77: error: expected declaration specifiers 
or '...' before ' char16_t'
/usr/src/lib/libc/locale/c16rtomb.c: In function 'c16rtomb': 
/usr/src/lib/libc/locale/c16rtomb.c:80: error: 'c16' undeclared (first use in 
this function)
/usr/src/lib/libc/locale/c16rtomb.c:80: warning: passing argument 3 of 
'c16rtomb_l' from incompa
tible pointer type
/usr/src/lib/libc/locale/c16rtomb.c:80: error: too many arguments to function 
'c16rtomb_l'
*** Error code 1

Stop.
make: stopped in /usr/src/lib/libc
*** Error code 1

Glen



pgpBdbvpVooqm.pgp
Description: PGP signature


svn commit: r250917 - head/sys/xen/xenbus

2013-05-22 Thread Justin T. Gibbs
Author: gibbs
Date: Wed May 22 19:22:44 2013
New Revision: 250917
URL: http://svnweb.freebsd.org/changeset/base/250917

Log:
  Fix loss of the emulated keyboard on Xen PV HVM domains.
  
  xen/xenbus/xenbusb.c:
  In xenbusb_probe_children(), do not modify the XenBus state of
  devices for which we have no PV driver support. An emulated device
  we do support may share this backend.  Hide the node from XenBus
  instead.
  
  This prevents closing the vkbd device, which Qemu's emulated keyboard
  device is using as the source for keyboard events.
  
  Tested with qemu-xen-traditional, qemu-xen and qemu stubdomains, all
  working as expected.
  
  Submitted by: Roger Pau Monne 
  Reviewed by:  gibbs
  MFC after:1 week

Modified:
  head/sys/xen/xenbus/xenbusb.c

Modified: head/sys/xen/xenbus/xenbusb.c
==
--- head/sys/xen/xenbus/xenbusb.c   Wed May 22 19:00:05 2013
(r250916)
+++ head/sys/xen/xenbus/xenbusb.c   Wed May 22 19:22:44 2013
(r250917)
@@ -404,6 +404,31 @@ xenbusb_device_sysctl_init(device_t dev)
 }
 
 /**
+ * \brief Decrement the number of XenBus child devices in the
+ *connecting state by one and release the xbs_attch_ch
+ *interrupt configuration hook if the connecting count
+ *drops to zero.
+ *
+ * \param xbs  XenBus Bus device softc of the owner of the bus to enumerate.
+ */
+static void
+xenbusb_release_confighook(struct xenbusb_softc *xbs)
+{
+   mtx_lock(&xbs->xbs_lock);
+   KASSERT(xbs->xbs_connecting_children > 0,
+   ("Connecting device count error\n"));
+   xbs->xbs_connecting_children--;
+   if (xbs->xbs_connecting_children == 0
+&& (xbs->xbs_flags & XBS_ATTACH_CH_ACTIVE) != 0) {
+   xbs->xbs_flags &= ~XBS_ATTACH_CH_ACTIVE;
+   mtx_unlock(&xbs->xbs_lock);
+   config_intrhook_disestablish(&xbs->xbs_attach_ch);
+   } else {
+   mtx_unlock(&xbs->xbs_lock);
+   }
+}
+
+/**
  * \brief Verify the existance of attached device instances and perform
  *probe/attach processing for newly arrived devices.
  *
@@ -417,7 +442,7 @@ xenbusb_probe_children(device_t dev)
 {
device_t *kids;
struct xenbus_device_ivars *ivars;
-   int i, count;
+   int i, count, error;
 
if (device_get_children(dev, &kids, &count) == 0) {
for (i = 0; i < count; i++) {
@@ -430,7 +455,30 @@ xenbusb_probe_children(device_t dev)
continue;
}
 
-   if (device_probe_and_attach(kids[i])) {
+   error = device_probe_and_attach(kids[i]);
+   if (error == ENXIO) {
+   struct xenbusb_softc *xbs;
+
+   /*
+* We don't have a PV driver for this device.
+* However, an emulated device we do support
+* may share this backend.  Hide the node from
+* XenBus until the next rescan, but leave it's
+* state unchanged so we don't inadvertently
+* prevent attachment of any emulated device.
+*/
+   xenbusb_delete_child(dev, kids[i]);
+
+   /*
+* Since the XenStore state of this device
+* still indicates a pending attach, manually
+* release it's hold on the boot process.
+*/
+   xbs = device_get_softc(dev);
+   xenbusb_release_confighook(xbs);
+
+   continue;
+   } else if (error) {
/*
 * Transition device to the closed state
 * so the world knows that attachment will
@@ -579,31 +627,6 @@ xenbusb_nop_confighook_cb(void *arg __un
 {
 }
 
-/**
- * \brief Decrement the number of XenBus child devices in the
- *connecting state by one and release the xbs_attch_ch
- *interrupt configuration hook if the connecting count
- *drops to zero.
- *
- * \param xbs  XenBus Bus device softc of the owner of the bus to enumerate.
- */
-static void
-xenbusb_release_confighook(struct xenbusb_softc *xbs)
-{
-   mtx_lock(&xbs->xbs_lock);
-   KASSERT(xbs->xbs_connecting_children > 0,
-   ("Connecting device count error\n"));
-   xbs->xbs_connecting_children--;
-   if (xbs->xbs_connecting_children == 0
-&& (xbs->xbs_flags & XBS_ATTACH_CH_ACTIVE) != 0) {
-   xbs->xbs_flags &= ~XBS_ATTACH_CH_ACTIVE;
-   mtx_unlock(&xbs->xbs_lock);

svn commit: r250916 - head/usr.sbin/mergemaster

2013-05-22 Thread Peter Wemm
Author: peter
Date: Wed May 22 19:00:05 2013
New Revision: 250916
URL: http://svnweb.freebsd.org/changeset/base/250916

Log:
  Don't mess with /etc/localtime if it is a symlink.

Modified:
  head/usr.sbin/mergemaster/mergemaster.sh

Modified: head/usr.sbin/mergemaster/mergemaster.sh
==
--- head/usr.sbin/mergemaster/mergemaster.shWed May 22 18:26:12 2013
(r250915)
+++ head/usr.sbin/mergemaster/mergemaster.shWed May 22 19:00:05 2013
(r250916)
@@ -1327,7 +1327,7 @@ case "${NEED_PWD_MKDB}" in
   ;;
 esac
 
-if [ -e "${DESTDIR}/etc/localtime" -a -z "${PRE_WORLD}" ]; then# 
Ignore if TZ == UTC
+if [ -e "${DESTDIR}/etc/localtime" -a ! -L "${DESTDIR}/etc/localtime" -a -z 
"${PRE_WORLD}" ]; then # Ignore if TZ == UTC
   echo ''
   [ -n "${DESTDIR}" ] && tzs_args="-C ${DESTDIR}"
   if [ -f "${DESTDIR}/var/db/zoneinfo" ]; then
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r250915 - in stable/9: etc etc/rc.d sys/kern

2013-05-22 Thread Jamie Gritton
Author: jamie
Date: Wed May 22 18:26:12 2013
New Revision: 250915
URL: http://svnweb.freebsd.org/changeset/base/250915

Log:
  MFC r250804:
  
Refine the "nojail" rc keyword, adding "nojailvnet" for files that don't
apply to most jails but do apply to vnet jails.  This includes adding
a new sysctl "security.jail.vnet" to identify vnet jails.
  
  PR:   conf/149050
  Submitted by: mdodd

Modified:
  stable/9/etc/rc
  stable/9/etc/rc.d/ipfw
  stable/9/etc/rc.d/netif
  stable/9/etc/rc.d/routing
  stable/9/etc/rc.shutdown
  stable/9/sys/kern/kern_jail.c
Directory Properties:
  stable/9/etc/   (props changed)
  stable/9/etc/rc.d/   (props changed)
  stable/9/sys/   (props changed)

Modified: stable/9/etc/rc
==
--- stable/9/etc/rc Wed May 22 17:47:45 2013(r250914)
+++ stable/9/etc/rc Wed May 22 18:26:12 2013(r250915)
@@ -77,6 +77,9 @@ if [ `/sbin/sysctl -n security.jail.jail
if [ "$early_late_divider" = "FILESYSTEMS" ]; then
early_late_divider=NETWORKING
fi
+   if [ `/sbin/sysctl -n security.jail.vnet` -ne 1 ]; then
+   skip="$skip -s nojailvnet"
+   fi
 fi
 
 # Do a first pass to get everything up to $early_late_divider so that

Modified: stable/9/etc/rc.d/ipfw
==
--- stable/9/etc/rc.d/ipfw  Wed May 22 17:47:45 2013(r250914)
+++ stable/9/etc/rc.d/ipfw  Wed May 22 18:26:12 2013(r250915)
@@ -5,7 +5,7 @@
 
 # PROVIDE: ipfw
 # REQUIRE: ppp
-# KEYWORD: nojail
+# KEYWORD: nojailvnet
 
 . /etc/rc.subr
 . /etc/network.subr

Modified: stable/9/etc/rc.d/netif
==
--- stable/9/etc/rc.d/netif Wed May 22 17:47:45 2013(r250914)
+++ stable/9/etc/rc.d/netif Wed May 22 18:26:12 2013(r250915)
@@ -28,7 +28,7 @@
 # PROVIDE: netif
 # REQUIRE: atm1 FILESYSTEMS serial sppp sysctl
 # REQUIRE: ipfilter ipfs
-# KEYWORD: nojail
+# KEYWORD: nojailvnet
 
 . /etc/rc.subr
 . /etc/network.subr

Modified: stable/9/etc/rc.d/routing
==
--- stable/9/etc/rc.d/routing   Wed May 22 17:47:45 2013(r250914)
+++ stable/9/etc/rc.d/routing   Wed May 22 18:26:12 2013(r250915)
@@ -7,7 +7,7 @@
 
 # PROVIDE: routing
 # REQUIRE: faith netif ppp stf
-# KEYWORD: nojail
+# KEYWORD: nojailvnet
 
 . /etc/rc.subr
 . /etc/network.subr

Modified: stable/9/etc/rc.shutdown
==
--- stable/9/etc/rc.shutdownWed May 22 17:47:45 2013(r250914)
+++ stable/9/etc/rc.shutdownWed May 22 18:26:12 2013(r250915)
@@ -81,7 +81,12 @@ fi
 # and perform the operation
 #
 rcorder_opts="-k shutdown"
-[ `/sbin/sysctl -n security.jail.jailed` -eq 1 ] && 
rcorder_opts="$rcorder_opts -s nojail"
+if [ `/sbin/sysctl -n security.jail.jailed` -eq 1 ]; then
+   rcorder_opts="$rcorder_opts -s nojail"
+   if [ `/sbin/sysctl -n security.jail.vnet` -ne 1 ]; then
+   rcorder_opts="$rcorder_opts -s nojailvnet"
+   fi
+fi
 
 case ${local_startup} in
 [Nn][Oo] | '') ;;

Modified: stable/9/sys/kern/kern_jail.c
==
--- stable/9/sys/kern/kern_jail.c   Wed May 22 17:47:45 2013
(r250914)
+++ stable/9/sys/kern/kern_jail.c   Wed May 22 18:26:12 2013
(r250915)
@@ -4147,6 +4147,26 @@ SYSCTL_PROC(_security_jail, OID_AUTO, ja
 CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_MPSAFE, NULL, 0,
 sysctl_jail_jailed, "I", "Process in jail?");
 
+static int
+sysctl_jail_vnet(SYSCTL_HANDLER_ARGS)
+{
+   int error, havevnet;
+#ifdef VIMAGE
+   struct ucred *cred = req->td->td_ucred;
+
+   havevnet = jailed(cred) && prison_owns_vnet(cred);
+#else
+   havevnet = 0;
+#endif
+   error = SYSCTL_OUT(req, &havevnet, sizeof(havevnet));
+
+   return (error);
+}
+
+SYSCTL_PROC(_security_jail, OID_AUTO, vnet,
+CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_MPSAFE, NULL, 0,
+sysctl_jail_vnet, "I", "Jail owns VNET?");
+
 #if defined(INET) || defined(INET6)
 SYSCTL_UINT(_security_jail, OID_AUTO, jail_max_af_ips, CTLFLAG_RW,
 &jail_max_af_ips, 0,
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r250881 - in head: . sys/sys usr.bin/lex usr.bin/lex/lib

2013-05-22 Thread Jung-uk Kim
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On 2013-05-22 13:45:57 -0400, Glen Barber wrote:
> On Tue, May 21, 2013 at 07:32:36PM +, Jung-uk Kim wrote:
>> Author: jkim Date: Tue May 21 19:32:35 2013 New Revision: 250881 
>> URL: http://svnweb.freebsd.org/changeset/base/250881
>> 
>> Log: Connect flex 2.5.37 to the build and bump
>> __FreeBSD_version.
>> 
> 
> I think this commit breaks head/.
> 
> cc  -O2 -pipe  -I/src/sbin/hastctl/../hastd -DHAVE_CAPSICUM -DINET 
> -DINET6 -DYY_NO_UNPUT -DYY_NO_INPUT -DHAVE_CRYPTO -std=gnu99 
> -fstack-protector -Wsystem-headers -Werror -Wall -Wno-format-y2k
> -W -Wno-unused-parameter -Wstrict-prototypes -Wmissing-prototypes 
> -Wpointer-arith -Wreturn-type -Wcast-qual -Wwrite-strings -Wswitch 
> -Wshadow -Wunused-parameter -Wchar-subscripts -Winline
> -Wnested-externs -Wredundant-decls -Wold-style-definition
> -Wno-pointer-sign -Wno-format -c token.c cc1: warnings being
> treated as errors :753: warning: redundant redeclaration of
> 'yylex' /src/sbin/hastctl/../hastd/hast.h:263: warning: previous
> declaration of 'yylex' was here *** Error code 1
> 
> Stop. make: stopped in /src/sbin/hastctl *** Error code 1
> 
> http://tinderbox.freebsd.org/tinderbox-head-build-HEAD-powerpc-powerpc.full

It
> 
should be fixed with r250914.

Sorry for the breakage.

Jung-uk Kim
-BEGIN PGP SIGNATURE-
Version: GnuPG v2.0.20 (FreeBSD)

iQEcBAEBAgAGBQJRnQRGAAoJECXpabHZMqHOzJoH/ivn5nGSL7LJd5pf4ORfYrN4
ru+YVHqGve3SDBEmuz//3jjqqzs9ovg54pm6EBSEFv2HP3uzzslX4kgRqFWPlI6j
rEunbwrmv8Dz4+P1oVXzJuzCOAFh0nTZVM1PRV4RCcH5DyAaEU80fcO5DcCsapdj
O4PCpcFmXkoDFSa5w4sVe8IRyAbsExsi8DQuM+ThoAshtEGhfm7PwRx8TfRkYzeQ
CUpQ+MwmoqqFRZUGwF/Ny3OUNBwBEzhXKWsrB8PsE1jKsw7nujhnbWhm6c/K1E5/
rkKFhc1QhQzn3LzNzq9B4ncUo+ygCUaoSsQquFHRXSIeAs29lwVdXr54riouosM=
=LAn1
-END PGP SIGNATURE-
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r250914 - head/sbin/hastd

2013-05-22 Thread Jung-uk Kim
Author: jkim
Date: Wed May 22 17:47:45 2013
New Revision: 250914
URL: http://svnweb.freebsd.org/changeset/base/250914

Log:
  Improve compatibility with old flex and fix build with GCC.

Modified:
  head/sbin/hastd/hast.h
  head/sbin/hastd/parse.y
  head/sbin/hastd/token.l

Modified: head/sbin/hastd/hast.h
==
--- head/sbin/hastd/hast.h  Wed May 22 17:13:03 2013(r250913)
+++ head/sbin/hastd/hast.h  Wed May 22 17:47:45 2013(r250914)
@@ -259,7 +259,4 @@ struct hast_resource {
 struct hastd_config *yy_config_parse(const char *config, bool exitonerror);
 void yy_config_free(struct hastd_config *config);
 
-void yyerror(const char *);
-int yylex(void);
-
 #endif /* !_HAST_H_ */

Modified: head/sbin/hastd/parse.y
==
--- head/sbin/hastd/parse.y Wed May 22 17:13:03 2013(r250913)
+++ head/sbin/hastd/parse.y Wed May 22 17:47:45 2013(r250914)
@@ -75,6 +75,8 @@ static char depth1_provname[PATH_MAX];
 static char depth1_localpath[PATH_MAX];
 static int depth1_metaflush;
 
+extern void yyerror(const char *);
+extern int yylex(void);
 extern void yyrestart(FILE *);
 
 static int isitme(const char *name);

Modified: head/sbin/hastd/token.l
==
--- head/sbin/hastd/token.l Wed May 22 17:13:03 2013(r250913)
+++ head/sbin/hastd/token.l Wed May 22 17:47:45 2013(r250914)
@@ -42,6 +42,9 @@ int depth;
 int lineno;
 
 #defineDP  do { } while (0)
+#defineYY_DECL int yylex(void)
+
+extern int yylex(void);
 %}
 
 %option noinput
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r250881 - in head: . sys/sys usr.bin/lex usr.bin/lex/lib

2013-05-22 Thread Glen Barber
On Tue, May 21, 2013 at 07:32:36PM +, Jung-uk Kim wrote:
> Author: jkim
> Date: Tue May 21 19:32:35 2013
> New Revision: 250881
> URL: http://svnweb.freebsd.org/changeset/base/250881
> 
> Log:
>   Connect flex 2.5.37 to the build and bump __FreeBSD_version.
> 

I think this commit breaks head/.

cc  -O2 -pipe  -I/src/sbin/hastctl/../hastd -DHAVE_CAPSICUM -DINET
-DINET6 -DYY_NO_UNPUT -DYY_NO_INPUT -DHAVE_CRYPTO -std=gnu99
-fstack-protector -Wsystem-headers -Werror -Wall -Wno-format-y2k -W
-Wno-unused-parameter -Wstrict-prototypes -Wmissing-prototypes
-Wpointer-arith -Wreturn-type -Wcast-qual -Wwrite-strings -Wswitch
-Wshadow -Wunused-parameter -Wchar-subscripts -Winline -Wnested-externs
-Wredundant-decls -Wold-style-definition -Wno-pointer-sign -Wno-format -c 
token.c
cc1: warnings being treated as errors
:753: warning: redundant redeclaration of 'yylex'
/src/sbin/hastctl/../hastd/hast.h:263: warning: previous declaration of 'yylex' 
was here
*** Error code 1

Stop.
make: stopped in /src/sbin/hastctl
*** Error code 1

http://tinderbox.freebsd.org/tinderbox-head-build-HEAD-powerpc-powerpc.full

Glen



pgpPxvXfkGHl1.pgp
Description: PGP signature


svn commit: r250913 - head/sys/dev/xen/netfront

2013-05-22 Thread Justin T. Gibbs
Author: gibbs
Date: Wed May 22 17:13:03 2013
New Revision: 250913
URL: http://svnweb.freebsd.org/changeset/base/250913

Log:
  Correct panic on detach of Xen PV network interfaces.
  
  dev/xen/netfront:
  In netif_free(), properly stop the interface and drain any pending
  timers prior to disconnecting from the backend device.
  
  Remove all media and detach our interface object from the system
  prior to deleting it.
  
  PR:   kern/176471
  Submitted by: Roger Pau Monne 
  Reviewed by:  gibbs
  MFC after:1 week

Modified:
  head/sys/dev/xen/netfront/netfront.c

Modified: head/sys/dev/xen/netfront/netfront.c
==
--- head/sys/dev/xen/netfront/netfront.cWed May 22 16:33:28 2013
(r250912)
+++ head/sys/dev/xen/netfront/netfront.cWed May 22 17:13:03 2013
(r250913)
@@ -2171,10 +2171,14 @@ netfront_detach(device_t dev)
 static void
 netif_free(struct netfront_info *info)
 {
+   XN_LOCK(info);
+   xn_stop(info);
+   XN_UNLOCK(info);
+   callout_drain(&info->xn_stat_ch);
netif_disconnect_backend(info);
-#if 0
-   close_netdev(info);
-#endif
+   ifmedia_removeall(&info->sc_media);
+   ether_ifdetach(info->xn_ifp);
+   if_free(info->xn_ifp);
 }
 
 static void
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r250912 - head/share/man/man9

2013-05-22 Thread Ed Maste
Author: emaste
Date: Wed May 22 16:33:28 2013
New Revision: 250912
URL: http://svnweb.freebsd.org/changeset/base/250912

Log:
  Remove reference to removed !MPSAFE filesystem support

Modified:
  head/share/man/man9/locking.9

Modified: head/share/man/man9/locking.9
==
--- head/share/man/man9/locking.9   Wed May 22 16:32:18 2013
(r250911)
+++ head/share/man/man9/locking.9   Wed May 22 16:33:28 2013
(r250912)
@@ -24,7 +24,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd May 25, 2012
+.Dd May 22, 2013
 .Dt LOCKING 9
 .Os
 .Sh NAME
@@ -167,7 +167,7 @@ Giant is an instance of a mutex, with so
 .It
 It is recursive.
 .It
-Drivers and filesystems can request that Giant be locked around them
+Drivers can request that Giant be locked around them
 by not marking themselves MPSAFE.
 Note that infrastructure to do this is slowly going away as non-MPSAFE
 drivers either became properly locked or disappear.
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r250911 - head/sys/kern

2013-05-22 Thread Luigi Rizzo
Author: luigi
Date: Wed May 22 16:32:18 2013
New Revision: 250911
URL: http://svnweb.freebsd.org/changeset/base/250911

Log:
  Increase the (arbitrary) limit for the number of packets per tick
  from 1k to 20k The previous value was good 10 years ago, but not
  anymore now.
  
  More importantly, lots of good surprises:
  polling is incredibly effective under virtualization, and not only
  prevents livelock but also saves most of the VM exit overhead in
  receive mode.
  
  Using polling, a FreeBSD instance under qemu-kvm remains perfectly
  responsive even when bombed with 10 Mpps over an emulated e1000,
  and happily processes 1.7 Mpps through ipfw.
  
  Note that some incompatibilities still remain: e.g. polling is not
  (yet) compatible with netmap, and seems to freeze the guest when
  kern.polling.idle_poll=1
  
  MFC after:3 days

Modified:
  head/sys/kern/kern_poll.c

Modified: head/sys/kern/kern_poll.c
==
--- head/sys/kern/kern_poll.c   Wed May 22 15:15:05 2013(r250910)
+++ head/sys/kern/kern_poll.c   Wed May 22 16:32:18 2013(r250911)
@@ -87,12 +87,11 @@ static struct mtx   poll_mtx;
  * The following constraints hold
  *
  * 1 <= poll_each_burst <= poll_burst <= poll_burst_max
- * 0 <= poll_each_burst
  * MIN_POLL_BURST_MAX <= poll_burst_max <= MAX_POLL_BURST_MAX
  */
 
 #define MIN_POLL_BURST_MAX 10
-#define MAX_POLL_BURST_MAX 1000
+#define MAX_POLL_BURST_MAX 2
 
 static uint32_t poll_burst = 5;
 static uint32_t poll_burst_max = 150;  /* good for 100Mbit net and HZ=1000 */
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r250907 - stable/9/sys/kern

2013-05-22 Thread John Baldwin
On Wednesday, May 22, 2013 6:37:28 am Scott Long wrote:
> Author: scottl
> Date: Wed May 22 10:37:28 2013
> New Revision: 250907
> URL: http://svnweb.freebsd.org/changeset/base/250907
> 
> Log:
>   MFC r248830, r250027, r250409
>   
>   Submitted by:   gibbs, andre, kib
>   Obtained from:  Netflix

What does it do?  (Perhaps a forced commit to include the missing bits of the 
commit message?)

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


svn commit: r250909 - head/sys/vm

2013-05-22 Thread Attilio Rao
Author: attilio
Date: Wed May 22 15:11:00 2013
New Revision: 250909
URL: http://svnweb.freebsd.org/changeset/base/250909

Log:
  Acquire read lock on the src object for vm_fault_copy_entry().
  
  Sponsored by: EMC / Isilon storage division
  Reviewed by:  alc

Modified:
  head/sys/vm/vm_fault.c

Modified: head/sys/vm/vm_fault.c
==
--- head/sys/vm/vm_fault.c  Wed May 22 12:59:39 2013(r250908)
+++ head/sys/vm/vm_fault.c  Wed May 22 15:11:00 2013(r250909)
@@ -1318,7 +1318,7 @@ vm_fault_copy_entry(vm_map_t dst_map, vm
 * (Because the source is wired down, the page will be in
 * memory.)
 */
-   VM_OBJECT_WLOCK(src_object);
+   VM_OBJECT_RLOCK(src_object);
object = src_object;
pindex = src_pindex + dst_pindex;
while ((src_m = vm_page_lookup(object, pindex)) == NULL &&
@@ -1327,15 +1327,15 @@ vm_fault_copy_entry(vm_map_t dst_map, vm
/*
 * Allow fallback to backing objects if we are reading.
 */
-   VM_OBJECT_WLOCK(backing_object);
+   VM_OBJECT_RLOCK(backing_object);
pindex += OFF_TO_IDX(object->backing_object_offset);
-   VM_OBJECT_WUNLOCK(object);
+   VM_OBJECT_RUNLOCK(object);
object = backing_object;
}
if (src_m == NULL)
panic("vm_fault_copy_wired: page missing");
pmap_copy_page(src_m, dst_m);
-   VM_OBJECT_WUNLOCK(object);
+   VM_OBJECT_RUNLOCK(object);
dst_m->valid = VM_PAGE_BITS_ALL;
dst_m->dirty = VM_PAGE_BITS_ALL;
VM_OBJECT_WUNLOCK(dst_object);
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


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

2013-05-22 Thread Mateusz Guzik
On Wed, May 22, 2013 at 01:21:48PM +0400, Gleb Smirnoff wrote:
> On Tue, May 21, 2013 at 09:58:01PM +, Mateusz Guzik wrote:
> M> Author: mjg
> M> Date: Tue May 21 21:58:00 2013
> M> New Revision: 250890
> M> URL: http://svnweb.freebsd.org/changeset/base/250890
> M> 
> M> Log:
> M>   passing fd over unix socket: fix a corner case where caller
> M>   wants to pass no descriptors.
> M>   
> M>   Previously the kernel would leak memory and try to free a potentially
> M>   arbitrary pointer.
> M>   
> M>   Reviewed by: pjd
> 
> Is it possible to make code more strict: assert that fdcount > 0, and
> do not perform any processing if number of fds is 0?
> 

stable/9 returns with a non-zero length message in such cases and your
patch changes it. Apparently with your patch we would get behaviour
present in Linux. Whether it matters in practice I don't know.

That being said I have no strong opinion either way. If you want, please
go ahead and change this.
-- 
Mateusz Guzik 
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r250907 - stable/9/sys/kern

2013-05-22 Thread Scott Long
Author: scottl
Date: Wed May 22 10:37:28 2013
New Revision: 250907
URL: http://svnweb.freebsd.org/changeset/base/250907

Log:
  MFC r248830, r250027, r250409
  
  Submitted by: gibbs, andre, kib
  Obtained from:Netflix

Modified:
  stable/9/sys/kern/uipc_syscalls.c
Directory Properties:
  stable/9/sys/   (props changed)

Modified: stable/9/sys/kern/uipc_syscalls.c
==
--- stable/9/sys/kern/uipc_syscalls.c   Wed May 22 08:44:21 2013
(r250906)
+++ stable/9/sys/kern/uipc_syscalls.c   Wed May 22 10:37:28 2013
(r250907)
@@ -1835,9 +1835,11 @@ kern_sendfile(struct thread *td, struct 
struct mbuf *m = NULL;
struct sf_buf *sf;
struct vm_page *pg;
+   struct vattr va;
off_t off, xfsize, fsbytes = 0, sbytes = 0, rem = 0;
int error, hdrlen = 0, mnw = 0;
int vfslocked;
+   int bsize;
struct sendfile_sync *sfs = NULL;
 
/*
@@ -1852,6 +1854,18 @@ kern_sendfile(struct thread *td, struct 
vfslocked = VFS_LOCK_GIANT(vp->v_mount);
vn_lock(vp, LK_SHARED | LK_RETRY);
if (vp->v_type == VREG) {
+   bsize = vp->v_mount->mnt_stat.f_iosize;
+   if (uap->nbytes == 0) {
+   error = VOP_GETATTR(vp, &va, td->td_ucred);
+   if (error != 0) {
+   VOP_UNLOCK(vp, 0);
+   VFS_UNLOCK_GIANT(vfslocked);
+   obj = NULL;
+   goto out;
+   }
+   rem = va.va_size;
+   } else
+   rem = uap->nbytes;
obj = vp->v_object;
if (obj != NULL) {
/*
@@ -1869,7 +1883,8 @@ kern_sendfile(struct thread *td, struct 
obj = NULL;
}
}
-   }
+   } else
+   bsize = 0;  /* silence gcc */
VOP_UNLOCK(vp, 0);
VFS_UNLOCK_GIANT(vfslocked);
if (obj == NULL) {
@@ -1962,11 +1977,20 @@ kern_sendfile(struct thread *td, struct 
 * The outer loop checks the state and available space of the socket
 * and takes care of the overall progress.
 */
-   for (off = uap->offset, rem = uap->nbytes; ; ) {
-   struct mbuf *mtail = NULL;
-   int loopbytes = 0;
-   int space = 0;
-   int done = 0;
+   for (off = uap->offset; ; ) {
+   struct mbuf *mtail;
+   int loopbytes;
+   int space;
+   int done;
+
+   if ((uap->nbytes != 0 && uap->nbytes == fsbytes) ||
+   (uap->nbytes == 0 && va.va_size == fsbytes))
+   break;
+
+   mtail = NULL;
+   loopbytes = 0;
+   space = 0;
+   done = 0;
 
/*
 * Check the socket state for ongoing connection,
@@ -2034,6 +2058,20 @@ retry_space:
 */
space -= hdrlen;
 
+   vfslocked = VFS_LOCK_GIANT(vp->v_mount);
+   error = vn_lock(vp, LK_SHARED);
+   if (error != 0) {
+   VFS_UNLOCK_GIANT(vfslocked);
+   goto done;
+   }
+   error = VOP_GETATTR(vp, &va, td->td_ucred);
+   if (error != 0 || off >= va.va_size) {
+   VOP_UNLOCK(vp, 0);
+   VFS_UNLOCK_GIANT(vfslocked);
+   goto done;
+   }
+   VFS_UNLOCK_GIANT(vfslocked);
+
/*
 * Loop and construct maximum sized mbuf chain to be bulk
 * dumped into socket buffer.
@@ -2043,25 +2081,20 @@ retry_space:
vm_offset_t pgoff;
struct mbuf *m0;
 
-   VM_OBJECT_LOCK(obj);
/*
 * Calculate the amount to transfer.
 * Not to exceed a page, the EOF,
 * or the passed in nbytes.
 */
pgoff = (vm_offset_t)(off & PAGE_MASK);
-   xfsize = omin(PAGE_SIZE - pgoff,
-   obj->un_pager.vnp.vnp_size - uap->offset -
-   fsbytes - loopbytes);
if (uap->nbytes)
rem = (uap->nbytes - fsbytes - loopbytes);
else
-   rem = obj->un_pager.vnp.vnp_size -
+   rem = va.va_size -
uap->offset - fsbytes - loopbytes;
-   xfsize = omin(rem, xfsize);
+   xfsize = omin(PAGE_SIZE - pgoff, rem);
xfsize = omin(space - loopbytes, xfsize)

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

2013-05-22 Thread Gleb Smirnoff
On Tue, May 21, 2013 at 09:58:01PM +, Mateusz Guzik wrote:
M> Author: mjg
M> Date: Tue May 21 21:58:00 2013
M> New Revision: 250890
M> URL: http://svnweb.freebsd.org/changeset/base/250890
M> 
M> Log:
M>   passing fd over unix socket: fix a corner case where caller
M>   wants to pass no descriptors.
M>   
M>   Previously the kernel would leak memory and try to free a potentially
M>   arbitrary pointer.
M>   
M>   Reviewed by:   pjd

Is it possible to make code more strict: assert that fdcount > 0, and
do not perform any processing if number of fds is 0?

Prototype patch against r250890 attached.

-- 
Totus tuus, Glebius.
Index: uipc_usrreq.c
===
--- uipc_usrreq.c	(revision 250906)
+++ uipc_usrreq.c	(working copy)
@@ -1686,8 +1686,8 @@ unp_freerights(struct filedescent **fdep, int fdco
 	struct file *fp;
 	int i;
 
-	if (fdcount == 0)
-		return;
+	KASSERT(fdcount > 0, ("%s: fdcount %d", __func__, fdcount));
+
 	for (i = 0; i < fdcount; i++) {
 		fp = fdep[i]->fde_file;
 		filecaps_free(&fdep[i]->fde_caps);
@@ -1725,6 +1725,8 @@ unp_externalize(struct mbuf *control, struct mbuf
 		if (cm->cmsg_level == SOL_SOCKET
 		&& cm->cmsg_type == SCM_RIGHTS) {
 			newfds = datalen / sizeof(*fdep);
+			if (newfds == 0)
+goto next;
 			fdep = data;
 
 			/* If we're not outputting the descriptors free them. */
@@ -1770,8 +1772,7 @@ unp_externalize(struct mbuf *control, struct mbuf
 unp_externalize_fp(fde->fde_file);
 			}
 			FILEDESC_XUNLOCK(fdesc);
-			if (newfds != 0)
-free(fdep[0], M_FILECAPS);
+			free(fdep[0], M_FILECAPS);
 		} else {
 			/* We can just copy anything else across. */
 			if (error || controlp == NULL)
@@ -1894,6 +1895,8 @@ unp_internalize(struct mbuf **controlp, struct thr
 
 		case SCM_RIGHTS:
 			oldfds = datalen / sizeof (int);
+			if (oldfds == 0)
+break;
 			/*
 			 * Check that all the FDs passed in refer to legal
 			 * files.  If not, reject the entire operation.
@@ -1928,10 +1931,6 @@ unp_internalize(struct mbuf **controlp, struct thr
 error = E2BIG;
 goto out;
 			}
-			if (oldfds == 0) {
-FILEDESC_SUNLOCK(fdesc);
-break;
-			}
 			fdp = data;
 			fdep = (struct filedescent **)
 			CMSG_DATA(mtod(*controlp, struct cmsghdr *));
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

svn commit: r250906 - stable/9/sys/kern

2013-05-22 Thread Scott Long
Author: scottl
Date: Wed May 22 08:44:21 2013
New Revision: 250906
URL: http://svnweb.freebsd.org/changeset/base/250906

Log:
  MFC r250327
  
  Add a sysctl vfs.read_min to complement the exiting vfs.read_max.  It
  defaults to 1, meaning that it's off.
  
  When read-ahead is enabled on a file, the vfs cluster code deliberately
  breaks a read into 2 I/O transactions; one to satisfy the actual read,
  and one to perform read-ahead.  This makes sense in low-latency
  circumstances, but often produces unbalanced i/o transactions that
  penalize disks.  By setting vfs.read_min, we can tell the algorithm to
  fetch a larger transaction that what we asked for, achieving the same
  effect as the read-ahead but without the doubled, unbalanced transaction
  and the slightly lower latency.  This significantly helps our workloads
  with video streaming.
  
  Submitted by:   emax
  Reviewed by:kib
  Obtained from:  Netflix

Modified:
  stable/9/sys/kern/vfs_cluster.c
Directory Properties:
  stable/9/sys/   (props changed)

Modified: stable/9/sys/kern/vfs_cluster.c
==
--- stable/9/sys/kern/vfs_cluster.c Wed May 22 07:52:41 2013
(r250905)
+++ stable/9/sys/kern/vfs_cluster.c Wed May 22 08:44:21 2013
(r250906)
@@ -75,6 +75,10 @@ static int read_max = 64;
 SYSCTL_INT(_vfs, OID_AUTO, read_max, CTLFLAG_RW, &read_max, 0,
 "Cluster read-ahead max block count");
 
+static int read_min = 1;
+SYSCTL_INT(_vfs, OID_AUTO, read_min, CTLFLAG_RW, &read_min, 0,
+"Cluster read min block count");
+
 /* Page expended to mark partially backed buffers */
 extern vm_page_t   bogus_page;
 
@@ -169,6 +173,7 @@ cluster_read(vp, filesize, lblkno, size,
} else {
off_t firstread = bp->b_offset;
int nblks;
+   long minread;
 
KASSERT(bp->b_offset != NOOFFSET,
("cluster_read: no buffer offset"));
@@ -176,6 +181,13 @@ cluster_read(vp, filesize, lblkno, size,
ncontig = 0;
 
/*
+* Adjust totread if needed
+*/
+   minread = read_min * size;
+   if (minread > totread)
+   totread = minread;
+
+   /*
 * Compute the total number of blocks that we should read
 * synchronously.
 */
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r250905 - stable/9/usr.bin/locale

2013-05-22 Thread Greg Lehey
Author: grog
Date: Wed May 22 07:52:41 2013
New Revision: 250905
URL: http://svnweb.freebsd.org/changeset/base/250905

Log:
  MFH revisions 242743 to 243202:
  
  Make parameters to -c and -k options optional.  If no parameters are
  supplied, print information for all keywords.
  
  Improve output of -c option, in particular in conjunction with -k
  option.
  
  Complete man page.
  
  Add comment on standards conformity.

Modified:
  stable/9/usr.bin/locale/locale.1
  stable/9/usr.bin/locale/locale.c
Directory Properties:
  stable/9/usr.bin/locale/   (props changed)

Modified: stable/9/usr.bin/locale/locale.1
==
--- stable/9/usr.bin/locale/locale.1Wed May 22 05:43:14 2013
(r250904)
+++ stable/9/usr.bin/locale/locale.1Wed May 22 07:52:41 2013
(r250905)
@@ -25,7 +25,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd November 1, 2005
+.Dd November 18, 2012
 .Dt LOCALE 1
 .Os
 .Sh NAME
@@ -40,7 +40,7 @@
 .Op Ar prefix
 .Nm
 .Op Fl ck
-.Ar keyword ...
+.Op Ar keyword ...
 .Sh DESCRIPTION
 The
 .Nm
@@ -70,12 +70,16 @@ will respect the
 .Ev PATH_LOCALE
 environment variable, and use it instead of the system's default locale
 directory.
-.It Fl m
-Print names of all available charmaps.
-.It Fl k
-Print the names and values of all selected keywords.
 .It Fl c
 Print the category name for all selected keywords.
+If no keywords are selected, print the category name for all defined
+keywords.
+.It Fl k
+Print the names and values of all selected keywords.
+If no keywords are selected, print the names and values of all defined
+keywords.
+.It Fl m
+Print names of all available charmaps.
 .El
 .Sh IMPLEMENTATION NOTES
 The special
@@ -89,6 +93,17 @@ a prefix string can be defined to limit 
 .Ex -std
 .Sh SEE ALSO
 .Xr setlocale 3
+.Sh STANDARDS
+The
+.Nm
+utility conforms to
+.St -p1003.1-2004 .
+The
+.Ev LC_CTYPE ,
+.Ev LC_MESSAGES
+and
+.Ev NLSPATH
+environment variables are not interpreted.
 .Sh BUGS
 Since
 .Fx

Modified: stable/9/usr.bin/locale/locale.c
==
--- stable/9/usr.bin/locale/locale.cWed May 22 05:43:14 2013
(r250904)
+++ stable/9/usr.bin/locale/locale.cWed May 22 07:52:41 2013
(r250905)
@@ -31,7 +31,7 @@
  * nl_langinfo(3) extensions)
  *
  * XXX: correctly handle reserved 'charmap' keyword and '-m' option (require
- *  localedef(1) implementation).  Currently it's handled via
+ * localedef(1) implementation).  Currently it's handled via
  * nl_langinfo(CODESET).
  */
 
@@ -79,32 +79,32 @@ struct _lcinfo {
{ "LC_MONETARY",LC_MONETARY },
{ "LC_MESSAGES",LC_MESSAGES }
 };
-#define NLCINFO (sizeof(lcinfo)/sizeof(lcinfo[0]))
+#defineNLCINFO (sizeof(lcinfo)/sizeof(lcinfo[0]))
 
 /* ids for values not referenced by nl_langinfo() */
 #defineKW_ZERO 1
 #defineKW_GROUPING (KW_ZERO+1)
-#define KW_INT_CURR_SYMBOL (KW_ZERO+2)
-#define KW_CURRENCY_SYMBOL (KW_ZERO+3)
-#define KW_MON_DECIMAL_POINT   (KW_ZERO+4)
-#define KW_MON_THOUSANDS_SEP   (KW_ZERO+5)
-#define KW_MON_GROUPING(KW_ZERO+6)
-#define KW_POSITIVE_SIGN   (KW_ZERO+7)
-#define KW_NEGATIVE_SIGN   (KW_ZERO+8)
-#define KW_INT_FRAC_DIGITS (KW_ZERO+9)
-#define KW_FRAC_DIGITS (KW_ZERO+10)
-#define KW_P_CS_PRECEDES   (KW_ZERO+11)
-#define KW_P_SEP_BY_SPACE  (KW_ZERO+12)
-#define KW_N_CS_PRECEDES   (KW_ZERO+13)
-#define KW_N_SEP_BY_SPACE  (KW_ZERO+14)
-#define KW_P_SIGN_POSN (KW_ZERO+15)
-#define KW_N_SIGN_POSN (KW_ZERO+16)
-#define KW_INT_P_CS_PRECEDES   (KW_ZERO+17)
-#define KW_INT_P_SEP_BY_SPACE  (KW_ZERO+18)
-#define KW_INT_N_CS_PRECEDES   (KW_ZERO+19)
-#define KW_INT_N_SEP_BY_SPACE  (KW_ZERO+20)
-#define KW_INT_P_SIGN_POSN (KW_ZERO+21)
-#define KW_INT_N_SIGN_POSN (KW_ZERO+22)
+#defineKW_INT_CURR_SYMBOL  (KW_ZERO+2)
+#defineKW_CURRENCY_SYMBOL  (KW_ZERO+3)
+#defineKW_MON_DECIMAL_POINT(KW_ZERO+4)
+#defineKW_MON_THOUSANDS_SEP(KW_ZERO+5)
+#defineKW_MON_GROUPING (KW_ZERO+6)
+#defineKW_POSITIVE_SIGN(KW_ZERO+7)
+#defineKW_NEGATIVE_SIGN(KW_ZERO+8)
+#defineKW_INT_FRAC_DIGITS  (KW_ZERO+9)
+#defineKW_FRAC_DIGITS  (KW_ZERO+10)
+#defineKW_P_CS_PRECEDES(KW_ZERO+11)
+#defineKW_P_SEP_BY_SPACE   (KW_ZERO+12)
+#defineKW_N_CS_PRECEDES(KW_ZERO+13)
+#defineKW_N_SEP_BY_SPACE   (KW_ZERO+14)
+#defineKW_P_SIGN_POSN  (KW_ZERO+15)
+#defineKW_N_SIGN_POSN  (KW_ZERO+16)
+#defineKW_INT_P_CS_PRECEDES(KW_ZERO+17)
+#defineKW_INT_P_SEP_BY_SPACE   (KW_ZERO+18)
+#defineKW_INT_N_CS_PRECEDES(KW_ZERO+19)
+#defineKW_INT_N_SEP_BY_SPACE   (KW_ZERO+20)
+#defineKW_INT_P_