svn commit: r267148 - head

2014-06-06 Thread Baptiste Daroussin
Author: bapt
Date: Fri Jun  6 08:05:34 2014
New Revision: 267148
URL: http://svnweb.freebsd.org/changeset/base/267148

Log:
  Prevent arc commands from overwriting history

Modified:
  head/.arcconfig

Modified: head/.arcconfig
==
--- head/.arcconfig Fri Jun  6 04:09:07 2014(r267147)
+++ head/.arcconfig Fri Jun  6 08:05:34 2014(r267148)
@@ -1,4 +1,5 @@
 {
project.name: S,
-   phabricator.uri : https://phabric.freebsd.org/;
+   phabricator.uri : https://phabric.freebsd.org/;,
+   history.immutable : true
 }
___
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: r267149 - head/usr.bin/netstat

2014-06-06 Thread Joel Dahl
Author: joel (doc committer)
Date: Fri Jun  6 08:42:03 2014
New Revision: 267149
URL: http://svnweb.freebsd.org/changeset/base/267149

Log:
  Minor mdoc nit.

Modified:
  head/usr.bin/netstat/netstat.1

Modified: head/usr.bin/netstat/netstat.1
==
--- head/usr.bin/netstat/netstat.1  Fri Jun  6 08:05:34 2014
(r267148)
+++ head/usr.bin/netstat/netstat.1  Fri Jun  6 08:42:03 2014
(r267149)
@@ -90,8 +90,8 @@
 .Op Fl M Ar core
 .Op Fl N Ar system
 .It Nm Fl Q
-.Ek
 .El
+.Ek
 .Sh DESCRIPTION
 The
 .Nm
___
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: r267150 - head/sys/dev/netmap

2014-06-06 Thread Luigi Rizzo
Author: luigi
Date: Fri Jun  6 10:40:20 2014
New Revision: 267150
URL: http://svnweb.freebsd.org/changeset/base/267150

Log:
  prevent a panic when the netdev/ifp is not set in attach
  (internal  c63a7b85)
  
  MFC after:3 days

Modified:
  head/sys/dev/netmap/netmap.c

Modified: head/sys/dev/netmap/netmap.c
==
--- head/sys/dev/netmap/netmap.cFri Jun  6 08:42:03 2014
(r267149)
+++ head/sys/dev/netmap/netmap.cFri Jun  6 10:40:20 2014
(r267150)
@@ -2260,7 +2260,8 @@ netmap_attach(struct netmap_adapter *arg
 
 fail:
D(fail, arg %p ifp %p na %p, arg, ifp, hwna);
-   netmap_detach(ifp);
+   if (ifp)
+   netmap_detach(ifp);
return (hwna ? EINVAL : ENOMEM);
 }
 
___
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: r267151 - head/sys/dev/netmap

2014-06-06 Thread Luigi Rizzo
Author: luigi
Date: Fri Jun  6 10:50:14 2014
New Revision: 267151
URL: http://svnweb.freebsd.org/changeset/base/267151

Log:
  add checks for invalid buffer pointers and lengths

Modified:
  head/sys/dev/netmap/netmap_vale.c

