svn commit: r254401 - vendor-sys/ipfilter/dist/netinet

2013-08-16 Thread Cy Schubert
Author: cy
Date: Fri Aug 16 07:03:28 2013
New Revision: 254401
URL: http://svnweb.freebsd.org/changeset/base/254401

Log:
  Include three new files that should be in vendor-sys branch too.
  
  Approved by:  glebius (Mentor)

Added:
  vendor-sys/ipfilter/dist/netinet/ip_dns_pxy.c
  vendor-sys/ipfilter/dist/netinet/ip_nat6.c
  vendor-sys/ipfilter/dist/netinet/ip_tftp_pxy.c

Added: vendor-sys/ipfilter/dist/netinet/ip_dns_pxy.c
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ vendor-sys/ipfilter/dist/netinet/ip_dns_pxy.c   Fri Aug 16 07:03:28 
2013(r254401)
@@ -0,0 +1,402 @@
+/*
+ * Copyright (C) 2012 by Darren Reed.
+ *
+ * See the IPFILTER.LICENCE file for details on licencing.
+ *
+ * $Id: ip_dns_pxy.c,v 1.1.2.10 2012/07/22 08:04:23 darren_r Exp $
+ */
+
+#defineIPF_DNS_PROXY
+
+/*
+ * map ... proxy port dns/udp 53 { block .cnn.com; }
+ */
+typedefstruct  ipf_dns_filter  {
+   struct  ipf_dns_filter  *idns_next;
+   char*idns_name;
+   int idns_namelen;
+   int idns_pass;
+} ipf_dns_filter_t;
+
+
+typedef struct ipf_dns_softc_s {
+   ipf_dns_filter_t*ipf_p_dns_list;
+   ipfrwlock_t ipf_p_dns_rwlock;
+   u_long  ipf_p_dns_compress;
+   u_long  ipf_p_dns_toolong;
+   u_long  ipf_p_dns_nospace;
+} ipf_dns_softc_t;
+
+int ipf_p_dns_allow_query __P((ipf_dns_softc_t *, dnsinfo_t *));
+int ipf_p_dns_ctl __P((ipf_main_softc_t *, void *, ap_ctl_t *));
+int ipf_p_dns_del __P((ipf_main_softc_t *, ap_session_t *));
+int ipf_p_dns_get_name __P((ipf_dns_softc_t *, char *, int, char *, int));
+int ipf_p_dns_inout __P((void *, fr_info_t *, ap_session_t *, nat_t *));
+int ipf_p_dns_match __P((fr_info_t *, ap_session_t *, nat_t *));
+int ipf_p_dns_match_names __P((ipf_dns_filter_t *, char *, int));
+int ipf_p_dns_new __P((void *, fr_info_t *, ap_session_t *, nat_t *));
+void *ipf_p_dns_soft_create __P((ipf_main_softc_t *));
+void ipf_p_dns_soft_destroy __P((ipf_main_softc_t *, void *));
+
+typedef struct {
+   u_char  dns_id[2];
+   u_short dns_ctlword;
+   u_short dns_qdcount;
+   u_short dns_ancount;
+   u_short dns_nscount;
+   u_short dns_arcount;
+} ipf_dns_hdr_t;
+
+#defineDNS_QR(x)   ((ntohs(x) & 0x8000) >> 15)
+#defineDNS_OPCODE(x)   ((ntohs(x) & 0x7800) >> 11)
+#defineDNS_AA(x)   ((ntohs(x) & 0x0400) >> 10)
+#defineDNS_TC(x)   ((ntohs(x) & 0x0200) >> 9)
+#defineDNS_RD(x)   ((ntohs(x) & 0x0100) >> 8)
+#defineDNS_RA(x)   ((ntohs(x) & 0x0080) >> 7)
+#defineDNS_Z(x)((ntohs(x) & 0x0070) >> 4)
+#defineDNS_RCODE(x)((ntohs(x) & 0x000f) >> 0)
+
+
+void *
+ipf_p_dns_soft_create(softc)
+   ipf_main_softc_t *softc;
+{
+   ipf_dns_softc_t *softd;
+
+   KMALLOC(softd, ipf_dns_softc_t *);
+   if (softd == NULL)
+   return NULL;
+
+   bzero((char *)softd, sizeof(*softd));
+   RWLOCK_INIT(&softd->ipf_p_dns_rwlock, "ipf dns rwlock");
+
+   return softd;
+}
+
+
+void
+ipf_p_dns_soft_destroy(softc, arg)
+   ipf_main_softc_t *softc;
+   void *arg;
+{
+   ipf_dns_softc_t *softd = arg;
+   ipf_dns_filter_t *idns;
+
+   while ((idns = softd->ipf_p_dns_list) != NULL) {
+   KFREES(idns->idns_name, idns->idns_namelen);
+   idns->idns_name = NULL;
+   idns->idns_namelen = 0;
+   softd->ipf_p_dns_list = idns->idns_next;
+   KFREE(idns);
+   }
+   RW_DESTROY(&softd->ipf_p_dns_rwlock);
+
+   KFREE(softd);
+}
+
+
+int
+ipf_p_dns_ctl(softc, arg, ctl)
+   ipf_main_softc_t *softc;
+   void *arg;
+   ap_ctl_t *ctl;
+{
+   ipf_dns_softc_t *softd = arg;
+   ipf_dns_filter_t *tmp, *idns, **idnsp;
+   int error = 0;
+
+   /*
+* To make locking easier.
+*/
+   KMALLOC(tmp, ipf_dns_filter_t *);
+
+   WRITE_ENTER(&softd->ipf_p_dns_rwlock);
+   for (idnsp = &softd->ipf_p_dns_list; (idns = *idnsp) != NULL;
+idnsp = &idns->idns_next) {
+   if (idns->idns_namelen != ctl->apc_dsize)
+   continue;
+   if (!strncmp(ctl->apc_data, idns->idns_name,
+   idns->idns_namelen))
+   break;
+   }
+
+   switch (ctl->apc_cmd)
+   {
+   case APC_CMD_DEL :
+   if (idns == NULL) {
+   IPFERROR(80006);
+   error = ESRCH;
+   break;
+   }
+   *idnsp = idns->idns_next;
+   idns->idns_next = NULL;
+   KFREES(idns->idns_name, idns->idns_namelen);
+   idns->idns_name = NULL;
+   idns->idns_namelen 

svn commit: r254403 - vendor-sys/ipfilter/5-1-2/netinet

2013-08-16 Thread Cy Schubert
Author: cy
Date: Fri Aug 16 07:16:26 2013
New Revision: 254403
URL: http://svnweb.freebsd.org/changeset/base/254403

Log:
  Tag three new files that should have been in vendor-sys in r254219 and 
r254221.
  
  Approved by:  glebius (Mentor)

Added:
  vendor-sys/ipfilter/5-1-2/netinet/ip_dns_pxy.c
 - copied unchanged from r254401, 
vendor-sys/ipfilter/dist/netinet/ip_dns_pxy.c
  vendor-sys/ipfilter/5-1-2/netinet/ip_nat6.c
 - copied unchanged from r254401, vendor-sys/ipfilter/dist/netinet/ip_nat6.c
  vendor-sys/ipfilter/5-1-2/netinet/ip_tftp_pxy.c
 - copied unchanged from r254401, 
vendor-sys/ipfilter/dist/netinet/ip_tftp_pxy.c

Copied: vendor-sys/ipfilter/5-1-2/netinet/ip_dns_pxy.c (from r254401, 
vendor-sys/ipfilter/dist/netinet/ip_dns_pxy.c)
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ vendor-sys/ipfilter/5-1-2/netinet/ip_dns_pxy.c  Fri Aug 16 07:16:26 
2013(r254403, copy of r254401, 
vendor-sys/ipfilter/dist/netinet/ip_dns_pxy.c)
@@ -0,0 +1,402 @@
+/*
+ * Copyright (C) 2012 by Darren Reed.
+ *
+ * See the IPFILTER.LICENCE file for details on licencing.
+ *
+ * $Id: ip_dns_pxy.c,v 1.1.2.10 2012/07/22 08:04:23 darren_r Exp $
+ */
+
+#defineIPF_DNS_PROXY
+
+/*
+ * map ... proxy port dns/udp 53 { block .cnn.com; }
+ */
+typedefstruct  ipf_dns_filter  {
+   struct  ipf_dns_filter  *idns_next;
+   char*idns_name;
+   int idns_namelen;
+   int idns_pass;
+} ipf_dns_filter_t;
+
+
+typedef struct ipf_dns_softc_s {
+   ipf_dns_filter_t*ipf_p_dns_list;
+   ipfrwlock_t ipf_p_dns_rwlock;
+   u_long  ipf_p_dns_compress;
+   u_long  ipf_p_dns_toolong;
+   u_long  ipf_p_dns_nospace;
+} ipf_dns_softc_t;
+
+int ipf_p_dns_allow_query __P((ipf_dns_softc_t *, dnsinfo_t *));
+int ipf_p_dns_ctl __P((ipf_main_softc_t *, void *, ap_ctl_t *));
+int ipf_p_dns_del __P((ipf_main_softc_t *, ap_session_t *));
+int ipf_p_dns_get_name __P((ipf_dns_softc_t *, char *, int, char *, int));
+int ipf_p_dns_inout __P((void *, fr_info_t *, ap_session_t *, nat_t *));
+int ipf_p_dns_match __P((fr_info_t *, ap_session_t *, nat_t *));
+int ipf_p_dns_match_names __P((ipf_dns_filter_t *, char *, int));
+int ipf_p_dns_new __P((void *, fr_info_t *, ap_session_t *, nat_t *));
+void *ipf_p_dns_soft_create __P((ipf_main_softc_t *));
+void ipf_p_dns_soft_destroy __P((ipf_main_softc_t *, void *));
+
+typedef struct {
+   u_char  dns_id[2];
+   u_short dns_ctlword;
+   u_short dns_qdcount;
+   u_short dns_ancount;
+   u_short dns_nscount;
+   u_short dns_arcount;
+} ipf_dns_hdr_t;
+
+#defineDNS_QR(x)   ((ntohs(x) & 0x8000) >> 15)
+#defineDNS_OPCODE(x)   ((ntohs(x) & 0x7800) >> 11)
+#defineDNS_AA(x)   ((ntohs(x) & 0x0400) >> 10)
+#defineDNS_TC(x)   ((ntohs(x) & 0x0200) >> 9)
+#defineDNS_RD(x)   ((ntohs(x) & 0x0100) >> 8)
+#defineDNS_RA(x)   ((ntohs(x) & 0x0080) >> 7)
+#defineDNS_Z(x)((ntohs(x) & 0x0070) >> 4)
+#defineDNS_RCODE(x)((ntohs(x) & 0x000f) >> 0)
+
+
+void *
+ipf_p_dns_soft_create(softc)
+   ipf_main_softc_t *softc;
+{
+   ipf_dns_softc_t *softd;
+
+   KMALLOC(softd, ipf_dns_softc_t *);
+   if (softd == NULL)
+   return NULL;
+
+   bzero((char *)softd, sizeof(*softd));
+   RWLOCK_INIT(&softd->ipf_p_dns_rwlock, "ipf dns rwlock");
+
+   return softd;
+}
+
+
+void
+ipf_p_dns_soft_destroy(softc, arg)
+   ipf_main_softc_t *softc;
+   void *arg;
+{
+   ipf_dns_softc_t *softd = arg;
+   ipf_dns_filter_t *idns;
+
+   while ((idns = softd->ipf_p_dns_list) != NULL) {
+   KFREES(idns->idns_name, idns->idns_namelen);
+   idns->idns_name = NULL;
+   idns->idns_namelen = 0;
+   softd->ipf_p_dns_list = idns->idns_next;
+   KFREE(idns);
+   }
+   RW_DESTROY(&softd->ipf_p_dns_rwlock);
+
+   KFREE(softd);
+}
+
+
+int
+ipf_p_dns_ctl(softc, arg, ctl)
+   ipf_main_softc_t *softc;
+   void *arg;
+   ap_ctl_t *ctl;
+{
+   ipf_dns_softc_t *softd = arg;
+   ipf_dns_filter_t *tmp, *idns, **idnsp;
+   int error = 0;
+
+   /*
+* To make locking easier.
+*/
+   KMALLOC(tmp, ipf_dns_filter_t *);
+
+   WRITE_ENTER(&softd->ipf_p_dns_rwlock);
+   for (idnsp = &softd->ipf_p_dns_list; (idns = *idnsp) != NULL;
+idnsp = &idns->idns_next) {
+   if (idns->idns_namelen != ctl->apc_dsize)
+   continue;
+   if (!strncmp(ctl->apc_data, idns->idns_name,
+   idns->idns_namelen))
+   break;
+   }
+
+   switch (ctl->apc_cmd)
+   {
+   c

svn commit: r254404 - in head: share/man/man4 sys/dev/usb/net

2013-08-16 Thread Kevin Lo
Author: kevlo
Date: Fri Aug 16 07:42:06 2013
New Revision: 254404
URL: http://svnweb.freebsd.org/changeset/base/254404

Log:
  Bring datasheet URL up to date.

Modified:
  head/share/man/man4/udav.4
  head/sys/dev/usb/net/if_udav.c

Modified: head/share/man/man4/udav.4
==
--- head/share/man/man4/udav.4  Fri Aug 16 07:16:26 2013(r254403)
+++ head/share/man/man4/udav.4  Fri Aug 16 07:42:06 2013(r254404)
@@ -87,7 +87,7 @@ For more information on configuring this
 .Xr ifconfig 8
 .Rs
 .%T "Davicom DM9601 data sheet"
-.%U 
http://www.davicom.com.tw/big5/download/Data%20Sheet/DM9601-DS-P01-930914.pdf
+.%U 
http://ptm2.cc.utu.fi/ftp/network/cards/DM9601/From_NET/DM9601-DS-P01-930914.pdf
 .Re
 .Sh HISTORY
 The

Modified: head/sys/dev/usb/net/if_udav.c
==
--- head/sys/dev/usb/net/if_udav.c  Fri Aug 16 07:16:26 2013
(r254403)
+++ head/sys/dev/usb/net/if_udav.c  Fri Aug 16 07:42:06 2013
(r254404)
@@ -34,7 +34,7 @@
 /*
  * DM9601(DAVICOM USB to Ethernet MAC Controller with Integrated 10/100 PHY)
  * The spec can be found at the following url.
- *   
http://www.davicom.com.tw/big5/download/Data%20Sheet/DM9601-DS-P01-930914.pdf
+ *   
http://ptm2.cc.utu.fi/ftp/network/cards/DM9601/From_NET/DM9601-DS-P01-930914.pdf
  */
 
 /*
___
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: r254380 - in head/sys: kern sys

2013-08-16 Thread Ivan Voras
> We have a single-writer / multiple-readers lock on *any particular byte*
> of a vnode.  The rangelock code is what keeps track of this, and the
> locking contention I was reducing was in the rangelock bookkeeping.

So, for example, if multiple processes or multiple threads read or
write a file somewhat unintelligently (a small file, operations on the
whole file, like in blogbench), they will effectively content for the
byte 0, right?
___
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: r254407 - head/lib/libpam/libpam

2013-08-16 Thread Dag-Erling Smørgrav
Author: des
Date: Fri Aug 16 10:53:36 2013
New Revision: 254407
URL: http://svnweb.freebsd.org/changeset/base/254407

Log:
  GC unused source file.

Deleted:
  head/lib/libpam/libpam/pam_std_option.c
___
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: r254409 - in head: include lib/libc/gen

2013-08-16 Thread Jilles Tjoelker
Author: jilles
Date: Fri Aug 16 13:10:30 2013
New Revision: 254409
URL: http://svnweb.freebsd.org/changeset/base/254409

Log:
  Add dup3(), based on F_DUP2FD and F_DUP2FD_CLOEXEC fcntls.
  
  I removed functionality not proposed for POSIX in Austin group issue #411.
  A man page (my own) and test cases will follow in later commits.
  
  PR:   176233
  Submitted by: Jukka Ukkonen

Added:
  head/lib/libc/gen/dup3.c   (contents, props changed)
Modified:
  head/include/unistd.h
  head/lib/libc/gen/Makefile.inc
  head/lib/libc/gen/Symbol.map

Modified: head/include/unistd.h
==
--- head/include/unistd.h   Fri Aug 16 12:25:02 2013(r254408)
+++ head/include/unistd.h   Fri Aug 16 13:10:30 2013(r254409)
@@ -493,6 +493,7 @@ const char *
 int crypt_set_format(const char *);
 int des_cipher(const char *, char *, long, int);
 int des_setkey(const char *key);
+int dup3(int, int, int);
 int eaccess(const char *, int);
 voidendusershell(void);
 int exect(const char *, char * const *, char * const *);

Modified: head/lib/libc/gen/Makefile.inc
==
--- head/lib/libc/gen/Makefile.inc  Fri Aug 16 12:25:02 2013
(r254408)
+++ head/lib/libc/gen/Makefile.inc  Fri Aug 16 13:10:30 2013
(r254409)
@@ -31,6 +31,7 @@ SRCS+=__getosreldate.c \
disklabel.c \
dlfcn.c \
drand48.c \
+   dup3.c \
elf_utils.c \
erand48.c \
err.c \

Modified: head/lib/libc/gen/Symbol.map
==
--- head/lib/libc/gen/Symbol.mapFri Aug 16 12:25:02 2013
(r254408)
+++ head/lib/libc/gen/Symbol.mapFri Aug 16 13:10:30 2013
(r254409)
@@ -383,6 +383,7 @@ FBSD_1.2 {
 FBSD_1.3 {
clock_getcpuclockid;
dirfd;
+   dup3;
 fdlopen;
__FreeBSD_libc_enter_restricted_mode;
getcontextx;

Added: head/lib/libc/gen/dup3.c
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/lib/libc/gen/dup3.cFri Aug 16 13:10:30 2013(r254409)
@@ -0,0 +1,59 @@
+/*-
+ * Copyright (c) 2012 Jukka A. Ukkonen
+ * All rights reserved.
+ *
+ * This software was developed by Jukka Ukkonen for FreeBSD.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include 
+__FBSDID("$FreeBSD$");
+
+#include "namespace.h"
+#include 
+#include 
+#include 
+#include "un-namespace.h"
+
+int
+__dup3(int oldfd, int newfd, int flags)
+{
+   int how;
+
+   if (oldfd == newfd) {
+   errno = EINVAL;
+   return (-1);
+   }
+
+   if (flags & ~O_CLOEXEC) {
+   errno = EINVAL;
+   return (-1);
+   }
+
+   how = (flags & O_CLOEXEC) ? F_DUP2FD_CLOEXEC : F_DUP2FD;
+
+   return (_fcntl(oldfd, how, newfd));
+}
+
+__weak_reference(__dup3, dup3);
+__weak_reference(__dup3, _dup3);
___
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: r254410 - in head/lib/libc: gen sys

2013-08-16 Thread Jilles Tjoelker
Author: jilles
Date: Fri Aug 16 13:16:27 2013
New Revision: 254410
URL: http://svnweb.freebsd.org/changeset/base/254410

Log:
  Add man page dup3(3).

Added:
  head/lib/libc/gen/dup3.3   (contents, props changed)
Modified:
  head/lib/libc/gen/Makefile.inc
  head/lib/libc/sys/dup.2

Modified: head/lib/libc/gen/Makefile.inc
==
--- head/lib/libc/gen/Makefile.inc  Fri Aug 16 13:10:30 2013
(r254409)
+++ head/lib/libc/gen/Makefile.inc  Fri Aug 16 13:16:27 2013
(r254410)
@@ -185,6 +185,7 @@ MAN+=   alarm.3 \
dlinfo.3 \
dllockinit.3 \
dlopen.3 \
+   dup3.3 \
err.3 \
exec.3 \
feature_present.3 \

Added: head/lib/libc/gen/dup3.3
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/lib/libc/gen/dup3.3Fri Aug 16 13:16:27 2013(r254410)
@@ -0,0 +1,120 @@
+.\" Copyright (c) 1980, 1991, 1993
+.\"The Regents of the University of California.  All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\"notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\"notice, this list of conditions and the following disclaimer in the
+.\"documentation and/or other materials provided with the distribution.
+.\" 4. Neither the name of the University nor the names of its contributors
+.\"may be used to endorse or promote products derived from this software
+.\"without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" @(#)dup.2  8.1 (Berkeley) 6/4/93
+.\" $FreeBSD$
+.\"
+.Dd August 16, 2013
+.Dt DUP3 3
+.Os
+.Sh NAME
+.Nm dup3
+.Nd duplicate an existing file descriptor
+.Sh LIBRARY
+.Lb libc
+.Sh SYNOPSIS
+.In fcntl.h
+.In unistd.h
+.Ft int
+.Fn dup3 "int oldd" "int newd" "int flags"
+.Sh DESCRIPTION
+The
+.Fn dup3
+function
+duplicates an existing object descriptor
+while allowing the value of the new descriptor to be specified.
+.Pp
+The close-on-exec flag on the new file descriptor is determined by the
+.Dv O_CLOEXEC
+bit in
+.Fa flags .
+.Pp
+If
+.Fa oldd
+\*(Ne
+.Fa newd
+and
+.Fa flags
+== 0,
+the behavior is identical to
+.Li dup2(oldd, newd) .
+.Pp
+If
+.Fa oldd
+==
+.Fa newd ,
+then
+.Fn dup3
+fails, unlike
+.Xr dup2 2 .
+.Sh RETURN VALUES
+The value -1 is returned if an error occurs.
+The external variable
+.Va errno
+indicates the cause of the error.
+.Sh ERRORS
+The
+.Fn dup3
+function fails if:
+.Bl -tag -width Er
+.It Bq Er EBADF
+The
+.Fa oldd
+argument is not a valid active descriptor or the
+.Fa newd
+argument is negative or exceeds the maximum allowable descriptor number
+.It Bq Er EINVAL
+The
+.Fa oldd
+argument is equal to the
+.Fa newd
+argument.
+.It Bq Er EINVAL
+The
+.Fa flags
+argument has bits set other than
+.Dv O_CLOEXEC .
+.El
+.Sh SEE ALSO
+.Xr accept 2 ,
+.Xr close 2 ,
+.Xr dup2 2 ,
+.Xr fcntl 2 ,
+.Xr getdtablesize 2 ,
+.Xr open 2 ,
+.Xr pipe 2 ,
+.Xr socket 2 ,
+.Xr socketpair 2
+.Sh STANDARDS
+The
+.Fn dup3
+function does not conform to any standard.
+.Sh HISTORY
+The
+.Fn dup3
+function appeared in
+.Fx 10.0 .

Modified: head/lib/libc/sys/dup.2
==
--- head/lib/libc/sys/dup.2 Fri Aug 16 13:10:30 2013(r254409)
+++ head/lib/libc/sys/dup.2 Fri Aug 16 13:16:27 2013(r254410)
@@ -151,7 +151,8 @@ argument is negative or exceeds the maxi
 .Xr open 2 ,
 .Xr pipe 2 ,
 .Xr socket 2 ,
-.Xr socketpair 2
+.Xr socketpair 2 ,
+.Xr dup3 3
 .Sh STANDARDS
 The
 .Fn dup
___
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: r254411 - head/tools/regression/file/dup

2013-08-16 Thread Jilles Tjoelker
Author: jilles
Date: Fri Aug 16 13:16:55 2013
New Revision: 254411
URL: http://svnweb.freebsd.org/changeset/base/254411

Log:
  Add tests for dup3().

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

Modified: head/tools/regression/file/dup/dup.c
==
--- head/tools/regression/file/dup/dup.cFri Aug 16 13:16:27 2013
(r254410)
+++ head/tools/regression/file/dup/dup.cFri Aug 16 13:16:55 2013
(r254411)
@@ -38,6 +38,16 @@
  *   fd.
  * Test #23: check if fcntl(F_DUP2FD_CLOEXEC) to a fd > current maximum number
  *   of open files limit work.
+ * Test #24: check if dup3(O_CLOEXEC) works.
+ * Test #25: check if dup3(O_CLOEXEC) returned a fd we asked for.
+ * Test #26: check if dup3(O_CLOEXEC) set close-on-exec flag for duped fd.
+ * Test #27: check if dup3(0) works.
+ * Test #28: check if dup3(0) returned a fd we asked for.
+ * Test #29: check if dup3(0) cleared close-on-exec flag for duped fd.
+ * Test #30: check if dup3(O_CLOEXEC) fails if oldfd == newfd.
+ * Test #31: check if dup3(0) fails if oldfd == newfd.
+ * Test #32: check if dup3(O_CLOEXEC) to a fd > current maximum number of
+ *   open files limit work.
  */
 
 #include 
@@ -74,7 +84,7 @@ main(int __unused argc, char __unused *a
 
orgfd = getafile();
 
-   printf("1..23\n");
+   printf("1..32\n");
 
/* If dup(2) ever work? */
if ((fd1 = dup(orgfd)) < 0)
@@ -297,5 +307,80 @@ main(int __unused argc, char __unused *a
printf("ok %d - fcntl(F_DUP2FD_CLOEXEC) didn't bypass NOFILE 
limit\n",
test);
 
+   /* Does dup3(O_CLOEXEC) ever work? */
+   if ((fd2 = dup3(fd1, fd1 + 1, O_CLOEXEC)) < 0)
+   err(1, "dup3(O_CLOEXEC)");
+   printf("ok %d - dup3(O_CLOEXEC) works\n", ++test);
+
+   /* Do we get the right fd? */
+   ++test;
+   if (fd2 != fd1 + 1)
+   printf(
+   "no ok %d - dup3(O_CLOEXEC) didn't give us the right fd\n",
+   test);
+   else
+   printf("ok %d - dup3(O_CLOEXEC) returned a correct fd\n",
+   test);
+
+   /* Was close-on-exec set? */
+   ++test;
+   if (fcntl(fd2, F_GETFD) != FD_CLOEXEC)
+   printf(
+   "not ok %d - dup3(O_CLOEXEC) didn't set close-on-exec\n",
+   test);
+   else
+   printf("ok %d - dup3(O_CLOEXEC) set close-on-exec\n",
+   test);
+
+   /* Does dup3(0) ever work? */
+   if ((fd2 = dup3(fd1, fd1 + 1, 0)) < 0)
+   err(1, "dup3(0)");
+   printf("ok %d - dup3(0) works\n", ++test);
+
+   /* Do we get the right fd? */
+   ++test;
+   if (fd2 != fd1 + 1)
+   printf(
+   "no ok %d - dup3(0) didn't give us the right fd\n",
+   test);
+   else
+   printf("ok %d - dup3(0) returned a correct fd\n",
+   test);
+
+   /* Was close-on-exec cleared? */
+   ++test;
+   if (fcntl(fd2, F_GETFD) != 0)
+   printf(
+   "not ok %d - dup3(0) didn't clear close-on-exec\n",
+   test);
+   else
+   printf("ok %d - dup3(0) cleared close-on-exec\n",
+   test);
+
+   /* dup3() does not allow duplicating to the same fd */
+   ++test;
+   if (dup3(fd1, fd1, O_CLOEXEC) != -1)
+   printf(
+   "not ok %d - dup3(fd1, fd1, O_CLOEXEC) succeeded\n", test);
+   else
+   printf("ok %d - dup3(fd1, fd1, O_CLOEXEC) failed\n", test);
+
+   ++test;
+   if (dup3(fd1, fd1, 0) != -1)
+   printf(
+   "not ok %d - dup3(fd1, fd1, 0) succeeded\n", test);
+   else
+   printf("ok %d - dup3(fd1, fd1, 0) failed\n", test);
+
+   ++test;
+   if (getrlimit(RLIMIT_NOFILE, &rlp) < 0)
+   err(1, "getrlimit");
+   if ((fd2 = dup3(fd1, rlp.rlim_cur + 1, O_CLOEXEC)) >= 0)
+   printf("not ok %d - dup3(O_CLOEXEC) bypassed NOFILE limit\n",
+   test);
+   else
+   printf("ok %d - dup3(O_CLOEXEC) didn't bypass NOFILE limit\n",
+   test);
+
return (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"


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

2013-08-16 Thread Jilles Tjoelker
Author: jilles
Date: Fri Aug 16 13:48:11 2013
New Revision: 254412
URL: http://svnweb.freebsd.org/changeset/base/254412

Log:
  sh: Add test for the non-standard jobid builtin.

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

Added: head/tools/regression/bin/sh/builtins/jobid1.0
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/tools/regression/bin/sh/builtins/jobid1.0  Fri Aug 16 13:48:11 
2013(r254412)
@@ -0,0 +1,7 @@
+# $FreeBSD$
+# Non-standard builtin.
+
+: &
+p1=$!
+p2=$(jobid)
+[ "${p1:?}" = "${p2:?}" ]
___
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: r254413 - in head: bin/sh tools/regression/bin/sh/builtins

2013-08-16 Thread Jilles Tjoelker
Author: jilles
Date: Fri Aug 16 13:56:43 2013
New Revision: 254413
URL: http://svnweb.freebsd.org/changeset/base/254413

Log:
  sh: Recognize "--" as end of options in bg/fg/jobid builtins.

Added:
  head/tools/regression/bin/sh/builtins/jobid2.0   (contents, props changed)
Modified:
  head/bin/sh/jobs.c

Modified: head/bin/sh/jobs.c
==
--- head/bin/sh/jobs.c  Fri Aug 16 13:48:11 2013(r254412)
+++ head/bin/sh/jobs.c  Fri Aug 16 13:56:43 2013(r254413)
@@ -183,13 +183,14 @@ out:  out2fmt_flush("sh: 
can't access 
 
 #if JOBS
 int
-fgcmd(int argc __unused, char **argv)
+fgcmd(int argc __unused, char **argv __unused)
 {
struct job *jp;
pid_t pgrp;
int status;
 
-   jp = getjob(argv[1]);
+   nextopt("");
+   jp = getjob(*argptr);
if (jp->jobctl == 0)
error("job not created under job control");
printjobcmd(jp);
@@ -210,8 +211,9 @@ bgcmd(int argc, char **argv)
 {
struct job *jp;
 
+   nextopt("");
do {
-   jp = getjob(*++argv);
+   jp = getjob(*argptr);
if (jp->jobctl == 0)
error("job not created under job control");
if (jp->state == JOBDONE)
@@ -220,7 +222,7 @@ bgcmd(int argc, char **argv)
jp->foreground = 0;
out1fmt("[%td] ", jp - jobtab + 1);
printjobcmd(jp);
-   } while (--argc > 1);
+   } while (*argptr != NULL && *++argptr != NULL);
return 0;
 }
 
@@ -542,12 +544,13 @@ waitcmdloop(struct job *job)
 
 
 int
-jobidcmd(int argc __unused, char **argv)
+jobidcmd(int argc __unused, char **argv __unused)
 {
struct job *jp;
int i;
 
-   jp = getjob(argv[1]);
+   nextopt("");
+   jp = getjob(*argptr);
for (i = 0 ; i < jp->nprocs ; ) {
out1fmt("%d", (int)jp->ps[i].pid);
out1c(++i < jp->nprocs? ' ' : '\n');

Added: head/tools/regression/bin/sh/builtins/jobid2.0
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/tools/regression/bin/sh/builtins/jobid2.0  Fri Aug 16 13:56:43 
2013(r254413)
@@ -0,0 +1,9 @@
+# $FreeBSD$
+
+: &
+p1=$(jobid)
+p2=$(jobid --)
+p3=$(jobid %+)
+p4=$(jobid -- %+)
+[ "${p1:?}" = "${p2:?}" ] && [ "${p2:?}" = "${p3:?}" ] &&
+[ "${p3:?}" = "${p4:?}" ] && [ "${p4:?}" = "${p1:?}" ]
___
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: r254414 - head/lib/libc/sys

2013-08-16 Thread Jilles Tjoelker
Author: jilles
Date: Fri Aug 16 14:06:29 2013
New Revision: 254414
URL: http://svnweb.freebsd.org/changeset/base/254414

Log:
  pselect(2): Add xref to sigsuspend(2).

Modified:
  head/lib/libc/sys/pselect.2

Modified: head/lib/libc/sys/pselect.2
==
--- head/lib/libc/sys/pselect.2 Fri Aug 16 13:56:43 2013(r254413)
+++ head/lib/libc/sys/pselect.2 Fri Aug 16 14:06:29 2013(r254414)
@@ -28,7 +28,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd October 27, 2009
+.Dd August 16, 2013
 .Dt PSELECT 2
 .Os
 .Sh NAME
@@ -104,7 +104,8 @@ and (if a signal mask is provided)
 .Xr kqueue 2 ,
 .Xr poll 2 ,
 .Xr select 2 ,
-.Xr sigprocmask 2
+.Xr sigprocmask 2 ,
+.Xr sigsuspend 2
 .Sh STANDARDS
 The
 .Fn pselect
___
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: r254415 - in head/sys: dev/streams fs/devfs kern sys

2013-08-16 Thread Konstantin Belousov
Author: kib
Date: Fri Aug 16 14:22:20 2013
New Revision: 254415
URL: http://svnweb.freebsd.org/changeset/base/254415

Log:
  Restore the previous sendfile(2) behaviour on the block devices.
  Provide valid .fo_sendfile method for several missed struct fileops.
  
  Reviewed by:  glebius
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/dev/streams/streams.c
  head/sys/fs/devfs/devfs_vnops.c
  head/sys/kern/sys_procdesc.c
  head/sys/kern/vfs_vnops.c
  head/sys/sys/file.h

Modified: head/sys/dev/streams/streams.c
==
--- head/sys/dev/streams/streams.c  Fri Aug 16 14:06:29 2013
(r254414)
+++ head/sys/dev/streams/streams.c  Fri Aug 16 14:22:20 2013
(r254415)
@@ -98,6 +98,7 @@ static struct fileops svr4_netops = {
.fo_close =  svr4_soo_close,
.fo_chmod = invfo_chmod,
.fo_chown = invfo_chown,
+   .fo_sendfile = invfo_sendfile,
 };
  
 static struct cdevsw streams_cdevsw = {

Modified: head/sys/fs/devfs/devfs_vnops.c
==
--- head/sys/fs/devfs/devfs_vnops.c Fri Aug 16 14:06:29 2013
(r254414)
+++ head/sys/fs/devfs/devfs_vnops.c Fri Aug 16 14:22:20 2013
(r254415)
@@ -1696,6 +1696,7 @@ static struct fileops devfs_ops_f = {
.fo_close = devfs_close_f,
.fo_chmod = vn_chmod,
.fo_chown = vn_chown,
+   .fo_sendfile =  vn_sendfile,
.fo_flags = DFLAG_PASSABLE | DFLAG_SEEKABLE
 };
 

Modified: head/sys/kern/sys_procdesc.c
==
--- head/sys/kern/sys_procdesc.cFri Aug 16 14:06:29 2013
(r254414)
+++ head/sys/kern/sys_procdesc.cFri Aug 16 14:22:20 2013
(r254415)
@@ -113,6 +113,7 @@ static struct fileops procdesc_ops = {
.fo_close = procdesc_close,
.fo_chmod = procdesc_chmod,
.fo_chown = procdesc_chown,
+   .fo_sendfile = invfo_sendfile,
.fo_flags = DFLAG_PASSABLE,
 };
 

Modified: head/sys/kern/vfs_vnops.c
==
--- head/sys/kern/vfs_vnops.c   Fri Aug 16 14:06:29 2013(r254414)
+++ head/sys/kern/vfs_vnops.c   Fri Aug 16 14:22:20 2013(r254415)
@@ -88,7 +88,6 @@ static fo_poll_t  vn_poll;
 static fo_kqfilter_t   vn_kqfilter;
 static fo_stat_t   vn_statfile;
 static fo_close_t  vn_closefile;
-extern fo_sendfile_t   vn_sendfile;
 
 struct fileops vnops = {
.fo_read = vn_io_fault,

Modified: head/sys/sys/file.h
==
--- head/sys/sys/file.h Fri Aug 16 14:06:29 2013(r254414)
+++ head/sys/sys/file.h Fri Aug 16 14:22:20 2013(r254415)
@@ -241,6 +241,8 @@ fo_chmod_t  invfo_chmod;
 fo_chown_t invfo_chown;
 fo_sendfile_t  invfo_sendfile;
 
+fo_sendfile_t  vn_sendfile;
+
 void finit(struct file *, u_int, short, void *, struct fileops *);
 int fgetvp(struct thread *td, int fd, cap_rights_t rights, struct vnode **vpp);
 int fgetvp_exec(struct thread *td, int fd, cap_rights_t rights,
___
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: r254410 - in head/lib/libc: gen sys

2013-08-16 Thread Benjamin Kaduk
On Fri, Aug 16, 2013 at 9:16 AM, Jilles Tjoelker  wrote:

> Author: jilles
> Date: Fri Aug 16 13:16:27 2013
> New Revision: 254410
> URL: http://svnweb.freebsd.org/changeset/base/254410
>
> Log:
>   Add man page dup3(3).
>
> Added: head/lib/libc/gen/dup3.3
>
> ==
> --- /dev/null   00:00:00 1970   (empty, because file is newly added)
> +++ head/lib/libc/gen/dup3.3Fri Aug 16 13:16:27 2013(r254410)
> @@ -0,0 +1,120 @@
> +.\" Copyright (c) 1980, 1991, 1993
> +.\"The Regents of the University of California.  All rights reserved.
>

You are donating the work to the Regents?  And it was done twenty years ago?


> +.\"
> +.\" Redistribution and use in source and binary forms, with or without
> +.\" modification, are permitted provided that the following conditions
> +.\" are met:
> +.\" 1. Redistributions of source code must retain the above copyright
> +.\"notice, this list of conditions and the following disclaimer.
> +.\" 2. Redistributions in binary form must reproduce the above copyright
> +.\"notice, this list of conditions and the following disclaimer in the
> +.\"documentation and/or other materials provided with the
> distribution.
> +.\" 4. Neither the name of the University nor the names of its
> contributors
> +.\"may be used to endorse or promote products derived from this
> software
> +.\"without specific prior written permission.
> +.\"
> +.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS''
> AND
> +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
> +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
> PURPOSE
> +.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
> LIABLE
> +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
> CONSEQUENTIAL
> +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
> GOODS
> +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
> +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
> STRICT
> +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY
> WAY
> +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
> +.\" SUCH DAMAGE.
> +.\"
> +.\" @(#)dup.2  8.1 (Berkeley) 6/4/93
>

This file is not named dup.2...


> +.\" $FreeBSD$
> +.\"
> +.Dd August 16, 2013
> +.Dt DUP3 3
> +.Os
> +.Sh NAME
> +.Nm dup3
> +.Nd duplicate an existing file descriptor
> +.Sh LIBRARY
> +.Lb libc
> +.Sh SYNOPSIS
> +.In fcntl.h
> +.In unistd.h
> +.Ft int
> +.Fn dup3 "int oldd" "int newd" "int flags"
> +.Sh DESCRIPTION
> +The
> +.Fn dup3
>

Hmm, I guess .Nm is not quite appropriate here, so this is okay.

-Ben


> +function
> +duplicates an existing object descriptor
> +while allowing the value of the new descriptor to be specified.
___
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: r254416 - head/sys/cam/scsi

2013-08-16 Thread Kenneth D. Merry
Author: ken
Date: Fri Aug 16 16:14:32 2013
New Revision: 254416
URL: http://svnweb.freebsd.org/changeset/base/254416

Log:
  Add unmapped I/O and larger I/O support to the sa(4) driver.
  
  We now pay attention to the maxio field in the XPT_PATH_INQ CCB,
  and if it is set, propagate it up to physio via the si_iosize_max
  field in the cdev structure.
  
  We also now pay attention to the PIM_UNMAPPED capability bit in the
  XPT_PATH_INQ CCB, and set the new SI_UNMAPPED cdev flag when the
  underlying SIM supports unmapped I/O.
  
  scsi_sa.c:Add unmapped I/O support and propagate the SIM's
maximum I/O size up.
  
Adjust scsi_tape_read_write() in the same way that
scsi_read_write() was changed to support unmapped
I/O.  We overload the readop parameter with bits
that tell us whether it's an unmapped I/O, and we
need to set the CAM_DATA_BIO CCB flag.  This change
should be backwards compatible in source and
binary forms.
  
  MFC after:1 week
  Sponsored by: Spectra Logic

Modified:
  head/sys/cam/scsi/scsi_sa.c

Modified: head/sys/cam/scsi/scsi_sa.c
==
--- head/sys/cam/scsi/scsi_sa.c Fri Aug 16 14:22:20 2013(r254415)
+++ head/sys/cam/scsi/scsi_sa.c Fri Aug 16 16:14:32 2013(r254416)
@@ -212,6 +212,7 @@ struct sa_softc {
sa_statestate;
sa_flagsflags;
sa_quirks   quirks;
+   u_int   si_flags;
struct  bio_queue_head bio_queue;
int queue_count;
struct  devstat *device_stats;
@@ -221,6 +222,7 @@ struct sa_softc {
int blk_shift;
u_int32_t   max_blk;
u_int32_t   min_blk;
+   u_int32_t   maxio;
u_int32_t   comp_algorithm;
u_int32_t   saved_comp_algorithm;
u_int32_t   media_blksize;
@@ -447,7 +449,7 @@ static struct cdevsw sa_cdevsw = {
.d_ioctl =  saioctl,
.d_strategy =   sastrategy,
.d_name =   "sa",
-   .d_flags =  D_TAPE | D_NEEDGIANT,
+   .d_flags =  D_TAPE,
 };
 
 static int
@@ -1506,10 +1508,29 @@ saregister(struct cam_periph *periph, vo
DEVSTAT_BS_UNAVAILABLE, SID_TYPE(&cgd->inq_data) |
XPORT_DEVSTAT_TYPE(cpi.transport), DEVSTAT_PRIORITY_TAPE);
 
+   /*
+* If maxio isn't set, we fall back to DFLTPHYS.  If it is set, we
+* take it whether or not it's larger than MAXPHYS.  physio will
+* break it down into pieces small enough to fit in a buffer.
+*/
+   if (cpi.maxio == 0)
+   softc->maxio = DFLTPHYS;
+   else
+   softc->maxio = cpi.maxio;
+
+   /*
+* If the SIM supports unmapped I/O, let physio know that we can
+* handle unmapped buffers.
+*/
+   if (cpi.hba_misc & PIM_UNMAPPED)
+   softc->si_flags = SI_UNMAPPED;
+
softc->devs.ctl_dev = make_dev(&sa_cdevsw, SAMINOR(SA_CTLDEV,
0, SA_ATYPE_R), UID_ROOT, GID_OPERATOR,
0660, "%s%d.ctl", periph->periph_name, periph->unit_number);
softc->devs.ctl_dev->si_drv1 = periph;
+   softc->devs.ctl_dev->si_iosize_max = softc->maxio;
+   softc->devs.ctl_dev->si_flags |= softc->si_flags;
 
for (i = 0; i < SA_NUM_MODES; i++) {
 
@@ -1518,18 +1539,24 @@ saregister(struct cam_periph *periph, vo
UID_ROOT, GID_OPERATOR, 0660, "%s%d.%d",
periph->periph_name, periph->unit_number, i);
softc->devs.mode_devs[i].r_dev->si_drv1 = periph;
+   softc->devs.mode_devs[i].r_dev->si_iosize_max = softc->maxio;
+   softc->devs.mode_devs[i].r_dev->si_flags |= softc->si_flags;
 
softc->devs.mode_devs[i].nr_dev = make_dev(&sa_cdevsw,
SAMINOR(SA_NOT_CTLDEV, i, SA_ATYPE_NR),
UID_ROOT, GID_OPERATOR, 0660, "n%s%d.%d",
periph->periph_name, periph->unit_number, i);
softc->devs.mode_devs[i].nr_dev->si_drv1 = periph;
+   softc->devs.mode_devs[i].nr_dev->si_iosize_max = softc->maxio;
+   softc->devs.mode_devs[i].nr_dev->si_flags |= softc->si_flags;
 
softc->devs.mode_devs[i].er_dev = make_dev(&sa_cdevsw,
SAMINOR(SA_NOT_CTLDEV, i, SA_ATYPE_ER),
UID_ROOT, GID_OPERATOR, 0660, "e%s%d.%d",
periph->periph_name, periph->unit_number, i);
softc->devs.mode_devs[i].er_dev->si_drv1 = periph;
+   softc->devs.mode_devs[i].er_dev->si_iosize_max = softc->maxio;
+   softc->devs.mode_devs[i].er_dev->si_flags |= softc->si_flags;
 
/*
 * Make the (well known) aliases for the first mode.
@@ -1540,12 +1567,20 @@ saregister(struct cam_periph *

Re: svn commit: r254410 - in head/lib/libc: gen sys

2013-08-16 Thread Jilles Tjoelker
On Fri, Aug 16, 2013 at 11:56:03AM -0400, Benjamin Kaduk wrote:
> On Fri, Aug 16, 2013 at 9:16 AM, Jilles Tjoelker  wrote:
> > Author: jilles
> > Date: Fri Aug 16 13:16:27 2013
> > New Revision: 254410
> > URL: http://svnweb.freebsd.org/changeset/base/254410

> > Log:
> >   Add man page dup3(3).

> > Added: head/lib/libc/gen/dup3.3

> > ==
> > --- /dev/null   00:00:00 1970   (empty, because file is newly added)
> > +++ head/lib/libc/gen/dup3.3Fri Aug 16 13:16:27 2013(r254410)
> > @@ -0,0 +1,120 @@
> > +.\" Copyright (c) 1980, 1991, 1993
> > +.\"The Regents of the University of California.  All rights reserved.

> You are donating the work to the Regents?  And it was done twenty
> years ago?

Hmm, I did not adjust that when copying dup.2. It looks like very few
words remain from the original: only the first few words of the
description, the [EBADF] error description and the xref list. So can I
put in only my own name using share/examples/etc/bsd-style-copyright?

I did not use Jukka Ukkonen's submitted man page.

> > +.\"
> > +.\" Redistribution and use in source and binary forms, with or without
> > +.\" modification, are permitted provided that the following conditions
> > +.\" are met:
> > +.\" 1. Redistributions of source code must retain the above copyright
> > +.\"notice, this list of conditions and the following disclaimer.
> > +.\" 2. Redistributions in binary form must reproduce the above copyright
> > +.\"notice, this list of conditions and the following disclaimer in the
> > +.\"documentation and/or other materials provided with the
> > distribution.
> > +.\" 4. Neither the name of the University nor the names of its
> > contributors
> > +.\"may be used to endorse or promote products derived from this
> > software
> > +.\"without specific prior written permission.
> > +.\"
> > +.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS''
> > AND
> > +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
> > +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
> > PURPOSE
> > +.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
> > LIABLE
> > +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
> > CONSEQUENTIAL
> > +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
> > GOODS
> > +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
> > +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
> > STRICT
> > +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY
> > WAY
> > +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
> > +.\" SUCH DAMAGE.
> > +.\"
> > +.\" @(#)dup.2  8.1 (Berkeley) 6/4/93

> This file is not named dup.2...

Also from the original.

> > +.\" $FreeBSD$
> > +.\"
> > +.Dd August 16, 2013
> > +.Dt DUP3 3
> > +.Os
> > +.Sh NAME
> > +.Nm dup3
> > +.Nd duplicate an existing file descriptor
> > +.Sh LIBRARY
> > +.Lb libc
> > +.Sh SYNOPSIS
> > +.In fcntl.h
> > +.In unistd.h
> > +.Ft int
> > +.Fn dup3 "int oldd" "int newd" "int flags"
> > +.Sh DESCRIPTION
> > +The
> > +.Fn dup3

> Hmm, I guess .Nm is not quite appropriate here, so this is okay.

-- 
Jilles Tjoelker
___
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: r254417 - head

2013-08-16 Thread Simon J. Gerraty
Author: sjg
Date: Fri Aug 16 16:26:23 2013
New Revision: 254417
URL: http://svnweb.freebsd.org/changeset/base/254417

Log:
  When we need to build using the in-tree make,
  switch at the earliest opportunity.
  In the case of fmake vs bmake, this helps ensure correct load handling.
  
  Reviewed by: obrien

Modified:
  head/Makefile

Modified: head/Makefile
==
--- head/Makefile   Fri Aug 16 16:14:32 2013(r254416)
+++ head/Makefile   Fri Aug 16 16:26:23 2013(r254417)
@@ -242,6 +242,7 @@ cleanworld:
 # skip this for -n to avoid changing previous behavior of 
 # 'make -n buildworld' etc.
 ${TGTS}: .MAKE
+tinderbox toolchains kernel-toolchains: .MAKE
 .endif
 
 ${TGTS}:
@@ -353,14 +354,16 @@ make bmake: .PHONY
${MMAKE} all && \
${MMAKE} install DESTDIR=${MYMAKE:H} BINDIR= 
PROGNAME=${MYMAKE:T}
 
+tinderbox toolchains kernel-toolchains: upgrade_checks
+
 tinderbox:
-   @cd ${.CURDIR} && ${MAKE} DOING_TINDERBOX=YES universe
+   @cd ${.CURDIR} && ${SUB_MAKE} DOING_TINDERBOX=YES universe
 
 toolchains:
-   @cd ${.CURDIR} && ${MAKE} UNIVERSE_TARGET=toolchain universe
+   @cd ${.CURDIR} && ${SUB_MAKE} UNIVERSE_TARGET=toolchain universe
 
 kernel-toolchains:
-   @cd ${.CURDIR} && ${MAKE} UNIVERSE_TARGET=kernel-toolchain universe
+   @cd ${.CURDIR} && ${SUB_MAKE} UNIVERSE_TARGET=kernel-toolchain universe
 
 #
 # universe
@@ -419,7 +422,7 @@ universe_${target}_prologue: universe_pr
 .if !defined(MAKE_JUST_KERNELS)
 .for target_arch in ${TARGET_ARCHES_${target}}
 universe_${target}: universe_${target}_${target_arch}
-universe_${target}_${target_arch}: universe_${target}_prologue
+universe_${target}_${target_arch}: universe_${target}_prologue .MAKE
@echo ">> ${target}.${target_arch} ${UNIVERSE_TARGET} started on 
`LC_ALL=C date`"
@(cd ${.CURDIR} && env __MAKE_CONF=/dev/null \
${SUB_MAKE} ${JFLAG} ${UNIVERSE_TARGET} \
@@ -440,7 +443,7 @@ universe_${target}_kernels: universe_${t
 .endfor
 .endif
 universe_${target}: universe_${target}_kernels
-universe_${target}_kernels: universe_${target}_prologue
+universe_${target}_kernels: universe_${target}_prologue .MAKE
 .if exists(${KERNSRCDIR}/${target}/conf/NOTES)
@(cd ${KERNSRCDIR}/${target}/conf && env __MAKE_CONF=/dev/null \
${SUB_MAKE} LINT > ${.CURDIR}/_.${target}.makeLINT 2>&1 || \
@@ -468,7 +471,7 @@ TARGET_ARCH_${kernel}!= cd ${KERNSRCDIR}
 .error "Target architecture for ${TARGET}/conf/${kernel} unknown.  config(8) 
likely too old."
 .endif
 universe_kernconfs: universe_kernconf_${TARGET}_${kernel}
-universe_kernconf_${TARGET}_${kernel}:
+universe_kernconf_${TARGET}_${kernel}: .MAKE
@(cd ${.CURDIR} && env __MAKE_CONF=/dev/null \
${SUB_MAKE} ${JFLAG} buildkernel \
TARGET=${TARGET} \
___
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: r254309 - in head: share/man/man9 sys/cddl/contrib/opensolaris/uts/common/dtrace sys/cddl/dev/dtrace sys/cddl/dev/sdt sys/kern sys/sys

2013-08-16 Thread Mark Johnston
On Wed, Aug 14, 2013 at 08:19:13AM -0400, John Baldwin wrote:
> On Tuesday, August 13, 2013 8:42:22 pm Mark Johnston wrote:
> > Author: markj
> > Date: Wed Aug 14 00:42:21 2013
> > New Revision: 254309
> > URL: http://svnweb.freebsd.org/changeset/base/254309
> > 
> > Log:
> >   Use kld_{load,unload} instead of mod_{load,unload} for the linker file 
> > load
> >   and unload event handlers added in r254266.
> >   
> >   Reported by:  jhb
> >   X-MFC with:   r254266
> 
> Thanks!  BTW, it would be really nice to replace HWPMC_HOOKS in kern_linker.c 
> with
> EVENTHANDLER calls.  I think kld_load would just work (though you might need 
> to
> downgrade the lock before you run it).  For kld_unload it seems you want two 
> events,
> a kld_unload_try for your newly added event (since it can reject a 
> kld_unload), and
> perhaps kld_unload at the end where the current HWPMC_HOOK is.  Just an idea 
> if
> someone is looking for something to do.  I know there are other modules that 
> need
> to hook into linker events like this, and making HWPMC_HOOKS more generic 
> would be
> a big help.

Ok, I have a couple of patches which do this. The first diff fixes the
locking issue in linker_file_lookup_set(). It ensures that this function
is always called with the linker lock held; it's only called from
kern_linker.c and sdt.c. The assertion in linker_file_lookup_set()
checks for !cold to avoid adding some unnecessary locking in
linker_preload().

The second diff below renames the kld_unload event to kld_unload_try,
adds a kld_unload eventhandler, and converts hwpmc(4) to use kld_load
and kld_unload. So now the kld_load and kld_unload handlers are invoked
with the shared lock held, and the kld_unload_try handlers are invoked
with the exclusive lock held.

I've done a bunch of testing with module loads/unloads and made sure
that the hwpmc and DTrace handlers are being called correctly. Would you
be able to review the diff when you have a chance? The combined diff is
also here:
http://people.freebsd.org/~markj/patches/hwpmc-eh/hwpmc-eh-2.diff

Thanks!
-Mark

diff 1:

diff --git a/sys/kern/kern_linker.c b/sys/kern/kern_linker.c
index 3e500f3..528666c 100644
--- a/sys/kern/kern_linker.c
+++ b/sys/kern/kern_linker.c
@@ -81,6 +81,10 @@ TUNABLE_INT("debug.kld_debug", &kld_debug);
if (!cold)  \
sx_assert(&kld_sx, SX_XLOCKED); \
 } while (0)
+#defineKLD_LOCK_READ_ASSERT() do { 
\
+   if (!cold)  \
+   sx_assert(&kld_sx, SX_LOCKED);  \
+} while (0)
 
 /*
  * static char *linker_search_path(const char *name, struct mod_depend
@@ -208,6 +212,8 @@ linker_file_sysinit(linker_file_t lf)
KLD_DPF(FILE, ("linker_file_sysinit: calling SYSINITs for %s\n",
lf->filename));
 
+   KLD_LOCK_ASSERT();
+
if (linker_file_lookup_set(lf, "sysinit_set", &start, &stop, NULL) != 0)
return;
/*
@@ -233,6 +239,7 @@ linker_file_sysinit(linker_file_t lf)
 * Traverse the (now) ordered list of system initialization tasks.
 * Perform each task, and continue on to the next task.
 */
+   KLD_UNLOCK();
mtx_lock(&Giant);
for (sipp = start; sipp < stop; sipp++) {
if ((*sipp)->subsystem == SI_SUB_DUMMY)
@@ -242,6 +249,7 @@ linker_file_sysinit(linker_file_t lf)
(*((*sipp)->func)) ((*sipp)->udata);
}
mtx_unlock(&Giant);
+   KLD_LOCK();
 }
 
 static void
@@ -252,6 +260,8 @@ linker_file_sysuninit(linker_file_t lf)
KLD_DPF(FILE, ("linker_file_sysuninit: calling SYSUNINITs for %s\n",
lf->filename));
 
+   KLD_LOCK_ASSERT();
+
if (linker_file_lookup_set(lf, "sysuninit_set", &start, &stop,
NULL) != 0)
return;
@@ -279,6 +289,7 @@ linker_file_sysuninit(linker_file_t lf)
 * Traverse the (now) ordered list of system initialization tasks.
 * Perform each task, and continue on to the next task.
 */
+   KLD_UNLOCK();
mtx_lock(&Giant);
for (sipp = start; sipp < stop; sipp++) {
if ((*sipp)->subsystem == SI_SUB_DUMMY)
@@ -288,6 +299,7 @@ linker_file_sysuninit(linker_file_t lf)
(*((*sipp)->func)) ((*sipp)->udata);
}
mtx_unlock(&Giant);
+   KLD_LOCK();
 }
 
 static void
@@ -299,13 +311,17 @@ linker_file_register_sysctls(linker_file_t lf)
("linker_file_register_sysctls: registering SYSCTLs for %s\n",
lf->filename));
 
+   KLD_LOCK_ASSERT();
+
if (linker_file_lookup_set(lf, "sysctl_set", &start, &stop, NULL) != 0)
return;
 
+   KLD_UNLOCK();
sysctl_lock();
for (oidp = start; oidp < stop; oidp++)
sysctl_register_oid(*oidp);
sysctl_unlock();
+   KLD_LO

Re: svn commit: r254309 - in head: share/man/man9 sys/cddl/contrib/opensolaris/uts/common/dtrace sys/cddl/dev/dtrace sys/cddl/dev/sdt sys/kern sys/sys

2013-08-16 Thread Davide Italiano
[trim old mails]

> diff --git a/sys/sys/pmckern.h b/sys/sys/pmckern.h
> index e3e18a6..90585de 100644
> --- a/sys/sys/pmckern.h
> +++ b/sys/sys/pmckern.h
> @@ -51,13 +51,11 @@
>  #definePMC_FN_CSW_IN   2
>  #definePMC_FN_CSW_OUT  3
>  #definePMC_FN_DO_SAMPLES   4
> -#definePMC_FN_KLD_LOAD 5
> -#definePMC_FN_KLD_UNLOAD   6
> -#definePMC_FN_MMAP 7
> -#definePMC_FN_MUNMAP   8
> -#definePMC_FN_USER_CALLCHAIN   9
> -#definePMC_FN_USER_CALLCHAIN_SOFT  10
> -#definePMC_FN_SOFT_SAMPLING11
> +#definePMC_FN_MMAP 5
> +#definePMC_FN_MUNMAP   6
> +#definePMC_FN_USER_CALLCHAIN   7
> +#definePMC_FN_USER_CALLCHAIN_SOFT  8
> +#definePMC_FN_SOFT_SAMPLING9
>

I've skimmed over your patch quickly so I could miss something, but I
worry about this change breaking the KBI.
Does this make sense for you?


>  #definePMC_HR  0   /* Hardware ring buffer */
>  #definePMC_SR  1   /* Software ring buffer */
>

Thanks,

-- 
Davide

"There are no solved problems; there are only problems that are more
or less solved" -- Henri Poincare
___
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: r254309 - in head: share/man/man9 sys/cddl/contrib/opensolaris/uts/common/dtrace sys/cddl/dev/dtrace sys/cddl/dev/sdt sys/kern sys/sys

2013-08-16 Thread Mark Johnston
On Fri, Aug 16, 2013 at 07:13:16PM +0200, Davide Italiano wrote:
> [trim old mails]
> 
> > diff --git a/sys/sys/pmckern.h b/sys/sys/pmckern.h
> > index e3e18a6..90585de 100644
> > --- a/sys/sys/pmckern.h
> > +++ b/sys/sys/pmckern.h
> > @@ -51,13 +51,11 @@
> >  #definePMC_FN_CSW_IN   2
> >  #definePMC_FN_CSW_OUT  3
> >  #definePMC_FN_DO_SAMPLES   4
> > -#definePMC_FN_KLD_LOAD 5
> > -#definePMC_FN_KLD_UNLOAD   6
> > -#definePMC_FN_MMAP 7
> > -#definePMC_FN_MUNMAP   8
> > -#definePMC_FN_USER_CALLCHAIN   9
> > -#definePMC_FN_USER_CALLCHAIN_SOFT  10
> > -#definePMC_FN_SOFT_SAMPLING11
> > +#definePMC_FN_MMAP 5
> > +#definePMC_FN_MUNMAP   6
> > +#definePMC_FN_USER_CALLCHAIN   7
> > +#definePMC_FN_USER_CALLCHAIN_SOFT  8
> > +#definePMC_FN_SOFT_SAMPLING9
> >
> 
> I've skimmed over your patch quickly so I could miss something, but I
> worry about this change breaking the KBI.
> Does this make sense for you?

I think you're right. I considered this last night, but it didn't occur
to me that external modules might try to invoke these hooks. I'm not
sure if such modules exist, but it's better to be safe. I updated the
patch here:

http://people.freebsd.org/~markj/patches/hwpmc-eh/hwpmc-eh-3.diff

Thanks!
-Mark
___
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: r254380 - in head/sys: kern sys

2013-08-16 Thread Colin Percival
On 08/16/13 02:38, Ivan Voras wrote:
>> We have a single-writer / multiple-readers lock on *any particular byte*
>> of a vnode.  The rangelock code is what keeps track of this, and the
>> locking contention I was reducing was in the rangelock bookkeeping.
> 
> So, for example, if multiple processes or multiple threads read or
> write a file somewhat unintelligently (a small file, operations on the
> whole file, like in blogbench), they will effectively content for the
> byte 0, right?

There can be multiple reads or one write, so yes there would be contention
in that case.

-- 
Colin Percival
Security Officer Emeritus, FreeBSD | The power to serve
Founder, Tarsnap | www.tarsnap.com | Online backups for the truly paranoid

___
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: r254419 - head/contrib/bmake

2013-08-16 Thread Simon J. Gerraty
Author: sjg
Date: Fri Aug 16 18:47:18 2013
New Revision: 254419
URL: http://svnweb.freebsd.org/changeset/base/254419

Log:
  Add .MAKE.ALWAYS_PASS_JOB_QUEUE knob (default yes)
  for backwards compatability.

Modified:
  head/contrib/bmake/job.c
  head/contrib/bmake/make.1

Modified: head/contrib/bmake/job.c
==
--- head/contrib/bmake/job.cFri Aug 16 16:55:39 2013(r254418)
+++ head/contrib/bmake/job.cFri Aug 16 18:47:18 2013(r254419)
@@ -172,6 +172,14 @@ __RCSID("$NetBSD: job.c,v 1.175 2013/07/
 # define STATIC static
 
 /*
+ * FreeBSD: traditionally .MAKE is not required to
+ * pass jobs queue to sub-makes.
+ * Use .MAKE.ALWAYS_PASS_JOB_QUEUE=no to disable.
+ */
+#define MAKE_ALWAYS_PASS_JOB_QUEUE ".MAKE.ALWAYS_PASS_JOB_QUEUE"
+static int Always_pass_job_queue = TRUE;
+
+/*
  * error handling variables
  */
 static int errors = 0; /* number of errors reported */
@@ -1360,7 +1368,7 @@ JobExec(Job *job, char **argv)
(void)fcntl(0, F_SETFD, 0);
(void)lseek(0, (off_t)0, SEEK_SET);
 
-   if (job->node->type & OP_MAKE) {
+   if (Always_pass_job_queue || (job->node->type & OP_MAKE)) {
/*
 * Pass job token pipe to submakes.
 */
@@ -2226,6 +2234,9 @@ Job_Init(void)
 
 lastNode =   NULL;
 
+Always_pass_job_queue = getBoolean(MAKE_ALWAYS_PASS_JOB_QUEUE,
+  Always_pass_job_queue);
+
 /*
  * There is a non-zero chance that we already have children.
  * eg after 'make -f- 

Re: svn commit: r254415 - in head/sys: dev/streams fs/devfs kern sys

2013-08-16 Thread Zbigniew Bodek
2013/8/16 Konstantin Belousov 

> Author: kib
> Date: Fri Aug 16 14:22:20 2013
> New Revision: 254415
> URL: http://svnweb.freebsd.org/changeset/base/254415
>
> Log:
>   Restore the previous sendfile(2) behaviour on the block devices.
>   Provide valid .fo_sendfile method for several missed struct fileops.
>
>   Reviewed by:  glebius
>   Sponsored by: The FreeBSD Foundation
>
> Modified:
>   head/sys/dev/streams/streams.c
>   head/sys/fs/devfs/devfs_vnops.c
>   head/sys/kern/sys_procdesc.c
>   head/sys/kern/vfs_vnops.c
>   head/sys/sys/file.h
>
>
Hello Konstantin.

I believe that this commit adds redundant vn_sendfile declaration. Please
see below:

c1: warnings being treated as errors
sys/kern/uipc_syscalls.c:161: warning: redundant redeclaration of
'vn_sendfile' [-Wredundant-decls]
sys/sys/file.h:244: warning: previous declaration of 'vn_sendfile' was here

Best regards
Zbyszek Bodek
___
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: r254419 - head/contrib/bmake

2013-08-16 Thread Juli Mallett
On Fri, Aug 16, 2013 at 11:47 AM, Simon J. Gerraty  wrote:

> Author: sjg
> Date: Fri Aug 16 18:47:18 2013
> New Revision: 254419
> URL: http://svnweb.freebsd.org/changeset/base/254419
>
> Log:
>   Add .MAKE.ALWAYS_PASS_JOB_QUEUE knob (default yes)
>   for backwards compatability.
>

Thanks very much.  Do you have some sense of when/if this might switch to a
default of "no"?  If so, it seems like it might be good to note that
dependence on that behaviour is deprecated and will be removed in
11.0-RELEASE or whenever you think appropriate.

Thanks again,
Juli.
___
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: r254420 - vendor-sys/illumos/dist/uts/common/fs/zfs

2013-08-16 Thread Xin LI
Author: delphij
Date: Fri Aug 16 19:23:44 2013
New Revision: 254420
URL: http://svnweb.freebsd.org/changeset/base/254420

Log:
  Update vendor-sys/illumos/dist to illumos-gate 14133:4caa3904e52a:
  
  Illumos ZFS issues:
4039 zfs_rename()/zfs_link() needs stronger test for XDEV

Modified:
  vendor-sys/illumos/dist/uts/common/fs/zfs/zfs_vnops.c

Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/zfs_vnops.c
==
--- vendor-sys/illumos/dist/uts/common/fs/zfs/zfs_vnops.c   Fri Aug 16 
18:47:18 2013(r254419)
+++ vendor-sys/illumos/dist/uts/common/fs/zfs/zfs_vnops.c   Fri Aug 16 
19:23:44 2013(r254420)
@@ -21,6 +21,7 @@
 /*
  * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
  * Copyright (c) 2013 by Delphix. All rights reserved.
+ * Copyright 2013 Nexenta Systems, Inc.  All rights reserved.
  */
 
 /* Portions Copyright 2007 Jeremy Teo */
@@ -3372,13 +3373,18 @@ zfs_rename(vnode_t *sdvp, char *snm, vno
if (VOP_REALVP(tdvp, &realvp, ct) == 0)
tdvp = realvp;
 
-   if (tdvp->v_vfsp != sdvp->v_vfsp || zfsctl_is_node(tdvp)) {
+   tdzp = VTOZ(tdvp);
+   ZFS_VERIFY_ZP(tdzp);
+
+   /*
+* We check z_zfsvfs rather than v_vfsp here, because snapshots and the
+* ctldir appear to have the same v_vfsp.
+*/
+   if (tdzp->z_zfsvfs != zfsvfs || zfsctl_is_node(tdvp)) {
ZFS_EXIT(zfsvfs);
return (SET_ERROR(EXDEV));
}
 
-   tdzp = VTOZ(tdvp);
-   ZFS_VERIFY_ZP(tdzp);
if (zfsvfs->z_utf8 && u8_validate(tnm,
strlen(tnm), NULL, U8_VALIDATE_ENTIRE, &error) < 0) {
ZFS_EXIT(zfsvfs);
@@ -3923,14 +3929,18 @@ zfs_link(vnode_t *tdvp, vnode_t *svp, ch
return (SET_ERROR(EPERM));
}
 
-   if (svp->v_vfsp != tdvp->v_vfsp || zfsctl_is_node(svp)) {
+   szp = VTOZ(svp);
+   ZFS_VERIFY_ZP(szp);
+
+   /*
+* We check z_zfsvfs rather than v_vfsp here, because snapshots and the
+* ctldir appear to have the same v_vfsp.
+*/
+   if (szp->z_zfsvfs != zfsvfs || zfsctl_is_node(svp)) {
ZFS_EXIT(zfsvfs);
return (SET_ERROR(EXDEV));
}
 
-   szp = VTOZ(svp);
-   ZFS_VERIFY_ZP(szp);
-
/* Prevent links to .zfs/shares files */
 
if ((error = sa_lookup(szp->z_sa_hdl, SA_ZPL_PARENT(zfsvfs),
___
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: r254421 - vendor-sys/illumos/dist/uts/common/fs/zfs vendor-sys/illumos/dist/uts/common/fs/zfs/sys vendor/illumos/dist/lib/libzfs/common vendor/illumos/dist/lib/libzfs_core/common

2013-08-16 Thread Xin LI
Author: delphij
Date: Fri Aug 16 19:27:29 2013
New Revision: 254421
URL: http://svnweb.freebsd.org/changeset/base/254421

Log:
  Update vendor/illumos/dist and vendor-sys/illumos/dist
  to illumos-gate 14137:f7523d207d74:
  
  Illumos ZFS issues:
3996 want a libzfs_core API to rollback to latest snapshot

Modified:
  vendor/illumos/dist/lib/libzfs/common/libzfs_dataset.c
  vendor/illumos/dist/lib/libzfs_core/common/libzfs_core.c
  vendor/illumos/dist/lib/libzfs_core/common/libzfs_core.h

Changes in other areas also in this revision:
Modified:
  vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_dataset.c
  vendor-sys/illumos/dist/uts/common/fs/zfs/sys/dsl_dataset.h
  vendor-sys/illumos/dist/uts/common/fs/zfs/zfs_ioctl.c

Modified: vendor/illumos/dist/lib/libzfs/common/libzfs_dataset.c
==
--- vendor/illumos/dist/lib/libzfs/common/libzfs_dataset.c  Fri Aug 16 
19:23:44 2013(r254420)
+++ vendor/illumos/dist/lib/libzfs/common/libzfs_dataset.c  Fri Aug 16 
19:27:29 2013(r254421)
@@ -3518,7 +3518,6 @@ zfs_rollback(zfs_handle_t *zhp, zfs_hand
 {
rollback_data_t cb = { 0 };
int err;
-   zfs_cmd_t zc = { 0 };
boolean_t restore_resv = 0;
uint64_t old_volsize, new_volsize;
zfs_prop_t resv_prop;
@@ -3550,22 +3549,15 @@ zfs_rollback(zfs_handle_t *zhp, zfs_hand
(old_volsize == zfs_prop_get_int(zhp, resv_prop));
}
 
-   (void) strlcpy(zc.zc_name, zhp->zfs_name, sizeof (zc.zc_name));
-
-   if (ZFS_IS_VOLUME(zhp))
-   zc.zc_objset_type = DMU_OST_ZVOL;
-   else
-   zc.zc_objset_type = DMU_OST_ZFS;
-
/*
 * We rely on zfs_iter_children() to verify that there are no
 * newer snapshots for the given dataset.  Therefore, we can
 * simply pass the name on to the ioctl() call.  There is still
 * an unlikely race condition where the user has taken a
 * snapshot since we verified that this was the most recent.
-*
 */
-   if ((err = zfs_ioctl(zhp->zfs_hdl, ZFS_IOC_ROLLBACK, &zc)) != 0) {
+   err = lzc_rollback(zhp->zfs_name, NULL, 0);
+   if (err != 0) {
(void) zfs_standard_error_fmt(zhp->zfs_hdl, errno,
dgettext(TEXT_DOMAIN, "cannot rollback '%s'"),
zhp->zfs_name);

Modified: vendor/illumos/dist/lib/libzfs_core/common/libzfs_core.c
==
--- vendor/illumos/dist/lib/libzfs_core/common/libzfs_core.cFri Aug 16 
19:23:44 2013(r254420)
+++ vendor/illumos/dist/lib/libzfs_core/common/libzfs_core.cFri Aug 16 
19:27:29 2013(r254421)
@@ -20,7 +20,7 @@
  */
 
 /*
- * Copyright (c) 2012 by Delphix. All rights reserved.
+ * Copyright (c) 2013 by Delphix. All rights reserved.
  * Copyright (c) 2013 Steven Hartland. All rights reserved.
  */
 
@@ -581,3 +581,27 @@ out:
free((void*)(uintptr_t)zc.zc_nvlist_dst);
return (error);
 }
+
+/*
+ * Roll back this filesystem or volume to its most recent snapshot.
+ * If snapnamebuf is not NULL, it will be filled in with the name
+ * of the most recent snapshot.
+ *
+ * Return 0 on success or an errno on failure.
+ */
+int
+lzc_rollback(const char *fsname, char *snapnamebuf, int snapnamelen)
+{
+   nvlist_t *args;
+   nvlist_t *result;
+   int err;
+
+   args = fnvlist_alloc();
+   err = lzc_ioctl(ZFS_IOC_ROLLBACK, fsname, args, &result);
+   nvlist_free(args);
+   if (err == 0 && snapnamebuf != NULL) {
+   const char *snapname = fnvlist_lookup_string(result, "target");
+   (void) strlcpy(snapnamebuf, snapname, snapnamelen);
+   }
+   return (err);
+}

Modified: vendor/illumos/dist/lib/libzfs_core/common/libzfs_core.h
==
--- vendor/illumos/dist/lib/libzfs_core/common/libzfs_core.hFri Aug 16 
19:23:44 2013(r254420)
+++ vendor/illumos/dist/lib/libzfs_core/common/libzfs_core.hFri Aug 16 
19:27:29 2013(r254421)
@@ -20,7 +20,7 @@
  */
 
 /*
- * Copyright (c) 2012 by Delphix. All rights reserved.
+ * Copyright (c) 2013 by Delphix. All rights reserved.
  */
 
 #ifndef_LIBZFS_CORE_H
@@ -58,6 +58,7 @@ int lzc_send_space(const char *snapname,
 
 boolean_t lzc_exists(const char *dataset);
 
+int lzc_rollback(const char *fsname, char *snapnamebuf, int snapnamelen);
 
 #ifdef __cplusplus
 }
___
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: r254421 - vendor-sys/illumos/dist/uts/common/fs/zfs vendor-sys/illumos/dist/uts/common/fs/zfs/sys vendor/illumos/dist/lib/libzfs/common vendor/illumos/dist/lib/libzfs_core/common

2013-08-16 Thread Xin LI
Author: delphij
Date: Fri Aug 16 19:27:29 2013
New Revision: 254421
URL: http://svnweb.freebsd.org/changeset/base/254421

Log:
  Update vendor/illumos/dist and vendor-sys/illumos/dist
  to illumos-gate 14137:f7523d207d74:
  
  Illumos ZFS issues:
3996 want a libzfs_core API to rollback to latest snapshot

Modified:
  vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_dataset.c
  vendor-sys/illumos/dist/uts/common/fs/zfs/sys/dsl_dataset.h
  vendor-sys/illumos/dist/uts/common/fs/zfs/zfs_ioctl.c

Changes in other areas also in this revision:
Modified:
  vendor/illumos/dist/lib/libzfs/common/libzfs_dataset.c
  vendor/illumos/dist/lib/libzfs_core/common/libzfs_core.c
  vendor/illumos/dist/lib/libzfs_core/common/libzfs_core.h

Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_dataset.c
==
--- vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_dataset.c Fri Aug 16 
19:23:44 2013(r254420)
+++ vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_dataset.c Fri Aug 16 
19:27:29 2013(r254421)
@@ -1722,6 +1722,7 @@ dsl_dataset_handoff_check(dsl_dataset_t 
 typedef struct dsl_dataset_rollback_arg {
const char *ddra_fsname;
void *ddra_owner;
+   nvlist_t *ddra_result;
 } dsl_dataset_rollback_arg_t;
 
 static int
@@ -1793,9 +1794,13 @@ dsl_dataset_rollback_sync(void *arg, dmu
dsl_pool_t *dp = dmu_tx_pool(tx);
dsl_dataset_t *ds, *clone;
uint64_t cloneobj;
+   char namebuf[ZFS_MAXNAMELEN];
 
VERIFY0(dsl_dataset_hold(dp, ddra->ddra_fsname, FTAG, &ds));
 
+   dsl_dataset_name(ds->ds_prev, namebuf);
+   fnvlist_add_string(ddra->ddra_result, "target", namebuf);
+
cloneobj = dsl_dataset_create_sync(ds->ds_dir, "%rollback",
ds->ds_prev, DS_CREATE_FLAG_NODIRTY, kcred, tx);
 
@@ -1811,8 +1816,11 @@ dsl_dataset_rollback_sync(void *arg, dmu
 }
 
 /*
- * If owner != NULL:
+ * Rolls back the given filesystem or volume to the most recent snapshot.
+ * The name of the most recent snapshot will be returned under key "target"
+ * in the result nvlist.
  *
+ * If owner != NULL:
  * - The existing dataset MUST be owned by the specified owner at entry
  * - Upon return, dataset will still be held by the same owner, whether we
  *   succeed or not.
@@ -1821,15 +1829,16 @@ dsl_dataset_rollback_sync(void *arg, dmu
  * notes above zfs_suspend_fs() for further details.
  */
 int
-dsl_dataset_rollback(const char *fsname, void *owner)
+dsl_dataset_rollback(const char *fsname, void *owner, nvlist_t *result)
 {
dsl_dataset_rollback_arg_t ddra;
 
ddra.ddra_fsname = fsname;
ddra.ddra_owner = owner;
+   ddra.ddra_result = result;
 
return (dsl_sync_task(fsname, dsl_dataset_rollback_check,
-   dsl_dataset_rollback_sync, (void *)&ddra, 1));
+   dsl_dataset_rollback_sync, &ddra, 1));
 }
 
 struct promotenode {

Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/sys/dsl_dataset.h
==
--- vendor-sys/illumos/dist/uts/common/fs/zfs/sys/dsl_dataset.h Fri Aug 16 
19:23:44 2013(r254420)
+++ vendor-sys/illumos/dist/uts/common/fs/zfs/sys/dsl_dataset.h Fri Aug 16 
19:27:29 2013(r254421)
@@ -265,7 +265,7 @@ int dsl_dataset_snap_lookup(dsl_dataset_
 int dsl_dataset_snap_remove(dsl_dataset_t *ds, const char *name, dmu_tx_t *tx);
 void dsl_dataset_set_refreservation_sync_impl(dsl_dataset_t *ds,
 zprop_source_t source, uint64_t value, dmu_tx_t *tx);
-int dsl_dataset_rollback(const char *fsname, void *owner);
+int dsl_dataset_rollback(const char *fsname, void *owner, nvlist_t *result);
 
 #ifdef ZFS_DEBUG
 #definedprintf_ds(ds, fmt, ...) do { \

Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/zfs_ioctl.c
==
--- vendor-sys/illumos/dist/uts/common/fs/zfs/zfs_ioctl.c   Fri Aug 16 
19:23:44 2013(r254420)
+++ vendor-sys/illumos/dist/uts/common/fs/zfs/zfs_ioctl.c   Fri Aug 16 
19:27:29 2013(r254421)
@@ -3493,29 +3493,32 @@ zfs_ioc_destroy(zfs_cmd_t *zc)
 }
 
 /*
- * inputs:
- * zc_name name of dataset to rollback (to most recent snapshot)
+ * fsname is name of dataset to rollback (to most recent snapshot)
  *
- * outputs:none
+ * innvl is not used.
+ *
+ * outnvl: "target" -> name of most recent snapshot
+ * }
  */
+/* ARGSUSED */
 static int
-zfs_ioc_rollback(zfs_cmd_t *zc)
+zfs_ioc_rollback(const char *fsname, nvlist_t *args, nvlist_t *outnvl)
 {
zfsvfs_t *zfsvfs;
int error;
 
-   if (getzfsvfs(zc->zc_name, &zfsvfs) == 0) {
+   if (getzfsvfs(fsname, &zfsvfs) == 0) {
error = zfs_suspend_fs(zfsvfs);
if (error == 0) {
int resume_err;
 
-   error = dsl_dataset_rollback(zc->zc_name, zfsvfs);
-   resume_err = zfs_resume_fs(zfsvf

svn commit: r254422 - vendor-sys/illumos/dist/uts/common/sys vendor/illumos/dist/common/ctf

2013-08-16 Thread Xin LI
Author: delphij
Date: Fri Aug 16 19:33:36 2013
New Revision: 254422
URL: http://svnweb.freebsd.org/changeset/base/254422

Log:
  Update vendor/illumos/dist and vendor-sys/illumos/dist
  to illumos-gate 14143:42d090a37218:
  
  Illumos DTrace issues:
3089 want ::typedef
3094 libctf should support removing a dynamic type
3095 libctf does not validate arrays correctly
3096 libctf does not validate function types correctly

Modified:
  vendor/illumos/dist/common/ctf/ctf_create.c
  vendor/illumos/dist/common/ctf/ctf_error.c
  vendor/illumos/dist/common/ctf/ctf_impl.h
  vendor/illumos/dist/common/ctf/ctf_open.c

Changes in other areas also in this revision:
Modified:
  vendor-sys/illumos/dist/uts/common/sys/ctf_api.h

Modified: vendor/illumos/dist/common/ctf/ctf_create.c
==
--- vendor/illumos/dist/common/ctf/ctf_create.c Fri Aug 16 19:27:29 2013
(r254421)
+++ vendor/illumos/dist/common/ctf/ctf_create.c Fri Aug 16 19:33:36 2013
(r254422)
@@ -24,13 +24,15 @@
  * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
-
-#pragma ident  "%Z%%M% %I% %E% SMI"
+/*
+ * Copyright (c) 2013, Joyent, Inc.  All rights reserved.
+ */
 
 #include 
 #include 
 #include 
 #include 
+#include 
 
 /*
  * This static string is used as the template for initially populating a
@@ -167,6 +169,51 @@ ctf_copy_membnames(ctf_dtdef_t *dtd, uch
 }
 
 /*
+ * Only types of dyanmic CTF containers contain reference counts. These
+ * containers are marked RD/WR. Because of that we basically make this a no-op
+ * for compatability with non-dynamic CTF sections. This is also a no-op for
+ * types which are not dynamic types. It is the responsibility of the caller to
+ * make sure it is a valid type. We help that caller out on debug builds.
+ *
+ * Note that the reference counts are not maintained for types that are not
+ * within this container. In other words if we have a type in a parent, that
+ * will not have its reference count increased. On the flip side, the parent
+ * will not be allowed to remove dynamic types if it has children.
+ */
+static void
+ctf_ref_inc(ctf_file_t *fp, ctf_id_t tid)
+{
+   ctf_dtdef_t *dtd = ctf_dtd_lookup(fp, tid);
+
+   if (dtd == NULL)
+   return;
+
+   if (!(fp->ctf_flags & LCTF_RDWR))
+   return;
+
+   dtd->dtd_ref++;
+}
+
+/*
+ * Just as with ctf_ref_inc, this is a no-op on non-writeable containers and 
the
+ * caller should ensure that this is already a valid type.
+ */
+static void
+ctf_ref_dec(ctf_file_t *fp, ctf_id_t tid)
+{
+   ctf_dtdef_t *dtd = ctf_dtd_lookup(fp, tid);
+
+   if (dtd == NULL)
+   return;
+
+   if (!(fp->ctf_flags & LCTF_RDWR))
+   return;
+
+   ASSERT(dtd->dtd_ref >= 1);
+   dtd->dtd_ref--;
+}
+
+/*
  * If the specified CTF container is writable and has been modified, reload
  * this container with the updated type definitions.  In order to make this
  * code and the rest of libctf as simple as possible, we perform updates by
@@ -180,6 +227,10 @@ ctf_copy_membnames(ctf_dtdef_t *dtd, uch
  * ctf_bufopen() will return a new ctf_file_t, but we want to keep the fp
  * constant for the caller, so after ctf_bufopen() returns, we use bcopy to
  * swap the interior of the old and new ctf_file_t's, and then free the old.
+ *
+ * Note that the lists of dynamic types stays around and the resulting 
container
+ * is still writeable. Furthermore, the reference counts that are on the dtd's
+ * are still valid.
  */
 int
 ctf_update(ctf_file_t *fp)
@@ -432,6 +483,7 @@ ctf_dtd_delete(ctf_file_t *fp, ctf_dtdef
ctf_dtdef_t *p, **q = &fp->ctf_dthash[h];
ctf_dmdef_t *dmd, *nmd;
size_t len;
+   int kind, i;
 
for (p = *q; p != NULL; p = p->dtd_hash) {
if (p != dtd)
@@ -443,7 +495,8 @@ ctf_dtd_delete(ctf_file_t *fp, ctf_dtdef
if (p != NULL)
*q = p->dtd_hash;
 
-   switch (CTF_INFO_KIND(dtd->dtd_data.ctt_info)) {
+   kind = CTF_INFO_KIND(dtd->dtd_data.ctt_info);
+   switch (kind) {
case CTF_K_STRUCT:
case CTF_K_UNION:
case CTF_K_ENUM:
@@ -454,14 +507,33 @@ ctf_dtd_delete(ctf_file_t *fp, ctf_dtdef
ctf_free(dmd->dmd_name, len);
fp->ctf_dtstrlen -= len;
}
+   if (kind != CTF_K_ENUM)
+   ctf_ref_dec(fp, dmd->dmd_type);
nmd = ctf_list_next(dmd);
ctf_free(dmd, sizeof (ctf_dmdef_t));
}
break;
case CTF_K_FUNCTION:
+   ctf_ref_dec(fp, dtd->dtd_data.ctt_type);
+   for (i = 0; i < CTF_INFO_VLEN(dtd->dtd_data.ctt_info); i++)
+   if (dtd->dtd_u.dtu_argv[i] != 0)
+   ctf_ref_dec(fp, dtd

svn commit: r254422 - vendor-sys/illumos/dist/uts/common/sys vendor/illumos/dist/common/ctf

2013-08-16 Thread Xin LI
Author: delphij
Date: Fri Aug 16 19:33:36 2013
New Revision: 254422
URL: http://svnweb.freebsd.org/changeset/base/254422

Log:
  Update vendor/illumos/dist and vendor-sys/illumos/dist
  to illumos-gate 14143:42d090a37218:
  
  Illumos DTrace issues:
3089 want ::typedef
3094 libctf should support removing a dynamic type
3095 libctf does not validate arrays correctly
3096 libctf does not validate function types correctly

Modified:
  vendor-sys/illumos/dist/uts/common/sys/ctf_api.h

Changes in other areas also in this revision:
Modified:
  vendor/illumos/dist/common/ctf/ctf_create.c
  vendor/illumos/dist/common/ctf/ctf_error.c
  vendor/illumos/dist/common/ctf/ctf_impl.h
  vendor/illumos/dist/common/ctf/ctf_open.c

Modified: vendor-sys/illumos/dist/uts/common/sys/ctf_api.h
==
--- vendor-sys/illumos/dist/uts/common/sys/ctf_api.hFri Aug 16 19:27:29 
2013(r254421)
+++ vendor-sys/illumos/dist/uts/common/sys/ctf_api.hFri Aug 16 19:33:36 
2013(r254422)
@@ -23,6 +23,9 @@
  * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
+/*
+ * Copyright (c) 2012, Joyent, Inc.  All rights reserved.
+ */
 
 /*
  * This header file defines the interfaces available from the CTF debugger
@@ -40,8 +43,6 @@
 #ifndef_CTF_API_H
 #define_CTF_API_H
 
-#pragma ident  "%Z%%M% %I% %E% SMI"
-
 #include 
 #include 
 #include 
@@ -223,6 +224,8 @@ extern int ctf_add_member(ctf_file_t *, 
 
 extern int ctf_set_array(ctf_file_t *, ctf_id_t, const ctf_arinfo_t *);
 
+extern int ctf_delete_type(ctf_file_t *, ctf_id_t);
+
 extern int ctf_update(ctf_file_t *);
 extern int ctf_discard(ctf_file_t *);
 extern int ctf_write(ctf_file_t *, int);
___
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: r254423 - head/sys/dev/sdhci

2013-08-16 Thread Ian Lepore
Author: ian
Date: Fri Aug 16 19:40:00 2013
New Revision: 254423
URL: http://svnweb.freebsd.org/changeset/base/254423

Log:
  When the timeout clock is based on the SD clock, the timeout counter
  has to be recalculated every time the SD clock frequency changes.
  
  Also, tidy up the counter calculation... it makes no sense to calculate
  a value one larger than the limit, then whine that it's too large and
  truncate it to the limit.  If the BROKEN_TIMEOUT quirk is set, don't
  calculate the counter at all, just set it to the limit value.

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

Modified: head/sys/dev/sdhci/sdhci.c
==
--- head/sys/dev/sdhci/sdhci.c  Fri Aug 16 19:33:36 2013(r254422)
+++ head/sys/dev/sdhci/sdhci.c  Fri Aug 16 19:40:00 2013(r254423)
@@ -238,6 +238,11 @@ sdhci_set_clock(struct sdhci_slot *slot,
/* If no clock requested - left it so. */
if (clock == 0)
return;
+
+   /* Recalculate timeout clock frequency based on the new sd clock. */
+   if (slot->quirks & SDHCI_QUIRK_DATA_TIMEOUT_USES_SDCLK)
+   slot->timeout_clk = slot->clock / 1000;
+
if (slot->version < SDHCI_SPEC_300) {
/* Looking for highest freq <= clock. */
res = slot->max_clk;
@@ -545,7 +550,8 @@ sdhci_init_slot(device_t dev, struct sdh
 
if (slot->timeout_clk == 0) {
device_printf(dev, "Hardware doesn't specify timeout clock "
-   "frequency.\n");
+   "frequency, setting BROKEN_TIMEOUT quirk.\n");
+   slot->quirks |= SDHCI_QUIRK_BROKEN_TIMEOUT_VAL;
}
 
slot->host.f_min = SDHCI_MIN_FREQ(slot->bus, slot);
@@ -855,24 +861,22 @@ sdhci_start_data(struct sdhci_slot *slot
 
/* Calculate and set data timeout.*/
/* XXX: We should have this from mmc layer, now assume 1 sec. */
-   target_timeout = 100;
-   div = 0;
-   current_timeout = (1 << 13) * 1000 / slot->timeout_clk;
-   while (current_timeout < target_timeout) {
-   div++;
-   current_timeout <<= 1;
-   if (div >= 0xF)
-   break;
-   }
-   /* Compensate for an off-by-one error in the CaFe chip.*/
-   if (slot->quirks & SDHCI_QUIRK_INCR_TIMEOUT_CONTROL)
-   div++;
-   if (div >= 0xF) {
-   slot_printf(slot, "Timeout too large!\n");
+   if (slot->quirks & SDHCI_QUIRK_BROKEN_TIMEOUT_VAL) {
div = 0xE;
+   } else {
+   target_timeout = 100;
+   div = 0;
+   current_timeout = (1 << 13) * 1000 / slot->timeout_clk;
+   while (current_timeout < target_timeout && div < 0xE) {
+   ++div;
+   current_timeout <<= 1;
+   }
+   /* Compensate for an off-by-one error in the CaFe chip.*/
+   if (div < 0xE && 
+   (slot->quirks & SDHCI_QUIRK_INCR_TIMEOUT_CONTROL)) {
+   ++div;
+   }
}
-   if (slot->quirks & SDHCI_QUIRK_BROKEN_TIMEOUT_VAL)
-   div = 0xE;
WR1(slot, SDHCI_TIMEOUT_CONTROL, div);
 
if (data == NULL)
___
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: r254424 - head/sys/dev/sdhci

2013-08-16 Thread Ian Lepore
Author: ian
Date: Fri Aug 16 19:44:49 2013
New Revision: 254424
URL: http://svnweb.freebsd.org/changeset/base/254424

Log:
  Add named constants for 8-bit bus support.  The sdhci and mmc drivers
  don't have support for this yet, but some low-level hardware is ready
  for it when the higher layers catch up.

Modified:
  head/sys/dev/sdhci/sdhci.h

Modified: head/sys/dev/sdhci/sdhci.h
==
--- head/sys/dev/sdhci/sdhci.h  Fri Aug 16 19:40:00 2013(r254423)
+++ head/sys/dev/sdhci/sdhci.h  Fri Aug 16 19:44:49 2013(r254424)
@@ -120,6 +120,8 @@
 #define  SDHCI_CTRL_SDMA   0x08
 #define  SDHCI_CTRL_ADMA2  0x10
 #define  SDHCI_CTRL_ADMA2640x18
+#define  SDHCI_CTRL_DMA_MASK   0x18
+#define  SDHCI_CTRL_8BITBUS0x20
 #define  SDHCI_CTRL_CARD_DET   0x40
 #define  SDHCI_CTRL_FORCE_CARD 0x80
 
@@ -195,6 +197,7 @@
 #define  SDHCI_CLOCK_BASE_SHIFT8
 #define  SDHCI_MAX_BLOCK_MASK  0x0003
 #define  SDHCI_MAX_BLOCK_SHIFT  16
+#define  SDHCI_CAN_DO_8BITBUS  0x0004
 #define  SDHCI_CAN_DO_ADMA20x0008
 #define  SDHCI_CAN_DO_HISPD0x0020
 #define  SDHCI_CAN_DO_DMA  0x0040
___
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: r254425 - head/sys/dev/mmc

2013-08-16 Thread Ian Lepore
Author: ian
Date: Fri Aug 16 20:22:57 2013
New Revision: 254425
URL: http://svnweb.freebsd.org/changeset/base/254425

Log:
  Print the card relative address in hex, because that's what all the
  other debugging output does (when it appears in command arguments,
  for example).

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

Modified: head/sys/dev/mmc/mmc.c
==
--- head/sys/dev/mmc/mmc.c  Fri Aug 16 19:44:49 2013(r254424)
+++ head/sys/dev/mmc/mmc.c  Fri Aug 16 20:22:57 2013(r254425)
@@ -1209,7 +1209,7 @@ mmc_set_blocklen(struct mmc_softc *sc, u
 static void
 mmc_log_card(device_t dev, struct mmc_ivars *ivar, int newcard)
 {
-   device_printf(dev, "Card at relative address %d%s:\n",
+   device_printf(dev, "Card at relative address 0x%04x%s:\n",
ivar->rca, newcard ? " added" : "");
device_printf(dev, " card: %s\n", ivar->card_id_string);
device_printf(dev, " bus: %ubit, %uMHz%s\n",
___
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: r254426 - head/bin/sh

2013-08-16 Thread Jilles Tjoelker
Author: jilles
Date: Fri Aug 16 20:24:41 2013
New Revision: 254426
URL: http://svnweb.freebsd.org/changeset/base/254426

Log:
  sh: Remove unnecessary reset functions.
  
  These are already handled by exception handlers.

Modified:
  head/bin/sh/eval.c
  head/bin/sh/main.c
  head/bin/sh/parser.c
  head/bin/sh/parser.h
  head/bin/sh/redir.c
  head/bin/sh/redir.h

Modified: head/bin/sh/eval.c
==
--- head/bin/sh/eval.c  Fri Aug 16 20:22:57 2013(r254425)
+++ head/bin/sh/eval.c  Fri Aug 16 20:24:41 2013(r254426)
@@ -109,7 +109,6 @@ reseteval(void)
 {
evalskip = 0;
loopnest = 0;
-   funcnest = 0;
 }
 
 

Modified: head/bin/sh/main.c
==
--- head/bin/sh/main.c  Fri Aug 16 20:22:57 2013(r254425)
+++ head/bin/sh/main.c  Fri Aug 16 20:24:41 2013(r254426)
@@ -185,8 +185,6 @@ reset(void)
 {
reseteval();
resetinput();
-   resetparser();
-   resetredir();
 }
 
 /*

Modified: head/bin/sh/parser.c
==
--- head/bin/sh/parser.cFri Aug 16 20:22:57 2013(r254425)
+++ head/bin/sh/parser.cFri Aug 16 20:24:41 2013(r254426)
@@ -210,6 +210,7 @@ parsecmd(int interact)
heredoclist = NULL;
 
tokpushback = 0;
+   checkkwd = 0;
doprompt = interact;
if (doprompt)
setprompt(1);
@@ -1822,14 +1823,6 @@ parsearith: {
 } /* end of readtoken */
 
 
-void
-resetparser(void)
-{
-   tokpushback = 0;
-   checkkwd = 0;
-}
-
-
 /*
  * Returns true if the text contains nothing to expand (no dollar signs
  * or backquotes).

Modified: head/bin/sh/parser.h
==
--- head/bin/sh/parser.hFri Aug 16 20:22:57 2013(r254425)
+++ head/bin/sh/parser.hFri Aug 16 20:24:41 2013(r254426)
@@ -79,7 +79,6 @@ extern const char *const parsekwd[];
 
 union node *parsecmd(int);
 void fixredir(union node *, const char *, int);
-void resetparser(void);
 int goodname(const char *);
 int isassignment(const char *);
 char *getprompt(void *);

Modified: head/bin/sh/redir.c
==
--- head/bin/sh/redir.c Fri Aug 16 20:22:57 2013(r254425)
+++ head/bin/sh/redir.c Fri Aug 16 20:24:41 2013(r254426)
@@ -319,18 +319,6 @@ popredir(void)
INTON;
 }
 
-/*
- * Undo all redirections.  Called on error or interrupt.
- */
-
-void
-resetredir(void)
-{
-   while (redirlist)
-   popredir();
-}
-
-
 /* Return true if fd 0 has already been redirected at least once.  */
 int
 fd0_redirected_p(void)

Modified: head/bin/sh/redir.h
==
--- head/bin/sh/redir.h Fri Aug 16 20:22:57 2013(r254425)
+++ head/bin/sh/redir.h Fri Aug 16 20:24:41 2013(r254426)
@@ -40,7 +40,6 @@
 union node;
 void redirect(union node *, int);
 void popredir(void);
-void resetredir(void);
 int fd0_redirected_p(void);
 void clearredir(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: r254427 - head/sys/dev/mmc

2013-08-16 Thread Ian Lepore
Author: ian
Date: Fri Aug 16 20:32:56 2013
New Revision: 254427
URL: http://svnweb.freebsd.org/changeset/base/254427

Log:
  During card identification, run the bus at 400KHz, not the minimum
  speed the bus claims to be capable of.  The 400KHz speed is dictated
  by the SD and MMC standards.

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

Modified: head/sys/dev/mmc/mmc.c
==
--- head/sys/dev/mmc/mmc.c  Fri Aug 16 20:24:41 2013(r254426)
+++ head/sys/dev/mmc/mmc.c  Fri Aug 16 20:32:56 2013(r254427)
@@ -106,6 +106,8 @@ struct mmc_ivars {
 
 #define CMD_RETRIES3
 
+#defineCARD_ID_FREQUENCY 40 /* Spec requires 400KHz max during ID 
phase. */
+
 static SYSCTL_NODE(_hw, OID_AUTO, mmc, CTLFLAG_RD, NULL, "mmc driver");
 
 static int mmc_debug;
@@ -579,7 +581,7 @@ mmc_power_up(struct mmc_softc *sc)
mmcbr_update_ios(dev);
mmc_ms_delay(1);
 
-   mmcbr_set_clock(dev, mmcbr_get_f_min(sc->dev));
+   mmcbr_set_clock(dev, CARD_ID_FREQUENCY);
mmcbr_set_timing(dev, bus_timing_normal);
mmcbr_set_power_mode(dev, power_on);
mmcbr_update_ios(dev);
@@ -1534,7 +1536,7 @@ mmc_go_discovery(struct mmc_softc *sc)
mmc_idle_cards(sc);
} else {
mmcbr_set_bus_mode(dev, opendrain);
-   mmcbr_set_clock(dev, mmcbr_get_f_min(dev));
+   mmcbr_set_clock(dev, CARD_ID_FREQUENCY);
mmcbr_update_ios(dev);
/* XXX recompute vdd based on new cards? */
}
@@ -1572,11 +1574,10 @@ static int
 mmc_calculate_clock(struct mmc_softc *sc)
 {
int max_dtr, max_hs_dtr, max_timing;
-   int nkid, i, f_min, f_max;
+   int nkid, i, f_max;
device_t *kids;
struct mmc_ivars *ivar;

-   f_min = mmcbr_get_f_min(sc->dev);
f_max = mmcbr_get_f_max(sc->dev);
max_dtr = max_hs_dtr = f_max;
if ((mmcbr_get_caps(sc->dev) & MMC_CAP_HSPEED))
___
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: r254430 - in head: lib/libc/sys sys/sys sys/vm usr.bin/kdump usr.bin/truss

2013-08-16 Thread John Baldwin
Author: jhb
Date: Fri Aug 16 21:13:55 2013
New Revision: 254430
URL: http://svnweb.freebsd.org/changeset/base/254430

Log:
  Add new mmap(2) flags to permit applications to request specific virtual
  address alignment of mappings.
  - MAP_ALIGNED(n) requests a mapping aligned on a boundary of (1 << n).
Requests for n >= number of bits in a pointer or less than the size of
a page fail with EINVAL.  This matches the API provided by NetBSD.
  - MAP_ALIGNED_SUPER is a special case of MAP_ALIGNED.  It can be used
to optimize the chances of using large pages.  By default it will align
the mapping on a large page boundary (the system is free to choose any
large page size to align to that seems best for the mapping request).
However, if the object being mapped is already using large pages, then
it will align the virtual mapping to match the existing large pages in
the object instead.
  - Internally, VMFS_ALIGNED_SPACE is now renamed to VMFS_SUPER_SPACE, and
VMFS_ALIGNED_SPACE(n) is repurposed for specifying a specific alignment.
MAP_ALIGNED(n) maps to using VMFS_ALIGNED_SPACE(n), while
MAP_ALIGNED_SUPER maps to VMFS_SUPER_SPACE.
  - mmap() of a device object now uses VMFS_OPTIMAL_SPACE rather than
explicitly using VMFS_SUPER_SPACE.  All device objects are forced to
use a specific color on creation, so VMFS_OPTIMAL_SPACE is effectively
equivalent.
  
  Reviewed by:  alc
  MFC after:1 month

Modified:
  head/lib/libc/sys/mmap.2
  head/sys/sys/mman.h
  head/sys/vm/vm_init.c
  head/sys/vm/vm_kern.c
  head/sys/vm/vm_map.c
  head/sys/vm/vm_map.h
  head/sys/vm/vm_mmap.c
  head/usr.bin/kdump/mksubr
  head/usr.bin/truss/syscalls.c

Modified: head/lib/libc/sys/mmap.2
==
--- head/lib/libc/sys/mmap.2Fri Aug 16 21:04:58 2013(r254429)
+++ head/lib/libc/sys/mmap.2Fri Aug 16 21:13:55 2013(r254430)
@@ -28,7 +28,7 @@
 .\"@(#)mmap.2  8.4 (Berkeley) 5/11/95
 .\" $FreeBSD$
 .\"
-.Dd March 18, 2012
+.Dd August 16, 2013
 .Dt MMAP 2
 .Os
 .Sh NAME
@@ -97,7 +97,30 @@ Sharing, mapping type and options are sp
 argument by
 .Em or Ns 'ing
 the following values:
-.Bl -tag -width MAP_HASSEMAPHORE
+.Bl -tag -width MAP_PREFAULT_READ
+.It Dv MAP_ALIGNED Ns Pq Fa n
+Align the region on a requested boundary.
+If a suitable region cannot be found,
+.Fn mmap
+will fail.
+The
+.Fa n
+argument specifies the binary logarithm of the desired alignment.
+.It Dv MAP_ALIGNED_SUPER
+Align the region to maximize the potential use of large
+.Pq Dq super
+pages.
+If a suitable region cannot be found,
+.Fn mmap
+will fail.
+The system will choose a suitable page size based on the size of
+mapping.
+The page size used as well as the alignment of the region may both be
+affected by properties of the file being mapped.
+In particular,
+the physical address of existing pages of a file may require a specific
+alignment.
+The region is not guaranteed to be aligned on any specific boundary.
 .It Dv MAP_ANON
 Map anonymous memory not associated with any specific file.
 The file descriptor used for creating
@@ -274,6 +297,25 @@ Although this implementation does not im
 the
 .Fa offset
 argument, a portable program must only use page-aligned values.
+.Pp
+Large page mappings require that the pages backing an object be
+aligned in matching blocks in both the virtual address space and RAM.
+The system will automatically attempt to use large page mappings when
+mapping an object that is already backed by large pages in RAM by
+aligning the mapping request in the virtual address space to match the
+alignment of the large physical pages.
+The system may also use large page mappings when mapping portions of an
+object that are not yet backed by pages in RAM.
+The
+.Dv MAP_ALIGNED_SUPER
+flag is an optimization that will align the mapping request to the
+size of a large page similar to
+.Dv MAP_ALIGNED ,
+except that the system will override this alignment if an object already
+uses large pages so that the mapping will be consistent with the existing
+large pages.
+This flag is mostly useful for maximizing the use of large pages on the
+first mapping of objects that do not yet have pages present in RAM.
 .Sh RETURN VALUES
 Upon successful completion,
 .Fn mmap
@@ -325,6 +367,10 @@ The
 argument
 was equal to zero.
 .It Bq Er EINVAL
+.Dv MAP_ALIGNED
+was specified and the desired alignment was either larger than the
+virtual address size of the machine or smaller than a page.
+.It Bq Er EINVAL
 .Dv MAP_ANON
 was specified and the
 .Fa fd
@@ -356,7 +402,8 @@ was specified and insufficient memory wa
 .Xr msync 2 ,
 .Xr munlock 2 ,
 .Xr munmap 2 ,
-.Xr getpagesize 3
+.Xr getpagesize 3 ,
+.Xr getpagesizes 3
 .Sh BUGS
 The
 .Fa len

Modified: head/sys/sys/mman.h
==
--- head/sys/sys/mman.h Fri Aug 16 21:04:58 2013(r254429)
+++ head/sys/sys

Re: svn commit: r254430 - in head: lib/libc/sys sys/sys sys/vm usr.bin/kdump usr.bin/truss

2013-08-16 Thread John Baldwin
On Friday, August 16, 2013 5:13:55 pm John Baldwin wrote:
> Author: jhb
> Date: Fri Aug 16 21:13:55 2013
> New Revision: 254430
> URL: http://svnweb.freebsd.org/changeset/base/254430
> 
> Log:
>   Add new mmap(2) flags to permit applications to request specific virtual
>   address alignment of mappings.
>   - MAP_ALIGNED(n) requests a mapping aligned on a boundary of (1 << n).
> Requests for n >= number of bits in a pointer or less than the size of
> a page fail with EINVAL.  This matches the API provided by NetBSD.
>   - MAP_ALIGNED_SUPER is a special case of MAP_ALIGNED.  It can be used
> to optimize the chances of using large pages.  By default it will align
> the mapping on a large page boundary (the system is free to choose any
> large page size to align to that seems best for the mapping request).
> However, if the object being mapped is already using large pages, then
> it will align the virtual mapping to match the existing large pages in
> the object instead.
>   - Internally, VMFS_ALIGNED_SPACE is now renamed to VMFS_SUPER_SPACE, and
> VMFS_ALIGNED_SPACE(n) is repurposed for specifying a specific alignment.
> MAP_ALIGNED(n) maps to using VMFS_ALIGNED_SPACE(n), while
> MAP_ALIGNED_SUPER maps to VMFS_SUPER_SPACE.
>   - mmap() of a device object now uses VMFS_OPTIMAL_SPACE rather than
> explicitly using VMFS_SUPER_SPACE.  All device objects are forced to
> use a specific color on creation, so VMFS_OPTIMAL_SPACE is effectively
> equivalent.

Forgot to note:

- Handle MAP_PREFAULT_READ in kdump and truss.

Also, any awkwardness in the mmap(2) text is purely my fault and not Alan's.
We might tweak it further, but the code is tested and fully reviewed.

-- 
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"


Re: svn commit: r254430 - in head: lib/libc/sys sys/sys sys/vm usr.bin/kdump usr.bin/truss

2013-08-16 Thread Alan Cox
On Aug 16, 2013, at 2:20 PM, John Baldwin wrote:

> On Friday, August 16, 2013 5:13:55 pm John Baldwin wrote:
>> Author: jhb
>> Date: Fri Aug 16 21:13:55 2013
>> New Revision: 254430
>> URL: http://svnweb.freebsd.org/changeset/base/254430
>> 
>> Log:
>>  Add new mmap(2) flags to permit applications to request specific virtual
>>  address alignment of mappings.
>>  - MAP_ALIGNED(n) requests a mapping aligned on a boundary of (1 << n).
>>Requests for n >= number of bits in a pointer or less than the size of
>>a page fail with EINVAL.  This matches the API provided by NetBSD.
>>  - MAP_ALIGNED_SUPER is a special case of MAP_ALIGNED.  It can be used
>>to optimize the chances of using large pages.  By default it will align
>>the mapping on a large page boundary (the system is free to choose any
>>large page size to align to that seems best for the mapping request).
>>However, if the object being mapped is already using large pages, then
>>it will align the virtual mapping to match the existing large pages in
>>the object instead.
>>  - Internally, VMFS_ALIGNED_SPACE is now renamed to VMFS_SUPER_SPACE, and
>>VMFS_ALIGNED_SPACE(n) is repurposed for specifying a specific alignment.
>>MAP_ALIGNED(n) maps to using VMFS_ALIGNED_SPACE(n), while
>>MAP_ALIGNED_SUPER maps to VMFS_SUPER_SPACE.
>>  - mmap() of a device object now uses VMFS_OPTIMAL_SPACE rather than
>>explicitly using VMFS_SUPER_SPACE.  All device objects are forced to
>>use a specific color on creation, so VMFS_OPTIMAL_SPACE is effectively
>>equivalent.
> 
> Forgot to note:
> 
> - Handle MAP_PREFAULT_READ in kdump and truss.
> 
> Also, any awkwardness in the mmap(2) text is purely my fault and not Alan's.
> We might tweak it further, but the code is tested and fully reviewed.
> 

Thank you for doing this!

Alan

___
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: r254431 - head/sys/dev/mmc

2013-08-16 Thread Ian Lepore
Author: ian
Date: Fri Aug 16 23:05:34 2013
New Revision: 254431
URL: http://svnweb.freebsd.org/changeset/base/254431

Log:
  Handle command retries for commands originating at the mmc layer, and
  ensure that all such commands have a non-zero retry count except for those
  that are expected to fail (for example, because they are used to probe for
  feature support).
  
  While it is possible to pass a retry count down to the hardware driver in
  the command request structure, no hardware driver currently implements any
  retry logic.  The hardware doesn't know much about the context of a single
  request, so it makes more sense to handle retries at a layer that does.
  
  This adds retry loops to the mmc_wait_for_cmd() and mmc_wait_for_app_cmd()
  functions.  These functions are the gateway from other code within mmc.c
  to the hardware.  App commands are a sequence of two commands and a retry
  has to rerun both of them in order, so it needs its own retry loop.
  
  Retry looping is specifically NOT implemented in mmc_wait_for_request()
  because it is the gateway for children on the bus, and they have to
  implement their own retry logic depending on what makes sense for them.

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

Modified: head/sys/dev/mmc/mmc.c
==
--- head/sys/dev/mmc/mmc.c  Fri Aug 16 21:13:55 2013(r254430)
+++ head/sys/dev/mmc/mmc.c  Fri Aug 16 23:05:34 2013(r254431)
@@ -393,8 +393,9 @@ mmc_wait_for_req(struct mmc_softc *sc, s
while ((req->flags & MMC_REQ_DONE) == 0)
msleep(req, &sc->sc_mtx, 0, "mmcreq", 0);
MMC_UNLOCK(sc);
-   if (mmc_debug > 2 || (mmc_debug > 1 && req->cmd->error))
-   device_printf(sc->dev, "RESULT: %d\n", req->cmd->error);
+   if (mmc_debug > 2 || (mmc_debug > 0 && req->cmd->error != MMC_ERR_NONE))
+   device_printf(sc->dev, "CMD%d RESULT: %d\n", 
+   req->cmd->opcode, req->cmd->error);
return (0);
 }
 
@@ -410,14 +411,21 @@ static int
 mmc_wait_for_cmd(struct mmc_softc *sc, struct mmc_command *cmd, int retries)
 {
struct mmc_request mreq;
+   int err;
+
+   do {
+   memset(&mreq, 0, sizeof(mreq));
+   memset(cmd->resp, 0, sizeof(cmd->resp));
+   cmd->retries = 0; /* Retries done here, not in hardware. */
+   cmd->mrq = &mreq;
+   mreq.cmd = cmd;
+   if (mmc_wait_for_req(sc, &mreq) != 0)
+   err = MMC_ERR_FAILED;
+   else
+   err = cmd->error;
+   } while (err != MMC_ERR_NONE && retries-- > 0);
 
-   memset(&mreq, 0, sizeof(mreq));
-   memset(cmd->resp, 0, sizeof(cmd->resp));
-   cmd->retries = retries;
-   cmd->mrq = &mreq;
-   mreq.cmd = cmd;
-   mmc_wait_for_req(sc, &mreq);
-   return (cmd->error);
+   return (err);
 }
 
 static int
@@ -425,24 +433,27 @@ mmc_wait_for_app_cmd(struct mmc_softc *s
 struct mmc_command *cmd, int retries)
 {
struct mmc_command appcmd;
-   int err = MMC_ERR_NONE, i;
+   int err;
 
-   for (i = 0; i <= retries; i++) {
+   do {
appcmd.opcode = MMC_APP_CMD;
appcmd.arg = rca << 16;
appcmd.flags = MMC_RSP_R1 | MMC_CMD_AC;
appcmd.data = NULL;
-   mmc_wait_for_cmd(sc, &appcmd, 0);
-   err = appcmd.error;
-   if (err != MMC_ERR_NONE)
-   continue;
-   if (!(appcmd.resp[0] & R1_APP_CMD))
-   return MMC_ERR_FAILED;
-   mmc_wait_for_cmd(sc, cmd, 0);
-   err = cmd->error;
-   if (err == MMC_ERR_NONE)
-   break;
-   }
+   if (mmc_wait_for_cmd(sc, &appcmd, 0) != 0)
+   err = MMC_ERR_FAILED;
+   else
+   err = appcmd.error;
+   if (err == MMC_ERR_NONE) {
+   if (!(appcmd.resp[0] & R1_APP_CMD))
+   return MMC_ERR_FAILED; /* Retries won't help. */
+   if (mmc_wait_for_cmd(sc, cmd, 0) != 0)
+   err = MMC_ERR_FAILED;
+   else
+   err = cmd->error;
+   }
+   } while (err != MMC_ERR_NONE && retries-- > 0);
+
return (err);
 }
 
@@ -461,8 +472,6 @@ mmc_wait_for_command(struct mmc_softc *s
err = mmc_wait_for_cmd(sc, &cmd, retries);
if (err)
return (err);
-   if (cmd.error)
-   return (cmd.error);
if (resp) {
if (flags & MMC_RSP_136)
memcpy(resp, cmd.resp, 4 * sizeof(uint32_t));
@@ -488,7 +497,7 @@ mmc_idle_cards(struct mmc_softc *sc)
cmd.arg = 0;
cmd.flags = MMC_RSP_NONE | MMC_CMD_BC;
cmd.data = NULL;
-   mmc_wait_for_cmd

svn commit: r254432 - head/sys/dev/mmc

2013-08-16 Thread Ian Lepore
Author: ian
Date: Sat Aug 17 00:19:27 2013
New Revision: 254432
URL: http://svnweb.freebsd.org/changeset/base/254432

Log:
  Consistently init all mmc request, command, and data structures to zero
  before using them.

Modified:
  head/sys/dev/mmc/mmc.c
  head/sys/dev/mmc/mmcsd.c

Modified: head/sys/dev/mmc/mmc.c
==
--- head/sys/dev/mmc/mmc.c  Fri Aug 16 23:05:34 2013(r254431)
+++ head/sys/dev/mmc/mmc.c  Sat Aug 17 00:19:27 2013(r254432)
@@ -436,6 +436,7 @@ mmc_wait_for_app_cmd(struct mmc_softc *s
int err;
 
do {
+   memset(&appcmd, 0, sizeof(appcmd));
appcmd.opcode = MMC_APP_CMD;
appcmd.arg = rca << 16;
appcmd.flags = MMC_RSP_R1 | MMC_CMD_AC;
@@ -627,6 +628,7 @@ mmc_switch(struct mmc_softc *sc, uint8_t
struct mmc_command cmd;
int err;
 
+   memset(&cmd, 0, sizeof(cmd));
cmd.opcode = MMC_SWITCH_FUNC;
cmd.arg = (MMC_SWITCH_FUNC_WR << 24) |
(index << 16) |
@@ -646,8 +648,8 @@ mmc_sd_switch(struct mmc_softc *sc, uint
struct mmc_command cmd;
struct mmc_data data;
 
-   memset(&cmd, 0, sizeof(struct mmc_command));
-   memset(&data, 0, sizeof(struct mmc_data));
+   memset(&cmd, 0, sizeof(cmd));
+   memset(&data, 0, sizeof(data));
memset(res, 0, 64);
 
cmd.opcode = SD_SWITCH_FUNC;
@@ -674,14 +676,14 @@ mmc_set_card_bus_width(struct mmc_softc 
uint8_t value;
 
if (mmcbr_get_mode(sc->dev) == mode_sd) {
-   memset(&cmd, 0, sizeof(struct mmc_command));
+   memset(&cmd, 0, sizeof(cmd));
cmd.opcode = ACMD_SET_CLR_CARD_DETECT;
cmd.flags = MMC_RSP_R1 | MMC_CMD_AC;
cmd.arg = SD_CLR_CARD_DETECT;
err = mmc_wait_for_app_cmd(sc, rca, &cmd, CMD_RETRIES);
if (err != 0)
return (err);
-   memset(&cmd, 0, sizeof(struct mmc_command));
+   memset(&cmd, 0, sizeof(cmd));
cmd.opcode = ACMD_SET_BUS_WIDTH;
cmd.flags = MMC_RSP_R1 | MMC_CMD_AC;
switch (width) {
@@ -757,6 +759,8 @@ mmc_test_bus_width(struct mmc_softc *sc)
mmcbr_set_bus_width(sc->dev, bus_width_8);
mmcbr_update_ios(sc->dev);
 
+   memset(&cmd, 0, sizeof(cmd));
+   memset(&data, 0, sizeof(data));
cmd.opcode = MMC_BUSTEST_W;
cmd.arg = 0;
cmd.flags = MMC_RSP_R1 | MMC_CMD_ADTC;
@@ -767,6 +771,8 @@ mmc_test_bus_width(struct mmc_softc *sc)
data.flags = MMC_DATA_WRITE;
mmc_wait_for_cmd(sc, &cmd, 0);

+   memset(&cmd, 0, sizeof(cmd));
+   memset(&data, 0, sizeof(data));
cmd.opcode = MMC_BUSTEST_R;
cmd.arg = 0;
cmd.flags = MMC_RSP_R1 | MMC_CMD_ADTC;
@@ -788,6 +794,8 @@ mmc_test_bus_width(struct mmc_softc *sc)
mmcbr_set_bus_width(sc->dev, bus_width_4);
mmcbr_update_ios(sc->dev);
 
+   memset(&cmd, 0, sizeof(cmd));
+   memset(&data, 0, sizeof(data));
cmd.opcode = MMC_BUSTEST_W;
cmd.arg = 0;
cmd.flags = MMC_RSP_R1 | MMC_CMD_ADTC;
@@ -798,6 +806,8 @@ mmc_test_bus_width(struct mmc_softc *sc)
data.flags = MMC_DATA_WRITE;
mmc_wait_for_cmd(sc, &cmd, 0);

+   memset(&cmd, 0, sizeof(cmd));
+   memset(&data, 0, sizeof(data));
cmd.opcode = MMC_BUSTEST_R;
cmd.arg = 0;
cmd.flags = MMC_RSP_R1 | MMC_CMD_ADTC;
@@ -1059,6 +1069,7 @@ mmc_all_send_cid(struct mmc_softc *sc, u
struct mmc_command cmd;
int err;
 
+   memset(&cmd, 0, sizeof(cmd));
cmd.opcode = MMC_ALL_SEND_CID;
cmd.arg = 0;
cmd.flags = MMC_RSP_R2 | MMC_CMD_BCR;
@@ -1074,6 +1085,7 @@ mmc_send_csd(struct mmc_softc *sc, uint1
struct mmc_command cmd;
int err;
 
+   memset(&cmd, 0, sizeof(cmd));
cmd.opcode = MMC_SEND_CSD;
cmd.arg = rca << 16;
cmd.flags = MMC_RSP_R2 | MMC_CMD_BCR;
@@ -1090,8 +1102,8 @@ mmc_app_send_scr(struct mmc_softc *sc, u
struct mmc_command cmd;
struct mmc_data data;
 
-   memset(&cmd, 0, sizeof(struct mmc_command));
-   memset(&data, 0, sizeof(struct mmc_data));
+   memset(&cmd, 0, sizeof(cmd));
+   memset(&data, 0, sizeof(data));
 
memset(rawscr, 0, 8);
cmd.opcode = ACMD_SEND_SCR;
@@ -1116,8 +1128,8 @@ mmc_send_ext_csd(struct mmc_softc *sc, u
struct mmc_command cmd;
struct mmc_data data;
 
-   memset(&cmd, 0, sizeof(struct mmc_command));
-   memset(&data, 0, sizeof(struct mmc_data));
+   memset(&cmd, 0, sizeof(cmd));
+   memset(&data, 0, size

svn commit: r254433 - head/sys/kern

2013-08-16 Thread Xin LI
Author: delphij
Date: Sat Aug 17 00:25:11 2013
New Revision: 254433
URL: http://svnweb.freebsd.org/changeset/base/254433

Log:
  Fix build.

Modified:
  head/sys/kern/uipc_syscalls.c

Modified: head/sys/kern/uipc_syscalls.c
==
--- head/sys/kern/uipc_syscalls.c   Sat Aug 17 00:19:27 2013
(r254432)
+++ head/sys/kern/uipc_syscalls.c   Sat Aug 17 00:25:11 2013
(r254433)
@@ -158,8 +158,6 @@ sfstat_sysctl(SYSCTL_HANDLER_ARGS)
 SYSCTL_PROC(_kern_ipc, OID_AUTO, sfstat, CTLTYPE_OPAQUE | CTLFLAG_RW,
 NULL, 0, sfstat_sysctl, "I", "sendfile statistics");
 
-fo_sendfile_t vn_sendfile;
-
 /*
  * Convert a user file descriptor to a kernel file entry and check if required
  * capability rights are present.
___
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: r254419 - head/contrib/bmake

2013-08-16 Thread Simon J. Gerraty
On Fri, 16 Aug 2013 11:56:24 -0700, Juli Mallett writes:
>> Log:
>>   Add .MAKE.ALWAYS_PASS_JOB_QUEUE knob (default yes)
>>   for backwards compatability.
>>
>
>Thanks very much.  Do you have some sense of when/if this might switch to a
>default of "no"?  If so, it seems like it might be good to note that
>dependence on that behaviour is deprecated and will be removed in
>11.0-RELEASE or whenever you think appropriate.

Right now I don't see any compelling reason to change it to "no".
So, no timeline.

___
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: r254434 - head/share/man/man9

2013-08-16 Thread David E. O'Brien
Author: obrien
Date: Sat Aug 17 01:02:04 2013
New Revision: 254434
URL: http://svnweb.freebsd.org/changeset/base/254434

Log:
  Correct spelling.

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

Modified: head/share/man/man9/sleep.9
==
--- head/share/man/man9/sleep.9 Sat Aug 17 00:25:11 2013(r254433)
+++ head/share/man/man9/sleep.9 Sat Aug 17 01:02:04 2013(r254434)
@@ -173,7 +173,7 @@ functions take
 .Fa sbt
 parameter instead of
 .Fa timo .
-It allows to specify relative or absolite wakeup time with higher resolution
+It allows to specify relative or absolute wakeup time with higher resolution
 in form of
 .Vt sbintime_t .
 The parameter
___
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: r254435 - head/sys/dev/ath

2013-08-16 Thread Adrian Chadd
Author: adrian
Date: Sat Aug 17 01:14:28 2013
New Revision: 254435
URL: http://svnweb.freebsd.org/changeset/base/254435

Log:
  Log the MAC address of the node in question rather than the pointer.

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

Modified: head/sys/dev/ath/if_ath_tx.c
==
--- head/sys/dev/ath/if_ath_tx.cSat Aug 17 01:02:04 2013
(r254434)
+++ head/sys/dev/ath/if_ath_tx.cSat Aug 17 01:14:28 2013
(r254435)
@@ -3739,33 +3739,50 @@ ath_tx_tid_drain_print(struct ath_softc 
tap = ath_tx_get_tx_tid(an, tid->tid);
 
device_printf(sc->sc_dev,
-   "%s: %s: node %p: bf=%p: addbaw=%d, dobaw=%d, "
+   "%s: %s: %6D: bf=%p: addbaw=%d, dobaw=%d, "
"seqno=%d, retry=%d\n",
-   __func__, pfx, ni, bf,
+   __func__,
+   pfx,
+   ni->ni_macaddr,
+   ":",
+   bf,
bf->bf_state.bfs_addedbaw,
bf->bf_state.bfs_dobaw,
SEQNO(bf->bf_state.bfs_seqno),
bf->bf_state.bfs_retries);
device_printf(sc->sc_dev,
-   "%s: node %p: bf=%p: txq[%d] axq_depth=%d, axq_aggr_depth=%d\n",
-   __func__, ni, bf,
+   "%s: %s: %6D: bf=%p: txq[%d] axq_depth=%d, axq_aggr_depth=%d\n",
+   __func__,
+   pfx,
+   ni->ni_macaddr,
+   ":",
+   bf,
txq->axq_qnum,
txq->axq_depth,
txq->axq_aggr_depth);
 
device_printf(sc->sc_dev,
-   "%s: node %p: bf=%p: tid txq_depth=%d hwq_depth=%d, bar_wait=%d, 
isfiltered=%d\n",
-   __func__, ni, bf,
+   "%s: %s: %6D: bf=%p: tid txq_depth=%d hwq_depth=%d, bar_wait=%d, "
+ "isfiltered=%d\n",
+   __func__,
+   pfx,
+   ni->ni_macaddr,
+   ":",
+   bf,
tid->axq_depth,
tid->hwq_depth,
tid->bar_wait,
tid->isfiltered);
device_printf(sc->sc_dev,
-   "%s: node %p: tid %d: "
+   "%s: %s: %6D: tid %d: "
"sched=%d, paused=%d, "
"incomp=%d, baw_head=%d, "
"baw_tail=%d txa_start=%d, ni_txseqs=%d\n",
-__func__, ni, tid->tid,
+__func__,
+pfx,
+ni->ni_macaddr,
+":",
+tid->tid,
 tid->sched, tid->paused,
 tid->incomp, tid->baw_head,
 tid->baw_tail, tap == NULL ? -1 : tap->txa_start,
___
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: r254436 - head/share/man/man9

2013-08-16 Thread Matt Jacob
Author: mjacob
Date: Sat Aug 17 01:17:51 2013
New Revision: 254436
URL: http://svnweb.freebsd.org/changeset/base/254436

Log:
  Correct sentence syntax too.

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

Modified: head/share/man/man9/sleep.9
==
--- head/share/man/man9/sleep.9 Sat Aug 17 01:14:28 2013(r254435)
+++ head/share/man/man9/sleep.9 Sat Aug 17 01:17:51 2013(r254436)
@@ -173,15 +173,15 @@ functions take
 .Fa sbt
 parameter instead of
 .Fa timo .
-It allows to specify relative or absolute wakeup time with higher resolution
+It allows the caller to specify relative or absolute wakeup time with higher 
resolution
 in form of
 .Vt sbintime_t .
 The parameter
 .Fa pr
-allows to specify wanted absolute event precision.
+allows the caller to specify wanted absolute event precision.
 The parameter
 .Fa flags
-allows to pass additional
+allows the caller to pass additional
 .Fn callout_reset_sbt
 flags.
 .Pp
___
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: r254437 - head

2013-08-16 Thread Simon J. Gerraty
Author: sjg
Date: Sat Aug 17 04:41:35 2013
New Revision: 254437
URL: http://svnweb.freebsd.org/changeset/base/254437

Log:
  Don't let user specified DESTDIR, break building our chosen make.

Modified:
  head/Makefile

Modified: head/Makefile
==
--- head/Makefile   Sat Aug 17 01:17:51 2013(r254436)
+++ head/Makefile   Sat Aug 17 04:41:35 2013(r254437)
@@ -349,9 +349,9 @@ make bmake: .PHONY
@echo ">>> Building an up-to-date make(1)"
@echo "--"
${_+_}@cd ${.CURDIR}/usr.bin/${.TARGET}; \
-   ${MMAKE} obj && \
-   ${MMAKE} depend && \
-   ${MMAKE} all && \
+   ${MMAKE} obj DESTDIR= && \
+   ${MMAKE} depend DESTDIR= && \
+   ${MMAKE} all DESTDIR= && \
${MMAKE} install DESTDIR=${MYMAKE:H} BINDIR= 
PROGNAME=${MYMAKE:T}
 
 tinderbox toolchains kernel-toolchains: upgrade_checks
___
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: r254438 - head/sys/dev/usb/controller

2013-08-16 Thread Hans Petter Selasky
Author: hselasky
Date: Sat Aug 17 06:29:45 2013
New Revision: 254438
URL: http://svnweb.freebsd.org/changeset/base/254438

Log:
  Fix some USB controller names according to pciconf output.
  
  MFC after:1 week
  Submitted by: Dmitry Luhtionov 

Modified:
  head/sys/dev/usb/controller/ehci_pci.c
  head/sys/dev/usb/controller/ohci_pci.c

Modified: head/sys/dev/usb/controller/ehci_pci.c
==
--- head/sys/dev/usb/controller/ehci_pci.c  Sat Aug 17 04:41:35 2013
(r254437)
+++ head/sys/dev/usb/controller/ehci_pci.c  Sat Aug 17 06:29:45 2013
(r254438)
@@ -165,7 +165,7 @@ ehci_pci_match(device_t self)
case 0x00e810de:
return "NVIDIA nForce3 250 USB 2.0 controller";
case 0x005b10de:
-   return "NVIDIA nForce4 USB 2.0 controller";
+   return "NVIDIA nForce CK804 USB 2.0 controller";
case 0x036d10de:
return "NVIDIA nForce MCP55 USB 2.0 controller";
case 0x03f210de:

Modified: head/sys/dev/usb/controller/ohci_pci.c
==
--- head/sys/dev/usb/controller/ohci_pci.c  Sat Aug 17 04:41:35 2013
(r254437)
+++ head/sys/dev/usb/controller/ohci_pci.c  Sat Aug 17 06:29:45 2013
(r254438)
@@ -154,6 +154,8 @@ ohci_pci_match(device_t self)
case 0x00d710de:
return ("nVidia nForce3 USB Controller");
 
+   case 0x005a10de:
+   return ("nVidia nForce CK804 USB Controller");
case 0x036c10de:
return ("nVidia nForce MCP55 USB Controller");
case 0x03f110de:
___
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"