svn commit: r285621 - head/usr.sbin/devctl

2015-07-15 Thread Justin Hibbits
Author: jhibbits
Date: Thu Jul 16 05:14:20 2015
New Revision: 285621
URL: https://svnweb.freebsd.org/changeset/base/285621

Log:
  Fix formatting.

Modified:
  head/usr.sbin/devctl/devctl.8

Modified: head/usr.sbin/devctl/devctl.8
==
--- head/usr.sbin/devctl/devctl.8   Thu Jul 16 05:13:08 2015
(r285620)
+++ head/usr.sbin/devctl/devctl.8   Thu Jul 16 05:14:20 2015
(r285621)
@@ -109,7 +109,7 @@ loader tunable.
 .It Cm suspend Ar device
 Suspend a device.
 This may include placing the device in a reduced power state.
-.It Cm resume device
+.It Cm resume Ar device
 Resume a suspended device to a fully working state.
 .It Xo Cm set driver
 .Op Fl f
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r285617 - head/tools/build/mk

2015-07-15 Thread Andrey A. Chernov
Author: ache
Date: Thu Jul 16 02:08:54 2015
New Revision: 285617
URL: https://svnweb.freebsd.org/changeset/base/285617

Log:
  Comment out usr/sbin/mailwrapper removal
  because for no mailwrapper case we have:
  /usr/sbin/sendmail - /usr/sbin/mailwrapper
  /usr/sbin/mailwrapper - /usr/libexec/sendmail/sendmail
  Add comment explaining it.

Modified:
  head/tools/build/mk/OptionalObsoleteFiles.inc

Modified: head/tools/build/mk/OptionalObsoleteFiles.inc
==
--- head/tools/build/mk/OptionalObsoleteFiles.inc   Wed Jul 15 21:44:16 
2015(r285616)
+++ head/tools/build/mk/OptionalObsoleteFiles.inc   Thu Jul 16 02:08:54 
2015(r285617)
@@ -5122,7 +5122,10 @@ OLD_FILES+=usr/share/misc/mail.tildehelp
 
 .if ${MK_MAILWRAPPER} == no
 OLD_FILES+=etc/mail/mailer.conf
-OLD_FILES+=usr/sbin/mailwrapper
+# Don't remove, for no mailwrapper case:
+# /usr/sbin/sendmail - /usr/sbin/mailwrapper
+# /usr/sbin/mailwrapper - /usr/libexec/sendmail/sendmail
+#OLD_FILES+=usr/sbin/mailwrapper
 OLD_FILES+=usr/share/man/man8/mailwrapper.8.gz
 .endif
 
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r285619 - head/sys/dev/uart

2015-07-15 Thread Neel Natu
Author: neel
Date: Thu Jul 16 04:15:22 2015
New Revision: 285619
URL: https://svnweb.freebsd.org/changeset/base/285619

Log:
  If uart interrupts are not functioning then schedule the callout to do the
  polling at device attach time [1].
  
  Add tunables 'debug.uart_force_poll' and 'debug.uart_poll_freq' to control
  uart polling.
  
  Submitted by: Aleksey Kuleshov (rnd...@yandex.ru) [1]

Modified:
  head/sys/dev/uart/uart_core.c

Modified: head/sys/dev/uart/uart_core.c
==
--- head/sys/dev/uart/uart_core.c   Thu Jul 16 02:34:22 2015
(r285618)
+++ head/sys/dev/uart/uart_core.c   Thu Jul 16 04:15:22 2015
(r285619)
@@ -39,6 +39,7 @@ __FBSDID($FreeBSD$);
 #include sys/malloc.h
 #include sys/queue.h
 #include sys/reboot.h
+#include sys/sysctl.h
 #include machine/bus.h
 #include sys/rman.h
 #include machine/resource.h