Modified: head/sys/dev/netmap/netmap_vale.c
==
--- head/sys/dev/netmap/netmap_vale.c   Fri Jun  6 10:40:20 2014
(r267150)
+++ head/sys/dev/netmap/netmap_vale.c   Fri Jun  6 10:50:14 2014
(r267151)
@@ -959,6 +959,14 @@ nm_bdg_preflush(struct netmap_vp_adapter
ft[ft_i].ft_next = NM_FT_NULL;
buf = ft[ft_i].ft_buf = (slot-flags  NS_INDIRECT) ?
(void *)(uintptr_t)slot-ptr : BDG_NMB(na-up, slot);
+   if (unlikely(buf == NULL)) {
+   RD(5, NULL %s buffer pointer from %s slot %d len %d,
+   (slot-flags  NS_INDIRECT) ? INDIRECT : 
DIRECT,
+   kring-name, j, ft[ft_i].ft_len);
+   buf = ft[ft_i].ft_buf = NMB_VA(0); /* the 'null' buffer 
*/
+   ft[ft_i].ft_len = 0;
+   ft[ft_i].ft_flags = 0;
+   }
__builtin_prefetch(buf);
++ft_i;
if (slot-flags  NS_MOREFRAG) {
@@ -1312,6 +1320,7 @@ nm_bdg_flush(struct nm_bdg_fwd *ft, u_in
needed = d-bq_len + brddst-bq_len;
 
if (unlikely(dst_na-virt_hdr_len != na-virt_hdr_len)) {
+   RD(3, virt_hdr_mismatch, src %d len %d, 
na-virt_hdr_len, dst_na-virt_hdr_len);
/* There is a virtio-net header/offloadings mismatch 
between
 * source and destination. The slower mismatch datapath 
will
 * be used to cope with all the mismatches.
@@ -1412,6 +1421,11 @@ retry:
/* round to a multiple of 64 */
copy_len = (copy_len + 63)  ~63;
 
+   if (unlikely(copy_len  NETMAP_BUF_SIZE 
||
+   copy_len  
NETMAP_BUF_SIZE)) {
+   RD(5, invalid len %d, down to 
64, (int)copy_len);
+   copy_len = dst_len = 64; // XXX
+   }
if (ft_p-ft_flags  NS_INDIRECT) {
if (copyin(src, dst, copy_len)) 
{
// invalid user 
pointer, pretend len is 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: r267152 - head/sys/dev/i40e

2014-06-06 Thread Kevin Lo
Author: kevlo
Date: Fri Jun  6 11:12:19 2014
New Revision: 267152
URL: http://svnweb.freebsd.org/changeset/base/267152

Log:
  Replace deprecated M_DONTWAIT with M_NOWAIT.
  
  Reviewed by:  jfv

Modified:
  head/sys/dev/i40e/i40e_txrx.c

Modified: head/sys/dev/i40e/i40e_txrx.c
==
--- head/sys/dev/i40e/i40e_txrx.c   Fri Jun  6 10:50:14 2014
(r267151)
+++ head/sys/dev/i40e/i40e_txrx.c   Fri Jun  6 11:12:19 2014
(r267152)
@@ -210,7 +210,7 @@ i40e_xmit(struct i40e_queue *que, struct
if (error == EFBIG) {
struct mbuf *m;
 
-   m = m_defrag(*m_headp, M_DONTWAIT);
+   m = m_defrag(*m_headp, M_NOWAIT);
if (m == NULL) {
que-mbuf_defrag_failed++;
m_freem(*m_headp);
@@ -834,7 +834,7 @@ i40e_refresh_mbufs(struct i40e_queue *qu
goto no_split;
 
if (buf-m_head == NULL) {
-   mh = m_gethdr(M_DONTWAIT, MT_DATA);
+   mh = m_gethdr(M_NOWAIT, MT_DATA);
if (mh == NULL)
goto update;
} else
@@ -861,7 +861,7 @@ i40e_refresh_mbufs(struct i40e_queue *qu
 
 no_split:
if (buf-m_pack == NULL) {
-   mp = m_getjcl(M_DONTWAIT, MT_DATA,
+   mp = m_getjcl(M_NOWAIT, MT_DATA,
M_PKTHDR, rxr-mbuf_sz);
if (mp == NULL)
goto update;
___
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: r267153 - head/gnu/usr.bin/groff/tmac

2014-06-06 Thread Christian Brueffer
Author: brueffer
Date: Fri Jun  6 11:36:05 2014
New Revision: 267153
URL: http://svnweb.freebsd.org/changeset/base/267153

Log:
  Add Lb string for libcuse.

Modified:
  head/gnu/usr.bin/groff/tmac/mdoc.local

Modified: head/gnu/usr.bin/groff/tmac/mdoc.local
==
--- head/gnu/usr.bin/groff/tmac/mdoc.local  Fri Jun  6 11:12:19 2014
(r267152)
+++ head/gnu/usr.bin/groff/tmac/mdoc.local  Fri Jun  6 11:36:05 2014
(r267153)
@@ -35,6 +35,7 @@
 .ds doc-str-Lb-libarchive  Streaming Archive Library (libarchive, \-larchive)
 .ds doc-str-Lb-libbluetooth Bluetooth User Library (libbluetooth, \-lbluetooth)
 .ds doc-str-Lb-libcapsicum Capsicum Library (libcapsicum, \-lcapsicum)
+.ds doc-str-Lb-libcuse Userland Character Device Library (libcuse, \-lcuse)
 .ds doc-str-Lb-libedit Line Editor and History Library (libedit, \-ledit)
 .ds doc-str-Lb-libefi  EFI Runtime Services Library (libefi, \-lefi)
 .ds doc-str-Lb-libelf  ELF Parsing Library (libelf, \-lelf)
___
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: r267154 - head/lib/libcuse

2014-06-06 Thread Christian Brueffer
Author: brueffer
Date: Fri Jun  6 11:52:30 2014
New Revision: 267154
URL: http://svnweb.freebsd.org/changeset/base/267154

Log:
  Add missing MLINKs.

Modified:
  head/lib/libcuse/Makefile

Modified: head/lib/libcuse/Makefile
==
--- head/lib/libcuse/Makefile   Fri Jun  6 11:36:05 2014(r267153)
+++ head/lib/libcuse/Makefile   Fri Jun  6 11:52:30 2014(r267154)
@@ -40,6 +40,7 @@ LDADD+=   ${PTHREAD_LIBS}
 
 MLINKS=
 MLINKS+= cuse.3 cuse_alloc_unit_number.3
+MLINKS+= cuse.3 cuse_alloc_unit_number_by_id.3
 MLINKS+= cuse.3 cuse_copy_in.3
 MLINKS+= cuse.3 cuse_copy_out.3
 MLINKS+= cuse.3 cuse_dev_create.3
@@ -49,7 +50,10 @@ MLINKS+= cuse.3 cuse_dev_get_per_file_ha
 MLINKS+= cuse.3 cuse_dev_get_priv0.3
 MLINKS+= cuse.3 cuse_dev_get_priv1.3
 MLINKS+= cuse.3 cuse_dev_set_per_file_handle.3
+MLINKS+= cuse.3 cuse_dev_set_priv0.3
+MLINKS+= cuse.3 cuse_dev_set_priv1.3
 MLINKS+= cuse.3 cuse_free_unit_number.3
+MLINKS+= cuse.3 cuse_free_unit_number_by_id.3
 MLINKS+= cuse.3 cuse_got_peer_signal.3
 MLINKS+= cuse.3 cuse_init.3
 MLINKS+= cuse.3 cuse_poll_wakeup.3
@@ -59,6 +63,7 @@ MLINKS+= cuse.3 cuse_uninit.3
 MLINKS+= cuse.3 cuse_vmalloc.3
 MLINKS+= cuse.3 cuse_is_vmalloc_addr.3
 MLINKS+= cuse.3 cuse_vmfree.3
+MLINKS+= cuse.3 cuse_vmoffset.3
 MLINKS+= cuse.3 cuse_wait_and_process.3
 
 .include bsd.lib.mk
___
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: r267155 - head/lib/libcuse

2014-06-06 Thread Christian Brueffer
Author: brueffer
Date: Fri Jun  6 12:06:40 2014
New Revision: 267155
URL: http://svnweb.freebsd.org/changeset/base/267155

Log:
  Mdoc cleanup, typo and grammar fixes.

Modified:
  head/lib/libcuse/cuse.3

Modified: head/lib/libcuse/cuse.3
==
--- head/lib/libcuse/cuse.3 Fri Jun  6 11:52:30 2014(r267154)
+++ head/lib/libcuse/cuse.3 Fri Jun  6 12:06:40 2014(r267155)
@@ -25,271 +25,263 @@
 .\ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\ SUCH DAMAGE.
 .\
-.Dd May 23, 2014
+.Dd June 6, 2014
 .Dt CUSE 3
 .Os
 .Sh NAME
 .Nm libcuse
-.
 .Nd Userland character device library
-.
-.
 .Sh LIBRARY
-.
-.
-Userland character device library (libcuse -lcuse)
-.
-.
+.Lb libcuse
 .Sh SYNOPSIS
-.
-.Pp
 To load the required kernel module at boot time, place the following line in
 .Xr loader.conf 5 :
 .Bd -literal -offset indent
 cuse_load=YES
 .Ed
-.
 .Pp
-.
 .In cuse.h
-.
-.
 .Sh DESCRIPTION
 The
 .Nm
-library contains functions to create a character device in userspace. The
+library contains functions to create a character device in userspace.
+The
 .Nm
 library is thread safe.
-.
-.
 .Sh LIBRARY INITIALISATION / DEINITIALISATION
-.
-.Pp
-.
 .Ft int
 .Fn cuse_init void
 This function initialises
 .Nm .
 Must be called at the beginning of the program.
 This function returns 0 on success or a negative value on failure.
-See CUSE_ERR_XXX for known error codes.
-If the cuse kernel module is not loaded, CUSE_ERR_NOT_LOADED is
-returned.
-. 
+See
+.Dv CUSE_ERR_XXX
+for known error codes.
+If the cuse kernel module is not loaded,
+.Dv CUSE_ERR_NOT_LOADED
+is returned.
 .Pp
-.
 .Ft int
 .Fn cuse_uninit void
 Deinitialise
 .Nm .
 Can be called at the end of the application.
 This function returns 0 on success or a negative value on failure.
-See CUSE_ERR_XXX for known error codes.
-.
-.
+See
+.Dv CUSE_ERR_XXX
+for known error codes.
 .Sh UNIT MANAGEMENT
-.
 .Ft int
 .Fn cuse_alloc_unit_number int *
 This function stores a uniq system unit number at the pointed
 integer loation.
 This function returns 0 on success or a negative value on failure.
-See CUSE_ERR_XXX for known error codes.
-.
+See
+.Dv CUSE_ERR_XXX
+for known error codes.
 .Pp
-.
 .Ft int
 .Fn cuse_alloc_unit_number_by_id int * int id
-This function stores a uniq system unit number at the pointed
+This function stores a unique system unit number at the pointed
 integer loation.
 The returned unit number is uniq within the given ID.
 Valid ID values are defined by the cuse include file.
-See the CUSE_ID_XXX() macros for more information.
+See the
+.Fn CUSE_ID_XXX
+macros for more information.
 This function returns 0 on success or a negative value on failure.
-See CUSE_ERR_XXX for known error codes.
-.
+See
+.Dv CUSE_ERR_XXX
+for known error codes.
 .Pp
-.
 .Ft int
 .Fn cuse_free_unit_number int
 This function frees the given allocated system unit number.
 This function returns 0 on success or a negative value on failure.
-See CUSE_ERR_XXX for known error codes.
-.
+See
+.Dv CUSE_ERR_XXX
+for known error codes.
 .Pp
-.
 .Ft int
 .Fn cuse_free_unit_number_by_id int unit int id
 This function frees the given allocated system unit number belonging
 to the given ID.
 If both the unit and id argument is -1, all allocated units will be freed.
 This function returns 0 on success or a negative value on failure.
-See CUSE_ERR_XXX for known error codes.
-.
-.
+See
+.Dv CUSE_ERR_XXX
+for known error codes.
 .Sh LIBRARY USAGE
-.
-.
 .Ft void *
 .Fn cuse_vmalloc int size
 This function allocates
 .Ar size
-bytes of memory. Only memory allocated by this function can be memory
-mapped by mmap(). This function returns a valid data pointer on success or
-NULL on failure.
-.
+bytes of memory.
+Only memory allocated by this function can be memory
+mapped by
+.Xr mmap 2 .
+This function returns a valid data pointer on success or
+.Dv NULL
+on failure.
 .Pp
-.
 .Ft int
 .Fn cuse_is_vmalloc_addr void *
 This function returns non-zero if the passed pointer points to a valid
-and non-freed allocation, as returned by cuse_vmalloc().
+and non-freed allocation, as returned by
+.Fn cuse_vmalloc .
 Else this function returns zero.
-.
 .Pp
-.
 .Ft void
 .Fn cuse_vmfree void *
-This function frees memory allocated by cuse_vmalloc(). Note that the
+This function frees memory allocated by
+.Fn cuse_vmalloc .
+Note that the
 cuse library will internally not free the memory until the
-cuse_uninit() function is called and that the number of uniq
+.Fn cuse_uninit
+function is called and that the number of unique
 allocations is limited.
-.
-.
 .Pp
-.
 .Ft unsigned long
 .Fn cuse_vmoffset void *
 This function returns the mmap offset that the client must use to
 access the allocated memory.
-.
 .Pp
-.
 .Ft struct cuse_dev *
 .Fn cuse_dev_create const struct cuse_methods *mtod void *priv0 void 
*priv1 uid_t gid_t int permission const char *fmt ...
 This function creates a new 

svn commit: r267159 - head/sbin/geom/class/stripe

2014-06-06 Thread Pawel Jakub Dawidek
Author: pjd
Date: Fri Jun  6 13:00:53 2014
New Revision: 267159
URL: http://svnweb.freebsd.org/changeset/base/267159

Log:
  The 'create' subcommand doesn't have '-h' option.

Modified:
  head/sbin/geom/class/stripe/geom_stripe.c

Modified: head/sbin/geom/class/stripe/geom_stripe.c
==
--- head/sbin/geom/class/stripe/geom_stripe.c   Fri Jun  6 12:52:44 2014
(r267158)
+++ head/sbin/geom/class/stripe/geom_stripe.c   Fri Jun  6 13:00:53 2014
(r267159)
@@ -62,7 +62,7 @@ struct g_command class_commands[] = {
{ 's', stripesize, GSTRIPE_STRIPESIZE, G_TYPE_NUMBER },
G_OPT_SENTINEL
},
-   [-hv] [-s stripesize] name prov prov ...
+   [-v] [-s stripesize] name prov prov ...
},
{ destroy, G_FLAG_VERBOSE, NULL,
{
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r267160 - head/share/man/man7

2014-06-06 Thread Glen Barber
Author: gjb
Date: Fri Jun  6 13:36:52 2014
New Revision: 267160
URL: http://svnweb.freebsd.org/changeset/base/267160

Log:
  Dereference portaudit(1), as it is now deprecated and its
  functionality exists in pkg-audit(8).
  
  Submitted by: Ronald Klop ronald-li...@klop.ws
  MFC after:3 days
  Sponsored by: The FreeBSD Foundation

Modified:
  head/share/man/man7/ports.7

Modified: head/share/man/man7/ports.7
==
--- head/share/man/man7/ports.7 Fri Jun  6 13:00:53 2014(r267159)
+++ head/share/man/man7/ports.7 Fri Jun  6 13:36:52 2014(r267160)
@@ -25,7 +25,7 @@
 .\
 .\ $FreeBSD$
 .\
-.Dd May 17, 2014
+.Dd June 6, 2014
 .Dt PORTS 7
 .Os
 .Sh NAME
@@ -458,7 +458,7 @@ If defined, only operate on a port if it
 If defined, only operate on a port if it can be installed 100% automatically.
 .It Va DISABLE_VULNERABILITIES
 If defined, disable check for security vulnerabilities using
-.Xr portaudit 1 Pq Pa ports/ports-mgmt/portaudit
+.Xr pkg-audit 8
 when installing new ports.
 .It Va NO_IGNORE
 If defined, allow installation of ports marked as
@@ -539,7 +539,7 @@ The big Kahuna.
 .Pp
 The following are part of the ports collection:
 .Pp
-.Xr portaudit 1 ,
+.Xr pkg 7 ,
 .Xr portlint 1
 .Rs
 .%B The FreeBSD Handbook
___
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: r267162 - head/sys/kern

2014-06-06 Thread Jilles Tjoelker
Author: jilles
Date: Fri Jun  6 14:49:00 2014
New Revision: 267162
URL: http://svnweb.freebsd.org/changeset/base/267162

Log:
  ktrace: Use designated initializers for the data_lengths array.
  
  In the .o file, this only changes some line numbers (head amd64) because
  element 0 is no longer explicitly initialized.
  
  This should make bugs like FreeBSD-SA-14:12.ktrace less likely.
  
  Discussed with:   des
  MFC after:1 week

Modified:
  head/sys/kern/kern_ktrace.c

Modified: head/sys/kern/kern_ktrace.c
==
--- head/sys/kern/kern_ktrace.c Fri Jun  6 13:37:40 2014(r267161)
+++ head/sys/kern/kern_ktrace.c Fri Jun  6 14:49:00 2014(r267162)
@@ -109,21 +109,20 @@ struct ktr_request {
 };
 
 static int data_lengths[] = {
-   0,  /* none */
-   offsetof(struct ktr_syscall, ktr_args), /* KTR_SYSCALL */
-   sizeof(struct ktr_sysret),  /* KTR_SYSRET */
-   0,  /* KTR_NAMEI */
-   sizeof(struct ktr_genio),   /* KTR_GENIO */
-   sizeof(struct ktr_psig),/* KTR_PSIG */
-   sizeof(struct ktr_csw), /* KTR_CSW */
-   0,  /* KTR_USER */
-   0,  /* KTR_STRUCT */
-   0,  /* KTR_SYSCTL */
-   sizeof(struct ktr_proc_ctor),   /* KTR_PROCCTOR */
-   0,  /* KTR_PROCDTOR */
-   sizeof(struct ktr_cap_fail),/* KTR_CAPFAIL */
-   sizeof(struct ktr_fault),   /* KTR_FAULT */
-   sizeof(struct ktr_faultend),/* KTR_FAULTEND */
+   [KTR_SYSCALL] = offsetof(struct ktr_syscall, ktr_args),
+   [KTR_SYSRET] = sizeof(struct ktr_sysret),
+   [KTR_NAMEI] = 0,
+   [KTR_GENIO] = sizeof(struct ktr_genio),
+   [KTR_PSIG] = sizeof(struct ktr_psig),
+   [KTR_CSW] = sizeof(struct ktr_csw),
+   [KTR_USER] = 0,
+   [KTR_STRUCT] = 0,
+   [KTR_SYSCTL] = 0,
+   [KTR_PROCCTOR] = sizeof(struct ktr_proc_ctor),
+   [KTR_PROCDTOR] = 0,
+   [KTR_CAPFAIL] = sizeof(struct ktr_cap_fail),
+   [KTR_FAULT] = sizeof(struct ktr_fault),
+   [KTR_FAULTEND] = sizeof(struct ktr_faultend),
 };
 
 static STAILQ_HEAD(, ktr_request) ktr_free;
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r267163 - head/sys/dev/netmap

2014-06-06 Thread Luigi Rizzo
Author: luigi
Date: Fri Jun  6 14:57:16 2014
New Revision: 267163
URL: http://svnweb.freebsd.org/changeset/base/267163

Log:
  remove two debugging messages, align comments with the code
  in our development trunk

Modified:
  head/sys/dev/netmap/netmap_generic.c

Modified: head/sys/dev/netmap/netmap_generic.c
==
--- head/sys/dev/netmap/netmap_generic.cFri Jun  6 14:49:00 2014
(r267162)
+++ head/sys/dev/netmap/netmap_generic.cFri Jun  6 14:57:16 2014
(r267163)
@@ -81,18 +81,25 @@ __FBSDID($FreeBSD$);
 #include dev/netmap/netmap_kern.h
 #include dev/netmap/netmap_mem2.h
 
-#define rtnl_lock() D(rtnl_lock called);
-#define rtnl_unlock() D(rtnl_unlock called);
+#define rtnl_lock()ND(rtnl_lock called);
+#define rtnl_unlock()  ND(rtnl_unlock called);
 #define MBUF_TXQ(m)((m)-m_pkthdr.flowid)
 #define MBUF_RXQ(m)((m)-m_pkthdr.flowid)
 #define smp_mb()
 
 /*
- * mbuf wrappers
+ * FreeBSD mbuf allocator/deallocator in emulation mode:
+ *
+ * We allocate EXT_PACKET mbuf+clusters, but need to set M_NOFREE
+ * so that the destructor, if invoked, will not free the packet.
+ *In principle we should set the destructor only on demand,
+ * but since there might be a race we better do it on allocation.
+ * As a consequence, we also need to set the destructor or we
+ * would leak buffers.
  */
 
 /*
- * we allocate an EXT_PACKET
+ * mbuf wrappers
  */
 #define netmap_get_mbuf(len) m_getcl(M_NOWAIT, MT_DATA, M_PKTHDR|M_NOFREE)
 
@@ -808,5 +815,5 @@ generic_netmap_attach(struct ifnet *ifp)
 struct netmap_adapter *
 netmap_getna(if_t ifp)
 {
-   return (NA((struct ifnet *)ifp));   
+   return (NA((struct ifnet *)ifp));
 }
___
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: r267164 - head/sys/dev/netmap

2014-06-06 Thread Luigi Rizzo
Author: luigi
Date: Fri Jun  6 14:57:40 2014
New Revision: 267164
URL: http://svnweb.freebsd.org/changeset/base/267164

Log:
  rate limit some error messages

Modified:
  head/sys/dev/netmap/netmap_vale.c

Modified: head/sys/dev/netmap/netmap_vale.c
==
--- head/sys/dev/netmap/netmap_vale.c   Fri Jun  6 14:57:16 2014
(r267163)
+++ head/sys/dev/netmap/netmap_vale.c   Fri Jun  6 14:57:40 2014
(r267164)
@@ -1072,7 +1072,7 @@ netmap_bdg_learning(char *buf, u_int buf
uint64_t smac, dmac;
 
if (buf_len  14) {
-   D(invalid buf length %d, buf_len);
+   RD(5, invalid buf length %d, buf_len);
return NM_BDG_NOPORT;
}
dmac = le64toh(*(uint64_t *)(buf))  0x;
___
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: r267165 - head/sys/dev/netmap

2014-06-06 Thread Luigi Rizzo
Author: luigi
Date: Fri Jun  6 14:58:25 2014
New Revision: 267165
URL: http://svnweb.freebsd.org/changeset/base/267165

Log:
  align comments with the ones in our development trunk

Modified:
  head/sys/dev/netmap/netmap.c
  head/sys/dev/netmap/netmap_kern.h

Modified: head/sys/dev/netmap/netmap.c
==
--- head/sys/dev/netmap/netmap.cFri Jun  6 14:57:40 2014
(r267164)
+++ head/sys/dev/netmap/netmap.cFri Jun  6 14:58:25 2014
(r267165)
@@ -270,6 +270,7 @@ netmap_disable_ring(struct netmap_kring 
 }
 
 
+/* stop or enable all the rings of na */
 static void
 netmap_set_all_rings(struct ifnet *ifp, int stopped)
 {
@@ -303,6 +304,13 @@ netmap_set_all_rings(struct ifnet *ifp, 
 }
 
 
+/*
+ * Convenience function used in drivers.  Waits for current txsync()s/rxsync()s
+ * to finish and prevents any new one from starting.  Call this before turning
+ * netmap mode off, or before removing the harware rings (e.g., on module
+ * onload).  As a rule of thumb for linux drivers, this should be placed near
+ * each napi_disable().
+ */
 void
 netmap_disable_all_rings(struct ifnet *ifp)
 {
@@ -310,6 +318,11 @@ netmap_disable_all_rings(struct ifnet *i
 }
 
 
+/*
+ * Convenience function used in drivers.  Re-enables rxsync and txsync on the
+ * adapter's rings In linux drivers, this should be placed near each
+ * napi_enable().
+ */
 void
 netmap_enable_all_rings(struct ifnet *ifp)
 {
@@ -393,6 +406,7 @@ nm_dump_buf(char *p, int len, int lim, c
  * Fetch configuration from the device, to cope with dynamic
  * reconfigurations after loading the module.
  */
+/* call with NMG_LOCK held */
 int
 netmap_update_config(struct netmap_adapter *na)
 {
@@ -447,18 +461,20 @@ netmap_rxsync_compat(struct netmap_kring
return na-nm_rxsync(na, kring-ring_id, flags);
 }
 
+/* kring-nm_sync callback for the host tx ring */
 static int
 netmap_txsync_to_host_compat(struct netmap_kring *kring, int flags)
 {
-   (void)flags;
+   (void)flags; /* unused */
netmap_txsync_to_host(kring-na);
return 0;
 }
 
+/* kring-nm_sync callback for the host rx ring */
 static int
 netmap_rxsync_from_host_compat(struct netmap_kring *kring, int flags)
 {
-   (void)flags;
+   (void)flags; /* unused */
netmap_rxsync_from_host(kring-na, NULL, NULL);
return 0;
 }
@@ -489,6 +505,7 @@ netmap_rxsync_from_host_compat(struct ne
  * Note: for compatibility, host krings are created even when not needed.
  * The tailroom space is currently used by vale ports for allocating leases.
  */
+/* call with NMG_LOCK held */
 int
 netmap_krings_create(struct netmap_adapter *na, u_int tailroom)
 {
@@ -567,6 +584,7 @@ netmap_krings_create(struct netmap_adapt
 
 
 /* undo the actions performed by netmap_krings_create */
+/* call with NMG_LOCK held */
 void
 netmap_krings_delete(struct netmap_adapter *na)
 {
@@ -586,6 +604,7 @@ netmap_krings_delete(struct netmap_adapt
  * on the rings connected to the host so we need to purge
  * them first.
  */
+/* call with NMG_LOCK held */
 static void
 netmap_hw_krings_delete(struct netmap_adapter *na)
 {
@@ -598,6 +617,12 @@ netmap_hw_krings_delete(struct netmap_ad
 }
 
 
+/* create a new netmap_if for a newly registered fd.
+ * If this is the first registration of the adapter,
+ * also create the netmap rings and their in-kernel view,
+ * the netmap krings.
+ */
+/* call with NMG_LOCK held */
 static struct netmap_if*
 netmap_if_new(const char *ifname, struct netmap_adapter *na)
 {
@@ -608,17 +633,23 @@ netmap_if_new(const char *ifname, struct
return NULL;
}
 
-   if (na-active_fds)
+   if (na-active_fds) /* already registered */
goto final;
 
+   /* create and init the krings arrays.
+* Depending on the adapter, this may also create
+* the netmap rings themselves
+*/
if (na-nm_krings_create(na))
goto cleanup;
 
+   /* create all missing netmap rings */
if (netmap_mem_rings_create(na))
goto cleanup;
 
 final:
 
+   /* in all cases, create a new netmap if */
nifp = netmap_mem_if_new(ifname, na);
if (nifp == NULL)
goto cleanup;
@@ -638,8 +669,8 @@ cleanup:
 
 /* grab a reference to the memory allocator, if we don't have one already.  The
  * reference is taken from the netmap_adapter registered with the priv.
- *
  */
+/* call with NMG_LOCK held */
 static int
 netmap_get_memory_locked(struct netmap_priv_d* p)
 {
@@ -672,6 +703,7 @@ netmap_get_memory_locked(struct netmap_p
 }
 
 
+/* call with NMG_LOCK *not* held */
 int
 netmap_get_memory(struct netmap_priv_d* p)
 {
@@ -683,6 +715,7 @@ netmap_get_memory(struct netmap_priv_d* 
 }
 
 
+/* call with NMG_LOCK held */
 static int
 netmap_have_memory_locked(struct netmap_priv_d* p)
 {
@@ -690,6 +723,7 @@ netmap_have_memory_locked(struct netmap_
 }
 
 
+/* call with NMG_LOCK held 

svn commit: r267167 - head/sys/net

2014-06-06 Thread Luigi Rizzo
Author: luigi
Date: Fri Jun  6 15:15:27 2014
New Revision: 267167
URL: http://svnweb.freebsd.org/changeset/base/267167

Log:
  whitespace change: fix one comment, remove a stale one.

Modified:
  head/sys/net/netmap.h

Modified: head/sys/net/netmap.h
==
--- head/sys/net/netmap.h   Fri Jun  6 15:09:08 2014(r267166)
+++ head/sys/net/netmap.h   Fri Jun  6 15:15:27 2014(r267167)
@@ -124,7 +124,7 @@
  *   space with a parent device. The ifname indicates the parent device,
  *   which must already exist. Flags in nr_flags indicate if we want to
  *   bind the master or slave side, the index (from nr_ringid)
- *   is just a cookie and does need to be sequential.
+ *   is just a cookie and does not need to be sequential.
  *
  * + NIOCREGIF can also attach to 'monitor' rings that replicate
  *   the content of specific rings, also from the same memory space.
@@ -228,7 +228,7 @@ struct netmap_slot {
  * 'head' and 'cur' must be incremented as slots are filled
  * with new packets to be sent;
  * 'cur' can be moved further ahead if we need more space
- * for new transmissions.
+ * for new transmissions. XXX todo (2014-03-12)
  *
  * In RX rings:
  *
@@ -454,20 +454,6 @@ struct netmap_if {
 
 /*
  * struct nmreq overlays a struct ifreq (just the name)
- *
- * On input, nr_ringid indicates which rings we are requesting,
- * with the low flags for the specific ring number.
- * selection   FLAGS   RING INDEX
- *
- * all the NIC rings   0x  -
- * only HOST ring  0x2000  ring index
- * single NIC ring 0x4000  -
- * all the NIC+HOST rings  0x6000  -
- * one pipe ring, master   0x8000  ring index
- * *** INVALID 0xA000
- * one pipe ring, slave0xC000  ring index
- * *** INVALID 0xE000
- *
  */
 struct nmreq {
charnr_name[IFNAMSIZ];
___
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: r267168 - head/sys/net

2014-06-06 Thread Luigi Rizzo
Author: luigi
Date: Fri Jun  6 15:17:19 2014
New Revision: 267168
URL: http://svnweb.freebsd.org/changeset/base/267168

Log:
  misc bugfixes:
  - stdio.h is needed for fprint()
  - make memsize uint32_t to avoid errors due to overflow
  - honor the *XPOLL flagg in NIOCREGIF requests
  - mmap fails wit MAP_FAILED, not NULL.
  
  MFC after:3 days

Modified:
  head/sys/net/netmap_user.h

Modified: head/sys/net/netmap_user.h
==
--- head/sys/net/netmap_user.h  Fri Jun  6 15:15:27 2014(r267167)
+++ head/sys/net/netmap_user.h  Fri Jun  6 15:17:19 2014(r267168)
@@ -133,6 +133,7 @@ nm_ring_space(struct netmap_ring *ring)
 #ifndef HAVE_NETMAP_WITH_LIBS
 #define HAVE_NETMAP_WITH_LIBS
 
+#include stdio.h
 #include sys/time.h
 #include sys/mman.h
 #include string.h/* memset */
@@ -192,7 +193,7 @@ struct nm_desc {
struct nm_desc *self; /* point to self if netmap. */
int fd;
void *mem;
-   int memsize;
+   uint32_t memsize;
int done_mmap;  /* set if mem is the result of mmap */
struct netmap_if * const nifp;
uint16_t first_tx_ring, last_tx_ring, cur_tx_ring;
@@ -404,8 +405,6 @@ nm_open(const char *ifname, const struct
errmsg = invalid ringid;
goto fail;
}
-   /* add the *XPOLL flags */
-   nr_ringid |= new_flags  (NETMAP_NO_TX_POLL | NETMAP_DO_RX_POLL);
 
d = (struct nm_desc *)calloc(1, sizeof(*d));
if (d == NULL) {
@@ -461,6 +460,9 @@ nm_open(const char *ifname, const struct
d-req.nr_flags = parent-req.nr_flags;
}
}
+   /* add the *XPOLL flags */
+   d-req.nr_ringid |= new_flags  (NETMAP_NO_TX_POLL | NETMAP_DO_RX_POLL);
+
if (ioctl(d-fd, NIOCREGIF, d-req)) {
errmsg = NIOCREGIF failed;
goto fail;
@@ -472,10 +474,11 @@ nm_open(const char *ifname, const struct
d-memsize = parent-memsize;
d-mem = parent-mem;
} else {
+   /* XXX TODO: check if memsize is too large (or there is 
overflow) */
d-memsize = d-req.nr_memsize;
d-mem = mmap(0, d-memsize, PROT_WRITE | PROT_READ, MAP_SHARED,
d-fd, 0);
-   if (d-mem == NULL) {
+   if (d-mem == MAP_FAILED) {
errmsg = mmap failed;
goto fail;
}
___
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: r266925 - in head/sys: amd64/linux32 i386/linux kern sys

2014-06-06 Thread Mateusz Guzik
On Sat, May 31, 2014 at 03:01:51PM +, Dmitry Chagin wrote:
 Author: dchagin
 Date: Sat May 31 15:01:51 2014
 New Revision: 266925
 URL: http://svnweb.freebsd.org/changeset/base/266925
 
 Log:
   To allow to run the interpreter itself add a new ELF branding type.
   Allow Linux ABI to run ELF interpreter.
   

[..]

 + /* Some ABI allows to run the interpreter itself. */
 + for (i = 0; i  MAX_BRANDS; i++) {
 + bi = elf_brand_list[i];
 + if (bi == NULL || bi-flags  BI_BRAND_NOTE_MANDATORY)
 + continue;
 + if (hdr-e_machine != bi-machine ||
 + (bi-flags  BI_CAN_EXEC_INTERP) == 0)
 + continue;
 + /*
 +  * Compare the interpreter name not the path to allow run it
 +  * from everywhere.
 +  */
 + interp_brand_name = strrchr(bi-interp_path, '/');
 + if (interp_brand_name == NULL)
 + interp_brand_name = bi-interp_path;
 + interp_len = strlen(interp_brand_name);
 + fname_name = strrchr(imgp-args-fname, '/');

Don't know about the rest, but this part looks incorrect.

fname is NULL (which will crash in strrchr) when fexecve is executed.

 + if (fname_name == NULL)
 + fname_name = imgp-args-fname;
 + fname_len = strlen(fname_name);
 + if (fname_len  interp_len)
 + continue;
 + ret = strncmp(fname_name, interp_brand_name, interp_len);
 + if (ret == 0)
 + return (bi);
 + }
 +


-- 
Mateusz Guzik mjguzik gmail.com
___
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: r267169 - head/usr.sbin/bhyve

2014-06-06 Thread Tycho Nightingale
Author: tychon
Date: Fri Jun  6 16:18:37 2014
New Revision: 267169
URL: http://svnweb.freebsd.org/changeset/base/267169

Log:
  Some devices (e.g. Intel AHCI and NICs) support quad-word access to
  register pairs where two 32-bit registers make up a larger logical
  size.  Support those access by splitting the quad-word into two
  double-words.
  
  Reviewed by:  grehan

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

Modified: head/usr.sbin/bhyve/pci_emul.c
==
--- head/usr.sbin/bhyve/pci_emul.c  Fri Jun  6 15:17:19 2014
(r267168)
+++ head/usr.sbin/bhyve/pci_emul.c  Fri Jun  6 16:18:37 2014
(r267169)
@@ -375,10 +375,27 @@ pci_emul_mem_handler(struct vmctx *ctx, 
 
offset = addr - pdi-pi_bar[bidx].addr;
 
-   if (dir == MEM_F_WRITE)
-   (*pe-pe_barwrite)(ctx, vcpu, pdi, bidx, offset, size, *val);
-   else
-   *val = (*pe-pe_barread)(ctx, vcpu, pdi, bidx, offset, size);
+   if (dir == MEM_F_WRITE) {
+   if (pdi-pi_bar[bidx].type == PCIBAR_MEM32  size == 8) {
+   (*pe-pe_barwrite)(ctx, vcpu, pdi, bidx, offset,
+  4, *val  0x);
+   (*pe-pe_barwrite)(ctx, vcpu, pdi, bidx, offset + 4,
+  4, *val  32);
+   } else {
+   (*pe-pe_barwrite)(ctx, vcpu, pdi, bidx, offset,
+  size, *val);
+   }
+   } else {
+   if (pdi-pi_bar[bidx].type == PCIBAR_MEM32  size == 8) {
+   *val = (*pe-pe_barread)(ctx, vcpu, pdi, bidx,
+offset, 4);
+   *val |= (*pe-pe_barread)(ctx, vcpu, pdi, bidx,
+ offset + 4, 4)  32;
+   } else {
+   *val = (*pe-pe_barread)(ctx, vcpu, pdi, bidx,
+offset, size);
+   }
+   }
 
return (0);
 }
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r267170 - head/sys/dev/netmap

2014-06-06 Thread Luigi Rizzo
Author: luigi
Date: Fri Jun  6 16:23:08 2014
New Revision: 267170
URL: http://svnweb.freebsd.org/changeset/base/267170

Log:
  move netmap_getna() to a freebsd-specific file

Modified:
  head/sys/dev/netmap/netmap_freebsd.c
  head/sys/dev/netmap/netmap_generic.c

Modified: head/sys/dev/netmap/netmap_freebsd.c
==
--- head/sys/dev/netmap/netmap_freebsd.cFri Jun  6 16:18:37 2014
(r267169)
+++ head/sys/dev/netmap/netmap_freebsd.cFri Jun  6 16:23:08 2014
(r267170)
@@ -223,6 +223,14 @@ generic_xmit_frame(struct ifnet *ifp, st
 }
 
 
+#if __FreeBSD_version = 115
+struct netmap_adapter *
+netmap_getna(if_t ifp)
+{
+   return (NA((struct ifnet *)ifp));
+}
+#endif /* __FreeBSD_version = 115 */
+
 /*
  * The following two functions are empty until we have a generic
  * way to extract the info from the ifp

Modified: head/sys/dev/netmap/netmap_generic.c
==
--- head/sys/dev/netmap/netmap_generic.cFri Jun  6 16:18:37 2014
(r267169)
+++ head/sys/dev/netmap/netmap_generic.cFri Jun  6 16:23:08 2014
(r267170)
@@ -811,9 +811,3 @@ generic_netmap_attach(struct ifnet *ifp)
 
return retval;
 }
-
-struct netmap_adapter *
-netmap_getna(if_t ifp)
-{
-   return (NA((struct ifnet *)ifp));
-}
___
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: r267171 - in head/sys/arm: at91 freescale/imx ti/am335x

2014-06-06 Thread Kevin Lo
Author: kevlo
Date: Fri Jun  6 16:37:42 2014
New Revision: 267171
URL: http://svnweb.freebsd.org/changeset/base/267171

Log:
  Remove extra semicolons.

Modified:
  head/sys/arm/at91/board_tsc4370.c
  head/sys/arm/freescale/imx/imx_sdhci.c
  head/sys/arm/ti/am335x/am335x_lcd.c

Modified: head/sys/arm/at91/board_tsc4370.c
==
--- head/sys/arm/at91/board_tsc4370.c   Fri Jun  6 16:23:08 2014
(r267170)
+++ head/sys/arm/at91/board_tsc4370.c   Fri Jun  6 16:37:42 2014
(r267171)
@@ -332,19 +332,19 @@ set_mac_from_idprom(void)
DEVOFFSET_BSO_SIGNATURE + sizeof(sig), 
dev_offset, sizeof(dev_offset));
if (status == -1)
-   return -1;;
+   return -1;
 
/* Check for the boot section signature. */
status = eeprom_read(EE_DEV_ADDR, 
dev_offset + OFFSET_BS_SIGNATURE, sig, sizeof(sig));
if ((status == -1) || (sig != BS_SIGNATURE))
-   return -1;;
+   return -1;
}
dev_offset += OFFSET_EUI64;
 
/* Read the EUI64 from the device.  */
if (eeprom_read(EE_DEV_ADDR, dev_offset, eui64, sizeof(eui64)) == -1)
-   return -1;;
+   return -1;
 
/* Transcribe the EUI-64 to a MAC-48.
 *

Modified: head/sys/arm/freescale/imx/imx_sdhci.c
==
--- head/sys/arm/freescale/imx/imx_sdhci.c  Fri Jun  6 16:23:08 2014
(r267170)
+++ head/sys/arm/freescale/imx/imx_sdhci.c  Fri Jun  6 16:37:42 2014
(r267171)
@@ -153,7 +153,7 @@ static struct ofw_compat_data compat_dat
{fsl,imx53-esdhc, HWTYPE_ESDHC},
{fsl,imx51-esdhc, HWTYPE_ESDHC},
{NULL,  HWTYPE_NONE},
-};;
+};
 
 static void imx_sdhc_set_clock(struct imx_sdhci_softc *sc, int enable);
 static void imx_sdhci_r1bfix_func(void *arg);

Modified: head/sys/arm/ti/am335x/am335x_lcd.c
==
--- head/sys/arm/ti/am335x/am335x_lcd.c Fri Jun  6 16:23:08 2014
(r267170)
+++ head/sys/arm/ti/am335x/am335x_lcd.c Fri Jun  6 16:37:42 2014
(r267171)
@@ -223,7 +223,7 @@ am335x_lcd_sysctl_backlight(SYSCTL_HANDL
int error;
int backlight;

-   backlight = sc-sc_backlight;;
+   backlight = sc-sc_backlight;
error = sysctl_handle_int(oidp, backlight, 0, req);
 
if (error != 0 || req-newptr == NULL)
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


Re: svn commit: r266925 - in head/sys: amd64/linux32 i386/linux kern sys

2014-06-06 Thread Chagin Dmitry
On Fri, Jun 06, 2014 at 05:47:01PM +0200, Mateusz Guzik wrote:
 On Sat, May 31, 2014 at 03:01:51PM +, Dmitry Chagin wrote:
  Author: dchagin
  Date: Sat May 31 15:01:51 2014
  New Revision: 266925
  URL: http://svnweb.freebsd.org/changeset/base/266925
  
  Log:
To allow to run the interpreter itself add a new ELF branding type.
Allow Linux ABI to run ELF interpreter.

 
 [..]
 
  +   /* Some ABI allows to run the interpreter itself. */
  +   for (i = 0; i  MAX_BRANDS; i++) {
  +   bi = elf_brand_list[i];
  +   if (bi == NULL || bi-flags  BI_BRAND_NOTE_MANDATORY)
  +   continue;
  +   if (hdr-e_machine != bi-machine ||
  +   (bi-flags  BI_CAN_EXEC_INTERP) == 0)
  +   continue;
  +   /*
  +* Compare the interpreter name not the path to allow run it
  +* from everywhere.
  +*/
  +   interp_brand_name = strrchr(bi-interp_path, '/');
  +   if (interp_brand_name == NULL)
  +   interp_brand_name = bi-interp_path;
  +   interp_len = strlen(interp_brand_name);
  +   fname_name = strrchr(imgp-args-fname, '/');
 
 Don't know about the rest, but this part looks incorrect.
 
 fname is NULL (which will crash in strrchr) when fexecve is executed.
 

yes, indeed. will fix, thanks

  +   if (fname_name == NULL)
  +   fname_name = imgp-args-fname;
  +   fname_len = strlen(fname_name);
  +   if (fname_len  interp_len)
  +   continue;
  +   ret = strncmp(fname_name, interp_brand_name, interp_len);
  +   if (ret == 0)
  +   return (bi);
  +   }
  +
 
 
 -- 
 Mateusz Guzik mjguzik gmail.com

-- 
Have fun!
chd


pgpOO63QAjz9R.pgp
Description: PGP signature


svn commit: r267172 - in head: . lib/atf/libatf-c lib/atf/libatf-c++ tools/build/mk

2014-06-06 Thread Julio Merino
Author: jmmv
Date: Fri Jun  6 17:05:43 2014
New Revision: 267172
URL: http://svnweb.freebsd.org/changeset/base/267172

Log:
  Homogenize libatf-* version numbers with upstream.
  
  The libatf-* major version numbers in FreeBSD were one version ahead of
  upstream because, when atf was first imported into FreeBSD, the upstream
  numbers were not respected.  This is just confusing and bound to cause
  problems down the road.
  
  Fix this by taking advantage of the fact that libatf-* are now private
  and that atf is not yet built by default.  However, and unfortunately, a
  clean build is needed for tests to continue working once make
  delete-old-libs has been run; hence the note in UPDATING.

Modified:
  head/UPDATING
  head/lib/atf/libatf-c++/Makefile
  head/lib/atf/libatf-c/Makefile
  head/tools/build/mk/OptionalObsoleteFiles.inc

Modified: head/UPDATING
==
--- head/UPDATING   Fri Jun  6 16:37:42 2014(r267171)
+++ head/UPDATING   Fri Jun  6 17:05:43 2014(r267172)
@@ -31,6 +31,22 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 11
disable the most expensive debugging functionality run
ln -s 'abort:false,junk:false' /etc/malloc.conf.)
 
+20140606:
+   The libatf-c and libatf-c++ major versions were downgraded to 0 and
+   1 respectively to match the upstream numbers.  They were out of
+   sync because, when they were originally added to FreeBSD, the
+   upstream versions were not respected.  These libraries are private
+   and not yet built by default, so renumbering them should be a
+   non-issue.  However, unclean source trees will yield broken test
+   programs once the operator executes make delete-old-libs after a
+   make installworld.
+
+   If you are using WITH_TESTS=yes (not the default), wipe the object
+   tree and rebuild from scratch to prevent spurious test failures.
+   This is only needed once: the old, misnumbered libraries have been
+   added to OptionalObsoleteFiles.inc so they will be removed during a
+   clean upgrade.
+
 20140512:
Clang and llvm have been upgraded to 3.4.1 release.
 

Modified: head/lib/atf/libatf-c++/Makefile
==
--- head/lib/atf/libatf-c++/MakefileFri Jun  6 16:37:42 2014
(r267171)
+++ head/lib/atf/libatf-c++/MakefileFri Jun  6 17:05:43 2014
(r267172)
@@ -30,7 +30,7 @@
 
 LIB=   atf-c++
 PRIVATELIB=true
-SHLIB_MAJOR=   2
+SHLIB_MAJOR=   1
 
 # libatf-c++ depends on the C version of the ATF library to build.
 DPADD= ${LIBATFC}

Modified: head/lib/atf/libatf-c/Makefile
==
--- head/lib/atf/libatf-c/Makefile  Fri Jun  6 16:37:42 2014
(r267171)
+++ head/lib/atf/libatf-c/Makefile  Fri Jun  6 17:05:43 2014
(r267172)
@@ -30,7 +30,7 @@
 
 LIB=   atf-c
 PRIVATELIB=true
-SHLIB_MAJOR=   1
+SHLIB_MAJOR=   0
 
 ATF=   ${.CURDIR:H:H:H}/contrib/atf
 .PATH: ${ATF}

Modified: head/tools/build/mk/OptionalObsoleteFiles.inc
==
--- head/tools/build/mk/OptionalObsoleteFiles.inc   Fri Jun  6 16:37:42 
2014(r267171)
+++ head/tools/build/mk/OptionalObsoleteFiles.inc   Fri Jun  6 17:05:43 
2014(r267172)
@@ -4112,6 +4112,8 @@ OLD_LIBS+=usr/lib/libatf-c.a
 OLD_LIBS+=usr/lib/libatf-c.so
 OLD_LIBS+=usr/lib/libatf-c.so.1
 OLD_LIBS+=usr/lib/libatf-c_p.a
+OLD_LIBS+=usr/lib/private/libatf-c.so.1
+OLD_LIBS+=usr/lib/private/libatf-c++.so.2
 .if ${TARGET_ARCH} == amd64 || ${TARGET_ARCH} == powerpc64
 OLD_LIBS+=usr/lib32/libatf-c++.a
 OLD_LIBS+=usr/lib32/libatf-c++.so
@@ -4122,6 +4124,8 @@ OLD_LIBS+=usr/lib32/libatf-c.a
 OLD_LIBS+=usr/lib32/libatf-c.so
 OLD_LIBS+=usr/lib32/libatf-c.so.1
 OLD_LIBS+=usr/lib32/libatf-c_p.a
+OLD_LIBS+=usr/lib32/private/libatf-c.so.1
+OLD_LIBS+=usr/lib32/private/libatf-c++.so.2
 .endif
 OLD_FILES+=usr/libdata/pkgconfig/atf-c++.pc
 OLD_FILES+=usr/libdata/pkgconfig/atf-c.pc
___
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: r267174 - head/usr.bin/rpcgen

2014-06-06 Thread Bryan Drewery
Author: bdrewery
Date: Fri Jun  6 17:38:37 2014
New Revision: 267174
URL: http://svnweb.freebsd.org/changeset/base/267174

Log:
  Fix some rpcgen sample file issues.
  
  * -Sc was generating code without a return type on main.
  * -Sm was generating an unusable clean target due to undefined RM.
  * -Sm was generating clean target with extra preceding space.
  
  PR:   185582
  Submitted by: Pawel Biernacki pawel.bierna...@gmail.com
  MFC after:1 week

Modified:
  head/usr.bin/rpcgen/rpc_main.c
  head/usr.bin/rpcgen/rpc_sample.c

Modified: head/usr.bin/rpcgen/rpc_main.c
==
--- head/usr.bin/rpcgen/rpc_main.c  Fri Jun  6 17:38:30 2014
(r267173)
+++ head/usr.bin/rpcgen/rpc_main.c  Fri Jun  6 17:38:37 2014
(r267174)
@@ -878,8 +878,8 @@ $(TARGETS_SVC.c) \n\n);
f_print(fout, \t$(CC) -o $(CLIENT) $(OBJECTS_CLNT) \
 $(LDLIBS) \n\n);
f_print(fout, $(SERVER) : $(OBJECTS_SVC) \n);
-   f_print(fout, \t$(CC) -o $(SERVER) $(OBJECTS_SVC) $(LDLIBS)\n\n );
-   f_print(fout, clean:\n\t $(RM) -f core $(TARGETS) $(OBJECTS_CLNT) \
+   f_print(fout, \t$(CC) -o $(SERVER) $(OBJECTS_SVC) $(LDLIBS)\n\n);
+   f_print(fout, clean:\n\t rm -f core $(TARGETS) $(OBJECTS_CLNT) \
 $(OBJECTS_SVC) $(CLIENT) $(SERVER)\n\n);
 }
 

Modified: head/usr.bin/rpcgen/rpc_sample.c
==
--- head/usr.bin/rpcgen/rpc_sample.cFri Jun  6 17:38:30 2014
(r267173)
+++ head/usr.bin/rpcgen/rpc_sample.cFri Jun  6 17:38:37 2014
(r267174)
@@ -270,6 +270,7 @@ write_sample_clnt_main(void)
version_list *vp;
 
f_print(fout, \n\n);
+   f_print(fout, int\n);
f_print(fout, main(int argc, char *argv[])\n{\n);
 
f_print(fout, \tchar *host;);
___
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: r267173 - head/tools/tools/vt/fontcvt

2014-06-06 Thread Ed Maste
Author: emaste
Date: Fri Jun  6 17:38:30 2014
New Revision: 267173
URL: http://svnweb.freebsd.org/changeset/base/267173

Log:
  Update after r267011: use -h height and -w width args

Modified:
  head/tools/tools/vt/fontcvt/terminus.sh

Modified: head/tools/tools/vt/fontcvt/terminus.sh
==
--- head/tools/tools/vt/fontcvt/terminus.sh Fri Jun  6 17:05:43 2014
(r267172)
+++ head/tools/tools/vt/fontcvt/terminus.sh Fri Jun  6 17:38:30 2014
(r267173)
@@ -1,10 +1,12 @@
 #!/bin/sh
+# $FreeBSD$
+
 for i in 6:12 8:14 8:16 10:18 10:20 11:22 12:24 14:28 16:32
 do
C=`echo $i | cut -f 1 -d :`
R=`echo $i | cut -f 2 -d :`
./fontcvt \
-   $C $R \
+   -w $C -h $R \
~/terminus-font-4.36/ter-u${R}n.bdf \
~/terminus-font-4.36/ter-u${R}b.bdf \
terminus-u${R}.vfnt
___
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: r267176 - head/share/mk

2014-06-06 Thread Julio Merino
Author: jmmv
Date: Fri Jun  6 17:53:05 2014
New Revision: 267176
URL: http://svnweb.freebsd.org/changeset/base/267176

Log:
  Add the *_TESTS_SH_SED_* functionality to atf.test.mk.
  
  This exists already in plain.test.mk and tap.test.mk and should have been
  added to atf.test.mk too when the feature was first introduced.
  
  (It is probably time to address the related TODOs but I will do that
  separately.)

Modified:
  head/share/mk/atf.test.mk

Modified: head/share/mk/atf.test.mk
==
--- head/share/mk/atf.test.mk   Fri Jun  6 17:42:55 2014(r267175)
+++ head/share/mk/atf.test.mk   Fri Jun  6 17:53:05 2014(r267176)
@@ -98,10 +98,14 @@ _TESTS+= ${ATF_TESTS_SH}
 SCRIPTSDIR_${_T}= ${TESTSDIR}
 TEST_INTERFACE.${_T}= atf
 CLEANFILES+= ${_T} ${_T}.tmp
+# TODO(jmmv): It seems to me that this SED and SRC functionality should
+# exist in bsd.prog.mk along the support for SCRIPTS.  Move it there if
+# this proves to be useful within the tests.
+ATF_TESTS_SH_SED_${_T}?= # empty
 ATF_TESTS_SH_SRC_${_T}?= ${_T}.sh
 ${_T}: ${ATF_TESTS_SH_SRC_${_T}}
echo '#! /usr/bin/atf-sh'  ${.TARGET}.tmp
-   cat ${.ALLSRC}  ${.TARGET}.tmp
+   cat ${.ALLSRC} | sed ${ATF_TESTS_SH_SED_${_T}} ${.TARGET}.tmp
chmod +x ${.TARGET}.tmp
mv ${.TARGET}.tmp ${.TARGET}
 .endfor
___
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: r267177 - head/sys/dev/netmap

2014-06-06 Thread Luigi Rizzo
Author: luigi
Date: Fri Jun  6 18:02:32 2014
New Revision: 267177
URL: http://svnweb.freebsd.org/changeset/base/267177

Log:
  introduce mbq_lock() and mbq_unlock() for the mbq,
  so it is easier to buil the same code on linux
  (this generalizes the change in svn 267142)
  
  MFC after:3 days

Modified:
  head/sys/dev/netmap/netmap.c
  head/sys/dev/netmap/netmap_mbq.c
  head/sys/dev/netmap/netmap_mbq.h

Modified: head/sys/dev/netmap/netmap.c
==
--- head/sys/dev/netmap/netmap.cFri Jun  6 17:53:05 2014
(r267176)
+++ head/sys/dev/netmap/netmap.cFri Jun  6 18:02:32 2014
(r267177)
@@ -1050,7 +1050,7 @@ netmap_rxsync_from_host(struct netmap_ad
(void)pwait;/* disable unused warnings */
(void)td;
 
-   mtx_lock_spin(q-lock);
+   mbq_lock(q);
 
/* First part: import newly received packets */
n = mbq_len(q);
@@ -1092,7 +1092,7 @@ netmap_rxsync_from_host(struct netmap_ad
if (kring-rcur == kring-rtail  td) /* no bufs available */
selrecord(td, kring-si);
 
-   mtx_unlock_spin(q-lock);
+   mbq_unlock(q);
return ret;
 }
 
@@ -2459,7 +2459,7 @@ netmap_transmit(struct ifnet *ifp, struc
 * not possible on Linux).
 * Also avoid overflowing the queue.
 */
-   mtx_lock_spin(q-lock);
+   mbq_lock(q);
 
 space = kring-nr_hwtail - kring-nr_hwcur;
 if (space  0)
@@ -2476,7 +2476,7 @@ netmap_transmit(struct ifnet *ifp, struc
m = NULL;
error = 0;
}
-   mtx_unlock_spin(q-lock);
+   mbq_unlock(q);
 
 done:
if (m)

Modified: head/sys/dev/netmap/netmap_mbq.c
==
--- head/sys/dev/netmap/netmap_mbq.cFri Jun  6 17:53:05 2014
(r267176)
+++ head/sys/dev/netmap/netmap_mbq.cFri Jun  6 18:02:32 2014
(r267177)
@@ -76,9 +76,9 @@ static inline void __mbq_enqueue(struct 
 
 void mbq_safe_enqueue(struct mbq *q, struct mbuf *m)
 {
-mtx_lock_spin(q-lock);
+mbq_lock(q);
 __mbq_enqueue(q, m);
-mtx_unlock_spin(q-lock);
+mbq_unlock(q);
 }
 
 
@@ -110,9 +110,9 @@ struct mbuf *mbq_safe_dequeue(struct mbq
 {
 struct mbuf *ret;
 
-mtx_lock_spin(q-lock);
+mbq_lock(q);
 ret =  __mbq_dequeue(q);
-mtx_unlock_spin(q-lock);
+mbq_unlock(q);
 
 return ret;
 }

Modified: head/sys/dev/netmap/netmap_mbq.h
==
--- head/sys/dev/netmap/netmap_mbq.hFri Jun  6 17:53:05 2014
(r267176)
+++ head/sys/dev/netmap/netmap_mbq.hFri Jun  6 18:02:32 2014
(r267177)
@@ -62,7 +62,17 @@ void mbq_enqueue(struct mbq *q, struct m
 struct mbuf *mbq_dequeue(struct mbq *q);
 void mbq_purge(struct mbq *q);
 
-/* XXX missing mbq_lock() and mbq_unlock */
+static inline void
+mbq_lock(struct mbq *q)
+{
+   mtx_lock_spin(q-lock);
+}
+
+static inline void
+mbq_unlock(struct mbq *q)
+{
+   mtx_unlock_spin(q-lock);
+}
 
 void mbq_safe_init(struct mbq *q);
 void mbq_safe_destroy(struct mbq *q);
___
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: r267178 - in head/sys/amd64/vmm: intel io

2014-06-06 Thread Tycho Nightingale
Author: tychon
Date: Fri Jun  6 18:23:49 2014
New Revision: 267178
URL: http://svnweb.freebsd.org/changeset/base/267178

Log:
  Support guest accesses to %cr8.
  
  Reviewed by:  neel

Modified:
  head/sys/amd64/vmm/intel/vmx.c
  head/sys/amd64/vmm/io/vlapic.c
  head/sys/amd64/vmm/io/vlapic.h

Modified: head/sys/amd64/vmm/intel/vmx.c
==
--- head/sys/amd64/vmm/intel/vmx.c  Fri Jun  6 18:02:32 2014
(r267177)
+++ head/sys/amd64/vmm/intel/vmx.c  Fri Jun  6 18:23:49 2014
(r267178)
@@ -83,7 +83,9 @@ __FBSDID($FreeBSD$);
(PROCBASED_SECONDARY_CONTROLS   |   \
 PROCBASED_IO_EXITING   |   \
 PROCBASED_MSR_BITMAPS  |   \
-PROCBASED_CTLS_WINDOW_SETTING)
+PROCBASED_CTLS_WINDOW_SETTING  |   \
+PROCBASED_CR8_LOAD_EXITING |   \
+PROCBASED_CR8_STORE_EXITING)
 #definePROCBASED_CTLS_ZERO_SETTING \
(PROCBASED_CR3_LOAD_EXITING |   \
PROCBASED_CR3_STORE_EXITING |   \
@@ -714,6 +716,13 @@ vmx_init(int ipinum)
procbased_ctls2 = ~PROCBASED2_VIRTUALIZE_X2APIC_MODE;
 
/*
+* No need to emulate accesses to %CR8 if virtual
+* interrupt delivery is enabled.
+*/
+   procbased_ctls = ~PROCBASED_CR8_LOAD_EXITING;
+   procbased_ctls = ~PROCBASED_CR8_STORE_EXITING;
+
+   /*
 * Check for Posted Interrupts only if Virtual Interrupt
 * Delivery is enabled.
 */
@@ -1426,97 +1435,130 @@ vmx_emulate_xsetbv(struct vmx *vmx, int 
return (HANDLED);
 }
 
-static int
-vmx_emulate_cr_access(struct vmx *vmx, int vcpu, uint64_t exitqual)
+static uint64_t
+vmx_get_guest_reg(struct vmx *vmx, int vcpu, int ident)
 {
-   int cr, vmcs_guest_cr, vmcs_shadow_cr;
-   uint64_t crval, regval, ones_mask, zeros_mask;
const struct vmxctx *vmxctx;
 
-   /* We only handle mov to %cr0 or %cr4 at this time */
-   if ((exitqual  0xf0) != 0x00)
-   return (UNHANDLED);
+   vmxctx = vmx-ctx[vcpu];
 
-   cr = exitqual  0xf;
-   if (cr != 0  cr != 4)
-   return (UNHANDLED);
+   switch (ident) {
+   case 0:
+   return (vmxctx-guest_rax);
+   case 1:
+   return (vmxctx-guest_rcx);
+   case 2:
+   return (vmxctx-guest_rdx);
+   case 3:
+   return (vmxctx-guest_rbx);
+   case 4:
+   return (vmcs_read(VMCS_GUEST_RSP));
+   case 5:
+   return (vmxctx-guest_rbp);
+   case 6:
+   return (vmxctx-guest_rsi);
+   case 7:
+   return (vmxctx-guest_rdi);
+   case 8:
+   return (vmxctx-guest_r8);
+   case 9:
+   return (vmxctx-guest_r9);
+   case 10:
+   return (vmxctx-guest_r10);
+   case 11:
+   return (vmxctx-guest_r11);
+   case 12:
+   return (vmxctx-guest_r12);
+   case 13:
+   return (vmxctx-guest_r13);
+   case 14:
+   return (vmxctx-guest_r14);
+   case 15:
+   return (vmxctx-guest_r15);
+   default:
+   panic(invalid vmx register %d, ident);
+   }
+}
+
+static void
+vmx_set_guest_reg(struct vmx *vmx, int vcpu, int ident, uint64_t regval)
+{
+   struct vmxctx *vmxctx;
 
-   regval = 0; /* silence gcc */
vmxctx = vmx-ctx[vcpu];
 
-   /*
-* We must use vmcs_write() directly here because vmcs_setreg() will
-* call vmclear(vmcs) as a side-effect which we certainly don't want.
-*/
-   switch ((exitqual  8)  0xf) {
+   switch (ident) {
case 0:
-   regval = vmxctx-guest_rax;
+   vmxctx-guest_rax = regval;
break;
case 1:
-   regval = vmxctx-guest_rcx;
+   vmxctx-guest_rcx = regval;
break;
case 2:
-   regval = vmxctx-guest_rdx;
+   vmxctx-guest_rdx = regval;
break;
case 3:
-   regval = vmxctx-guest_rbx;
+   vmxctx-guest_rbx = regval;
break;
case 4:
-   regval = vmcs_read(VMCS_GUEST_RSP);
+   vmcs_write(VMCS_GUEST_RSP, regval);
break;
case 5:
-   regval = vmxctx-guest_rbp;
+   vmxctx-guest_rbp = regval;
break;
case 6:
-   regval = vmxctx-guest_rsi;
+   vmxctx-guest_rsi = regval;
break;
case 7:
-   regval = vmxctx-guest_rdi;
+   vmxctx-guest_rdi = regval;
break;
case 8:
-   regval = vmxctx-guest_r8;
+   

svn commit: r267179 - head/sys/dev/vt/font

2014-06-06 Thread Ed Maste
Author: emaste
Date: Fri Jun  6 18:32:05 2014
New Revision: 267179
URL: http://svnweb.freebsd.org/changeset/base/267179

Log:
  Clarify statement on font origin
  
  Submitted by: Dimitar Zhekov

Modified:
  head/sys/dev/vt/font/vt_font_default.c

Modified: head/sys/dev/vt/font/vt_font_default.c
==
--- head/sys/dev/vt/font/vt_font_default.c  Fri Jun  6 18:23:49 2014
(r267178)
+++ head/sys/dev/vt/font/vt_font_default.c  Fri Jun  6 18:32:05 2014
(r267179)
@@ -24,9 +24,9 @@
  */
 
 /*
- * This is the Terminus BSD Console font, a derivative of Terminus that is
- * provided under the 2-clause BSD license for use by the FreeBSD vt(4)
- * console.  Please contribute any changes back to Mr. Zhekov at
+ * This is the Terminus BSD Console font.  It is identical to the standard
+ * variant of Terminus Font 8x16, but provided under the 2-clause BSD License
+ * (FreeBSD License).  Please contribute any changes back to Mr. Zhekov at
  * dimitar.zhe...@gmail.com.
  */
 
___
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: r267180 - head/sys/dev/netmap

2014-06-06 Thread Luigi Rizzo
Author: luigi
Date: Fri Jun  6 18:36:02 2014
New Revision: 267180
URL: http://svnweb.freebsd.org/changeset/base/267180

Log:
  better handling of netmap emulation over standard device drivers:
  plug a potential mbuf leak, and detect bogus drivers that
  return ENOBUFS even when the packet has been queued.
  
  MFC after:3 days

Modified:
  head/sys/dev/netmap/netmap_freebsd.c
  head/sys/dev/netmap/netmap_generic.c

Modified: head/sys/dev/netmap/netmap_freebsd.c
==
--- head/sys/dev/netmap/netmap_freebsd.cFri Jun  6 18:32:05 2014
(r267179)
+++ head/sys/dev/netmap/netmap_freebsd.cFri Jun  6 18:36:02 2014
(r267180)
@@ -61,7 +61,8 @@
 
 /*  FREEBSD-SPECIFIC ROUTINES == */
 
-rawsum_t nm_csum_raw(uint8_t *data, size_t len, rawsum_t cur_sum)
+rawsum_t
+nm_csum_raw(uint8_t *data, size_t len, rawsum_t cur_sum)
 {
/* TODO XXX please use the FreeBSD implementation for this. */
uint16_t *words = (uint16_t *)data;
@@ -80,7 +81,8 @@ rawsum_t nm_csum_raw(uint8_t *data, size
 /* Fold a raw checksum: 'cur_sum' is in host byte order, while the
  * return value is in network byte order.
  */
-uint16_t nm_csum_fold(rawsum_t cur_sum)
+uint16_t
+nm_csum_fold(rawsum_t cur_sum)
 {
/* TODO XXX please use the FreeBSD implementation for this. */
while (cur_sum  16)
@@ -89,7 +91,8 @@ uint16_t nm_csum_fold(rawsum_t cur_sum)
return htobe16((~cur_sum)  0x);
 }
 
-uint16_t nm_csum_ipv4(struct nm_iphdr *iph)
+uint16_t
+nm_csum_ipv4(struct nm_iphdr *iph)
 {
 #if 0
return in_cksum_hdr((void *)iph);
@@ -98,7 +101,8 @@ uint16_t nm_csum_ipv4(struct nm_iphdr *i
 #endif
 }
 
-void nm_csum_tcpudp_ipv4(struct nm_iphdr *iph, void *data,
+void
+nm_csum_tcpudp_ipv4(struct nm_iphdr *iph, void *data,
size_t datalen, uint16_t *check)
 {
 #ifdef INET
@@ -120,7 +124,8 @@ void nm_csum_tcpudp_ipv4(struct nm_iphdr
 #endif
 }
 
-void nm_csum_tcpudp_ipv6(struct nm_ipv6hdr *ip6h, void *data,
+void
+nm_csum_tcpudp_ipv6(struct nm_ipv6hdr *ip6h, void *data,
size_t datalen, uint16_t *check)
 {
 #ifdef INET6
@@ -143,7 +148,8 @@ void nm_csum_tcpudp_ipv6(struct nm_ipv6h
 int
 netmap_catch_rx(struct netmap_adapter *na, int intercept)
 {
-   struct netmap_generic_adapter *gna = (struct netmap_generic_adapter 
*)na;
+   struct netmap_generic_adapter *gna =
+   (struct netmap_generic_adapter *)na;
struct ifnet *ifp = na-ifp;
 
if (intercept) {
@@ -209,11 +215,29 @@ generic_xmit_frame(struct ifnet *ifp, st
 {
int ret;
 
-   m-m_len = m-m_pkthdr.len = 0;
+   /*
+* The mbuf should be a cluster from our special pool,
+* so we do not need to do an m_copyback but just copy
+* (and eventually, just reference the netmap buffer)
+*/
 
-   // copy data to the mbuf
-   m_copyback(m, 0, len, addr);
-   // inc refcount. We are alone, so we can skip the atomic
+   if (*m-m_ext.ref_cnt != 1) {
+   D(invalid refcnt %d for %p,
+   *m-m_ext.ref_cnt, m);
+   panic(in generic_xmit_frame);
+   }
+   // XXX the ext_size check is unnecessary if we link the netmap buf
+   if (m-m_ext.ext_size  len) {
+   RD(5, size %d  len %d, m-m_ext.ext_size, len);
+   len = m-m_ext.ext_size;
+   }
+   if (0) { /* XXX seems to have negligible benefits */
+   m-m_ext.ext_buf = m-m_data = addr;
+   } else {
+   bcopy(addr, m-m_data, len);
+   }
+   m-m_len = m-m_pkthdr.len = len;
+   // inc refcount. All ours, we could skip the atomic
atomic_fetchadd_int(m-m_ext.ref_cnt, 1);
m-m_flags |= M_FLOWID;
m-m_pkthdr.flowid = ring_nr;
@@ -238,7 +262,7 @@ netmap_getna(if_t ifp)
 int
 generic_find_num_desc(struct ifnet *ifp, unsigned int *tx, unsigned int *rx)
 {
-   D(called);
+   D(called, in tx %d rx %d, *tx, *rx);
return 0;
 }
 
@@ -246,13 +270,14 @@ generic_find_num_desc(struct ifnet *ifp,
 void
 generic_find_num_queues(struct ifnet *ifp, u_int *txq, u_int *rxq)
 {
-   D(called);
+   D(called, in txq %d rxq %d, *txq, *rxq);
*txq = netmap_generic_rings;
*rxq = netmap_generic_rings;
 }
 
 
-void netmap_mitigation_init(struct nm_generic_mit *mit, struct netmap_adapter 
*na)
+void
+netmap_mitigation_init(struct nm_generic_mit *mit, struct netmap_adapter *na)
 {
ND(called);
mit-mit_pending = 0;
@@ -260,26 +285,30 @@ void netmap_mitigation_init(struct nm_ge
 }
 
 
-void netmap_mitigation_start(struct nm_generic_mit *mit)
+void
+netmap_mitigation_start(struct nm_generic_mit *mit)
 {
ND(called);
 }
 
 
-void netmap_mitigation_restart(struct nm_generic_mit *mit)
+void
+netmap_mitigation_restart(struct nm_generic_mit *mit)
 {

svn commit: r267181 - in head: . etc/mtree libexec/atf libexec/atf/atf-check libexec/atf/atf-sh libexec/atf/atf-sh/tests share/mk tools/build/mk usr.bin usr.bin/atf

2014-06-06 Thread Julio Merino
Author: jmmv
Date: Fri Jun  6 18:58:06 2014
New Revision: 267181
URL: http://svnweb.freebsd.org/changeset/base/267181

Log:
  Move atf-sh from /usr/bin/ to /usr/libexec/
  
  In r266650, we made libatf-c and libatf-c++ private libraries so that no
  components outside of the source tree could unintendedly depend on them.
  
  This change does the same for the atf-sh library by moving the atf-sh
  interpreter from its public location in /usr/bin/ to the private location
  in /usr/libexec/.  Our build system will ensure that our own test programs
  use the right binary, but users won't be able to depend on atf-sh by
  mistake.
  
  Committing this now to ride the UPDATING notice added with r267172 today.

Added:
  head/libexec/atf/atf-sh/
 - copied from r267172, head/usr.bin/atf/atf-sh/
Deleted:
  head/usr.bin/atf/
Modified:
  head/UPDATING
  head/etc/mtree/BSD.tests.dist
  head/libexec/atf/Makefile
  head/libexec/atf/Makefile.inc
  head/libexec/atf/atf-check/Makefile
  head/libexec/atf/atf-sh/tests/Makefile
  head/share/mk/atf.test.mk
  head/tools/build/mk/OptionalObsoleteFiles.inc
  head/usr.bin/Makefile

Modified: head/UPDATING
==
--- head/UPDATING   Fri Jun  6 18:36:02 2014(r267180)
+++ head/UPDATING   Fri Jun  6 18:58:06 2014(r267181)
@@ -41,11 +41,16 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 11
programs once the operator executes make delete-old-libs after a
make installworld.
 
+   Additionally, the atf-sh binary was made private by moving it into
+   /usr/libexec/.  Already-built shell test programs will keep the
+   path to the old binary so they will break after make delete-old
+   is run.
+
If you are using WITH_TESTS=yes (not the default), wipe the object
tree and rebuild from scratch to prevent spurious test failures.
-   This is only needed once: the old, misnumbered libraries have been
-   added to OptionalObsoleteFiles.inc so they will be removed during a
-   clean upgrade.
+   This is only needed once: the misnumbered libraries and misplaced
+   binaries have been added to OptionalObsoleteFiles.inc so they will
+   be removed during a clean upgrade.
 
 20140512:
Clang and llvm have been upgraded to 3.4.1 release.

Modified: head/etc/mtree/BSD.tests.dist
==
--- head/etc/mtree/BSD.tests.dist   Fri Jun  6 18:36:02 2014
(r267180)
+++ head/etc/mtree/BSD.tests.dist   Fri Jun  6 18:58:06 2014
(r267181)
@@ -88,6 +88,8 @@
 atf
 atf-check
 ..
+atf-sh
+..
 ..
 ..
 sbin
@@ -127,10 +129,6 @@
 usr.bin
 apply
 ..
-atf
-atf-sh
-..
-..
 bmake
 archives
 fmt_44bsd

Modified: head/libexec/atf/Makefile
==
--- head/libexec/atf/Makefile   Fri Jun  6 18:36:02 2014(r267180)
+++ head/libexec/atf/Makefile   Fri Jun  6 18:58:06 2014(r267181)
@@ -25,6 +25,6 @@
 #
 # $FreeBSD$
 
-SUBDIR=atf-check tests
+SUBDIR=atf-check atf-sh tests
 
 .include bsd.subdir.mk

Modified: head/libexec/atf/Makefile.inc
==
--- head/libexec/atf/Makefile.inc   Fri Jun  6 18:36:02 2014
(r267180)
+++ head/libexec/atf/Makefile.inc   Fri Jun  6 18:58:06 2014
(r267181)
@@ -28,3 +28,5 @@
 CFLAGS+=   -DHAVE_CONFIG_H
 
 WARNS?=3
+
+.include ../Makefile.inc

Modified: head/libexec/atf/atf-check/Makefile
==
--- head/libexec/atf/atf-check/Makefile Fri Jun  6 18:36:02 2014
(r267180)
+++ head/libexec/atf/atf-check/Makefile Fri Jun  6 18:58:06 2014
(r267181)
@@ -31,7 +31,6 @@
 ATF=   ${.CURDIR:H:H:H}/contrib/atf
 .PATH: ${ATF}/atf-sh
 
-BINDIR=/usr/libexec
 PROG_CXX=  atf-check
 SRCS=  atf-check.cpp
 MAN=   atf-check.1

Modified: head/libexec/atf/atf-sh/tests/Makefile
==
--- head/usr.bin/atf/atf-sh/tests/Makefile  Fri Jun  6 17:05:43 2014
(r267172)
+++ head/libexec/atf/atf-sh/tests/Makefile  Fri Jun  6 18:58:06 2014
(r267181)
@@ -2,7 +2,7 @@
 
 .include bsd.init.mk
 
-TESTSDIR=  ${TESTSBASE}/usr.bin/atf/atf-sh
+TESTSDIR=  ${TESTSBASE}/libexec/atf/atf-sh
 
 ATF=   ${.CURDIR:H:H:H:H}/contrib/atf
 .PATH: ${ATF}/atf-sh
@@ -10,6 +10,8 @@ ATF=  ${.CURDIR:H:H:H:H}/contrib/atf
 ATF_TESTS_SH+= atf_check_test
 ATF_TESTS_SH+= config_test
 ATF_TESTS_SH+= 

svn commit: r267182 - in head: sbin/geom/class/label sbin/reboot share/man/man4 usr.bin/mkimg

2014-06-06 Thread Joel Dahl
Author: joel (doc committer)
Date: Fri Jun  6 19:00:43 2014
New Revision: 267182
URL: http://svnweb.freebsd.org/changeset/base/267182

Log:
  Minor mdoc improvements.

Modified:
  head/sbin/geom/class/label/glabel.8
  head/sbin/reboot/boot_i386.8
  head/share/man/man4/mrsas.4
  head/share/man/man4/ng_bridge.4
  head/share/man/man4/ng_ppp.4
  head/share/man/man4/nvme.4
  head/usr.bin/mkimg/mkimg.1

Modified: head/sbin/geom/class/label/glabel.8
==
--- head/sbin/geom/class/label/glabel.8 Fri Jun  6 18:58:06 2014
(r267181)
+++ head/sbin/geom/class/label/glabel.8 Fri Jun  6 19:00:43 2014
(r267182)
@@ -235,7 +235,7 @@ and creating label nodes in the 
 .Xr devfs 5
 tree. It is sometimes desirable to disable certain label types if
 they conflict with other classes in complex GEOM topologies.
-.Bl
+.El
 .Sh EXIT STATUS
 Exit status is 0 on success, and 1 if the command fails.
 .Sh EXAMPLES

Modified: head/sbin/reboot/boot_i386.8
==
--- head/sbin/reboot/boot_i386.8Fri Jun  6 18:58:06 2014
(r267181)
+++ head/sbin/reboot/boot_i386.8Fri Jun  6 19:00:43 2014
(r267182)
@@ -113,7 +113,6 @@ boot device, as a hint about available b
 .Ic ?\
 may also be specified as the last segment of a path, in which case
 the listing will be of the relevant subdirectory.)
-.Pp
 .It Xo
 .Sm off
 .Ar bios_drive : interface ( unit , Oo Ar slice , Oc Ar part )

Modified: head/share/man/man4/mrsas.4
==
--- head/share/man/man4/mrsas.4 Fri Jun  6 18:58:06 2014(r267181)
+++ head/share/man/man4/mrsas.4 Fri Jun  6 19:00:43 2014(r267182)
@@ -321,7 +321,7 @@ management interface
 .Xr mfi 4 ,
 .Xr pci 4 ,
 .Xr device.hints 5 ,
-.Xt camcontrol 8
+.Xr camcontrol 8
 .Sh HISTORY
 The
 .Nm

Modified: head/share/man/man4/ng_bridge.4
==
--- head/share/man/man4/ng_bridge.4 Fri Jun  6 18:58:06 2014
(r267181)
+++ head/share/man/man4/ng_bridge.4 Fri Jun  6 19:00:43 2014
(r267182)
@@ -139,7 +139,6 @@ The
 determines how quickly a host must jump from one link to another
 before we declare a loopback condition.
 The default is one second.
-.Pp
 .It Dv NGM_BRIDGE_GET_CONFIG Pq Ic getconfig
 Returns the current configuration as a
 .Dv struct ng_bridge_config .

Modified: head/share/man/man4/ng_ppp.4
==
--- head/share/man/man4/ng_ppp.4Fri Jun  6 18:58:06 2014
(r267181)
+++ head/share/man/man4/ng_ppp.4Fri Jun  6 19:00:43 2014
(r267182)
@@ -385,7 +385,6 @@ struct ng_ppp_node_conf {
   struct ng_ppp_link_conf   links[NG_PPP_MAX_LINKS];
 };
 .Ed
-.Pp
 .It Dv NGM_PPP_GET_CONFIG Pq Ic getconfig
 Returns the current configuration as a
 .Dv struct ng_ppp_node_conf .

Modified: head/share/man/man4/nvme.4
==
--- head/share/man/man4/nvme.4  Fri Jun  6 18:58:06 2014(r267181)
+++ head/share/man/man4/nvme.4  Fri Jun  6 19:00:43 2014(r267182)
@@ -85,7 +85,6 @@ the format
 .Pa /dev/nvmeXnsY .
 Note that the NVM Express specification starts numbering namespaces at 1,
 not 0, and this driver follows that convention.
-.El
 .Sh CONFIGURATION
 By default,
 .Nm

Modified: head/usr.bin/mkimg/mkimg.1
==
--- head/usr.bin/mkimg/mkimg.1  Fri Jun  6 18:58:06 2014(r267181)
+++ head/usr.bin/mkimg/mkimg.1  Fri Jun  6 19:00:43 2014(r267182)
@@ -115,6 +115,12 @@ For a complete list of supported partiti
 format, or for a detailed description of how to specify partitions, run the
 .Nm
 utility without any arguments.
+.Sh ENVIRONMENT
+.Bl -tag -width TMPDIR -compact
+.It Ev TMPDIR
+Directory to put temporary files in; default is
+.Pa /tmp .
+.El
 .Sh EXAMPLES
 To create a bootable disk image that is partitioned using the GPT scheme and
 containing a root file system that was previously created using
@@ -159,11 +165,6 @@ For partitioning schemes that feature pa
 utility supports assigning labels to the partitions specified.
 In the following example the file system partition is labeled as 'backup':
 .Dl % mkimg -s gpt -p freebsd-ufs/backup:=file-system.ufs -o gpt.img
-.Sh ENVIRONMENT
-.Bl -tag -width TMPDIR -compact
-.It Ev TMPDIR
-Directory to put temporary files in; default is
-.Pa /tmp .
 .Sh SEE ALSO
 .Xr gpart 8
 .Xr makefs 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: r267183 - head/sys/boot/usb

2014-06-06 Thread Hans Petter Selasky
Author: hselasky
Date: Fri Jun  6 19:02:45 2014
New Revision: 267183
URL: http://svnweb.freebsd.org/changeset/base/267183

Log:
  Compilation fixes.

Modified:
  head/sys/boot/usb/bsd_kernel.h

Modified: head/sys/boot/usb/bsd_kernel.h
==
--- head/sys/boot/usb/bsd_kernel.h  Fri Jun  6 19:00:43 2014
(r267182)
+++ head/sys/boot/usb/bsd_kernel.h  Fri Jun  6 19:02:45 2014
(r267183)
@@ -38,6 +38,7 @@
 #defineisalpha(x) (((x) = 'a'  (x) = 'z') || ((x) = 'A'  (x) = 
'Z'))
 #defineisdigit(x) ((x) = '0'  (x) = '9')
 #definepanic(...) do { printf(USB PANIC:  __VA_ARGS__); while (1) ; 
} while (0)
+#definerebooting 0
 #defineM_USB 0
 #defineM_USBDEV 0
 #defineUSB_PROC_MAX 3
@@ -182,9 +183,10 @@ typedef uint16_t gid_t;
 typedef uint16_t mode_t;
 
 typedef uint8_t *caddr_t;
-typedef unsigned long __uintptr_t;
+#define_UINTPTR_T_DECLARED
 typedef unsigned long uintptr_t;
 
+#define_SIZE_T_DECLARED
 typedef unsigned long size_t;
 typedef unsigned long u_long;
 #endif
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r267184 - head/release/doc/en_US.ISO8859-1/hardware

2014-06-06 Thread Christian Brueffer
Author: brueffer
Date: Fri Jun  6 19:10:23 2014
New Revision: 267184
URL: http://svnweb.freebsd.org/changeset/base/267184

Log:
  Add vte(4) to the hardware notes.
  
  MFC after:3 days

Modified:
  head/release/doc/en_US.ISO8859-1/hardware/article.xml

Modified: head/release/doc/en_US.ISO8859-1/hardware/article.xml
==
--- head/release/doc/en_US.ISO8859-1/hardware/article.xml   Fri Jun  6 
19:02:45 2014(r267183)
+++ head/release/doc/en_US.ISO8859-1/hardware/article.xml   Fri Jun  6 
19:10:23 2014(r267184)
@@ -944,6 +944,8 @@
 
   hwlist.vr;
 
+  hwlist.vte;
+
   hwlist.vx;
 
   hwlist.vxge;
___
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: r267185 - head/share/man/man4

2014-06-06 Thread Christian Brueffer
Author: brueffer
Date: Fri Jun  6 20:01:45 2014
New Revision: 267185
URL: http://svnweb.freebsd.org/changeset/base/267185

Log:
  Minor improvements.
  
  MFC after:1 week

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

Modified: head/share/man/man4/xnb.4
==
--- head/share/man/man4/xnb.4   Fri Jun  6 19:10:23 2014(r267184)
+++ head/share/man/man4/xnb.4   Fri Jun  6 20:01:45 2014(r267185)
@@ -30,7 +30,7 @@
 .\
 .\ $FreeBSD$
 .\
-.Dd January 6, 2012
+.Dd June 6, 2014
 .Dt XNB 4
 .Os
 .Sh NAME
@@ -116,7 +116,9 @@ machine.
 However, when a Xennet interface is bridged to a physical interface,
 a correct checksum must be attached to any packets bound for that physical
 interface.
-Currently, FreeBSD lacks any mechanism for an ethernet device to
+Currently,
+.Fx
+lacks any mechanism for an Ethernet device to
 inform the OS that newly received packets are valid even though their checksums
 are not.
 So if the netfront driver is configured to offload checksum calculations,
___
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: r267187 - in head/sys/dev: e1000 ixgbe vmware/vmxnet3

2014-06-06 Thread Luigi Rizzo
Author: luigi
Date: Fri Jun  6 20:49:56 2014
New Revision: 267187
URL: http://svnweb.freebsd.org/changeset/base/267187

Log:
  make sure if_transmit returns 0 if the mbuf is enqueued.
  ixgbe/ixv.c still needs a similar fix but it takes a little
  more restructuring of the code.
  
  MFC after:3 days

Modified:
  head/sys/dev/e1000/if_igb.c
  head/sys/dev/ixgbe/ixgbe.c
  head/sys/dev/vmware/vmxnet3/if_vmx.c

Modified: head/sys/dev/e1000/if_igb.c
==
--- head/sys/dev/e1000/if_igb.c Fri Jun  6 20:35:40 2014(r267186)
+++ head/sys/dev/e1000/if_igb.c Fri Jun  6 20:49:56 2014(r267187)
@@ -989,12 +989,12 @@ igb_mq_start(struct ifnet *ifp, struct m
if (err)
return (err);
if (IGB_TX_TRYLOCK(txr)) {
-   err = igb_mq_start_locked(ifp, txr);
+   igb_mq_start_locked(ifp, txr);
IGB_TX_UNLOCK(txr);
} else
taskqueue_enqueue(que-tq, txr-txq_task);
 
-   return (err);
+   return (0);
 }
 
 static int

Modified: head/sys/dev/ixgbe/ixgbe.c
==
--- head/sys/dev/ixgbe/ixgbe.c  Fri Jun  6 20:35:40 2014(r267186)
+++ head/sys/dev/ixgbe/ixgbe.c  Fri Jun  6 20:49:56 2014(r267187)
@@ -831,12 +831,12 @@ ixgbe_mq_start(struct ifnet *ifp, struct
if (err)
return (err);
if (IXGBE_TX_TRYLOCK(txr)) {
-   err = ixgbe_mq_start_locked(ifp, txr);
+   ixgbe_mq_start_locked(ifp, txr);
IXGBE_TX_UNLOCK(txr);
} else
taskqueue_enqueue(que-tq, txr-txq_task);
 
-   return (err);
+   return (0);
 }
 
 static int

Modified: head/sys/dev/vmware/vmxnet3/if_vmx.c
==
--- head/sys/dev/vmware/vmxnet3/if_vmx.cFri Jun  6 20:35:40 2014
(r267186)
+++ head/sys/dev/vmware/vmxnet3/if_vmx.cFri Jun  6 20:49:56 2014
(r267187)
@@ -2935,7 +2935,6 @@ vmxnet3_txq_mq_start_locked(struct vmxne
/* Assume worse case if this mbuf is the head of a chain. */
if (m-m_next != NULL  avail  VMXNET3_TX_MAXSEGS) {
drbr_putback(ifp, br, m);
-   error = ENOBUFS;
break;
}
 
@@ -2958,7 +2957,7 @@ vmxnet3_txq_mq_start_locked(struct vmxne
txq-vxtxq_watchdog = VMXNET3_WATCHDOG_TIMEOUT;
}
 
-   return (error);
+   return (0);
 }
 
 static int
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


Re: svn commit: r267187 - in head/sys/dev: e1000 ixgbe vmware/vmxnet3

2014-06-06 Thread Adrian Chadd
Thanks for finally committing this stuff!


-a


On 6 June 2014 16:49, Luigi Rizzo lu...@freebsd.org wrote:
 Author: luigi
 Date: Fri Jun  6 20:49:56 2014
 New Revision: 267187
 URL: http://svnweb.freebsd.org/changeset/base/267187

 Log:
   make sure if_transmit returns 0 if the mbuf is enqueued.
   ixgbe/ixv.c still needs a similar fix but it takes a little
   more restructuring of the code.

   MFC after:3 days

 Modified:
   head/sys/dev/e1000/if_igb.c
   head/sys/dev/ixgbe/ixgbe.c
   head/sys/dev/vmware/vmxnet3/if_vmx.c

 Modified: head/sys/dev/e1000/if_igb.c
 ==
 --- head/sys/dev/e1000/if_igb.c Fri Jun  6 20:35:40 2014(r267186)
 +++ head/sys/dev/e1000/if_igb.c Fri Jun  6 20:49:56 2014(r267187)
 @@ -989,12 +989,12 @@ igb_mq_start(struct ifnet *ifp, struct m
 if (err)
 return (err);
 if (IGB_TX_TRYLOCK(txr)) {
 -   err = igb_mq_start_locked(ifp, txr);
 +   igb_mq_start_locked(ifp, txr);
 IGB_TX_UNLOCK(txr);
 } else
 taskqueue_enqueue(que-tq, txr-txq_task);

 -   return (err);
 +   return (0);
  }

  static int

 Modified: head/sys/dev/ixgbe/ixgbe.c
 ==
 --- head/sys/dev/ixgbe/ixgbe.c  Fri Jun  6 20:35:40 2014(r267186)
 +++ head/sys/dev/ixgbe/ixgbe.c  Fri Jun  6 20:49:56 2014(r267187)
 @@ -831,12 +831,12 @@ ixgbe_mq_start(struct ifnet *ifp, struct
 if (err)
 return (err);
 if (IXGBE_TX_TRYLOCK(txr)) {
 -   err = ixgbe_mq_start_locked(ifp, txr);
 +   ixgbe_mq_start_locked(ifp, txr);
 IXGBE_TX_UNLOCK(txr);
 } else
 taskqueue_enqueue(que-tq, txr-txq_task);

 -   return (err);
 +   return (0);
  }

  static int

 Modified: head/sys/dev/vmware/vmxnet3/if_vmx.c
 ==
 --- head/sys/dev/vmware/vmxnet3/if_vmx.cFri Jun  6 20:35:40 2014  
   (r267186)
 +++ head/sys/dev/vmware/vmxnet3/if_vmx.cFri Jun  6 20:49:56 2014  
   (r267187)
 @@ -2935,7 +2935,6 @@ vmxnet3_txq_mq_start_locked(struct vmxne
 /* Assume worse case if this mbuf is the head of a chain. */
 if (m-m_next != NULL  avail  VMXNET3_TX_MAXSEGS) {
 drbr_putback(ifp, br, m);
 -   error = ENOBUFS;
 break;
 }

 @@ -2958,7 +2957,7 @@ vmxnet3_txq_mq_start_locked(struct vmxne
 txq-vxtxq_watchdog = VMXNET3_WATCHDOG_TIMEOUT;
 }

 -   return (error);
 +   return (0);
  }

  static int

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


Re: svn commit: r267027 - head/usr.bin/users

2014-06-06 Thread Bruce Evans

On Thu, 5 Jun 2014, Pietro Cerutti wrote:


your comments do make sense. I semi-seriously suggest that we get rid of
the current implementation and replace it with this. Comments?


Not for me, thanks.


...
int
main(int argc, char **)
{
struct utmpx *ut;
vectorstring names;

if (argc  1) {
   cerr  usage: users  endl;
   return (1);
   }


This doesn't give quite the same error handling as the getopt() call,
but the C version could use the same simplification.  The C version
even has dead code for argc and argc.  It has almost as many style
bugs as the above.



setutxent();
while ((ut = getutxent()) != NULL) {
if (ut-ut_type != USER_PROCESS)
continue;
names.push_back(ut-ut_user);
}


This is simpler, but the C version does much more than needed too.
ut_user is now guaranteed to be NUL terminated.  The above depends
on this, but the current version still uses old code that adds a
NUL terminator.  This gives minor complications.

It should be possible to build an array of pointers and just sort that.
However, the getutxent() API is nasty, and is under-documented in
FreeBSD.  It returns a pointer to static storage (perhaps thread-local),
as is common for bad old APIs.  This is documented in POSIX, but doesn't
seem to be documented in FreeBSD.  It is obviously not expected that
there be a large number of users (else the serial API would be worse
than it is), so a small amount of statically allocated storage should
be enough, especially if the application only has to hold the pointers
and the database holds the strings.  The 4.4BSD-Lite version of user(1)
had a fixed limit of 200 users.  Memory is free-er than it used to be,
especially virtually, so no one would notice the bloat for statically
allocating enough for a measly few million users, but in practice a
few thousand should be enough.  The unformatted output is bad for just
200 users.

The above has only C++ default error handling.  I know little about C++,
but doubt that you it matches the errx() reporting exactly.  Of course,
realloc() can't fail, especially with only a few million users, so
no error handling would work too.  If there is a memory shortage,
then getutxent() might fail too and its API doesn't even allow
determining if there was an error -- the output would be truncated;
I prefer a core dump.


endutxent();

if (names.size() == 0) {
return (0);
}



The C version can use the same simplifcation (to reduce indentation).


sort(begin(names), end(names));
vectorstring::iterator last(unique(begin(names), end(names)));
copy(begin(names), last-1, ostream_iteratorstring(cout,  ));
cout  *(last-1)  endl;
}


This is not simpler.  I prefer to iterate with a for loop (that is not
obfuscated with a macro).

The C code is simple and was mostly correct here.  Except it has the
usual null error checking for printf() failure, and bogus void'ing of
the return value.  The above seems to duplicate the null error handling.

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: r267191 - head/sys/fs/nfsserver

2014-06-06 Thread Rick Macklem
Author: rmacklem
Date: Fri Jun  6 21:38:49 2014
New Revision: 267191
URL: http://svnweb.freebsd.org/changeset/base/267191

Log:
  The new NFS server would not allow a hard link to be
  created to a symlink. This restriction (which was
  inherited from OpenBSD) is not required by the NFS RFCs.
  Since this is allowed by the old NFS server, it is a
  POLA violation to not allow it. This patch modifies the
  new NFS server to allow this.
  
  Reported by:  jhb
  Reviewed by:  jhb
  MFC after:3 days

Modified:
  head/sys/fs/nfsserver/nfs_nfsdserv.c

Modified: head/sys/fs/nfsserver/nfs_nfsdserv.c
==
--- head/sys/fs/nfsserver/nfs_nfsdserv.cFri Jun  6 21:38:34 2014
(r267190)
+++ head/sys/fs/nfsserver/nfs_nfsdserv.cFri Jun  6 21:38:49 2014
(r267191)
@@ -1620,13 +1620,6 @@ nfsrvd_link(struct nfsrv_descript *nd, i
nd-nd_repstat = NFSERR_INVAL;
if (tovp)
vrele(tovp);
-   } else if (vnode_vtype(vp) == VLNK) {
-   if (nd-nd_flag  ND_NFSV2)
-   nd-nd_repstat = NFSERR_INVAL;
-   else
-   nd-nd_repstat = NFSERR_NOTSUPP;
-   if (tovp)
-   vrele(tovp);
}
if (!nd-nd_repstat) {
if (nd-nd_flag  ND_NFSV4) {
___
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: r267194 - in head/share/vt: . keymaps

2014-06-06 Thread Aleksandr Rybalko
Author: ray
Date: Fri Jun  6 21:58:27 2014
New Revision: 267194
URL: http://svnweb.freebsd.org/changeset/base/267194

Log:
  Add Ukranian vt(4) keymaps as an example.
  
  Sponsored by: The FreeBSD Foundation

Added:
  head/share/vt/keymaps/
  head/share/vt/keymaps/Makefile   (contents, props changed)
  head/share/vt/keymaps/ua.kbd   (contents, props changed)
  head/share/vt/keymaps/ua.shift.alt.kbd   (contents, props changed)
Modified:
  head/share/vt/Makefile

Modified: head/share/vt/Makefile
==
--- head/share/vt/Makefile  Fri Jun  6 21:45:14 2014(r267193)
+++ head/share/vt/Makefile  Fri Jun  6 21:58:27 2014(r267194)
@@ -1,5 +1,5 @@
 # $FreeBSD$
 
-SUBDIR= fonts
+SUBDIR= fonts keymaps
 
 .include bsd.subdir.mk

Added: head/share/vt/keymaps/Makefile
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/share/vt/keymaps/Makefile  Fri Jun  6 21:58:27 2014
(r267194)
@@ -0,0 +1,9 @@
+# $FreeBSD$
+
+FILES= ua.kbd ua.shift.alt.kbd
+
+FILESDIR= ${SHAREDIR}/vt/keymaps
+
+NO_OBJ=
+
+.include bsd.prog.mk

Added: head/share/vt/keymaps/ua.kbd
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/share/vt/keymaps/ua.kbdFri Jun  6 21:58:27 2014
(r267194)
@@ -0,0 +1,242 @@
+# $FreeBSD$
+# alt
+# scan   cntrl  altalt   cntrl lock
+# code  base   shift  cntrl  shift  altshift  cntrl  shift state
+# --
+  000   nopnopnopnopnopnopnopnop O
+  001   escescescescescescdebug  nop O
+  002   '1''!'nopnop'1''!'nopnop O
+  003   '2''@'nulnul'2'''nulnul O
+  004   '3''#'nopnop'3''/'nopnop O
+  005   '4''$'nopnop'4''$'nopnop O
+  006   '5''%'nopnop'5'':'nopnop O
+  007   '6''^'rs rs '6'','rs rs  O
+  008   '7'''nopnop'7''.'nopnop O
+  009   '8''*'nopnop'8'';'nopnop O
+  010   '9''('nopnop'9''?'nopnop O
+  011   '0'')'nopnop'0''%'nopnop O
+  012   '-''_'ns ns '-''_'ns ns  O
+  013   '=''+'nopnop'=''+'nopnop O
+  014   bs bs deldelbs bs deldel O
+  015   ht btab   nopnopbtab   btab   nopnop O
+  016   'q''Q'dc1dc110811049dc1dc1 C
+  017   'w''W'etbetb10941062etbetb C
+  018   'e''E'enqenq10911059enqenq C
+  019   'r''R'dc2dc210821050dc2dc2 C
+  020   't''T'dc4dc410771045dc4dc4 C
+  021   'y''Y'em em 10851053em em  C
+  022   'u''U'naknak10751043naknak C
+  023   'i''I'ht ht 10961064ht ht  C
+  024   'o''O'si si 10971065si si  C
+  025   'p''P'dledle10791047dledle C
+  026   '[''{'escesc10931061escesc O
+  027   ']''}'gs gs 103110981066 O
+  028   cr cr nl nl cr cr nl nl  O
+  029   lctrl  lctrl  lctrl  lctrl  lctrl  lctrl  lctrl  lctrl   O
+  030   'a''A'sohsoh10921060sohsoh C
+  031   's''S'dc3dc31110103010991067 C
+  032   'd''D'eoteot10741042eoteot C
+  033   'f''F'ackack10721040ackack C
+  034   'g''G'belbel10871055belbel C
+  035   'h''H'bs bs 10881056bs bs  C
+  036   'j''J'nl nl 10861054nl nl  C
+  037   'k''K'vt vt 10831051vt vt  C
+  038   'l''L'ff ff 10761044ff ff  C
+  039   ';'':'nopnop10781046nopnop O
+  040   '''''nopnop1108102811011069 O
+  041   '`''~'nopnop1169116811051025 O
+  042   lshift lshift lshift lshift lshift lshift lshift lshift  O
+  043   '\''|'fs fs '\''|'fs fs  O
+  044   'z''Z'subsub11031071subsub C
+  045   'x''X'cancan10951063cancan C
+  046   'c'

svn commit: r267196 - head/bin/ps

2014-06-06 Thread Sergey Kandaurov
Author: pluknet
Date: Fri Jun  6 22:52:11 2014
New Revision: 267196
URL: http://svnweb.freebsd.org/changeset/base/267196

Log:
  Add support for inspecting process flags set in p_flag2.
  
  Reviewed by:  jhb
  MFC after:1 week

Modified:
  head/bin/ps/keyword.c
  head/bin/ps/ps.1

Modified: head/bin/ps/keyword.c
==
--- head/bin/ps/keyword.c   Fri Jun  6 22:14:25 2014(r267195)
+++ head/bin/ps/keyword.c   Fri Jun  6 22:52:11 2014(r267196)
@@ -87,8 +87,10 @@ static VAR var[] = {
{etimes, ELAPSED, NULL, USER, elapseds, 0, CHAR, NULL, 0},
{euid, , uid, 0, NULL, 0, CHAR, NULL, 0},
{f, F, NULL, 0, kvar, KOFF(ki_flag), INT, x, 0},
+   {f2, F2, NULL, 0, kvar, KOFF(ki_flag2), INT, 08x, 0},
{fib, FIB, NULL, 0, kvar, KOFF(ki_fibnum), INT, d, 0},
{flags, , f, 0, NULL, 0, CHAR, NULL, 0},
+   {flags2, , f2, 0, NULL, 0, CHAR, NULL, 0},
{gid, GID, NULL, 0, kvar, KOFF(ki_groups), UINT, UIDFMT, 0},
{group, GROUP, NULL, LJUST, egroupname, 0, CHAR, NULL, 0},
{ignored, , sigignore, 0, NULL, 0, CHAR, NULL, 0},

Modified: head/bin/ps/ps.1
==
--- head/bin/ps/ps.1Fri Jun  6 22:14:25 2014(r267195)
+++ head/bin/ps/ps.1Fri Jun  6 22:52:11 2014(r267196)
@@ -29,7 +29,7 @@
 .\ @(#)ps.1   8.3 (Berkeley) 4/18/94
 .\ $FreeBSD$
 .\
-.Dd May 2, 2014
+.Dd June 6, 2014
 .Dt PS 1
 .Os
 .Sh NAME
@@ -340,6 +340,15 @@ the include file
 .It Dv P_SWAPPINGIN Ta No 0x4000 Ta Process is being swapped in
 .It Dv P_PPTRACE Ta No 0x8000 Ta Vforked child issued 
ptrace(PT_TRACEME)
 .El
+.It Cm flags2
+The flags kept in
+.Va p_flag2
+associated with the process as in
+the include file
+.In sys/proc.h :
+.Bl -column P2_INHERIT_PROTECTED 0x0001
+.It Dv P2_INHERIT_PROTECTED Ta No 0x0001 Ta New children get 
P_PROTECTED
+.El
 .It Cm label
 The MAC label of the process.
 .It Cm lim
@@ -534,6 +543,9 @@ default FIB number, see
 .It Cm flags
 the process flags, in hexadecimal (alias
 .Cm f )
+.It Cm flags2
+the additional set of process flags, in hexadecimal (alias
+.Cm f2 )
 .It Cm gid
 effective group ID (alias
 .Cm egid )
___
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: r267199 - head/sys/boot/fdt/dts

2014-06-06 Thread Rui Paulo
Author: rpaulo
Date: Sat Jun  7 02:38:13 2014
New Revision: 267199
URL: http://svnweb.freebsd.org/changeset/base/267199

Log:
  Fix the script to run make_dtb.sh instead of just dtc.

Modified:
  head/sys/boot/fdt/dts/Makefile.inc

Modified: head/sys/boot/fdt/dts/Makefile.inc
==
--- head/sys/boot/fdt/dts/Makefile.inc  Sat Jun  7 02:30:10 2014
(r267198)
+++ head/sys/boot/fdt/dts/Makefile.inc  Sat Jun  7 02:38:13 2014
(r267199)
@@ -1,7 +1,10 @@
 # $FreeBSD$
 
+SYSDIR?=${.CURDIR}/../../../..
+
 test-dts:
 .for dts in ${DTS}
-   dtc -I dts -O dtb -o /dev/null ${dts}
+   @env MACHINE=`basename ${.CURDIR}` ${SYSDIR}/tools/fdt/make_dtb.sh 
${SYSDIR} ${dts} /tmp
+
 .endfor
 
___
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: r267202 - in head/sys/boot/fdt/dts: arm powerpc

2014-06-06 Thread Rui Paulo
Author: rpaulo
Date: Sat Jun  7 02:55:53 2014
New Revision: 267202
URL: http://svnweb.freebsd.org/changeset/base/267202

Log:
  Mov p2041rdb.dts, p3041ds.dts, and p5020ds.dts to the powerpc directory.

Added:
  head/sys/boot/fdt/dts/powerpc/p2041rdb.dts
 - copied unchanged from r267196, head/sys/boot/fdt/dts/arm/p2041rdb.dts
  head/sys/boot/fdt/dts/powerpc/p3041ds.dts
 - copied unchanged from r267196, head/sys/boot/fdt/dts/arm/p3041ds.dts
  head/sys/boot/fdt/dts/powerpc/p5020ds.dts
 - copied unchanged from r267196, head/sys/boot/fdt/dts/arm/p5020ds.dts
Deleted:
  head/sys/boot/fdt/dts/arm/p2041rdb.dts
  head/sys/boot/fdt/dts/arm/p3041ds.dts
  head/sys/boot/fdt/dts/arm/p5020ds.dts

Copied: head/sys/boot/fdt/dts/powerpc/p2041rdb.dts (from r267196, 
head/sys/boot/fdt/dts/arm/p2041rdb.dts)
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/boot/fdt/dts/powerpc/p2041rdb.dts  Sat Jun  7 02:55:53 2014
(r267202, copy of r267196, head/sys/boot/fdt/dts/arm/p2041rdb.dts)
@@ -0,0 +1,490 @@
+/*
+ * P2041RDB Device Tree Source
+ *
+ * Copyright 2011 Freescale Semiconductor Inc.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * * Neither the name of Freescale Semiconductor nor the
+ *   names of its contributors may be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ *
+ * ALTERNATIVELY, this software may be distributed under the terms of the
+ * GNU General Public License (GPL) as published by the Free Software
+ * Foundation, either version 2 of that License or (at your option) any
+ * later version.
+ *
+ * THIS SOFTWARE IS PROVIDED BY Freescale Semiconductor ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL Freescale Semiconductor BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 
THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/* $FreeBSD$ */
+
+/include/ p2041si.dtsi
+
+/ {
+   model = fsl,P2041RDB;
+   compatible = fsl,P2041RDB;
+   #address-cells = 2;
+   #size-cells = 2;
+   interrupt-parent = mpic;
+
+   aliases {
+   phy_rgmii_0 = phy_rgmii_0;
+   phy_rgmii_1 = phy_rgmii_1;
+   phy_sgmii_2 = phy_sgmii_2;
+   phy_sgmii_3 = phy_sgmii_3;
+   phy_sgmii_4 = phy_sgmii_4;
+   phy_sgmii_1c = phy_sgmii_1c;
+   phy_sgmii_1d = phy_sgmii_1d;
+   phy_sgmii_1e = phy_sgmii_1e;
+   phy_sgmii_1f = phy_sgmii_1f;
+   phy_xgmii_2 = phy_xgmii_2;
+   };
+
+   memory {
+   device_type = memory;
+   reg = 0x 0x 0x 0x8000;
+   };
+
+   dcsr: dcsr@f {
+   ranges = 0x 0xf 0x 0x01008000;
+   };
+
+   bman-portals@ff400 {
+   bman-portal@0 {
+   cpu-handle = cpu0;
+   };
+   bman-portal@4000 {
+   cpu-handle = cpu1;
+   };
+   bman-portal@8000 {
+   cpu-handle = cpu2;
+   };
+   bman-portal@c000 {
+   cpu-handle = cpu3;
+   };
+   bman-portal@1 {
+   };
+   bman-portal@14000 {
+   };
+   bman-portal@18000 {
+   };
+   bman-portal@1c000 {
+   };
+   bman-portal@2 {
+   };
+   bman-portal@24000 {
+   };
+
+   buffer-pool@0 {
+   compatible = fsl,p2041-bpool, fsl,bpool;
+   fsl,bpid = 0;
+   fsl,bpool-cfg = 0 0x100 0 1 0 0x100;
+   };
+   };
+
+   qman-portals@ff420 {
+   qportal0: qman-portal@0 {
+   cpu-handle =