@@ -62,7 +63,12 @@ static MALLOC_DEFINE(M_UART, UART, UA
 #defineUART_POLL_FREQ  50
 #endif
 static int uart_poll_freq = UART_POLL_FREQ;
-TUNABLE_INT(debug.uart_poll_freq, uart_poll_freq);
+SYSCTL_INT(_debug, OID_AUTO, uart_poll_freq, CTLFLAG_RDTUN, uart_poll_freq,
+0, UART poll frequency);
+
+static int uart_force_poll;
+SYSCTL_INT(_debug, OID_AUTO, uart_force_poll, CTLFLAG_RDTUN, uart_force_poll,
+0, Force UART polling);
 
 void
 uart_add_sysdev(struct uart_devinfo *di)
@@ -514,7 +520,7 @@ uart_bus_attach(device_t dev)
 * conditions. We may have broken H/W and polling is probably the
 * safest thing to do.
 */
-   if (filt != FILTER_SCHEDULE_THREAD) {
+   if (filt != FILTER_SCHEDULE_THREAD  !uart_force_poll) {
sc-sc_irid = 0;
sc-sc_ires = bus_alloc_resource_any(dev, SYS_RES_IRQ,
sc-sc_irid, RF_ACTIVE | RF_SHAREABLE);
@@ -540,6 +546,8 @@ uart_bus_attach(device_t dev)
/* No interrupt resource. Force polled mode. */
sc-sc_polled = 1;
callout_init(sc-sc_timer, 1);
+   callout_reset(sc-sc_timer, hz / uart_poll_freq,
+   (timeout_t *)uart_intr, sc);
}
 
if (bootverbose  (sc-sc_fastintr || sc-sc_polled)) {
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r285620 - head/sys/powerpc/aim

2015-07-15 Thread Justin Hibbits
Author: jhibbits
Date: Thu Jul 16 05:13:08 2015
New Revision: 285620
URL: https://svnweb.freebsd.org/changeset/base/285620

Log:
  Fix userland program exception handling for powerpc64.
  
  It appears that the linker will not handle 64-bit relocations at addresses 
that
  are not aligned to 8-byte boundaries.  Prior to this change the line:
  
.llong generictrap
  
  was aligned to a 4-byte address, and the linker replaced that with an 8-byte
  0x0.  Aligning that address to 8 bytes caused the linker to generate the 
proper
  relocation.  As a follow-through, the dblow from trap_subr33.S used the code
  sequence 'lwz %r1, TRAP_GENTRAP(0)', so this reproduces the analogue of that 
for
  64-bit.

Modified:
  head/sys/powerpc/aim/trap_subr64.S

Modified: head/sys/powerpc/aim/trap_subr64.S
==
--- head/sys/powerpc/aim/trap_subr64.S  Thu Jul 16 04:15:22 2015
(r285619)
+++ head/sys/powerpc/aim/trap_subr64.S  Thu Jul 16 05:13:08 2015
(r285620)
@@ -842,11 +842,7 @@ CNAME(dblow):
 mflr   %r1 /* save LR */
mtsprg2 %r1 /* And then in SPRG2 */
 
-   nop /* Begin branching to generictrap */
-   bl  9f
-   .llong  generictrap
-9: mflr%r1
-   ld  %r1,0(%r1)
+   ld  %r1, TRAP_GENTRAP(0)/* Get branch address */
mtlr%r1
li  %r1, 0  /* How to get the vector from LR */
blrl/* Branch to generictrap */
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


Re: svn commit: r284959 - in head: . share/man/man4 share/man/man9 sys/conf sys/dev/glxsb sys/dev/hifn sys/dev/random sys/dev/rndtest sys/dev/safe sys/dev/syscons sys/dev/ubsec sys/dev/virtio/random s

2015-07-15 Thread Mark Murray

 On 15 Jul 2015, at 23:43, Adrian Chadd adrian.ch...@gmail.com wrote:
 
  - Add harvesting of slab allocator events. This needs to be checked for
weighing down the allocator code.
 
 Hi,
 
 Is this really doing it upon every one of those events? eg, for each
 mbuf alloc through UMA?

Only if you turn it on!

M

-- 

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


svn commit: r285618 - head/usr.sbin/ypbind

2015-07-15 Thread Marcelo Araujo
Author: araujo (ports committer)
Date: Thu Jul 16 02:34:22 2015
New Revision: 285618
URL: https://svnweb.freebsd.org/changeset/base/285618

Log:
  Fix a warning spotted by gcc4.9: dereferencing type-punned pointer will break
  strict-aliasing rules.
  
  Declare some variables as statics as well as some functions that are internal
  helpers. Update the function broadcast_result() to a post-KR definition.
  
  Differential Revision:D2690
  Reviewed by:  rodrigc, dim

Modified:
  head/usr.sbin/ypbind/ypbind.c

Modified: head/usr.sbin/ypbind/ypbind.c
==
--- head/usr.sbin/ypbind/ypbind.c   Thu Jul 16 02:08:54 2015
(r285617)
+++ head/usr.sbin/ypbind/ypbind.c   Thu Jul 16 02:34:22 2015
(r285618)
@@ -106,16 +106,16 @@ void  terminate(int);
 void   yp_restricted_mode(char *);
 intverify(struct in_addr);
 
-char *domain_name;
-struct _dom_binding *ypbindlist;
+static char *domain_name;
+static struct _dom_binding *ypbindlist;
 static struct _dom_binding *broad_domain;
 
 #define YPSET_NO   0
 #define YPSET_LOCAL1
 #define YPSET_ALL  2
-int ypsetmode = YPSET_NO;
-int ypsecuremode = 0;
-int ppid;
+static int ypsetmode = YPSET_NO;
+static int ypsecuremode = 0;
+static int ppid;
 
 #define NOT_RESPONDING_HYSTERESIS 10
 static int not_responding_count = 0;
@@ -126,9 +126,9 @@ static int not_responding_count = 0;
  * in restricted_addrs will be used for binding.
  */
 #define RESTRICTED_SERVERS 10
-int yp_restricted = 0;
-int yp_manycast = 0;
-struct in_addr restricted_addrs[RESTRICTED_SERVERS];
+static int yp_restricted = 0;
+static int yp_manycast = 0;
+static struct in_addr restricted_addrs[RESTRICTED_SERVERS];
 
 /* No more than MAX_CHILDREN child broadcasters at a time. */
 #ifndef MAX_CHILDREN
@@ -148,13 +148,13 @@ struct in_addr restricted_addrs[RESTRICT
 #define MAX_RETRIES 30
 #endif
 
-int retries = 0;
-int children = 0;
-int domains = 0;
-int yplockfd;
-fd_set fdsr;
+static int retries = 0;
+static int children = 0;
+static int domains = 0;
+static int yplockfd;
+static fd_set fdsr;
 
-SVCXPRT *udptransp, *tcptransp;
+static SVCXPRT *udptransp, *tcptransp;
 
 void *
 ypbindproc_null_2_yp(SVCXPRT *transp, void *argp, CLIENT *clnt)
@@ -165,7 +165,7 @@ ypbindproc_null_2_yp(SVCXPRT *transp, vo
return res;
 }
 
-struct ypbind_resp *
+static struct ypbind_resp *
 ypbindproc_domain_2_yp(SVCXPRT *transp, domainname *argp, CLIENT *clnt)
 {
static struct ypbind_resp res;
@@ -225,10 +225,10 @@ rejecting., *argp);
 
res.ypbind_status = YPBIND_SUCC_VAL;
res.ypbind_resp_u.ypbind_error = 0; /* Success */
-   *(u_int32_t *)res.ypbind_resp_u.ypbind_bindinfo.ypbind_binding_addr =
-   ypdb-dom_server_addr.sin_addr.s_addr;
-   *(u_short *)res.ypbind_resp_u.ypbind_bindinfo.ypbind_binding_port =
-   ypdb-dom_server_addr.sin_port;
+   memcpy(res.ypbind_resp_u.ypbind_bindinfo.ypbind_binding_addr,
+   ypdb-dom_server_addr.sin_addr.s_addr, sizeof(u_int32_t));
+   memcpy(res.ypbind_resp_u.ypbind_bindinfo.ypbind_binding_port,
+   ypdb-dom_server_addr.sin_port, sizeof(u_short));
/*printf(domain %s at %s/%d\n, ypdb-dom_domain,
inet_ntoa(ypdb-dom_server_addr.sin_addr),
ntohs(ypdb-dom_server_addr.sin_port));*/
@@ -275,8 +275,12 @@ rejecting., argp-ypsetdom_domain);
 
bzero(bindsin, sizeof bindsin);
bindsin.sin_family = AF_INET;
-   bindsin.sin_addr.s_addr = *(u_int32_t 
*)argp-ypsetdom_binding.ypbind_binding_addr;
-   bindsin.sin_port = *(u_short 
*)argp-ypsetdom_binding.ypbind_binding_port;
+   memcpy(bindsin.sin_addr.s_addr,
+   argp-ypsetdom_binding.ypbind_binding_addr,
+   sizeof(u_int32_t));
+   memcpy(bindsin.sin_port,
+   argp-ypsetdom_binding.ypbind_binding_port,
+   sizeof(u_short));
rpc_received(argp-ypsetdom_domain, bindsin, 1);
 
return((void *) result);
@@ -615,9 +619,8 @@ tell_parent(char *dom, struct sockaddr_i
return (0);
 }
 
-bool_t broadcast_result(out, addr)
-bool_t *out;
-struct sockaddr_in *addr;
+static bool_t
+broadcast_result(bool_t *out, struct sockaddr_in *addr)
 {
if (retries = MAX_RETRIES) {
bzero(addr, sizeof(struct sockaddr_in));
@@ -945,8 +948,10 @@ rpc_received(char *dom, struct sockaddr_
 
bzero(ybr, sizeof ybr);
ybr.ypbind_status = YPBIND_SUCC_VAL;
-   *(u_int32_t *)ybr.ypbind_resp_u.ypbind_bindinfo.ypbind_binding_addr = 
raddrp-sin_addr.s_addr;
-   *(u_short *)ybr.ypbind_resp_u.ypbind_bindinfo.ypbind_binding_port = 
raddrp-sin_port;
+   memcpy(ybr.ypbind_resp_u.ypbind_bindinfo.ypbind_binding_addr,
+   raddrp-sin_addr.s_addr, sizeof(u_int32_t));
+   memcpy(ybr.ypbind_resp_u.ypbind_bindinfo.ypbind_binding_port,
+   raddrp-sin_port, sizeof(u_short));
 
if (writev(ypdb-dom_lockfd, iov, 

Re: svn commit: r285552 - head/usr.bin/xargs

2015-07-15 Thread Bruce Evans

On Tue, 14 Jul 2015, Ian Lepore wrote:


On Tue, 2015-07-14 at 13:44 -0700, Xin Li wrote:

On 07/14/15 13:29, Garrett Cooper wrote:

On Jul 14, 2015, at 12:16, Baptiste Daroussin b...@freebsd.org
wrote:


Author: bapt Date: Tue Jul 14 19:16:14 2015 New Revision: 285552
URL: https://svnweb.freebsd.org/changeset/base/285552

Log: Convert atoi(3) to stronum(3) which allows to arguments and
report proper errors to the users


Is strtonum preferred over strtoll, etc?


No, but it is better than atoi() and expand_number() (except it uses
the long long abomination, like strtoll()).


strtonum(3) is a wrapper of strtoll() and provides more functionality
like range checking, so I think the answer would be yes.


It intentionally provides less functionality except for the range checking,
so as to try to be easier to use.


Except if we convert all our tools that take numbers on the command line
to use strtonum() then peoples' existing scripts and other automation
that passes 0xWhatever numbers suddenly stop working.  strtonum() seems
to be about 2/3 of a good idea.


1/3 io a good idea.

Bugs in it start with its name:
- it uses the reserved namespace
- it uses up a good name for a bad API

Bugs in its API include too much weakening of strtol(), etc:
- no support for bases other than 10.  This is the most annoying one.
  With the strtol() family, you get this support automatically by not
  forcing base 10.  Changing the type requires using another member
  of the strtol() family.  That is still possible with strtonum() by
  just not using it in complicated cases.
- no support for unsigned numbers
- no support for a mixture of signed and unsigned numbers (with e.g.
  a signed lower limit and an unsigned upper limit).  This can be
  built out of strtoul() but is complicated.  Applications like dd
  need this.
- no support for floating point.  Most numbers can be represented using
  floating point, support for floating point is not wanted for an atoi()
  replacement, and extra args to specify the format are also not wanted.
- no support even for large signed numbers.  The API hasn't caught up
  with C99 yet.  It uses the long long abomination instead of intmax_t.
  This is the most annoying design error.  With the strtol() family,
  you get intmax_t support automatically by using strtoimax() for
  everything, However, error handling is slightly more complicated with
  the general type.

BTW, it is unclear if POSIX even allows non-decimal or large args
in utilities, even in ones like dd where natural arg values are
multiples of powers of 2.  Portable shell scripts certainly shouldn't
use large non-decimal args.  This is a bug in POSIX.

Other bugs in its API include it being quite complicated to use despite
one of its reasons for existence being to be easier to use than the
strtol() family.

A drop-in replacement for atoi() would probably be named xatoi() and
do the same as atoi() except print a message and exit on error.  (The
behaviour of atoi() on error is only undefined in some cases, so atoi()
cannot exit on all errors.)  The message for this cannot be
context-specific, so xatoi() can't handle errors as well as a program
that actually checks for errors from atoi().  (The value of errno after
an error is unspecified, so checking it is nonsense, but the nonsense
usually works.)

strtonum()'s unease of use starts with the existence of its errstr
parameter.  This parameter is a bit like strtol()'s endptr parameter.
Often you don't need this parameter and have to fill it in with NULL
or a dummy pointer.  Actually using it requires further complications.

Unease of use continues with strtonum() having the same problem as
xatoi() with generating a context-specific errror messages.  strtonum()
can and does only return an error string that depends only on the error
type.  This string is quite short (shorter than ones returned by
strerror()).  strtonum() also sets errno.  Unfortunately, errno alone
is not enough to encode the error type, since the ERANGE errno must
be split into 2 types.  strtonum() has its errstr to do little more
than this splitting.  Then to actually use errstr, you have to either
accept its error description or parse it to turn it into your
context-specific description.  The latter would take more code than
using strtol() directly.

My main idea for a better API is a variadic one where only one parameter
other than the string is required:

intmax_t strtonum(const char *nptr, const char *flags, ...)

where the usual case is simple but the general one is complicated.
The simplest case has flags  and no more args.  This might give
xatoi().  The next level of complications is to either tell
strtonum() the messages that it should print before exiting, or
tell it to return an error string or code that is easy to print
yourself before existing.  It seems difficult to do either of
these without large code that would lose most of the advantages
of the wrapper.

Bruce

svn commit: r285596 - head/sys/compat/cloudabi

2015-07-15 Thread Ed Schouten
Author: ed
Date: Wed Jul 15 09:14:06 2015
New Revision: 285596
URL: https://svnweb.freebsd.org/changeset/base/285596

Log:
  Make posix_fallocate() and posix_fadvise() work.
  
  We can map these system calls directly to the FreeBSD counterparts. The
  other filesystem related system calls will be sent out for review
  separately, as they are a bit more complex to get right.

Modified:
  head/sys/compat/cloudabi/cloudabi_file.c

Modified: head/sys/compat/cloudabi/cloudabi_file.c
==
--- head/sys/compat/cloudabi/cloudabi_file.cWed Jul 15 06:14:04 2015
(r285595)
+++ head/sys/compat/cloudabi/cloudabi_file.cWed Jul 15 09:14:06 2015
(r285596)
@@ -26,15 +26,43 @@
 #include sys/cdefs.h
 __FBSDID($FreeBSD$);
 
+#include sys/param.h
+#include sys/fcntl.h
+#include sys/syscallsubr.h
+
 #include compat/cloudabi/cloudabi_proto.h
+#include compat/cloudabi/cloudabi_syscalldefs.h
 
 int
 cloudabi_sys_file_advise(struct thread *td,
 struct cloudabi_sys_file_advise_args *uap)
 {
+   int advice;
 
-   /* Not implemented. */
-   return (ENOSYS);
+   switch (uap-advice) {
+   case CLOUDABI_ADVICE_DONTNEED:
+   advice = POSIX_FADV_DONTNEED;
+   break;
+   case CLOUDABI_ADVICE_NOREUSE:
+   advice = POSIX_FADV_NOREUSE;
+   break;
+   case CLOUDABI_ADVICE_NORMAL:
+   advice = POSIX_FADV_NORMAL;
+   break;
+   case CLOUDABI_ADVICE_RANDOM:
+   advice = POSIX_FADV_RANDOM;
+   break;
+   case CLOUDABI_ADVICE_SEQUENTIAL:
+   advice = POSIX_FADV_SEQUENTIAL;
+   break;
+   case CLOUDABI_ADVICE_WILLNEED:
+   advice = POSIX_FADV_WILLNEED;
+   break;
+   default:
+   return (EINVAL);
+   }
+
+   return (kern_posix_fadvise(td, uap-fd, uap-offset, uap-len, advice));
 }
 
 int
@@ -42,8 +70,7 @@ cloudabi_sys_file_allocate(struct thread
 struct cloudabi_sys_file_allocate_args *uap)
 {
 
-   /* Not implemented. */
-   return (ENOSYS);
+   return (kern_posix_fallocate(td, uap-fd, uap-offset, uap-len));
 }
 
 int
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


Re: svn commit: r285552 - head/usr.bin/xargs

2015-07-15 Thread David Chisnall
On 15 Jul 2015, at 01:02, Xin Li delp...@delphij.net wrote:
 
 My only concern with strtonum() is that it's English only.

Given that strtonum() wraps strtoll, it ought to support whatever the current 
locale is (assuming that the program calls setlocale() before calling 
strtonum(), otherwise it will use the C locale[1]).  Or do you mean that the 
error messages are not localised?

David

[1] I would strongly advise against calling strtonum() or strtoll(), rather 
than strtoll_l() from a library, as it is impossible to specify in a 
potentially multi-threaded context whether you’re currently using a 
human-friendly or a machine-friendly number representation.  In a 
single-threaded application, it’s probably fine as long as *all* of your number 
parsing is either from a user or from a machine-parsable file (and all of your 
output is similar, or you’re explicitly setting the locale before each call).  
Given that strtonum() is non-standard anyway, we should probably add a 
strtonum_l() that takes a locale_t and a number base.
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r285597 - head/sys/arm64/arm64

2015-07-15 Thread Zbigniew Bodek
Author: zbb
Date: Wed Jul 15 09:24:45 2015
New Revision: 285597
URL: https://svnweb.freebsd.org/changeset/base/285597

Log:
  Add identify_cpu() to ARM64 init_secondary routine
  
  Identify current CPU. This is necessary to setup
  affinity registers and to provide support for
  runtime chip identification.
  
  Reviewed by:   andrew
  Obtained from: Semihalf
  Sponsored by:  The FreeBSD Foundation
  Differential Revision: https://reviews.freebsd.org/D3095

Modified:
  head/sys/arm64/arm64/mp_machdep.c

Modified: head/sys/arm64/arm64/mp_machdep.c
==
--- head/sys/arm64/arm64/mp_machdep.c   Wed Jul 15 09:14:06 2015
(r285596)
+++ head/sys/arm64/arm64/mp_machdep.c   Wed Jul 15 09:24:45 2015
(r285597)
@@ -229,6 +229,13 @@ init_secondary(uint64_t cpu)
pcpup-pc_curthread = pcpup-pc_idlethread;
pcpup-pc_curpcb = pcpup-pc_idlethread-td_pcb;
 
+   /*
+* Identify current CPU. This is necessary to setup
+* affinity registers and to provide support for
+* runtime chip identification.
+*/
+   identify_cpu();
+
/* Configure the interrupt controller */
arm_init_secondary();
 
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


Re: svn commit: r285592 - in head/sys: amd64/conf dev/ixgbe dev/netmap

2015-07-15 Thread Baptiste Daroussin
On Wed, Jul 15, 2015 at 01:02:02AM +, Patrick Kelsey wrote:
 Author: pkelsey
 Date: Wed Jul 15 01:02:01 2015
 New Revision: 285592
 URL: https://svnweb.freebsd.org/changeset/base/285592
 
 Log:
   Add netmap support for ixgbe SRIOV VFs (that is, to if_ixv).
   
   Differential Revision: https://reviews.freebsd.org/D2923
   Reviewed by: erj, gnn
   Approved by: jmallett (mentor)
   Sponsored by: Norse Corp, Inc.
 
 Modified:
   head/sys/amd64/conf/GENERIC
   head/sys/dev/ixgbe/if_ix.c
   head/sys/dev/ixgbe/if_ixv.c
   head/sys/dev/ixgbe/ixgbe.h
   head/sys/dev/netmap/ixgbe_netmap.h
 
 Modified: head/sys/amd64/conf/GENERIC
 ==
 --- head/sys/amd64/conf/GENERIC   Wed Jul 15 01:01:17 2015
 (r285591)
 +++ head/sys/amd64/conf/GENERIC   Wed Jul 15 01:02:01 2015
 (r285592)
 @@ -362,7 +362,7 @@ devicexenpci  # Xen HVM 
 Hypervisor se
  device   vmx # VMware VMXNET3 Ethernet
  
  # Netmap provides direct access to TX/RX rings on supported NICs
 -device   netmap  # netmap(4) support
 +# device netmap  # netmap(4) support
  
Is that intentional? why disabling netmap?

Best regards,
Bapt


pgpwsW6utcJnl.pgp
Description: PGP signature


Re: svn commit: r285592 - in head/sys: amd64/conf dev/ixgbe dev/netmap

2015-07-15 Thread Garrett Cooper
On Jul 14, 2015, at 23:00, Baptiste Daroussin b...@freebsd.org wrote:

 On Wed, Jul 15, 2015 at 01:02:02AM +, Patrick Kelsey wrote:
 Author: pkelsey
 Date: Wed Jul 15 01:02:01 2015
 New Revision: 285592
 URL: https://svnweb.freebsd.org/changeset/base/285592
 
 Log:
  Add netmap support for ixgbe SRIOV VFs (that is, to if_ixv).
 
  Differential Revision: https://reviews.freebsd.org/D2923
  Reviewed by: erj, gnn
  Approved by: jmallett (mentor)
  Sponsored by: Norse Corp, Inc.
 
 Modified:
  head/sys/amd64/conf/GENERIC
  head/sys/dev/ixgbe/if_ix.c
  head/sys/dev/ixgbe/if_ixv.c
  head/sys/dev/ixgbe/ixgbe.h
  head/sys/dev/netmap/ixgbe_netmap.h
 
 Modified: head/sys/amd64/conf/GENERIC
 ==
 --- head/sys/amd64/conf/GENERIC  Wed Jul 15 01:01:17 2015
 (r285591)
 +++ head/sys/amd64/conf/GENERIC  Wed Jul 15 01:02:01 2015
 (r285592)
 @@ -362,7 +362,7 @@ device   xenpci  # Xen HVM 
 Hypervisor se
 device   vmx # VMware VMXNET3 Ethernet
 
 # Netmap provides direct access to TX/RX rings on supported NICs
 -device  netmap  # netmap(4) support
 +# devicenetmap  # netmap(4) support
 
 Is that intentional? why disabling netmap?

It was accidental and has been reverted in r285593.


signature.asc
Description: Message signed with OpenPGP using GPGMail


Re: svn commit: r285552 - head/usr.bin/xargs

2015-07-15 Thread Julian Elischer

On 7/15/15 8:02 AM, Xin Li wrote:

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA512

On 07/14/15 15:17, Ian Lepore wrote:

On Tue, 2015-07-14 at 13:44 -0700, Xin Li wrote:

On 07/14/15 13:29, Garrett Cooper wrote:

On Jul 14, 2015, at 12:16, Baptiste Daroussin
b...@freebsd.org wrote:


Author: bapt Date: Tue Jul 14 19:16:14 2015 New Revision:
285552 URL: https://svnweb.freebsd.org/changeset/base/285552

Log: Convert atoi(3) to stronum(3) which allows to arguments
and report proper errors to the users

Is strtonum preferred over strtoll, etc?

strtonum(3) is a wrapper of strtoll() and provides more
functionality like range checking, so I think the answer would be
yes.

Cheers,


Except if we convert all our tools that take numbers on the command
line to use strtonum() then peoples' existing scripts and other
automation that passes 0xWhatever numbers suddenly stop working.
strtonum() seems to be about 2/3 of a good idea.

I think the caller has to be calling with 0 or 16 as base to request
that behavior?  If we are converting from atoi, the base number is a
fixed value of 10.

My only concern with strtonum() is that it's English only.

does it cover 0100 and 0x100?

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


svn commit: r285595 - head/usr.bin/ministat

2015-07-15 Thread John-Mark Gurney
Author: jmg
Date: Wed Jul 15 06:14:04 2015
New Revision: 285595
URL: https://svnweb.freebsd.org/changeset/base/285595

Log:
  fix error message...  errx since errno may not be set (if we didn't
  parse the full field), and err and errx add their own newline at the
  end...
  
  Sponsored by: Netflix, Inc.

Modified:
  head/usr.bin/ministat/ministat.c

Modified: head/usr.bin/ministat/ministat.c
==
--- head/usr.bin/ministat/ministat.cWed Jul 15 02:23:55 2015
(r285594)
+++ head/usr.bin/ministat/ministat.cWed Jul 15 06:14:04 2015
(r285595)
@@ -487,7 +487,7 @@ ReadSet(const char *n, int column, const
 
d = strtod(t, p);
if (p != NULL  *p != '\0')
-   err(2, Invalid data on line %d in %s\n, line, n);
+   errx(2, Invalid data on line %d in %s, line, n);
if (*buf != '\0')
AddPoint(s, d);
}
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r285607 - head/sys/kern

2015-07-15 Thread Konstantin Belousov
Author: kib
Date: Wed Jul 15 17:36:35 2015
New Revision: 285607
URL: https://svnweb.freebsd.org/changeset/base/285607

Log:
  Reset non-zero it_need indicator to zero atomically with fetching its
  current value.  It is believed that the change is the real fix for the
  issue which was covered over by the r252683.
  
  With the current code, if the interrupt handler sets it_need between
  read and consequent reset, the update could be lost and
  ithread_execute_handlers() would not be called in response to the lost
  update.
  
  The r252683 could have hide the issue since at the moment of commit,
  atomic_load_acq_int() did locked cmpxchg on the variable, which puts
  the cache line into the exclusive owned state and clears store
  buffers.  Then the immediate store of zero has very high chance of
  reusing the exclusive state of the cache line and make the load and
  store sequence operate as atomic swap.
  
  For now, add the acq+rel fence immediately after the swap, to not
  disturb current (but excessive) ordering.  Acquire is needed for the
  ih_need reads after the load, while release does not serve a useful
  purpose [*].
  
  Reviewed by:  alc
  Noted by: alc [*]
  Discussed with:   bde
  Tested by:pho
  Sponsored by: The FreeBSD Foundation
  MFC after:2 weeks

Modified:
  head/sys/kern/kern_intr.c

Modified: head/sys/kern/kern_intr.c
==
--- head/sys/kern/kern_intr.c   Wed Jul 15 17:14:05 2015(r285606)
+++ head/sys/kern/kern_intr.c   Wed Jul 15 17:36:35 2015(r285607)
@@ -1327,14 +1327,13 @@ ithread_loop(void *arg)
 * we are running, it will set it_need to note that we
 * should make another pass.
 */
-   while (atomic_load_acq_int(ithd-it_need) != 0) {
+   while (atomic_swap_int(ithd-it_need, 0) != 0) {
/*
-* This might need a full read and write barrier
-* to make sure that this write posts before any
-* of the memory or device accesses in the
-* handlers.
+* This needs a release barrier to make sure
+* that this write posts before any of the
+* memory or device accesses in the handlers.
 */
-   atomic_store_rel_int(ithd-it_need, 0);
+   atomic_thread_fence_acq_rel();
ithread_execute_handlers(p, ie);
}
WITNESS_WARN(WARN_PANIC, NULL, suspending ithread);
@@ -1507,14 +1506,13 @@ ithread_loop(void *arg)
 * we are running, it will set it_need to note that we
 * should make another pass.
 */
-   while (atomic_load_acq_int(ithd-it_need) != 0) {
+   while (atomic_swap_int(ithd-it_need, 0) != 0) {
/*
-* This might need a full read and write barrier
-* to make sure that this write posts before any
-* of the memory or device accesses in the
-* handlers.
+* This needs a release barrier to make sure
+* that this write posts before any of the
+* memory or device accesses in the handlers.
 */
-   atomic_store_rel_int(ithd-it_need, 0);
+   atomic_thread_fence_acq_rel();
if (priv)
priv_ithread_execute_handler(p, ih);
else 
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r285610 - head/usr.bin/calendar

2015-07-15 Thread Baptiste Daroussin
Author: bapt
Date: Wed Jul 15 18:49:15 2015
New Revision: 285610
URL: https://svnweb.freebsd.org/changeset/base/285610

Log:
  Fix trimming spaces writing at index -1 if an empty string is passed
  
  Submitted by: Gennady Proskurin gpr...@mail.ru

Modified:
  head/usr.bin/calendar/io.c

Modified: head/usr.bin/calendar/io.c
==
--- head/usr.bin/calendar/io.c  Wed Jul 15 18:18:07 2015(r285609)
+++ head/usr.bin/calendar/io.c  Wed Jul 15 18:49:15 2015(r285610)
@@ -87,11 +87,16 @@ static void
 trimlr(char **buf)
 {
char *walk = *buf;
+   char *last;
 
while (isspace(*walk))
walk++;
-   while (isspace(walk[strlen(walk) -1]))
-   walk[strlen(walk) -1] = '\0';
+   if (*walk != '\0') {
+   last = walk + strlen(walk) - 1;
+   while (last  walk  isspace(*last))
+   last--;
+   *(last+1) = 0;
+   }
 
*buf = walk;
 }
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r285606 - head/sys/kern

2015-07-15 Thread Konstantin Belousov
Author: kib
Date: Wed Jul 15 17:14:05 2015
New Revision: 285606
URL: https://svnweb.freebsd.org/changeset/base/285606

Log:
  Style.  Remove excessive brackets.  Compare non-boolean with zero.
  
  Sponsored by: The FreeBSD Foundation
  MFC after:2 weeks

Modified:
  head/sys/kern/kern_intr.c

Modified: head/sys/kern/kern_intr.c
==
--- head/sys/kern/kern_intr.c   Wed Jul 15 16:57:40 2015(r285605)
+++ head/sys/kern/kern_intr.c   Wed Jul 15 17:14:05 2015(r285606)
@@ -1346,8 +1346,8 @@ ithread_loop(void *arg)
 * set again, so we have to check it again.
 */
thread_lock(td);
-   if ((atomic_load_acq_int(ithd-it_need) == 0) 
-   !(ithd-it_flags  (IT_DEAD | IT_WAIT))) {
+   if (atomic_load_acq_int(ithd-it_need) == 0 
+   (ithd-it_flags  (IT_DEAD | IT_WAIT)) == 0) {
TD_SET_IWAIT(td);
ie-ie_count = 0;
mi_switch(SW_VOL | SWT_IWAIT, NULL);
@@ -1529,8 +1529,8 @@ ithread_loop(void *arg)
 * set again, so we have to check it again.
 */
thread_lock(td);
-   if ((atomic_load_acq_int(ithd-it_need) == 0) 
-   !(ithd-it_flags  (IT_DEAD | IT_WAIT))) {
+   if (atomic_load_acq_int(ithd-it_need) == 0 
+   (ithd-it_flags  (IT_DEAD | IT_WAIT)) == 0) {
TD_SET_IWAIT(td);
ie-ie_count = 0;
mi_switch(SW_VOL | SWT_IWAIT, NULL);
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r285598 - head/sys/compat/cloudabi

2015-07-15 Thread Ed Schouten
Author: ed
Date: Wed Jul 15 11:27:34 2015
New Revision: 285598
URL: https://svnweb.freebsd.org/changeset/base/285598

Log:
  Implement the trivial socket system calls: shutdown() and listen().

Modified:
  head/sys/compat/cloudabi/cloudabi_sock.c

Modified: head/sys/compat/cloudabi/cloudabi_sock.c
==
--- head/sys/compat/cloudabi/cloudabi_sock.cWed Jul 15 09:24:45 2015
(r285597)
+++ head/sys/compat/cloudabi/cloudabi_sock.cWed Jul 15 11:27:34 2015
(r285598)
@@ -26,7 +26,11 @@
 #include sys/cdefs.h
 __FBSDID($FreeBSD$);
 
+#include sys/socket.h
+#include sys/sysproto.h
+
 #include compat/cloudabi/cloudabi_proto.h
+#include compat/cloudabi/cloudabi_syscalldefs.h
 
 int
 cloudabi_sys_sock_accept(struct thread *td,
@@ -59,18 +63,37 @@ int
 cloudabi_sys_sock_listen(struct thread *td,
 struct cloudabi_sys_sock_listen_args *uap)
 {
+   struct listen_args listen_args = {
+   .s = uap-s,
+   .backlog = uap-backlog,
+   };
 
-   /* Not implemented. */
-   return (ENOSYS);
+   return (sys_listen(td, listen_args));
 }
 
 int
 cloudabi_sys_sock_shutdown(struct thread *td,
 struct cloudabi_sys_sock_shutdown_args *uap)
 {
+   struct shutdown_args shutdown_args = {
+   .s = uap-fd,
+   };
+
+   switch (uap-how) {
+   case CLOUDABI_SHUT_RD:
+   shutdown_args.how = SHUT_RD;
+   break;
+   case CLOUDABI_SHUT_WR:
+   shutdown_args.how = SHUT_WR;
+   break;
+   case CLOUDABI_SHUT_RD | CLOUDABI_SHUT_WR:
+   shutdown_args.how = SHUT_RDWR;
+   break;
+   default:
+   return (EINVAL);
+   }
 
-   /* Not implemented. */
-   return (ENOSYS);
+   return (sys_shutdown(td, shutdown_args));
 }
 
 int
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


Re: svn commit: r284959 - in head: . share/man/man4 share/man/man9 sys/conf sys/dev/glxsb sys/dev/hifn sys/dev/random sys/dev/rndtest sys/dev/safe sys/dev/syscons sys/dev/ubsec sys/dev/virtio/random s

2015-07-15 Thread Adrian Chadd
On 30 June 2015 at 10:00, Mark Murray ma...@freebsd.org wrote:
 Author: markm
 Date: Tue Jun 30 17:00:45 2015
 New Revision: 284959
 URL: https://svnweb.freebsd.org/changeset/base/284959

   - Add harvesting of FFS atime events. This needs to be checked for
 weighing down the FS code.
   - Add harvesting of slab allocator events. This needs to be checked for
 weighing down the allocator code.

Hi,

Is this really doing it upon every one of those events? eg, for each
mbuf alloc through UMA?



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


svn commit: r285616 - head/sys/kern

2015-07-15 Thread Konstantin Belousov
Author: kib
Date: Wed Jul 15 21:44:16 2015
New Revision: 285616
URL: https://svnweb.freebsd.org/changeset/base/285616

Log:
  Do not use atomic_swap_int(9), it is not available on all
  architectures.  Atomic_cmpset_int(9) is a direct replacement, due to
  loop.  The change fixes arm, arm64, mips an sparc64, which lack
  atomic_swap().
  
  Suggested and reviewed by:alc
  Sponsored by: The FreeBSD Foundation
  MFC after:2 weeks

Modified:
  head/sys/kern/kern_intr.c

Modified: head/sys/kern/kern_intr.c
==
--- head/sys/kern/kern_intr.c   Wed Jul 15 21:35:09 2015(r285615)
+++ head/sys/kern/kern_intr.c   Wed Jul 15 21:44:16 2015(r285616)
@@ -1327,7 +1327,7 @@ ithread_loop(void *arg)
 * we are running, it will set it_need to note that we
 * should make another pass.
 */
-   while (atomic_swap_int(ithd-it_need, 0) != 0) {
+   while (atomic_cmpset_int(ithd-it_need, 1, 0) != 0) {
/*
 * This needs a release barrier to make sure
 * that this write posts before any of the
@@ -1506,7 +1506,7 @@ ithread_loop(void *arg)
 * we are running, it will set it_need to note that we
 * should make another pass.
 */
-   while (atomic_swap_int(ithd-it_need, 0) != 0) {
+   while (atomic_cmpset_int(ithd-it_need, 1, 0) != 0) {
/*
 * This needs a release barrier to make sure
 * that this write posts before any of the
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r285615 - head/sbin/newfs

2015-07-15 Thread John-Mark Gurney
Author: jmg
Date: Wed Jul 15 21:35:09 2015
New Revision: 285615
URL: https://svnweb.freebsd.org/changeset/base/285615

Log:
  fix the docs, the number of frags per inode (NFPI) changed in r228794
  to 2 from 4, but the man page didn't get updated...
  
  other minor changes to make igor happy...
  
  MFC after:3 days

Modified:
  head/sbin/newfs/newfs.8

Modified: head/sbin/newfs/newfs.8
==
--- head/sbin/newfs/newfs.8 Wed Jul 15 21:09:38 2015(r285614)
+++ head/sbin/newfs/newfs.8 Wed Jul 15 21:35:09 2015(r285615)
@@ -28,7 +28,7 @@
 .\ @(#)newfs.88.6 (Berkeley) 5/3/95
 .\ $FreeBSD$
 .\
-.Dd October 1, 2013
+.Dd July 15, 2015
 .Dt NEWFS 8
 .Os
 .Sh NAME
@@ -152,7 +152,7 @@ The expected average number of files per
 .It Fl i Ar bytes
 Specify the density of inodes in the file system.
 The default is to create an inode for every
-.Pq 4 * Ar frag-size
+.Pq 2 * Ar frag-size
 bytes of data space.
 If fewer inodes are desired, a larger number should be used;
 to create more inodes a smaller number should be given.
@@ -173,7 +173,7 @@ Clustering the metadata blocks speeds up
 and decreases the running time of
 .Xr fsck 8 .
 By default
-.Xr newfs 8
+.Nm
 sets it to half of the space reserved to minfree.
 .It Fl l
 Enable multilabel MAC on the new file system.
@@ -228,7 +228,7 @@ for more details on how to set this opti
 The partition name (a..h) you want to use in case the underlying image
 is a file, so you do not have access to individual partitions through the
 filesystem.
-Can also be used with a device, e.g.
+Can also be used with a device, e.g.,
 .Nm
 .Fl p Ar f
 .Ar /dev/da1s3
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r285600 - head/sys/dev/isp

2015-07-15 Thread Alexander Motin
Author: mav
Date: Wed Jul 15 12:04:12 2015
New Revision: 285600
URL: https://svnweb.freebsd.org/changeset/base/285600

Log:
  MULTI_ID supported does not mean it is used.

Modified:
  head/sys/dev/isp/isp.c
  head/sys/dev/isp/isp_freebsd.c

Modified: head/sys/dev/isp/isp.c
==
--- head/sys/dev/isp/isp.c  Wed Jul 15 11:58:30 2015(r285599)
+++ head/sys/dev/isp/isp.c  Wed Jul 15 12:04:12 2015(r285600)
@@ -3653,7 +3653,7 @@ isp_scan_fabric(ispsoftc_t *isp, int cha
 * that have the same domain and area code as our own
 * portid.
 */
-   if (ISP_CAP_MULTI_ID(isp)) {
+   if (ISP_CAP_MULTI_ID(isp)  isp-isp_nchan  1) {
if ((portid  8) == (fcp-isp_portid  8)) {
isp_prt(isp, ISP_LOG_SANCFG,
Chan %d skip PortID 0x%06x,

Modified: head/sys/dev/isp/isp_freebsd.c
==
--- head/sys/dev/isp/isp_freebsd.c  Wed Jul 15 11:58:30 2015
(r285599)
+++ head/sys/dev/isp/isp_freebsd.c  Wed Jul 15 12:04:12 2015
(r285600)
@@ -2533,7 +2533,7 @@ isp_handle_platform_atio7(ispsoftc_t *is
 * If we can't, we're somewhat in trouble because we can't actually 
respond w/o that information.
 * We also, as a matter of course, need to know the WWN of the 
initiator too.
 */
-   if (ISP_CAP_MULTI_ID(isp)) {
+   if (ISP_CAP_MULTI_ID(isp)  isp-isp_nchan  1) {
/*
 * Find the right channel based upon D_ID
 */
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r285601 - head/sys/dev/ofw

2015-07-15 Thread Andrew Turner
Author: andrew
Date: Wed Jul 15 13:28:25 2015
New Revision: 285601
URL: https://svnweb.freebsd.org/changeset/base/285601

Log:
  Fix an infinite loop when a node doesn't have an interrupt-parent property.
  
  Submitted by: Aleksey Kuleshov rnd...@yandex.ru
  Differential Revision: https://reviews.freebsd.org/D3041

Modified:
  head/sys/dev/ofw/ofw_bus_subr.c

Modified: head/sys/dev/ofw/ofw_bus_subr.c
==
--- head/sys/dev/ofw/ofw_bus_subr.c Wed Jul 15 12:04:12 2015
(r285600)
+++ head/sys/dev/ofw/ofw_bus_subr.c Wed Jul 15 13:28:25 2015
(r285601)
@@ -445,7 +445,7 @@ ofw_bus_intr_to_rl(device_t dev, phandle
if (OF_searchencprop(node, interrupt-parent, iparent,
sizeof(iparent)) == -1) {
for (iparent = node; iparent != 0;
-   iparent = OF_parent(node)) {
+   iparent = OF_parent(iparent)) {
if (OF_hasprop(iparent, interrupt-controller))
break;
}
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org