svn commit: r334522 - in head/sys: amd64/amd64 amd64/include i386/i386 i386/include

2018-06-01 Thread Bruce Evans
Author: bde
Date: Sat Jun  2 05:48:44 2018
New Revision: 334522
URL: https://svnweb.freebsd.org/changeset/base/334522

Log:
  Fix high resolution kernel profiling just enough to not crash at boot
  time, especially for SMP.  If configured, it turns itself on at boot
  time for calibration, so is fragile even if never otherwise used.
  
  Both types of kernel profiling were supposed to use a global spinlock
  in the SMP case.  If hi-res profiling is configured (but not necessarily
  used), this was supposed to be optimized by only using it when
  necessary, and slightly more efficiently, in asm.  But it was not done
  at all for mcount entry where it is necessary.  This caused crashes
  in the SMP case when either type of profiling was enabled.  For mcount
  exit, it only caused wrong times.  The times were wrongest with an
  i8254 timer since using that requires exclusive access to the hardware.
  The i8254 timer was too slow to use here 20 years ago and is much less
  usable now, but it is the default for the SMP case since TSCs weren't
  invariant when SMP was new.  Do the locking in all hi-res SMP cases for
  simplicity.
  
  Calibration uses special asms, and the clobber lists in these were sort
  of inverted.  They contained the arg and return registers which are not
  clobbered, but on amd64 they didn't contain the residue of the call-used
  registers which may be clobbered (%r10 and %r11).  This usually caused
  hangs at boot time.  This usually affected even the UP case.

Modified:
  head/sys/amd64/amd64/prof_machdep.c
  head/sys/amd64/include/profile.h
  head/sys/i386/i386/prof_machdep.c
  head/sys/i386/include/profile.h

Modified: head/sys/amd64/amd64/prof_machdep.c
==
--- head/sys/amd64/amd64/prof_machdep.c Sat Jun  2 04:37:37 2018
(r334521)
+++ head/sys/amd64/amd64/prof_machdep.c Sat Jun  2 05:48:44 2018
(r334522)
@@ -56,6 +56,20 @@ static int   cputime_prof_active;
 #endif /* GUPROF */
 
 #ifdef __GNUCLIKE_ASM
+#if defined(SMP) && defined(GUPROF)
+#defineMPLOCK "\n\
+   movl$1,%edx \n\
+9: \n\
+   xorl%eax,%eax   \n\
+   lock\n\
+   cmpxchgl %edx,mcount_lock   \n\
+   jne 9b  \n"
+#defineMPUNLOCK "movl  $0,mcount_lock  \n"
+#else /* !(SMP && GUPROF) */
+#defineMPLOCK
+#defineMPUNLOCK
+#endif /* SMP && GUPROF */
+
 __asm("\n\
 GM_STATE   =   0   \n\
 GMON_PROF_OFF  =   3   \n\
@@ -111,8 +125,10 @@ __mcount:  
\n\
movq7*8(%rsp),%rsi  \n\
\n\
pushfq  \n\
-   cli \n\
-   callmcount  \n\
+   cli \n"
+   MPLOCK "\n\
+   callmcount  \n"
+   MPUNLOCK "  \n\
popfq   \n\
popq%r9 \n\
popq%r8 \n\
@@ -163,8 +179,10 @@ GMON_PROF_HIRES=   4   
\n\
pushq   %r9 \n\
movq7*8(%rsp),%rdi  \n\
pushfq  \n\
-   cli \n\
-   callmexitcount  \n\
+   cli \n"
+   MPLOCK "\n\
+   callmexitcount  \n"
+   MPUNLOCK "  \n\
popfq   \n\
popq%r9 \n\
popq%r8 \n\

Modified: head/sys/amd64/include/profile.h
==
--- head/sys/amd64/include/profile.hSat Jun  2 04:37:37 2018
(r334521)
+++ 

Re: svn commit: r334518 - head/usr.bin/top

2018-06-01 Thread Rodney W. Grimes
[ Charset UTF-8 unsupported, converting... ]
> On 1 June 2018 at 21:32, Rodney W. Grimes
>  wrote:
> >> Author: eadler
> >> Date: Sat Jun  2 04:08:52 2018
> >> New Revision: 334518
> >> URL: https://svnweb.freebsd.org/changeset/base/334518
> >>
> >> Log:
> >>   top(1): help scan-build along a bit
> >>
> >>   Teach scan-build that some arrays are larger than zero, and thus not to
> >>   warn.
> >>
> >> Modified:
> >>   head/usr.bin/top/display.c
> >>   head/usr.bin/top/machine.c
> >>
> >> Modified: head/usr.bin/top/display.c
> >>   swap_names = statics->swap_names;
> >>   num_swap = string_count(swap_names);
> >> + assert(num_swap > 0);
> >
> > Isn't it valid to run without swap and then num_swap = 0?
> 
> I explicitly tested this case. num_swap comes from swap_names which
> comes from swapnames which is defined as
> 
> static char *swapnames[] = {
> "K Total, ", "K Used, ", "K Free, ", "% Inuse, ", "K In, ", "K Out",
> NULL
> };
> 
> 
> In short: its poor naming :)

Yep, I went and dug down this path myself and was about to reply
to ignore my assumption about what swap_names is and num_swap was
counting.


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


Re: svn commit: r334518 - head/usr.bin/top

2018-06-01 Thread Eitan Adler
On 1 June 2018 at 21:32, Rodney W. Grimes
 wrote:
>> Author: eadler
>> Date: Sat Jun  2 04:08:52 2018
>> New Revision: 334518
>> URL: https://svnweb.freebsd.org/changeset/base/334518
>>
>> Log:
>>   top(1): help scan-build along a bit
>>
>>   Teach scan-build that some arrays are larger than zero, and thus not to
>>   warn.
>>
>> Modified:
>>   head/usr.bin/top/display.c
>>   head/usr.bin/top/machine.c
>>
>> Modified: head/usr.bin/top/display.c
>>   swap_names = statics->swap_names;
>>   num_swap = string_count(swap_names);
>> + assert(num_swap > 0);
>
> Isn't it valid to run without swap and then num_swap = 0?

I explicitly tested this case. num_swap comes from swap_names which
comes from swapnames which is defined as

static char *swapnames[] = {
"K Total, ", "K Used, ", "K Free, ", "% Inuse, ", "K In, ", "K Out",
NULL
};


In short: its poor naming :)



-- 
Eitan Adler
Source, Ports, Doc committer
Bugmeister, Ports Security teams
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r334521 - head/usr.bin/top

2018-06-01 Thread Eitan Adler
Author: eadler
Date: Sat Jun  2 04:37:37 2018
New Revision: 334521
URL: https://svnweb.freebsd.org/changeset/base/334521

Log:
  top(1): const poison
  
  top(1) has a number of issues with writing to const strings. Begin
  helping this along by marking easy cases as const.

Modified:
  head/usr.bin/top/utils.c
  head/usr.bin/top/utils.h

Modified: head/usr.bin/top/utils.c
==
--- head/usr.bin/top/utils.cSat Jun  2 04:25:09 2018(r334520)
+++ head/usr.bin/top/utils.cSat Jun  2 04:37:37 2018(r334521)
@@ -20,7 +20,7 @@
 #include 
 
 int
-atoiwi(char *str)
+atoiwi(const char *str)
 {
 int len;
 
@@ -136,7 +136,7 @@ int digits(int val)
  */
 
 char *
-strecpy(char *to, char *from)
+strecpy(char *to, const char *from)
 {
 while ((*to++ = *from++) != '\0');
 return(--to);
@@ -147,7 +147,7 @@ strecpy(char *to, char *from)
  */
 
 int
-string_index(char *string, char *array[])
+string_index(const char *string, char *array[])
 {
 size_t i = 0;
 
@@ -170,9 +170,10 @@ string_index(char *string, char *array[])
  * squat about quotes.
  */
 
-char **argparse(char *line, int *cntp)
+char **
+argparse(char *line, int *cntp)
 {
-char *from;
+const char *from;
 char *to;
 int cnt;
 int ch;

Modified: head/usr.bin/top/utils.h
==
--- head/usr.bin/top/utils.hSat Jun  2 04:25:09 2018(r334520)
+++ head/usr.bin/top/utils.hSat Jun  2 04:37:37 2018(r334521)
@@ -10,15 +10,15 @@
  *  Copyright (c) 1989, 1990, 1992, William LeFebvre, Northwestern University
  */
 
-int atoiwi(char *);
+int atoiwi(const char *);
 char *itoa(unsigned int);
 char *itoa7(unsigned int);
 int digits(int);
-char *strecpy(char *, char *);
+char *strecpy(char *, const char *);
 char **argparse(char *, int *);
 long percentages(int, int *, long *, long *, long *);
 char *format_time(long);
 char *format_k(int);
 char *format_k2(unsigned long long);
-int string_index(char *string, char **array);
+int string_index(const char *string, char *array[]);
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r334518 - head/usr.bin/top

2018-06-01 Thread Rodney W. Grimes
> Author: eadler
> Date: Sat Jun  2 04:08:52 2018
> New Revision: 334518
> URL: https://svnweb.freebsd.org/changeset/base/334518
> 
> Log:
>   top(1): help scan-build along a bit
>   
>   Teach scan-build that some arrays are larger than zero, and thus not to
>   warn.
> 
> Modified:
>   head/usr.bin/top/display.c
>   head/usr.bin/top/machine.c
> 
> Modified: head/usr.bin/top/display.c
> ==
> --- head/usr.bin/top/display.cSat Jun  2 03:54:50 2018
> (r334517)
> +++ head/usr.bin/top/display.cSat Jun  2 04:08:52 2018
> (r334518)
> @@ -30,6 +30,7 @@
>  
>  #include 
>  
> +#include 
>  #include 
>  #include 
>  #include 
> @@ -203,19 +204,23 @@ int display_init(struct statics * statics)
>   /* save pointers and allocate space for names */
>   procstate_names = statics->procstate_names;
>   num_procstates = string_count(procstate_names);
> + assert(num_procstates > 0);
>   lprocstates = malloc(num_procstates * sizeof(int));
>  
>   cpustate_names = statics->cpustate_names;
>  
>   swap_names = statics->swap_names;
>   num_swap = string_count(swap_names);
> + assert(num_swap > 0);

Isn't it valid to run without swap and then num_swap = 0?

>   lswap = malloc(num_swap * sizeof(int));
>   num_cpustates = string_count(cpustate_names);
> + assert(num_cpustates > 0);
>   lcpustates = malloc(num_cpustates * sizeof(int) * statics->ncpus);
>   cpustate_columns = malloc(num_cpustates * sizeof(int));
>  
>   memory_names = statics->memory_names;
>   num_memory = string_count(memory_names);
> + assert(num_memory > 0);
>   lmemory = malloc(num_memory * sizeof(int));
>  
>   arc_names = statics->arc_names;
> 
> Modified: head/usr.bin/top/machine.c
> ==
> --- head/usr.bin/top/machine.cSat Jun  2 03:54:50 2018
> (r334517)
> +++ head/usr.bin/top/machine.cSat Jun  2 04:08:52 2018
> (r334518)
> @@ -401,6 +401,7 @@ machine_init(struct statics *statics)
>   }
>   }
>   size = sizeof(long) * ncpus * CPUSTATES;
> + assert(size > 0);
>   pcpu_cp_old = calloc(1, size);
>   pcpu_cp_diff = calloc(1, size);
>   pcpu_cpu_states = calloc(1, size);
> 
> 

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


svn commit: r334520 - in head/sys: amd64/amd64 i386/i386 i386/include libkern

2018-06-01 Thread Bruce Evans
Author: bde
Date: Sat Jun  2 04:25:09 2018
New Revision: 334520
URL: https://svnweb.freebsd.org/changeset/base/334520

Log:
  Fix recent breakages of kernel profiling, mostly on i386 (high resolution
  kernel profiling remains broken).
  
  memmove() was broken using ALTENTRY().  ALTENTRY() is only different from
  ENTRY() in the profiling case, and its use in that case was sort of
  backwards.  The backwardness magically turned memmove() into memcpy()
  instead of completely breaking it.  Only the high resolution parts of
  profiling itself were broken.  Use ordinary ENTRY() for memmove().
  Turn bcopy() into a tail call to memmove() to reduce complications.
  This gives slightly different pessimizations and profiling lossage.
  The pessimizations are minimized by not using a frame pointer() for
  bcopy().
  
  Calls to profiling functions from exception trampolines were not
  relocated.  This caused crashes on the first exception.  Fix this using
  function pointers.
  
  Addresses of exception handlers in trampolines were not relocated.  This
  caused unknown offsets in the profiling data.  Relocate by abusing
  setidt_disp as for pmc although this is slower than necessary and
  requires namespace pollution.  pmc seems to be missing some relocations.
  Stack traces and lots of other things in debuggers need similar relocations.
  
  Most user addresses were misclassified as unknown kernel addresses and
  then ignored.  Treat all unknown addresses as user. Now only user
  addresses in the kernel text range are significantly misclassified (as
  known kernel addresses).
  
  The ibrs functions didn't preserve enough registers.  This is the only
  recent breakage on amd64.  Although these functions are written in
  asm, in the profiling case they call profiling functions which are
  mostly for the C ABI, so they only have to save call-used registers.
  They also have to save arg and return registers in some cases and
  actually save them in all cases to reduce complications.  They end up
  saving all registers except %ecx on i386 and %r10 and %r11 on amd64.
  Saving these is only needed for 1 caller on each of amd64 and i386.
  Save them there.  This is slightly simpler.
  
  Remove saving %ecx in handle_ibrs_exit on i386.  Both handle_ibrs_entry
  and handle_ibrs_exit use %ecx, but only the latter needed to or did
  save it.  But saving it there doesn't work for the profiling case.
  
  amd64 has more automatic saving of the most common scratch registers
  %rax, %rcx and %rdx (its complications for %r10 are from unusual use
  of %r10 by SYSCALL).  Thus profiling of handle_ibrs_exit_rs() was not
  broken, and I didn't simplify the saving by moving the saving of these
  registers from it to the caller.

Modified:
  head/sys/amd64/amd64/exception.S
  head/sys/i386/i386/exception.s
  head/sys/i386/i386/prof_machdep.c
  head/sys/i386/i386/support.s
  head/sys/i386/include/asmacros.h
  head/sys/i386/include/profile.h
  head/sys/libkern/mcount.c

Modified: head/sys/amd64/amd64/exception.S
==
--- head/sys/amd64/amd64/exception.SSat Jun  2 04:20:42 2018
(r334519)
+++ head/sys/amd64/amd64/exception.SSat Jun  2 04:25:09 2018
(r334520)
@@ -463,8 +463,16 @@ fast_syscall_common:
movqPCPU(SCRATCH_RSP),%r11  /* %r11 already saved */
movq%r11,TF_RSP(%rsp)   /* user stack pointer */
movqPCPU(SCRATCH_RAX),%rax
+   /*
+* Save a few arg registers early to free them for use in
+* handle_ibrs_entry().  %r10 is especially tricky.  It is not an
+* arg register, but it holds the arg register %rcx.  Profiling
+* preserves %rcx, but may clobber %r10.  Profiling may also
+* clobber %r11, but %r11 (original %eflags) has been saved.
+*/
movq%rax,TF_RAX(%rsp)   /* syscall number */
movq%rdx,TF_RDX(%rsp)   /* arg 3 */
+   movq%r10,TF_RCX(%rsp)   /* arg 4 */
SAVE_SEGS
callhandle_ibrs_entry
movqPCPU(CURPCB),%r11
@@ -475,7 +483,6 @@ fast_syscall_common:
movq$2,TF_ERR(%rsp)
movq%rdi,TF_RDI(%rsp)   /* arg 1 */
movq%rsi,TF_RSI(%rsp)   /* arg 2 */
-   movq%r10,TF_RCX(%rsp)   /* arg 4 */
movq%r8,TF_R8(%rsp) /* arg 5 */
movq%r9,TF_R9(%rsp) /* arg 6 */
movq%rbx,TF_RBX(%rsp)   /* C preserved */

Modified: head/sys/i386/i386/exception.s
==
--- head/sys/i386/i386/exception.s  Sat Jun  2 04:20:42 2018
(r334519)
+++ head/sys/i386/i386/exception.s  Sat Jun  2 04:25:09 2018
(r334520)
@@ -516,7 +516,9 @@ doreti_exit:
 1: testl   $SEL_RPL_MASK, TF_CS(%esp)
jz  doreti_popl_fs
 2: movl$handle_ibrs_exit,%eax
+   pushl   %ecx/* preserve 

svn commit: r334519 - head/usr.bin/top

2018-06-01 Thread Eitan Adler
Author: eadler
Date: Sat Jun  2 04:20:42 2018
New Revision: 334519
URL: https://svnweb.freebsd.org/changeset/base/334519

Log:
  top(1): clean up a bit
  
  - remove unused defines
  - use standard defines for STDOUT
  - don't cast for memset
  - avoid using (void) cast

Modified:
  head/usr.bin/top/machine.c
  head/usr.bin/top/screen.c

Modified: head/usr.bin/top/machine.c
==
--- head/usr.bin/top/machine.c  Sat Jun  2 04:08:52 2018(r334518)
+++ head/usr.bin/top/machine.c  Sat Jun  2 04:20:42 2018(r334519)
@@ -841,7 +841,7 @@ get_process_info(struct system_info *si, struct proces
total_inblock = 0;
total_oublock = 0;
total_majflt = 0;
-   memset((char *)process_states, 0, sizeof(process_states));
+   memset(process_states, 0, sizeof(process_states));
prefp = pref;
for (pp = pbase, i = 0; i < nproc; pp++, i++) {
 

Modified: head/usr.bin/top/screen.c
==
--- head/usr.bin/top/screen.c   Sat Jun  2 04:08:52 2018(r334518)
+++ head/usr.bin/top/screen.c   Sat Jun  2 04:20:42 2018(r334519)
@@ -20,15 +20,16 @@
  *  preprocessor variable "TOStop".   --wnl
  */
 
-#include "top.h"
-
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
+#include 
+
 #include "screen.h"
+#include "top.h"
 
 int  overstrike;
 int  screen_length;
@@ -54,10 +55,6 @@ static struct termios old_settings;
 static struct termios new_settings;
 static char is_a_terminal = false;
 
-#defineSTDIN   0
-#defineSTDOUT  1
-#defineSTDERR  2
-
 void
 init_termcap(int interactive)
 {
@@ -164,7 +161,7 @@ init_termcap(int interactive)
 PC = (PCptr = tgetstr("pc", )) ? *PCptr : 0;
 
 /* set convenience strings */
-(void) strncpy(home, tgoto(cursor_motion, 0, 0), sizeof(home) - 1);
+strncpy(home, tgoto(cursor_motion, 0, 0), sizeof(home) - 1);
 home[sizeof(home) - 1] = '\0';
 /* (lower_left is set in get_screensize) */
 
@@ -174,7 +171,7 @@ init_termcap(int interactive)
 get_screensize();
 
 /* if stdout is not a terminal, pretend we are a dumb terminal */
-if (tcgetattr(STDOUT, _settings) == -1)
+if (tcgetattr(STDOUT_FILENO, _settings) == -1)
 {
smart_terminal = false;
 }
@@ -184,7 +181,7 @@ void
 init_screen(void)
 {
 /* get the old settings for safe keeping */
-if (tcgetattr(STDOUT, _settings) != -1)
+if (tcgetattr(STDOUT_FILENO, _settings) != -1)
 {
/* copy the settings so we can modify them */
new_settings = old_settings;
@@ -194,7 +191,7 @@ init_screen(void)
new_settings.c_oflag &= ~(TAB3);
new_settings.c_cc[VMIN] = 1;
new_settings.c_cc[VTIME] = 0;
-   (void) tcsetattr(STDOUT, TCSADRAIN, _settings);
+   tcsetattr(STDOUT_FILENO, TCSADRAIN, _settings);
 
/* remember the erase and kill characters */
ch_erase = old_settings.c_cc[VERASE];
@@ -229,7 +226,7 @@ end_screen(void)
 /* if we have settings to reset, then do so */
 if (is_a_terminal)
 {
-   (void) tcsetattr(STDOUT, TCSADRAIN, _settings);
+   tcsetattr(STDOUT_FILENO, TCSADRAIN, _settings);
 }
 }
 
@@ -239,7 +236,7 @@ reinit_screen(void)
 /* install our settings if it is a terminal */
 if (is_a_terminal)
 {
-   (void) tcsetattr(STDOUT, TCSADRAIN, _settings);
+   tcsetattr(STDOUT_FILENO, TCSADRAIN, _settings);
 }
 
 /* send init string */
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r334518 - head/usr.bin/top

2018-06-01 Thread Eitan Adler
Author: eadler
Date: Sat Jun  2 04:08:52 2018
New Revision: 334518
URL: https://svnweb.freebsd.org/changeset/base/334518

Log:
  top(1): help scan-build along a bit
  
  Teach scan-build that some arrays are larger than zero, and thus not to
  warn.

Modified:
  head/usr.bin/top/display.c
  head/usr.bin/top/machine.c

Modified: head/usr.bin/top/display.c
==
--- head/usr.bin/top/display.c  Sat Jun  2 03:54:50 2018(r334517)
+++ head/usr.bin/top/display.c  Sat Jun  2 04:08:52 2018(r334518)
@@ -30,6 +30,7 @@
 
 #include 
 
+#include 
 #include 
 #include 
 #include 
@@ -203,19 +204,23 @@ int display_init(struct statics * statics)
/* save pointers and allocate space for names */
procstate_names = statics->procstate_names;
num_procstates = string_count(procstate_names);
+   assert(num_procstates > 0);
lprocstates = malloc(num_procstates * sizeof(int));
 
cpustate_names = statics->cpustate_names;
 
swap_names = statics->swap_names;
num_swap = string_count(swap_names);
+   assert(num_swap > 0);
lswap = malloc(num_swap * sizeof(int));
num_cpustates = string_count(cpustate_names);
+   assert(num_cpustates > 0);
lcpustates = malloc(num_cpustates * sizeof(int) * statics->ncpus);
cpustate_columns = malloc(num_cpustates * sizeof(int));
 
memory_names = statics->memory_names;
num_memory = string_count(memory_names);
+   assert(num_memory > 0);
lmemory = malloc(num_memory * sizeof(int));
 
arc_names = statics->arc_names;

Modified: head/usr.bin/top/machine.c
==
--- head/usr.bin/top/machine.c  Sat Jun  2 03:54:50 2018(r334517)
+++ head/usr.bin/top/machine.c  Sat Jun  2 04:08:52 2018(r334518)
@@ -401,6 +401,7 @@ machine_init(struct statics *statics)
}
}
size = sizeof(long) * ncpus * CPUSTATES;
+   assert(size > 0);
pcpu_cp_old = calloc(1, size);
pcpu_cp_diff = calloc(1, size);
pcpu_cpu_states = calloc(1, size);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r334517 - head/usr.bin/top

2018-06-01 Thread Eitan Adler
Author: eadler
Date: Sat Jun  2 03:54:50 2018
New Revision: 334517
URL: https://svnweb.freebsd.org/changeset/base/334517

Log:
  top(1): Use uid_t for uid rather than 'int'
  
  Remove unneeded define while here.

Modified:
  head/usr.bin/top/machine.c
  head/usr.bin/top/machine.h
  head/usr.bin/top/screen.c
  head/usr.bin/top/top.c
  head/usr.bin/top/username.c
  head/usr.bin/top/username.h
  head/usr.bin/top/utils.c
  head/usr.bin/top/utils.h

Modified: head/usr.bin/top/machine.c
==
--- head/usr.bin/top/machine.c  Sat Jun  2 03:33:02 2018(r334516)
+++ head/usr.bin/top/machine.c  Sat Jun  2 03:54:50 2018(r334517)
@@ -914,7 +914,7 @@ get_process_info(struct system_info *si, struct proces
 static char fmt[512];  /* static area where result is built */
 
 char *
-format_next_process(caddr_t xhandle, char *(*get_userid)(int), int flags)
+format_next_process(caddr_t xhandle, char *(*get_userid)(uid_t), int flags)
 {
struct kinfo_proc *pp;
const struct kinfo_proc *oldp;

Modified: head/usr.bin/top/machine.h
==
--- head/usr.bin/top/machine.h  Sat Jun  2 03:33:02 2018(r334516)
+++ head/usr.bin/top/machine.h  Sat Jun  2 03:54:50 2018(r334517)
@@ -75,7 +75,7 @@ struct process_select
 /* routines defined by the machine dependent module */
 
 char   *format_header(char *uname_field);
-char   *format_next_process(caddr_t handle, char *(*get_userid)(int),
+char   *format_next_process(caddr_t handle, char *(*get_userid)(uid_t),
int flags);
 voidtoggle_pcpustats(void);
 voidget_system_info(struct system_info *si);

Modified: head/usr.bin/top/screen.c
==
--- head/usr.bin/top/screen.c   Sat Jun  2 03:33:02 2018(r334516)
+++ head/usr.bin/top/screen.c   Sat Jun  2 03:54:50 2018(r334517)
@@ -25,7 +25,6 @@
 #include 
 #include 
 #include 
-#define TERMIOS
 #include 
 #include 
 #include 

Modified: head/usr.bin/top/top.c
==
--- head/usr.bin/top/top.c  Sat Jun  2 03:33:02 2018(r334516)
+++ head/usr.bin/top/top.c  Sat Jun  2 03:54:50 2018(r334517)
@@ -206,7 +206,7 @@ main(int argc, char *argv[])
 int displays = 0;  /* indicates unspecified */
 int sel_ret = 0;
 time_t curr_time;
-char *(*get_userid)(int) = username;
+char *(*get_userid)(uid_t) = username;
 char *uname_field = "USERNAME";
 char *header_text;
 char *env_top;

Modified: head/usr.bin/top/username.c
==
--- head/usr.bin/top/username.c Sat Jun  2 03:33:02 2018(r334516)
+++ head/usr.bin/top/username.c Sat Jun  2 03:54:50 2018(r334517)
@@ -37,29 +37,27 @@
 #include 
 #include 
 #include 
+#include 
 
 #include "utils.h"
 #include "username.h"
 
 struct hash_el {
-int  uid;
+uid_t  uid;
 char name[MAXLOGNAME];
 };
 
 #defineis_empty_hash(x)(hash_table[x].name[0] == 0)
 
 /* simple minded hashing function */
-/* Uid "nobody" is -2 results in hashit(-2) = -2 which is out of bounds for
-   the hash_table.  Applied abs() function to fix. 2/16/96 tpugh
-*/
-#definehashit(i)   (abs(i) % Table_size)
+#definehashit(i)   (i % Table_size)
 
 /* K requires that statically declared tables be initialized to zero. */
 /* We depend on that for hash_table and YOUR compiler had BETTER do it! */
 static struct hash_el hash_table[Table_size];
 
 
-char *username(int uid)
+char *username(uid_t uid)
 {
 int hashindex;
 
@@ -72,7 +70,7 @@ char *username(int uid)
 return(hash_table[hashindex].name);
 }
 
-int userid(char username[])
+uid_t userid(char username[])
 {
 struct passwd *pwd;
 
@@ -93,7 +91,7 @@ int userid(char username[])
 }
 
 /* wecare 1 = enter it always, 0 = nice to have */
-int enter_user(int uid, char name[], bool wecare)
+int enter_user(uid_t uid, char name[], bool wecare)
 {
 int hashindex;
 
@@ -124,7 +122,7 @@ int enter_user(int uid, char name[], bool wecare)
  */
 
 int
-get_user(int uid)
+get_user(uid_t uid)
 {
 struct passwd *pwd;
 

Modified: head/usr.bin/top/username.h
==
--- head/usr.bin/top/username.h Sat Jun  2 03:33:02 2018(r334516)
+++ head/usr.bin/top/username.h Sat Jun  2 03:54:50 2018(r334517)
@@ -12,12 +12,13 @@
 #define USERNAME_H
 
 #include 
+#include 
 
-int enter_user(int uid, char *name, bool wecare);
-int get_user(int uid);
+int enter_user(uid_t uid, char *name, bool wecare);
+int get_user(uid_t uid);
 voidinit_hash(void);
-char   *username(int uid);
-int userid(char *username);
+char   *username(uid_t uid);
+uid_t   userid(char *username);
 
 /*
  *  

svn commit: r334516 - head/usr.bin/top

2018-06-01 Thread Eitan Adler
Author: eadler
Date: Sat Jun  2 03:33:02 2018
New Revision: 334516
URL: https://svnweb.freebsd.org/changeset/base/334516

Log:
  top(1): Remove now-invalid NOTE

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

Modified: head/usr.bin/top/top.1
==
--- head/usr.bin/top/top.1  Sat Jun  2 03:31:14 2018(r334515)
+++ head/usr.bin/top/top.1  Sat Jun  2 03:33:02 2018(r334516)
@@ -1,5 +1,3 @@
-.\" NOTE:  changes to the manual page for "top" should be made in the
-.\"file "top.X" and NOT in the file "top.1".
 .\" $FreeBSD$
 .nr N -1
 .nr D 2
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r334515 - head/usr.bin/top

2018-06-01 Thread Eitan Adler
Author: eadler
Date: Sat Jun  2 03:31:14 2018
New Revision: 334515
URL: https://svnweb.freebsd.org/changeset/base/334515

Log:
  top(1): avoid casting malloc

Modified:
  head/usr.bin/top/display.c
  head/usr.bin/top/machine.c

Modified: head/usr.bin/top/display.c
==
--- head/usr.bin/top/display.c  Sat Jun  2 03:25:15 2018(r334514)
+++ head/usr.bin/top/display.c  Sat Jun  2 03:31:14 2018(r334515)
@@ -147,7 +147,7 @@ display_resize(void)
 }
 
 /* now, allocate space for the screen buffer */
-screenbuf = (char *)malloc(lines * display_width);
+screenbuf = malloc(lines * display_width);
 if (screenbuf == (char *)NULL)
 {
/* oops! */
@@ -203,20 +203,20 @@ int display_init(struct statics * statics)
/* save pointers and allocate space for names */
procstate_names = statics->procstate_names;
num_procstates = string_count(procstate_names);
-   lprocstates = (int *)malloc(num_procstates * sizeof(int));
+   lprocstates = malloc(num_procstates * sizeof(int));
 
cpustate_names = statics->cpustate_names;
 
swap_names = statics->swap_names;
num_swap = string_count(swap_names);
-   lswap = (int *)malloc(num_swap * sizeof(int));
+   lswap = malloc(num_swap * sizeof(int));
num_cpustates = string_count(cpustate_names);
-   lcpustates = (int *)malloc(num_cpustates * sizeof(int) * 
statics->ncpus);
-   cpustate_columns = (int *)malloc(num_cpustates * sizeof(int));
+   lcpustates = malloc(num_cpustates * sizeof(int) * statics->ncpus);
+   cpustate_columns = malloc(num_cpustates * sizeof(int));
 
memory_names = statics->memory_names;
num_memory = string_count(memory_names);
-   lmemory = (int *)malloc(num_memory * sizeof(int));
+   lmemory = malloc(num_memory * sizeof(int));
 
arc_names = statics->arc_names;
carc_names = statics->carc_names;

Modified: head/usr.bin/top/machine.c
==
--- head/usr.bin/top/machine.c  Sat Jun  2 03:25:15 2018(r334514)
+++ head/usr.bin/top/machine.c  Sat Jun  2 03:31:14 2018(r334515)
@@ -990,7 +990,7 @@ format_next_process(caddr_t xhandle, char *(*get_useri
break;
}
 
-   cmdbuf = (char *)malloc(cmdlen + 1);
+   cmdbuf = malloc(cmdlen + 1);
if (cmdbuf == NULL) {
warn("malloc(%d)", cmdlen + 1);
return NULL;
@@ -1025,7 +1025,7 @@ format_next_process(caddr_t xhandle, char *(*get_useri
size_t len;
 
argbuflen = cmdlen * 4;
-   argbuf = (char *)malloc(argbuflen + 1);
+   argbuf = malloc(argbuflen + 1);
if (argbuf == NULL) {
warn("malloc(%zu)", argbuflen + 1);
free(cmdbuf);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r334514 - head/usr.bin/top

2018-06-01 Thread Eitan Adler
Author: eadler
Date: Sat Jun  2 03:25:15 2018
New Revision: 334514
URL: https://svnweb.freebsd.org/changeset/base/334514

Log:
  top(1): Use standard boolean rather than homegrown alternative

Deleted:
  head/usr.bin/top/boolean.h
Modified:
  head/usr.bin/top/commands.c
  head/usr.bin/top/display.c
  head/usr.bin/top/machine.c
  head/usr.bin/top/screen.c
  head/usr.bin/top/top.1
  head/usr.bin/top/top.c

Modified: head/usr.bin/top/commands.c
==
--- head/usr.bin/top/commands.c Sat Jun  2 02:06:48 2018(r334513)
+++ head/usr.bin/top/commands.c Sat Jun  2 03:25:15 2018(r334514)
@@ -22,6 +22,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -30,7 +31,6 @@
 #include "commands.h"
 #include "sigdesc.h"   /* generated automatically */
 #include "top.h"
-#include "boolean.h"
 #include "machine.h"
 
 static int err_compar(const void *p1, const void *p2);
@@ -199,7 +199,7 @@ char *err_string(void)
 {
 struct errs *errp;
 int  cnt = 0;
-int  first = Yes;
+int  first = true;
 int  currerr = -1;
 int stringlen; /* characters still available in "string" */
 static char string[STRMAX];
@@ -233,13 +233,13 @@ char *err_string(void)
strcat(string, "; "); /* we know there's more */
}
currerr = errp->errnum;
-   first = Yes;
+   first = true;
}
if ((stringlen = str_addarg(string, stringlen, errp->arg, first)) ==0)
{
return(err_listem);
}
-   first = No;
+   first = false;
 }
 
 /* add final message */

Modified: head/usr.bin/top/display.c
==
--- head/usr.bin/top/display.c  Sat Jun  2 02:06:48 2018(r334513)
+++ head/usr.bin/top/display.c  Sat Jun  2 03:25:15 2018(r334514)
@@ -33,6 +33,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -44,7 +45,6 @@
 #include "layout.h"/* defines for screen position layout */
 #include "display.h"
 #include "top.h"
-#include "boolean.h"
 #include "machine.h"   /* we should eliminate this!!! */
 #include "utils.h"
 
@@ -1147,7 +1147,7 @@ line_update(char *old, char *new, int start, int line)
 int diff;
 int newcol = start + 1;
 int lastcol = start;
-char cursor_on_line = No;
+char cursor_on_line = false;
 char *current;
 
 /* compare the two strings and only rewrite what has changed */
@@ -1172,7 +1172,7 @@ line_update(char *old, char *new, int start, int line)
{
Move_to(start, line);
}
-   cursor_on_line = Yes;
+   cursor_on_line = true;
putchar(ch);
*old = ch;
lastcol = 1;
@@ -1209,7 +1209,7 @@ line_update(char *old, char *new, int start, int line)
{
/* use cursor addressing */
Move_to(newcol, line);
-   cursor_on_line = Yes;
+   cursor_on_line = true;
}
/* remember where the cursor is */
lastcol = newcol + 1;

Modified: head/usr.bin/top/machine.c
==
--- head/usr.bin/top/machine.c  Sat Jun  2 02:06:48 2018(r334513)
+++ head/usr.bin/top/machine.c  Sat Jun  2 03:25:15 2018(r334514)
@@ -35,6 +35,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -308,7 +309,7 @@ machine_init(struct statics *statics)
 {
int i, j, empty, pagesize;
uint64_t arc_size;
-   boolean_t carc_en;
+   bool carc_en;
size_t size;
 
size = sizeof(smpmode);

Modified: head/usr.bin/top/screen.c
==
--- head/usr.bin/top/screen.c   Sat Jun  2 02:06:48 2018(r334513)
+++ head/usr.bin/top/screen.c   Sat Jun  2 03:25:15 2018(r334514)
@@ -30,7 +30,6 @@
 #include 
 #include 
 #include "screen.h"
-#include "boolean.h"
 
 int  overstrike;
 int  screen_length;
@@ -54,7 +53,7 @@ static char *terminal_end;
 
 static struct termios old_settings;
 static struct termios new_settings;
-static char is_a_terminal = No;
+static char is_a_terminal = false;
 
 #defineSTDIN   0
 #defineSTDOUT  1
@@ -75,12 +74,12 @@ init_termcap(int interactive)
 if (!interactive)
 {
/* pretend we have a dumb terminal */
-   smart_terminal = No;
+   smart_terminal = false;
return;
 }
 
 /* assume we have a smart terminal until proven otherwise */
-smart_terminal = Yes;
+smart_terminal = true;
 
 /* get the terminal name */
 term_name = getenv("TERM");
@@ -89,7 +88,7 @@ init_termcap(int interactive)
 /* patch courtesy of Sam Horrocks at telegraph.ics.uci.edu */
 if (term_name == NULL)
   

svn commit: r334513 - stable/11/etc/pkg

2018-06-01 Thread Glen Barber
Author: gjb
Date: Sat Jun  2 02:06:48 2018
New Revision: 334513
URL: https://svnweb.freebsd.org/changeset/base/334513

Log:
  Revert r333474 in stable/11, which switches the default pkg repository
  from latest to quarterly, now that releng/11.2 had branched.
  
  Approved by:  re (implicit)
  Sponsored by: The FreeBSD Foundation

Modified:
  stable/11/etc/pkg/FreeBSD.conf

Modified: stable/11/etc/pkg/FreeBSD.conf
==
--- stable/11/etc/pkg/FreeBSD.conf  Sat Jun  2 02:05:31 2018
(r334512)
+++ stable/11/etc/pkg/FreeBSD.conf  Sat Jun  2 02:06:48 2018
(r334513)
@@ -8,7 +8,7 @@
 #
 
 FreeBSD: {
-  url: "pkg+http://pkg.FreeBSD.org/${ABI}/quarterly;,
+  url: "pkg+http://pkg.FreeBSD.org/${ABI}/latest;,
   mirror_type: "srv",
   signature_type: "fingerprints",
   fingerprints: "/usr/share/keys/pkg",
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r334512 - svnadmin/conf

2018-06-01 Thread Glen Barber
Author: gjb
Date: Sat Jun  2 02:05:31 2018
New Revision: 334512
URL: https://svnweb.freebsd.org/changeset/base/334512

Log:
  Thaw stable/11 after releng/11.2 has branched.
  
  Committers are requested to excercise caution for the duration
  of the 11.2-RELEASE cycle, especially regarding changes that
  are eligible (or proposed) for MFC to releng/11.2.
  
  Approved by:  re (implicit)
  Sponsored by: The FreeBSD Foundation

Modified:
  svnadmin/conf/approvers

Modified: svnadmin/conf/approvers
==
--- svnadmin/conf/approvers Sat Jun  2 00:11:26 2018(r334511)
+++ svnadmin/conf/approvers Sat Jun  2 02:05:31 2018(r334512)
@@ -17,7 +17,7 @@
 # $FreeBSD$
 #
 #^head/re
-^stable/11/re
+#^stable/11/   re
 ^release/  re
 ^releng/11.2/  re
 ^releng/11.[0-1]/  (security-officer|so)
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r334511 - in head/sys/fs: nfs nfsclient

2018-06-01 Thread Rick Macklem
Author: rmacklem
Date: Sat Jun  2 00:11:26 2018
New Revision: 334511
URL: https://svnweb.freebsd.org/changeset/base/334511

Log:
  Fix the default number of threads for Flex File layout pNFS client I/O.
  
  The intent was that the default would be based on number of CPUs, but the
  code disabled using taskqueue() by default.
  This code is only executed when mounting a NFSv4.1 server that supports the
  Flexible File layout for pNFS and, since such servers are rare, this change
  shouldn't result in a POLA violation.
  (The FreeBSD pNFS server is still a project and the only other one that
   uses Flexible File layout is being developed by Primary Data and I don't
   know if they have even shipped any to customers yet.)
  Found while testing the pNFS server.

Modified:
  head/sys/fs/nfs/nfs_commonport.c
  head/sys/fs/nfsclient/nfs_clrpcops.c

Modified: head/sys/fs/nfs/nfs_commonport.c
==
--- head/sys/fs/nfs/nfs_commonport.cSat Jun  2 00:02:27 2018
(r334510)
+++ head/sys/fs/nfs/nfs_commonport.cSat Jun  2 00:11:26 2018
(r334511)
@@ -90,7 +90,7 @@ SYSCTL_INT(_vfs_nfs, OID_AUTO, debuglevel, CTLFLAG_RW,
 0, "Debug level for NFS client");
 SYSCTL_INT(_vfs_nfs, OID_AUTO, userhashsize, CTLFLAG_RDTUN, _lughashsize,
 0, "Size of hash tables for uid/name mapping");
-int nfs_pnfsiothreads = 0;
+int nfs_pnfsiothreads = -1;
 SYSCTL_INT(_vfs_nfs, OID_AUTO, pnfsiothreads, CTLFLAG_RW, _pnfsiothreads,
 0, "Number of pNFS mirror I/O threads");
 
@@ -723,6 +723,8 @@ nfs_pnfsio(task_fn_t *func, void *context)
pio = (struct pnfsio *)context;
if (pnfsioq == NULL) {
if (nfs_pnfsiothreads == 0)
+   return (EPERM);
+   if (nfs_pnfsiothreads < 0)
nfs_pnfsiothreads = mp_ncpus * 4;
pnfsioq = taskqueue_create("pnfsioq", M_WAITOK,
taskqueue_thread_enqueue, );

Modified: head/sys/fs/nfsclient/nfs_clrpcops.c
==
--- head/sys/fs/nfsclient/nfs_clrpcops.cSat Jun  2 00:02:27 2018
(r334510)
+++ head/sys/fs/nfsclient/nfs_clrpcops.cSat Jun  2 00:11:26 2018
(r334511)
@@ -6436,7 +6436,7 @@ nfsio_writedsmir(vnode_t vp, int *iomode, int *must_co
drpc->p = p;
drpc->inprog = 0;
ret = EIO;
-   if (nfs_pnfsiothreads > 0) {
+   if (nfs_pnfsiothreads != 0) {
ret = nfs_pnfsio(start_writedsmir, drpc);
NFSCL_DEBUG(4, "nfsio_writedsmir: nfs_pnfsio=%d\n", ret);
}
@@ -6615,7 +6615,7 @@ nfsio_commitds(vnode_t vp, uint64_t offset, int cnt, s
drpc->p = p;
drpc->inprog = 0;
ret = EIO;
-   if (nfs_pnfsiothreads > 0) {
+   if (nfs_pnfsiothreads != 0) {
ret = nfs_pnfsio(start_commitds, drpc);
NFSCL_DEBUG(4, "nfsio_commitds: nfs_pnfsio=%d\n", ret);
}
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r334509 - head/usr.bin/top

2018-06-01 Thread Eitan Adler
Author: eadler
Date: Sat Jun  2 00:02:15 2018
New Revision: 334509
URL: https://svnweb.freebsd.org/changeset/base/334509

Log:
  top(1): ansify, style(9). and nits
  
  - Prefer using ansi prototypes rather than C prototypes
  - Keep type on separate line from name of function
  - Try to keep things const where possible. This will help get to WARNS=6
  - switch to "bool" where it makes sense

Modified:
  head/usr.bin/top/commands.c
  head/usr.bin/top/display.c
  head/usr.bin/top/machine.h
  head/usr.bin/top/screen.c
  head/usr.bin/top/top.c
  head/usr.bin/top/username.c
  head/usr.bin/top/username.h
  head/usr.bin/top/utils.c

Modified: head/usr.bin/top/commands.c
==
--- head/usr.bin/top/commands.c Sat Jun  2 00:01:07 2018(r334508)
+++ head/usr.bin/top/commands.c Sat Jun  2 00:02:15 2018(r334509)
@@ -53,8 +53,7 @@ static int str_addarg(char *str, int len, char *arg, i
  */
 
 void
-show_help()
-
+show_help(void)
 {
 printf("Top version FreeBSD, %s\n", copyright);
 fputs("\n\n\
@@ -198,7 +197,7 @@ static char err_listem[] = 
 
 #define STRMAX 80
 
-char *err_string()
+char *err_string(void)
 {
 struct errs *errp;
 int  cnt = 0;
@@ -281,13 +280,7 @@ str_adderr(char *str, int len, int err)
  */
 
 static int
-str_addarg(str, len, arg, first)
-
-char *str;
-int  len;
-char *arg;
-int  first;
-
+str_addarg(char str[], int len, char arg[], int first)
 {
 int arglen;
 
@@ -334,8 +327,7 @@ err_compar(const void *p1, const void *p2)
  */
 
 int
-error_count()
-
+error_count(void)
 {
 return(errcnt);
 }
@@ -345,8 +337,7 @@ error_count()
  */
 
 void
-show_errors()
-
+show_errors(void)
 {
 int cnt = 0;
 struct errs *errp = errs;

Modified: head/usr.bin/top/display.c
==
--- head/usr.bin/top/display.c  Sat Jun  2 00:01:07 2018(r334508)
+++ head/usr.bin/top/display.c  Sat Jun  2 00:02:15 2018(r334509)
@@ -52,9 +52,6 @@
 FILE *debug;
 #endif
 
-/* imported from screen.c */
-extern int overstrike;
-
 static int lmpid = 0;
 static int last_hi = 0;/* used in u_process and u_endscreen */
 static int lastline = 0;
@@ -123,8 +120,8 @@ int  y_procs =  7;
 int  y_cpustates = 2;
 int  Header_lines =7;
 
-int display_resize()
-
+int
+display_resize(void)
 {
 int lines;
 
@@ -162,10 +159,7 @@ int display_resize()
 return(smart_terminal ? lines : Largest);
 }
 
-int display_updatecpus(statics)
-
-struct statics *statics;
-
+int display_updatecpus(struct statics *statics)
 {
 int *lp;
 int lines;
@@ -194,10 +188,7 @@ struct statics *statics;
 return(lines);
 }
 
-int display_init(statics)
-
-struct statics *statics;
-
+int display_init(struct statics * statics)
 {
 int lines;
 char **pp;
@@ -249,11 +240,7 @@ struct statics *statics;
 }
 
 void
-i_loadave(mpid, avenrun)
-
-int mpid;
-double *avenrun;
-
+i_loadave(int mpid, double avenrun[])
 {
 int i;
 
@@ -278,11 +265,7 @@ double *avenrun;
 }
 
 void
-u_loadave(mpid, avenrun)
-
-int mpid;
-double *avenrun;
-
+u_loadave(int mpid, double *avenrun)
 {
 int i;
 
@@ -318,10 +301,7 @@ double *avenrun;
 }
 
 void
-i_timeofday(tod)
-
-time_t *tod;
-
+i_timeofday(time_t *tod)
 {
 /*
  *  Display the current time.
@@ -364,11 +344,7 @@ static char procstates_buffer[MAX_COLS];
  */
 
 void
-i_procstates(total, brkdn)
-
-int total;
-int *brkdn;
-
+i_procstates(int total, int *brkdn)
 {
 int i;
 
@@ -392,11 +368,7 @@ int *brkdn;
 }
 
 void
-u_procstates(total, brkdn)
-
-int total;
-int *brkdn;
-
+u_procstates(int total, int *brkdn)
 {
 static char new[MAX_COLS];
 int i;
@@ -441,10 +413,7 @@ int *brkdn;
 }
 
 void
-i_cpustates(states)
-
-int *states;
-
+i_cpustates(int *states)
 {
 int i = 0;
 int value;
@@ -487,10 +456,7 @@ for (cpu = 0; cpu < num_cpus; cpu++) {
 }
 
 void
-u_cpustates(states)
-
-int *states;
-
+u_cpustates(int *states)
 {
 int value;
 char **names;
@@ -540,8 +506,7 @@ for (cpu = 0; cpu < num_cpus; cpu++) {
 }
 
 void
-z_cpustates()
-
+z_cpustates(void)
 {
 int i = 0;
 char **names;
@@ -633,10 +598,7 @@ i_arc(int *stats)
 }
 
 void
-u_arc(stats)
-
-int *stats;
-
+u_arc(int *stats)
 {
 static char new[MAX_COLS];
 
@@ -672,10 +634,7 @@ i_carc(int *stats)
 }
 
 void
-u_carc(stats)
-
-int *stats;
-
+u_carc(int *stats)
 {
 static char new[MAX_COLS];
 
@@ -737,7 +696,7 @@ static int msglen = 0;
on the screen (even when next_msg doesn't contain that message). */
 
 void
-i_message()
+i_message(void)
 {
 
 while (lastline < y_message)
@@ -759,8 +718,7 @@ i_message()
 }
 
 void
-u_message()
-
+u_message(void)
 {
 i_message();
 }
@@ -773,10 +731,7 @@ static int header_length;
  */
 
 char *
-trim_header(text)
-
-char *text;
-
+trim_header(char *text)
 {
char *s;
int width;
@@ -801,10 +756,7 @@ char *text;
  */
 
 void

svn commit: r334510 - head/usr.bin/top

2018-06-01 Thread Eitan Adler
Author: eadler
Date: Sat Jun  2 00:02:27 2018
New Revision: 334510
URL: https://svnweb.freebsd.org/changeset/base/334510

Log:
  top(1): remove two unneeded headers

Modified:
  head/usr.bin/top/commands.c

Modified: head/usr.bin/top/commands.c
==
--- head/usr.bin/top/commands.c Sat Jun  2 00:02:15 2018(r334509)
+++ head/usr.bin/top/commands.c Sat Jun  2 00:02:27 2018(r334510)
@@ -17,7 +17,6 @@
  *  "top" (i.e.:  changing the number of processes to display).
  */
 
-#include 
 #include 
 
 #include 
@@ -32,7 +31,6 @@
 #include "sigdesc.h"   /* generated automatically */
 #include "top.h"
 #include "boolean.h"
-#include "utils.h"
 #include "machine.h"
 
 static int err_compar(const void *p1, const void *p2);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r334508 - head/sys/vm

2018-06-01 Thread Mark Johnston
Author: markj
Date: Sat Jun  2 00:01:07 2018
New Revision: 334508
URL: https://svnweb.freebsd.org/changeset/base/334508

Log:
  Remove the "pass" variable from the page daemon control loop.
  
  It serves little purpose after r308474 and r329882.  As a side
  effect, the removal fixes a bug in r329882 which caused the
  page daemon to periodically invoke lowmem handlers even in the
  absence of memory pressure.
  
  Reviewed by:  jeff
  Differential Revision:https://reviews.freebsd.org/D15491

Modified:
  head/sys/vm/vm_pageout.c

Modified: head/sys/vm/vm_pageout.c
==
--- head/sys/vm/vm_pageout.cFri Jun  1 23:50:51 2018(r334507)
+++ head/sys/vm/vm_pageout.cSat Jun  2 00:01:07 2018(r334508)
@@ -1352,7 +1352,7 @@ vm_pageout_reinsert_inactive(struct scan_state *ss, st
  * target.
  */
 static int
-vm_pageout_scan_inactive(struct vm_domain *vmd, int pass, int shortage,
+vm_pageout_scan_inactive(struct vm_domain *vmd, int shortage,
 int *addl_shortage)
 {
struct scan_state ss;
@@ -1366,25 +1366,6 @@ vm_pageout_scan_inactive(struct vm_domain *vmd, int pa
bool obj_locked;
 
/*
-* If we need to reclaim memory ask kernel caches to return
-* some.  We rate limit to avoid thrashing.
-*/
-   if (vmd == VM_DOMAIN(0) && pass > 0 &&
-   (time_uptime - lowmem_uptime) >= lowmem_period) {
-   /*
-* Decrease registered cache sizes.
-*/
-   SDT_PROBE0(vm, , , vm__lowmem_scan);
-   EVENTHANDLER_INVOKE(vm_lowmem, VM_LOW_PAGES);
-   /*
-* We do this explicitly after the caches have been
-* drained above.
-*/
-   uma_reclaim();
-   lowmem_uptime = time_uptime;
-   }
-
-   /*
 * The addl_page_shortage is an estimate of the number of temporarily
 * stuck pages in the inactive queue.  In other words, the
 * number of pages from the inactive count that should be
@@ -1393,16 +1374,13 @@ vm_pageout_scan_inactive(struct vm_domain *vmd, int pa
addl_page_shortage = 0;
 
/*
-* Calculate the number of pages that we want to free.  This number
-* can be negative if many pages are freed between the wakeup call to
-* the page daemon and this calculation.
+* vmd_pageout_deficit counts the number of pages requested in
+* allocations that failed because of a free page shortage.  We assume
+* that the allocations will be reattempted and thus include the deficit
+* in our scan target.
 */
-   if (pass > 0) {
-   deficit = atomic_readandclear_int(>vmd_pageout_deficit);
-   page_shortage = shortage + deficit;
-   } else
-   page_shortage = deficit = 0;
-   starting_page_shortage = page_shortage;
+   deficit = atomic_readandclear_int(>vmd_pageout_deficit);
+   starting_page_shortage = page_shortage = shortage + deficit;
 
mtx = NULL;
obj_locked = false;
@@ -1638,8 +1616,7 @@ reinsert:
/*
 * Reclaim pages by swapping out idle processes, if configured to do so.
 */
-   if (pass > 0)
-   vm_swapout_run_idle();
+   vm_swapout_run_idle();
 
/*
 * See the description of addl_page_shortage above.
@@ -1870,15 +1847,35 @@ vm_pageout_oom(int shortage)
 }
 
 static void
+vm_pageout_lowmem(struct vm_domain *vmd)
+{
+
+   if (vmd == VM_DOMAIN(0) &&
+   time_uptime - lowmem_uptime >= lowmem_period) {
+   /*
+* Decrease registered cache sizes.
+*/
+   SDT_PROBE0(vm, , , vm__lowmem_scan);
+   EVENTHANDLER_INVOKE(vm_lowmem, VM_LOW_PAGES);
+
+   /*
+* We do this explicitly after the caches have been
+* drained above.
+*/
+   uma_reclaim();
+   lowmem_uptime = time_uptime;
+   }
+}
+
+static void
 vm_pageout_worker(void *arg)
 {
struct vm_domain *vmd;
-   int addl_shortage, domain, pass, shortage;
+   int addl_shortage, domain, shortage;
bool target_met;
 
domain = (uintptr_t)arg;
vmd = VM_DOMAIN(domain);
-   pass = 0;
shortage = 0;
target_met = true;
 
@@ -1896,6 +1893,7 @@ vm_pageout_worker(void *arg)
 */
while (TRUE) {
vm_domain_pageout_lock(vmd);
+
/*
 * We need to clear wanted before we check the limits.  This
 * prevents races with wakers who will check wanted after they
@@ -1908,12 +1906,12 @@ vm_pageout_worker(void *arg)
 */
if (vm_paging_needed(vmd, vmd->vmd_free_count)) {
/*
-* Yes, the scan failed to free enough pages.  

svn commit: r334507 - head/sys/vm

2018-06-01 Thread Konstantin Belousov
Author: kib
Date: Fri Jun  1 23:50:51 2018
New Revision: 334507
URL: https://svnweb.freebsd.org/changeset/base/334507

Log:
  Only check for MAP_32BIT when available.
  
  Reported by:  mmacy
  Sponsored by: The FreeBSD Foundation
  MFC after:10 days

Modified:
  head/sys/vm/vm_mmap.c

Modified: head/sys/vm/vm_mmap.c
==
--- head/sys/vm/vm_mmap.c   Fri Jun  1 23:49:32 2018(r334506)
+++ head/sys/vm/vm_mmap.c   Fri Jun  1 23:50:51 2018(r334507)
@@ -242,7 +242,10 @@ kern_mmap(struct thread *td, uintptr_t addr0, size_t s
return (EINVAL);
if ((flags & MAP_GUARD) != 0 && (prot != PROT_NONE || fd != -1 ||
pos != 0 || (flags & ~(MAP_FIXED | MAP_GUARD | MAP_EXCL |
-   MAP_32BIT | MAP_ALIGNMENT_MASK)) != 0))
+#ifdef MAP_32BIT
+   MAP_32BIT |
+#endif
+   MAP_ALIGNMENT_MASK)) != 0))
return (EINVAL);
 
/*
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r334506 - head/sys/kern

2018-06-01 Thread Mark Johnston
Author: markj
Date: Fri Jun  1 23:49:32 2018
New Revision: 334506
URL: https://svnweb.freebsd.org/changeset/base/334506

Log:
  Avoid completing I/O when dumping core after a panic.
  
  Filesystem or pager completion callbacks are generally non-functional
  after a panic and may trigger deadlocks if invoked in this context
  (e.g., by attempting to destroying a buffer mapping).  To avoid this
  situation, short-circuit I/O completion in biodone().
  
  Reviewed by:  imp
  Discussed with:   mav
  MFC after:2 weeks
  Differential Revision:https://reviews.freebsd.org/D15592

Modified:
  head/sys/kern/vfs_bio.c

Modified: head/sys/kern/vfs_bio.c
==
--- head/sys/kern/vfs_bio.c Fri Jun  1 23:42:10 2018(r334505)
+++ head/sys/kern/vfs_bio.c Fri Jun  1 23:49:32 2018(r334506)
@@ -4310,6 +4310,8 @@ allocbuf(struct buf *bp, int size)
 
 extern int inflight_transient_maps;
 
+static struct bio_queue nondump_bios;
+
 void
 biodone(struct bio *bp)
 {
@@ -4318,6 +4320,17 @@ biodone(struct bio *bp)
vm_offset_t start, end;
 
biotrack(bp, __func__);
+
+   /*
+* Avoid completing I/O when dumping after a panic since that may
+* result in a deadlock in the filesystem or pager code.  Note that
+* this doesn't affect dumps that were started manually since we aim
+* to keep the system usable after it has been resumed.
+*/
+   if (__predict_false(dumping && SCHEDULER_STOPPED())) {
+   TAILQ_INSERT_HEAD(_bios, bp, bio_queue);
+   return;
+   }
if ((bp->bio_flags & BIO_TRANSIENT_MAPPING) != 0) {
bp->bio_flags &= ~BIO_TRANSIENT_MAPPING;
bp->bio_flags |= BIO_UNMAPPED;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r334505 - in head/lib/libc: aarch64 riscv

2018-06-01 Thread Mark Johnston
Author: markj
Date: Fri Jun  1 23:42:10 2018
New Revision: 334505
URL: https://svnweb.freebsd.org/changeset/base/334505

Log:
  Don't export _end on arm64 and riscv.
  
  These platforms don't support brk() and sbrk(), which are the reason
  for exporting _end in the first place.
  
  MFC after:1 week

Modified:
  head/lib/libc/aarch64/Symbol.map
  head/lib/libc/riscv/Symbol.map

Modified: head/lib/libc/aarch64/Symbol.map
==
--- head/lib/libc/aarch64/Symbol.mapFri Jun  1 23:40:43 2018
(r334504)
+++ head/lib/libc/aarch64/Symbol.mapFri Jun  1 23:42:10 2018
(r334505)
@@ -33,6 +33,5 @@ FBSD_1.0 {
 
 FBSDprivate_1.0 {
_set_tp;
-   _end;
__makecontext;
 };

Modified: head/lib/libc/riscv/Symbol.map
==
--- head/lib/libc/riscv/Symbol.map  Fri Jun  1 23:40:43 2018
(r334504)
+++ head/lib/libc/riscv/Symbol.map  Fri Jun  1 23:42:10 2018
(r334505)
@@ -33,6 +33,5 @@ FBSD_1.0 {
 
 FBSDprivate_1.0 {
_set_tp;
-   _end;
__makecontext;
 };
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r334504 - head/lib/libc/sys

2018-06-01 Thread Mark Johnston
Author: markj
Date: Fri Jun  1 23:40:43 2018
New Revision: 334504
URL: https://svnweb.freebsd.org/changeset/base/334504

Log:
  Remove an inaccuracy from mincore.2.
  
  Super pages are supported on non-x86 architectures, so just remove the
  incorrect note.  While here, change terminology to be consistent with
  mmap.2.
  
  MFC after:1 week

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

Modified: head/lib/libc/sys/mincore.2
==
--- head/lib/libc/sys/mincore.2 Fri Jun  1 22:57:19 2018(r334503)
+++ head/lib/libc/sys/mincore.2 Fri Jun  1 23:40:43 2018(r334504)
@@ -28,7 +28,7 @@
 .\"@(#)mincore.2   8.1 (Berkeley) 6/9/93
 .\" $FreeBSD$
 .\"
-.Dd January 17, 2003
+.Dd June 1, 2018
 .Dt MINCORE 2
 .Os
 .Sh NAME
@@ -73,7 +73,9 @@ Page has been referenced.
 .It Dv MINCORE_MODIFIED_OTHER
 Page has been modified.
 .It Dv MINCORE_SUPER
-Page is part of a "super" page. (only i386 & amd64)
+Page is part of a large
+.Pq Dq super
+page.
 .El
 .Pp
 The information returned by
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r334503 - head/usr.bin/at

2018-06-01 Thread Conrad Meyer
Author: cem
Date: Fri Jun  1 22:57:19 2018
New Revision: 334503
URL: https://svnweb.freebsd.org/changeset/base/334503

Log:
  at.man: Bump .Dd missed in r334502
  
  Sponsored by: Dell EMC Isilon

Modified:
  head/usr.bin/at/at.man

Modified: head/usr.bin/at/at.man
==
--- head/usr.bin/at/at.man  Fri Jun  1 22:37:59 2018(r334502)
+++ head/usr.bin/at/at.man  Fri Jun  1 22:57:19 2018(r334503)
@@ -1,5 +1,5 @@
 .\" $FreeBSD$
-.Dd January 13, 2002
+.Dd June 1, 2018
 .Dt "AT" 1
 .Os
 .Sh NAME
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r334502 - in head: bin/date usr.bin/at usr.bin/last

2018-06-01 Thread Conrad Meyer
Author: cem
Date: Fri Jun  1 22:37:59 2018
New Revision: 334502
URL: https://svnweb.freebsd.org/changeset/base/334502

Log:
  Update other man pages to match leap second reality
  
  Missed these in r334501; see justification there:
  
  https://svnweb.freebsd.org/base?view=revision=334501
  
  Sponsored by: Dell EMC Isilon

Modified:
  head/bin/date/date.1
  head/usr.bin/at/at.man
  head/usr.bin/last/last.1

Modified: head/bin/date/date.1
==
--- head/bin/date/date.1Fri Jun  1 22:34:59 2018(r334501)
+++ head/bin/date/date.1Fri Jun  1 22:37:59 2018(r334502)
@@ -32,7 +32,7 @@
 .\" @(#)date.1 8.3 (Berkeley) 4/28/95
 .\" $FreeBSD$
 .\"
-.Dd May 7, 2015
+.Dd June 1, 2018
 .Dt DATE 1
 .Os
 .Sh NAME
@@ -296,8 +296,8 @@ Hour, a number from 0 to 23.
 .It Ar MM
 Minutes, a number from 0 to 59.
 .It Ar ss
-Seconds, a number from 0 to 61
-(59 plus a maximum of two leap seconds).
+Seconds, a number from 0 to 60
+(59 plus a potential leap second).
 .El
 .Pp
 Everything but the minutes is optional.

Modified: head/usr.bin/at/at.man
==
--- head/usr.bin/at/at.man  Fri Jun  1 22:34:59 2018(r334501)
+++ head/usr.bin/at/at.man  Fri Jun  1 22:37:59 2018(r334502)
@@ -294,7 +294,7 @@ The hour of the day, from 0 to 23.
 .It Ar mm
 The minute of the hour, from 0 to 59.
 .It Ar SS
-The second of the minute, from 0 to 61.
+The second of the minute, from 0 to 60.
 .El
 .Pp
 If the

Modified: head/usr.bin/last/last.1
==
--- head/usr.bin/last/last.1Fri Jun  1 22:34:59 2018(r334501)
+++ head/usr.bin/last/last.1Fri Jun  1 22:37:59 2018(r334502)
@@ -28,7 +28,7 @@
 .\" @(#)last.1 8.1 (Berkeley) 6/6/93
 .\" $FreeBSD$
 .\"
-.Dd June 6, 2015
+.Dd June 1, 2018
 .Dt LAST 1
 .Os
 .Sh NAME
@@ -121,7 +121,7 @@ Hour of the day, from 0 to 23.
 .It Ar mm
 Minute of the hour, from 0 to 59.
 .It Ar SS
-Second of the minute, from 0 to 61.
+Second of the minute, from 0 to 60.
 .El
 .Pp
 If the
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r334501 - head/usr.bin/touch

2018-06-01 Thread Conrad Meyer
Author: cem
Date: Fri Jun  1 22:34:59 2018
New Revision: 334501
URL: https://svnweb.freebsd.org/changeset/base/334501

Log:
  touch.1: Update to conform to POSIX 2004
  
  POSIX borrowed the "double leap second" bug from C89.  Double leap seconds can
  never happen.  This mistake was present in at least POSIX 1997 and fixed by
  POSIX 2004.  I can't find a copy of 2001 online to determine if the bug was
  present in that revision.
  
  While here, remove duplicate language between -d and -t.  A few other minor
  enhancements and an igor (lint) bugfix.
  
  Further reading:
  
  2018 POSIX (documents -d):
  http://pubs.opengroup.org/onlinepubs/9699919799/utilities/touch.html
  
  2004 POSIX (documents SS from 0-60):
  http://pubs.opengroup.org/onlinepubs/009695399/utilities/touch.html
  
  1997 POSIX/SUSv2 (historical interest, 0-61):
  http://pubs.opengroup.org/onlinepubs/007908799/xcu/touch.html
  
  More on this subject (start at "Unix system time and the POSIX standard")
  https://www.ucolick.org/~sla/leapsecs/onlinebib.html
  
  And: https://marc.info/?l=openbsd-tech=92682843416159=2
  
  Reported by:  Vishal Sahu 
  Sponsored by: Dell EMC Isilon

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

Modified: head/usr.bin/touch/touch.1
==
--- head/usr.bin/touch/touch.1  Fri Jun  1 22:09:27 2018(r334500)
+++ head/usr.bin/touch/touch.1  Fri Jun  1 22:34:59 2018(r334501)
@@ -31,7 +31,7 @@
 .\" @(#)touch.18.3 (Berkeley) 4/28/95
 .\" $FreeBSD$
 .\"
-.Dd March 8, 2015
+.Dd June 1, 2018
 .Dt TOUCH 1
 .Os
 .Sh NAME
@@ -53,7 +53,8 @@ If any file does not exist, it is created with default
 .Pp
 By default,
 .Nm
-changes both modification and access times.  The
+changes both modification and access times.
+The
 .Fl a
 and
 .Fl m
@@ -113,39 +114,36 @@ The
 utility does not treat this as an error.
 No error messages are displayed and the exit value is not affected.
 .It Fl d
-Change the access and modification times to the specified time instead
+Change the access and modification times to the specified date time instead
 of the current time of day.
 The argument is of the form
 .Dq -MM-DDThh:mm:SS[.frac][tz]
 where the letters represent the following:
 .Bl -tag -width Ds -compact -offset indent
 .It Ar 
-The year.
-.It Ar MM
-The month of the year, from 01 to 12.
-.It Ar DD
-The day of the month, from 01 to 31.
+At least four decimal digits representing the year.
+.It Ar MM , Ar DD , Ar hh , Ar mm , Ar SS
+As with
+.Fl t
+time.
 .It Ar T
 The letter
 .Li T
-or a space.
-.It Ar hh
-The hour of the day, from 00 to 23.
-.It Ar mm
-The minute of the hour, from 00 to 59.
-.It Ar SS
-The second of the minute, from 00 to 61.
+or a space is the time designator.
 .It Ar .frac
-An optional fraction,
-consisting of a period or a comma followed by one or more digits.
-The number of significant digits depends on the kernel configuration and
-the filesystem, and may be zero.
+An optional fraction, consisting of a period or a comma followed by one or
+more digits.
+The number of significant digits depends on the kernel configuration and the
+filesystem, and may be zero.
 .It Ar tz
 An optional letter
 .Li Z
 indicating the time is in
 .Tn UTC .
 Otherwise, the time is assumed to be in local time.
+Local time is affected by the value of the
+.Ev TZ
+environment variable.
 .El
 .It Fl h
 If the file is a symbolic link, change the times of the link
@@ -196,7 +194,7 @@ The hour of the day, from 00 to 23.
 .It Ar mm
 The minute of the hour, from 00 to 59.
 .It Ar SS
-The second of the minute, from 00 to 61.
+The second of the minute, from 00 to 60.
 .El
 .Pp
 If the
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r334500 - in head/lib/libc: amd64/gen i386/gen

2018-06-01 Thread Brooks Davis
Author: brooks
Date: Fri Jun  1 22:09:27 2018
New Revision: 334500
URL: https://svnweb.freebsd.org/changeset/base/334500

Log:
  Remove support for SYS_sys_exit in favor of SYS_exit.
  
  SYS_exit has been defined in the repo since 1994 except for a brief
  window when SYS_sys_exit was defined in 2000.

Modified:
  head/lib/libc/amd64/gen/rfork_thread.S
  head/lib/libc/i386/gen/rfork_thread.S

Modified: head/lib/libc/amd64/gen/rfork_thread.S
==
--- head/lib/libc/amd64/gen/rfork_thread.S  Fri Jun  1 21:37:42 2018
(r334499)
+++ head/lib/libc/amd64/gen/rfork_thread.S  Fri Jun  1 22:09:27 2018
(r334500)
@@ -80,11 +80,7 @@ ENTRY(rfork_thread)
/*
 * Exit system call
 */
-#ifdef SYS_exit
movq$SYS_exit, %rax
-#else
-   movq$SYS_sys_exit, %rax
-#endif
KERNCALL
 
/*

Modified: head/lib/libc/i386/gen/rfork_thread.S
==
--- head/lib/libc/i386/gen/rfork_thread.S   Fri Jun  1 21:37:42 2018
(r334499)
+++ head/lib/libc/i386/gen/rfork_thread.S   Fri Jun  1 22:09:27 2018
(r334500)
@@ -98,11 +98,7 @@ ENTRY(rfork_thread)
 */
pushl   %eax
pushl   $0
-#ifdef SYS_exit
movl$SYS_exit, %eax
-#else
-   movl$SYS_sys_exit, %eax
-#endif
KERNCALL
 
/*
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r334498 - head/sys/powerpc/include

2018-06-01 Thread Justin Hibbits
Author: jhibbits
Date: Fri Jun  1 21:37:20 2018
New Revision: 334498
URL: https://svnweb.freebsd.org/changeset/base/334498

Log:
  Increase powerpc64 KVA from ~7.25GB to 32GB
  
  This will let us use much more KVA for ZFS ARC where needed.  This may be
  incresed in the future if memory requirements increase.
  
  Discussed with:   nwhitehorn

Modified:
  head/sys/powerpc/include/vmparam.h

Modified: head/sys/powerpc/include/vmparam.h
==
--- head/sys/powerpc/include/vmparam.h  Fri Jun  1 21:24:27 2018
(r334497)
+++ head/sys/powerpc/include/vmparam.h  Fri Jun  1 21:37:20 2018
(r334498)
@@ -107,7 +107,7 @@
 
 #ifdef __powerpc64__
 #defineVM_MIN_KERNEL_ADDRESS   0xe000UL
-#defineVM_MAX_KERNEL_ADDRESS   0xe001c7ffUL
+#defineVM_MAX_KERNEL_ADDRESS   0xe007UL
 #defineVM_MAX_SAFE_KERNEL_ADDRESS  VM_MAX_KERNEL_ADDRESS
 #endif
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r334499 - head/sys/vm

2018-06-01 Thread Alan Cox
Author: alc
Date: Fri Jun  1 21:37:42 2018
New Revision: 334499
URL: https://svnweb.freebsd.org/changeset/base/334499

Log:
  Only a small subset of mmap(2)'s flags should be used in combination with
  the flag MAP_GUARD.  Rather than enumerating the flags that are not
  allowed, enumerate the flags that are allowed.  The list of allowed flags
  is much shorter and less likely to change.  (As an aside, one of the
  previously enumerated flags, MAP_PREFAULT, was not even a legal flag for
  mmap(2).  However, because of an earlier check within kern_mmap(), this
  misuse of MAP_PREFAULT was harmless.)
  
  Reviewed by:  kib
  MFC after:10 days

Modified:
  head/sys/vm/vm_mmap.c

Modified: head/sys/vm/vm_mmap.c
==
--- head/sys/vm/vm_mmap.c   Fri Jun  1 21:37:20 2018(r334498)
+++ head/sys/vm/vm_mmap.c   Fri Jun  1 21:37:42 2018(r334499)
@@ -241,8 +241,8 @@ kern_mmap(struct thread *td, uintptr_t addr0, size_t s
(prot & ~(PROT_READ | PROT_WRITE | PROT_EXEC)) != 0)
return (EINVAL);
if ((flags & MAP_GUARD) != 0 && (prot != PROT_NONE || fd != -1 ||
-   pos != 0 || (flags & (MAP_SHARED | MAP_PRIVATE | MAP_PREFAULT |
-   MAP_PREFAULT_READ | MAP_ANON | MAP_STACK)) != 0))
+   pos != 0 || (flags & ~(MAP_FIXED | MAP_GUARD | MAP_EXCL |
+   MAP_32BIT | MAP_ALIGNMENT_MASK)) != 0))
return (EINVAL);
 
/*
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r334497 - head/sys/netinet

2018-06-01 Thread Michael Tuexen
Author: tuexen
Date: Fri Jun  1 21:24:27 2018
New Revision: 334497
URL: https://svnweb.freebsd.org/changeset/base/334497

Log:
  Limit the retransmission timer for SYN-ACKs by TCPTV_REXMTMAX.
  
  Use the same logic to handle the SYN-ACK retransmission when sent from
  the syn cache code as when sent from the main code.
  
  MFC after:3 days
  Sponsored by: Netflix, Inc.

Modified:
  head/sys/netinet/tcp_syncache.c

Modified: head/sys/netinet/tcp_syncache.c
==
--- head/sys/netinet/tcp_syncache.c Fri Jun  1 21:24:10 2018
(r334496)
+++ head/sys/netinet/tcp_syncache.c Fri Jun  1 21:24:27 2018
(r334497)
@@ -415,8 +415,14 @@ syncache_drop(struct syncache *sc, struct syncache_hea
 static void
 syncache_timeout(struct syncache *sc, struct syncache_head *sch, int docallout)
 {
-   sc->sc_rxttime = ticks +
-   TCPTV_RTOBASE * (tcp_syn_backoff[sc->sc_rxmits]);
+   int rexmt;
+
+   if (sc->sc_rxmits == 0)
+   rexmt = TCPTV_RTOBASE;
+   else
+   TCPT_RANGESET(rexmt, TCPTV_RTOBASE * 
tcp_syn_backoff[sc->sc_rxmits],
+   tcp_rexmit_min, TCPTV_REXMTMAX);
+   sc->sc_rxttime = ticks + rexmt;
sc->sc_rxmits++;
if (TSTMP_LT(sc->sc_rxttime, sch->sch_nextc)) {
sch->sch_nextc = sc->sc_rxttime;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r334496 - head/tests/sys/audit

2018-06-01 Thread Alan Somers
Author: asomers
Date: Fri Jun  1 21:24:10 2018
New Revision: 334496
URL: https://svnweb.freebsd.org/changeset/base/334496

Log:
  audit(4): add tests for the fd audit class
  
  The only syscalls in this class are rmdir, unlink, unlinkat, rename, and
  renameat.  Also, set is_exclusive for all audit(4) tests, because they can
  start and stop auditd.
  
  Submitted by: aniketp
  MFC after:2 weeks
  Sponsored by: Google, Inc. (GSoC 2018)
  Differential Revision:https://reviews.freebsd.org/D15647

Added:
  head/tests/sys/audit/file-delete.c   (contents, props changed)
Modified:
  head/tests/sys/audit/Makefile

Modified: head/tests/sys/audit/Makefile
==
--- head/tests/sys/audit/Makefile   Fri Jun  1 20:45:35 2018
(r334495)
+++ head/tests/sys/audit/Makefile   Fri Jun  1 21:24:10 2018
(r334496)
@@ -3,11 +3,14 @@
 TESTSDIR=  ${TESTSBASE}/sys/audit
 
 ATF_TESTS_C=   file-create
+ATF_TESTS_C+=  file-delete
 ATF_TESTS_C+=  file-write
 ATF_TESTS_C+=  file-read
 
 SRCS.file-create+= file-create.c
 SRCS.file-create+= utils.c
+SRCS.file-delete+= file-delete.c
+SRCS.file-delete+= utils.c
 SRCS.file-write+=  file-write.c
 SRCS.file-write+=  utils.c
 SRCS.file-read+=   file-read.c
@@ -15,6 +18,7 @@ SRCS.file-read+=  utils.c
 
 TEST_METADATA+= timeout="30"
 TEST_METADATA+= required_user="root"
+TEST_METADATA+= is_exclusive="true"
 
 WARNS?=6
 

Added: head/tests/sys/audit/file-delete.c
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/tests/sys/audit/file-delete.c  Fri Jun  1 21:24:10 2018
(r334496)
@@ -0,0 +1,270 @@
+/*-
+ * Copyright 2018 Aniket Pandey
+ *
+ * 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
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * 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
+ * SUCH DAMAGE.
+ *
+ * $FreeBSD$
+ */
+
+#include 
+
+#include 
+#include 
+#include 
+
+#include "utils.h"
+
+static struct pollfd fds[1];
+static mode_t mode = 0777;
+static const char *path = "fileforaudit";
+static const char *errpath = "dirdoesnotexist/fileforaudit";
+static const char *successreg = "fileforaudit.*return,success";
+static const char *failurereg = "fileforaudit.*return,failure";
+
+
+ATF_TC_WITH_CLEANUP(rmdir_success);
+ATF_TC_HEAD(rmdir_success, tc)
+{
+   atf_tc_set_md_var(tc, "descr", "Tests the audit of a successful "
+   "rmdir(2) call");
+}
+
+ATF_TC_BODY(rmdir_success, tc)
+{
+   ATF_REQUIRE_EQ(0, mkdir(path, mode));
+   FILE *pipefd = setup(fds, "fd");
+   ATF_REQUIRE_EQ(0, rmdir(path));
+   check_audit(fds, successreg, pipefd);
+}
+
+ATF_TC_CLEANUP(rmdir_success, tc)
+{
+   cleanup();
+}
+
+
+ATF_TC_WITH_CLEANUP(rmdir_failure);
+ATF_TC_HEAD(rmdir_failure, tc)
+{
+   atf_tc_set_md_var(tc, "descr", "Tests the audit of an unsuccessful "
+   "rmdir(2) call");
+}
+
+ATF_TC_BODY(rmdir_failure, tc)
+{
+   FILE *pipefd = setup(fds, "fd");
+   /* Failure reason: directory does not exist */
+   ATF_REQUIRE_EQ(-1, rmdir(errpath));
+   check_audit(fds, failurereg, pipefd);
+}
+
+ATF_TC_CLEANUP(rmdir_failure, tc)
+{
+   cleanup();
+}
+
+
+ATF_TC_WITH_CLEANUP(rename_success);
+ATF_TC_HEAD(rename_success, tc)
+{
+   atf_tc_set_md_var(tc, "descr", "Tests the audit of a successful "
+   "rename(2) call");
+}
+
+ATF_TC_BODY(rename_success, tc)
+{
+   ATF_REQUIRE(open(path, O_CREAT, mode) != -1);
+   FILE *pipefd = setup(fds, "fd");
+   ATF_REQUIRE_EQ(0, rename(path, "renamed"));
+   check_audit(fds, successreg, pipefd);
+}
+

svn commit: r334495 - head/usr.bin/indent

2018-06-01 Thread Piotr Pawel Stefaniak
Author: pstef
Date: Fri Jun  1 20:45:35 2018
New Revision: 334495
URL: https://svnweb.freebsd.org/changeset/base/334495

Log:
  indent(1): improve an error message
  
  When producing a "[...] requires a parameter" error, provide the recognized
  name of the option instead of argument provided.

Modified:
  head/usr.bin/indent/args.c

Modified: head/usr.bin/indent/args.c
==
--- head/usr.bin/indent/args.c  Fri Jun  1 19:58:19 2018(r334494)
+++ head/usr.bin/indent/args.c  Fri Jun  1 20:45:35 2018(r334495)
@@ -325,7 +325,7 @@ found:
 case PRO_INT:
if (!isdigit(*param_start)) {
 need_param:
-   errx(1, "%s: ``%s'' requires a parameter", option_source, arg - 1);
+   errx(1, "%s: ``%s'' requires a parameter", option_source, 
p->p_name);
}
*p->p_obj = atoi(param_start);
break;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r334494 - head/sys/netinet

2018-06-01 Thread Michael Tuexen
Author: tuexen
Date: Fri Jun  1 19:58:19 2018
New Revision: 334494
URL: https://svnweb.freebsd.org/changeset/base/334494

Log:
  Ensure net.inet.tcp.syncache.rexmtlimit is limited by TCP_MAXRXTSHIFT.
  
  If the sysctl variable is set to a value larger than TCP_MAXRXTSHIFT+1,
  the array tcp_syn_backoff[] is accessed out of bounds.
  
  Discussed with: jtl@
  MFC after:3 days
  Sponsored by: Netflix, Inc.

Modified:
  head/sys/netinet/tcp_syncache.c

Modified: head/sys/netinet/tcp_syncache.c
==
--- head/sys/netinet/tcp_syncache.c Fri Jun  1 19:56:41 2018
(r334493)
+++ head/sys/netinet/tcp_syncache.c Fri Jun  1 19:58:19 2018
(r334494)
@@ -183,8 +183,27 @@ SYSCTL_UINT(_net_inet_tcp_syncache, OID_AUTO, hashsize
 _NAME(tcp_syncache.hashsize), 0,
 "Size of TCP syncache hashtable");
 
-SYSCTL_UINT(_net_inet_tcp_syncache, OID_AUTO, rexmtlimit, CTLFLAG_VNET | 
CTLFLAG_RW,
+static int
+sysctl_net_inet_tcp_syncache_rexmtlimit_check(SYSCTL_HANDLER_ARGS)
+{
+   int error;
+   u_int new;
+
+   new = V_tcp_syncache.rexmt_limit;
+   error = sysctl_handle_int(oidp, , 0, req);
+   if ((error == 0) && (req->newptr != NULL)) {
+   if (new > TCP_MAXRXTSHIFT)
+   error = EINVAL;
+   else
+   V_tcp_syncache.rexmt_limit = new;
+   }
+   return (error);
+}
+
+SYSCTL_PROC(_net_inet_tcp_syncache, OID_AUTO, rexmtlimit,
+CTLFLAG_VNET | CTLTYPE_UINT | CTLFLAG_RW,
 _NAME(tcp_syncache.rexmt_limit), 0,
+sysctl_net_inet_tcp_syncache_rexmtlimit_check, "UI",
 "Limit on SYN/ACK retransmissions");
 
 VNET_DEFINE(int, tcp_sc_rst_sock_fail) = 1;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r334493 - in head/usr.bin/indent: . tests

2018-06-01 Thread Piotr Pawel Stefaniak
Author: pstef
Date: Fri Jun  1 19:56:41 2018
New Revision: 334493
URL: https://svnweb.freebsd.org/changeset/base/334493

Log:
  indent(1): restore working -pcs
  
  My previous indent(1) commit accidentally broke the -pcs option (which adds
  space between function name and opening parenthesis in function calls) by
  copying all but one of a few conditions in an if clause. Reinstate the
  condition.
  
  Add a regression test to lower the chances of breaking it again.
  
  Correct a comment with description of what the option does.

Added:
  head/usr.bin/indent/tests/pcs.0   (contents, props changed)
  head/usr.bin/indent/tests/pcs.0.pro   (contents, props changed)
  head/usr.bin/indent/tests/pcs.0.stdout   (contents, props changed)
Modified:
  head/usr.bin/indent/indent.c
  head/usr.bin/indent/indent_globs.h
  head/usr.bin/indent/tests/Makefile

Modified: head/usr.bin/indent/indent.c
==
--- head/usr.bin/indent/indent.cFri Jun  1 19:47:41 2018
(r334492)
+++ head/usr.bin/indent/indent.cFri Jun  1 19:56:41 2018
(r334493)
@@ -556,6 +556,7 @@ check_type:
}
else if (ps.want_blank && *token != '[' &&
((ps.last_token != ident && ps.last_token != funcname) ||
+   proc_calls_space ||
/* offsetof (1) is never allowed a space; sizeof (2) gets
 * one iff -bs; all other keywords (>2) always get a space
 * before lparen */

Modified: head/usr.bin/indent/indent_globs.h
==
--- head/usr.bin/indent/indent_globs.h  Fri Jun  1 19:47:41 2018
(r334492)
+++ head/usr.bin/indent/indent_globs.h  Fri Jun  1 19:56:41 2018
(r334493)
@@ -168,7 +168,7 @@ int procnames_start_line;   /* if true, the name
 * the type of the procedure and its
 * name) */
 int proc_calls_space;  /* If true, procedure calls look like:
-* foo(bar) rather than foo (bar) */
+* foo (bar) rather than foo(bar) */
 int format_block_comments; /* true if comments beginning with
 * `/ * \n' are to be reformatted */
 int format_col1_comments;  /* If comments which start in column 1

Modified: head/usr.bin/indent/tests/Makefile
==
--- head/usr.bin/indent/tests/Makefile  Fri Jun  1 19:47:41 2018
(r334492)
+++ head/usr.bin/indent/tests/Makefile  Fri Jun  1 19:56:41 2018
(r334493)
@@ -26,6 +26,9 @@ ${PACKAGE}FILES+= offsetof.0.stdout
 ${PACKAGE}FILES+=   parens.0
 ${PACKAGE}FILES+=   parens.0.stdout
 ${PACKAGE}FILES+=   parens.0.pro
+${PACKAGE}FILES+=  pcs.0
+${PACKAGE}FILES+=  pcs.0.stdout
+${PACKAGE}FILES+=  pcs.0.pro
 ${PACKAGE}FILES+=  sac.0
 ${PACKAGE}FILES+=  sac.0.stdout
 ${PACKAGE}FILES+=  sac.0.pro

Added: head/usr.bin/indent/tests/pcs.0
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/usr.bin/indent/tests/pcs.0 Fri Jun  1 19:56:41 2018
(r334493)
@@ -0,0 +1,7 @@
+/* $FreeBSD$ */
+#include 
+
+int main(void) {
+  puts("Hello");
+  return 0;
+}

Added: head/usr.bin/indent/tests/pcs.0.pro
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/usr.bin/indent/tests/pcs.0.pro Fri Jun  1 19:56:41 2018
(r334493)
@@ -0,0 +1,2 @@
+/* $FreeBSD$ */
+-pcs

Added: head/usr.bin/indent/tests/pcs.0.stdout
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/usr.bin/indent/tests/pcs.0.stdout  Fri Jun  1 19:56:41 2018
(r334493)
@@ -0,0 +1,9 @@
+/* $FreeBSD$ */
+#include 
+
+int
+main(void)
+{
+   puts ("Hello");
+   return 0;
+}
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r334492 - in head/sys/fs: nfs nfsserver

2018-06-01 Thread Rick Macklem
Author: rmacklem
Date: Fri Jun  1 19:47:41 2018
New Revision: 334492
URL: https://svnweb.freebsd.org/changeset/base/334492

Log:
  Add the BindConnectiontoSession operation to the NFSv4.1 server.
  
  Under some fairly unusual circumstances, the Linux NFSv4.1 client is
  doing a BindConnectiontoSession operation for TCP connections.
  It is also used by the ESXi6.5 NFSv4.1 client.
  This patch adds this operation to the NFSv4.1 server.
  
  Reported by:  andreas.n...@frequentis.com
  Tested by:andreas.n...@frequentis.com
  MFC after:2 weeks

Modified:
  head/sys/fs/nfs/nfs.h
  head/sys/fs/nfs/nfs_commonsubs.c
  head/sys/fs/nfs/nfs_var.h
  head/sys/fs/nfs/nfsproto.h
  head/sys/fs/nfsserver/nfs_nfsdserv.c
  head/sys/fs/nfsserver/nfs_nfsdsocket.c
  head/sys/fs/nfsserver/nfs_nfsdstate.c

Modified: head/sys/fs/nfs/nfs.h
==
--- head/sys/fs/nfs/nfs.h   Fri Jun  1 19:42:59 2018(r334491)
+++ head/sys/fs/nfs/nfs.h   Fri Jun  1 19:47:41 2018(r334492)
@@ -301,6 +301,7 @@ struct nfsreferral {
 #defineLCL_ADMINREVOKED0x8000
 #defineLCL_RECLAIMCOMPLETE 0x0001
 #defineLCL_NFSV41  0x0002
+#defineLCL_DONEBINDCONN0x0004
 
 #defineLCL_GSS LCL_KERBV   /* Or of all mechs */
 

Modified: head/sys/fs/nfs/nfs_commonsubs.c
==
--- head/sys/fs/nfs/nfs_commonsubs.cFri Jun  1 19:42:59 2018
(r334491)
+++ head/sys/fs/nfs/nfs_commonsubs.cFri Jun  1 19:47:41 2018
(r334492)
@@ -138,7 +138,7 @@ struct nfsv4_opflag nfsv4_opflag[NFSV41_NOPS] = {
{ 0, 2, 1, 1, LK_EXCLUSIVE, 1, 0 }, /* Write */
{ 0, 0, 0, 0, LK_EXCLUSIVE, 1, 0 }, /* ReleaseLockOwner */
{ 0, 0, 0, 0, LK_EXCLUSIVE, 1, 1 }, /* Backchannel Ctrl */
-   { 0, 0, 0, 0, LK_EXCLUSIVE, 1, 1 }, /* Bind Conn to Sess */
+   { 0, 0, 0, 0, LK_EXCLUSIVE, 0, 0 }, /* Bind Conn to Sess */
{ 0, 0, 0, 0, LK_EXCLUSIVE, 0, 0 }, /* Exchange ID */
{ 0, 0, 0, 0, LK_EXCLUSIVE, 0, 0 }, /* Create Session */
{ 0, 0, 0, 0, LK_EXCLUSIVE, 0, 0 }, /* Destroy Session */

Modified: head/sys/fs/nfs/nfs_var.h
==
--- head/sys/fs/nfs/nfs_var.h   Fri Jun  1 19:42:59 2018(r334491)
+++ head/sys/fs/nfs/nfs_var.h   Fri Jun  1 19:47:41 2018(r334492)
@@ -97,6 +97,7 @@ int nfsrv_getclient(nfsquad_t, int, struct nfsclient *
 nfsquad_t, uint32_t, struct nfsrv_descript *, NFSPROC_T *);
 int nfsrv_destroyclient(nfsquad_t, NFSPROC_T *);
 int nfsrv_destroysession(struct nfsrv_descript *, uint8_t *);
+int nfsrv_bindconnsess(struct nfsrv_descript *, uint8_t *, int *);
 int nfsrv_freestateid(struct nfsrv_descript *, nfsv4stateid_t *, NFSPROC_T *);
 int nfsrv_teststateid(struct nfsrv_descript *, nfsv4stateid_t *, NFSPROC_T *);
 int nfsrv_adminrevoke(struct nfsd_clid *, NFSPROC_T *);
@@ -232,6 +233,8 @@ int nfsrvd_sequence(struct nfsrv_descript *, int,
 int nfsrvd_reclaimcomplete(struct nfsrv_descript *, int,
 vnode_t, NFSPROC_T *, struct nfsexstuff *);
 int nfsrvd_destroyclientid(struct nfsrv_descript *, int,
+vnode_t, NFSPROC_T *, struct nfsexstuff *);
+int nfsrvd_bindconnsess(struct nfsrv_descript *, int,
 vnode_t, NFSPROC_T *, struct nfsexstuff *);
 int nfsrvd_destroysession(struct nfsrv_descript *, int,
 vnode_t, NFSPROC_T *, struct nfsexstuff *);

Modified: head/sys/fs/nfs/nfsproto.h
==
--- head/sys/fs/nfs/nfsproto.h  Fri Jun  1 19:42:59 2018(r334491)
+++ head/sys/fs/nfs/nfsproto.h  Fri Jun  1 19:47:41 2018(r334492)
@@ -659,6 +659,15 @@
 #defineNFSFLEXFLAG_NO_READIO   0x0004
 #defineNFSFLEXFLAG_WRITE_ONEMIRROR 0x0008
 
+/* Enum values for Bind Connection to Session. */
+#defineNFSCDFC4_FORE   0x1
+#defineNFSCDFC4_BACK   0x2
+#defineNFSCDFC4_FORE_OR_BOTH   0x3
+#defineNFSCDFC4_BACK_OR_BOTH   0x7
+#defineNFSCDFS4_FORE   0x1
+#defineNFSCDFS4_BACK   0x2
+#defineNFSCDFS4_BOTH   0x3
+
 /* Conversion macros */
 #definevtonfsv2_mode(t,m)  
\
txdr_unsigned(((t) == VFIFO) ? MAKEIMODE(VCHR, (m)) :   \

Modified: head/sys/fs/nfsserver/nfs_nfsdserv.c
==
--- head/sys/fs/nfsserver/nfs_nfsdserv.cFri Jun  1 19:42:59 2018
(r334491)
+++ head/sys/fs/nfsserver/nfs_nfsdserv.cFri Jun  1 19:47:41 2018
(r334492)
@@ -4055,6 +4055,45 @@ nfsmout:
 }
 
 /*
+ * nfsv4 bind connection to session service
+ */

svn commit: r334491 - head/sys/dev/aac

2018-06-01 Thread Warner Losh
Author: imp
Date: Fri Jun  1 19:42:59 2018
New Revision: 334491
URL: https://svnweb.freebsd.org/changeset/base/334491

Log:
  Add PNP_INFO to aac
  
  Reviewed by: imp, chuck
  Submitted by: Lakhan Shiva Kamireddy 
  Sponsored by: Google, Inc. (GSoC 2018)

Modified:
  head/sys/dev/aac/aac_pci.c

Modified: head/sys/dev/aac/aac_pci.c
==
--- head/sys/dev/aac/aac_pci.c  Fri Jun  1 16:47:39 2018(r334490)
+++ head/sys/dev/aac/aac_pci.c  Fri Jun  1 19:42:59 2018(r334491)
@@ -493,6 +493,8 @@ static driver_t aacch_driver = {
 
 static devclass_t  aacch_devclass;
 DRIVER_MODULE(aacch, pci, aacch_driver, aacch_devclass, NULL, NULL);
+MODULE_PNP_INFO("U16:vendor;U16:device;", pci, aac,
+aac_identifiers, sizeof(aac_identifiers[0]), nitems(aac_identifiers) - 1);
 
 static int
 aacch_probe(device_t dev)
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


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

2018-06-01 Thread Jonathan T. Looney
Author: jtl
Date: Fri Jun  1 16:47:39 2018
New Revision: 334490
URL: https://svnweb.freebsd.org/changeset/base/334490

Log:
  Update the sysctl(9) manpage to indicate that  is required
  instead of .  ( includes NULL, which is defined
  with  and not .)
  
  Sponsored by: Netflix

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

Modified: head/share/man/man9/sysctl.9
==
--- head/share/man/man9/sysctl.9Fri Jun  1 16:46:29 2018
(r334489)
+++ head/share/man/man9/sysctl.9Fri Jun  1 16:47:39 2018
(r334490)
@@ -25,7 +25,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd March 3, 2018
+.Dd June 1, 2018
 .Dt SYSCTL 9
 .Os
 .Sh NAME
@@ -80,7 +80,7 @@
 .Nm SYSCTL_UQUAD
 .Nd Dynamic and static sysctl MIB creation functions
 .Sh SYNOPSIS
-.In sys/types.h
+.In sys/param.h
 .In sys/sysctl.h
 .Fn SYSCTL_DECL name
 .Ft struct sysctl_oid *
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r334489 - head/sys/dev/cxgbe

2018-06-01 Thread Navdeep Parhar
Author: np
Date: Fri Jun  1 16:46:29 2018
New Revision: 334489
URL: https://svnweb.freebsd.org/changeset/base/334489

Log:
  cxgbe(4): Include full duplex mediaopt in media that can be reported as
  active.  Always report full duplex in active media.
  
  Sponsored by: Chelsio Communications

Modified:
  head/sys/dev/cxgbe/t4_main.c

Modified: head/sys/dev/cxgbe/t4_main.c
==
--- head/sys/dev/cxgbe/t4_main.cFri Jun  1 16:31:05 2018
(r334488)
+++ head/sys/dev/cxgbe/t4_main.cFri Jun  1 16:46:29 2018
(r334489)
@@ -2312,7 +2312,7 @@ cxgbe_media_status(struct ifnet *ifp, struct ifmediare
ifmr->ifm_status |= IFM_ACTIVE;
 
/* ifm_active */
-   ifmr->ifm_active = IFM_ETHER;
+   ifmr->ifm_active = IFM_ETHER | IFM_FDX;
ifmr->ifm_active &= ~(IFM_ETH_TXPAUSE | IFM_ETH_RXPAUSE);
if (lc->fc & PAUSE_RX)
ifmr->ifm_active |= IFM_ETH_RXPAUSE;
@@ -4191,13 +4191,13 @@ set_current_media(struct port_info *pi, struct ifmedia
IFM_SUBTYPE(ifm->ifm_cur->ifm_media) == IFM_NONE)
return;
 
-   mword = IFM_ETHER;
lc = >link_cfg;
if (lc->requested_aneg == AUTONEG_ENABLE &&
lc->supported & FW_PORT_CAP_ANEG) {
-   ifmedia_set(ifm, mword | IFM_AUTO);
+   ifmedia_set(ifm, IFM_ETHER | IFM_AUTO);
return;
}
+   mword = IFM_ETHER | IFM_FDX;
if (lc->requested_fc & PAUSE_TX)
mword |= IFM_ETH_TXPAUSE;
if (lc->requested_fc & PAUSE_RX)
@@ -4251,11 +4251,11 @@ no_media:
} else if (mword == IFM_UNKNOWN)
unknown++;
else
-   ifmedia_add4(ifm, IFM_ETHER | mword);
+   ifmedia_add4(ifm, IFM_ETHER | IFM_FDX | mword);
}
}
if (unknown > 0) /* Add one unknown for all unknown media types. */
-   ifmedia_add4(ifm, IFM_ETHER | IFM_UNKNOWN);
+   ifmedia_add4(ifm, IFM_ETHER | IFM_FDX | IFM_UNKNOWN);
if (lc->supported & FW_PORT_CAP_ANEG)
ifmedia_add(ifm, IFM_ETHER | IFM_AUTO, 0, NULL);
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r334488 - head/sys/powerpc/include

2018-06-01 Thread Justin Hibbits
Author: jhibbits
Date: Fri Jun  1 16:31:05 2018
New Revision: 334488
URL: https://svnweb.freebsd.org/changeset/base/334488

Log:
  Unbreak 32-bit binaries on powerpc64
  
  Recently a change was made which broke loading 32-bit binaries on powerpc64,
  with an assertion in ld-elf32.so.1:
  
  ld-elf32.so.1: assert failed:
  /usr/local/poudriere/jails/ppc64/usr/src/libexec/rtld-elf/rtld.c:390
  
  It turns out Elf32_AuxInfo was broken for a very long time on powerpc64, as
  it uses long and pointers, which are both 64 bits on powerpc64, and only
  manifested with the recent work on auxargs.

Modified:
  head/sys/powerpc/include/elf.h

Modified: head/sys/powerpc/include/elf.h
==
--- head/sys/powerpc/include/elf.h  Fri Jun  1 16:23:47 2018
(r334487)
+++ head/sys/powerpc/include/elf.h  Fri Jun  1 16:31:05 2018
(r334488)
@@ -69,9 +69,13 @@
 typedef struct {   /* Auxiliary vector entry on initial stack */
int a_type; /* Entry type. */
union {
+#ifdef __powerpc64__
+   int a_val;  /* Integer value */
+#else
longa_val;  /* Integer value. */
void*a_ptr; /* Address. */
void(*a_fcn)(void); /* Function pointer (not used). */
+#endif
} a_un;
 } Elf32_Auxinfo;
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r334487 - head/tests/sys/audit

2018-06-01 Thread Alan Somers
Author: asomers
Date: Fri Jun  1 16:23:47 2018
New Revision: 334487
URL: https://svnweb.freebsd.org/changeset/base/334487

Log:
  audit(4): Add tests for the fw class of syscalls.
  
  truncate and ftruncate are the only syscalls in this class, apart from
  certain variations of open and openat, which will be handled in a different
  file.
  
  Submitted by: aniketp
  MFC after:2 weeks
  Sponsored by: Google, Inc. (GSoC 2018)
  Differential Revision:https://reviews.freebsd.org/D15640

Added:
  head/tests/sys/audit/file-write.c   (contents, props changed)
Modified:
  head/tests/sys/audit/Makefile

Modified: head/tests/sys/audit/Makefile
==
--- head/tests/sys/audit/Makefile   Fri Jun  1 13:26:45 2018
(r334486)
+++ head/tests/sys/audit/Makefile   Fri Jun  1 16:23:47 2018
(r334487)
@@ -3,10 +3,13 @@
 TESTSDIR=  ${TESTSBASE}/sys/audit
 
 ATF_TESTS_C=   file-create
+ATF_TESTS_C+=  file-write
 ATF_TESTS_C+=  file-read
 
 SRCS.file-create+= file-create.c
 SRCS.file-create+= utils.c
+SRCS.file-write+=  file-write.c
+SRCS.file-write+=  utils.c
 SRCS.file-read+=   file-read.c
 SRCS.file-read+=   utils.c
 

Added: head/tests/sys/audit/file-write.c
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/tests/sys/audit/file-write.c   Fri Jun  1 16:23:47 2018
(r334487)
@@ -0,0 +1,139 @@
+/*-
+ * Copyright 2018 Aniket Pandey
+ *
+ * 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
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * 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
+ * SUCH DAMAGE.
+ *
+ * $FreeBSD$
+ */
+
+#include 
+#include 
+
+#include "utils.h"
+
+static struct pollfd fds[1];
+static mode_t mode = 0777;
+static off_t offlen = 0;
+static const char *path = "fileforaudit";
+static const char *errpath = "dirdoesnotexist/fileforaudit";
+static const char *successreg = "fileforaudit.*return,success";
+static const char *failurereg = "fileforaudit.*return,failure";
+
+
+ATF_TC_WITH_CLEANUP(truncate_success);
+ATF_TC_HEAD(truncate_success, tc)
+{
+   atf_tc_set_md_var(tc, "descr", "Tests the audit of a successful "
+   "truncate(2) call");
+}
+
+ATF_TC_BODY(truncate_success, tc)
+{
+   /* File needs to exist to call truncate(2) */
+   ATF_REQUIRE(open(path, O_CREAT, mode) != -1);
+   FILE *pipefd = setup(fds, "fw");
+   ATF_REQUIRE_EQ(0, truncate(path, offlen));
+   check_audit(fds, successreg, pipefd);
+}
+
+ATF_TC_CLEANUP(truncate_success, tc)
+{
+   cleanup();
+}
+
+
+ATF_TC_WITH_CLEANUP(truncate_failure);
+ATF_TC_HEAD(truncate_failure, tc)
+{
+   atf_tc_set_md_var(tc, "descr", "Tests the audit of an unsuccessful "
+   "truncate(2) call");
+}
+
+ATF_TC_BODY(truncate_failure, tc)
+{
+   FILE *pipefd = setup(fds, "fw");
+   /* Failure reason: file does not exist */
+   ATF_REQUIRE_EQ(-1, truncate(errpath, offlen));
+   check_audit(fds, failurereg, pipefd);
+}
+
+ATF_TC_CLEANUP(truncate_failure, tc)
+{
+   cleanup();
+}
+
+
+ATF_TC_WITH_CLEANUP(ftruncate_success);
+ATF_TC_HEAD(ftruncate_success, tc)
+{
+   atf_tc_set_md_var(tc, "descr", "Tests the audit of a successful "
+   "ftruncate(2) call");
+}
+
+ATF_TC_BODY(ftruncate_success, tc)
+{
+   int filedesc;
+   const char *regex = "ftruncate.*return,success";
+   /* Valid file descriptor needs to exist to call ftruncate(2) */
+   ATF_REQUIRE((filedesc = open(path, O_CREAT | O_RDWR)) != -1);
+   FILE *pipefd = setup(fds, "fw");
+   ATF_REQUIRE_EQ(0, ftruncate(filedesc, offlen));
+   check_audit(fds, regex, pipefd);

svn commit: r334486 - head/sys/kern

2018-06-01 Thread Ed Maste
Author: emaste
Date: Fri Jun  1 13:26:45 2018
New Revision: 334486
URL: https://svnweb.freebsd.org/changeset/base/334486

Log:
  ANSIfy sys/kern

Modified:
  head/sys/kern/kern_descrip.c
  head/sys/kern/kern_exec.c
  head/sys/kern/subr_prof.c
  head/sys/kern/sys_pipe.c
  head/sys/kern/sysv_msg.c
  head/sys/kern/vfs_cluster.c
  head/sys/kern/vfs_vnops.c

Modified: head/sys/kern/kern_descrip.c
==
--- head/sys/kern/kern_descrip.cFri Jun  1 12:43:13 2018
(r334485)
+++ head/sys/kern/kern_descrip.cFri Jun  1 13:26:45 2018
(r334486)
@@ -1148,8 +1148,7 @@ fail:
  * This is common code for FIOGETOWN ioctl called by fcntl(fd, F_GETOWN, arg).
  */
 pid_t
-fgetown(sigiop)
-   struct sigio **sigiop;
+fgetown(struct sigio **sigiop)
 {
pid_t pgid;
 

Modified: head/sys/kern/kern_exec.c
==
--- head/sys/kern/kern_exec.c   Fri Jun  1 12:43:13 2018(r334485)
+++ head/sys/kern/kern_exec.c   Fri Jun  1 13:26:45 2018(r334486)
@@ -978,8 +978,7 @@ exec_fail:
 }
 
 int
-exec_map_first_page(imgp)
-   struct image_params *imgp;
+exec_map_first_page(struct image_params *imgp)
 {
int rv, i, after, initial_pagein;
vm_page_t ma[VM_INITIAL_PAGEIN];

Modified: head/sys/kern/subr_prof.c
==
--- head/sys/kern/subr_prof.c   Fri Jun  1 12:43:13 2018(r334485)
+++ head/sys/kern/subr_prof.c   Fri Jun  1 13:26:45 2018(r334486)
@@ -139,8 +139,7 @@ kmupetext(uintfptr_t nhighpc)
 }
 
 static void
-kmstartup(dummy)
-   void *dummy;
+kmstartup(void *dummy)
 {
char *cp;
struct gmonparam *p = &_gmonparam;

Modified: head/sys/kern/sys_pipe.c
==
--- head/sys/kern/sys_pipe.cFri Jun  1 12:43:13 2018(r334485)
+++ head/sys/kern/sys_pipe.cFri Jun  1 13:26:45 2018(r334486)
@@ -491,9 +491,7 @@ sys_pipe2(struct thread *td, struct pipe2_args *uap)
  * If it fails it will return ENOMEM.
  */
 static int
-pipespace_new(cpipe, size)
-   struct pipe *cpipe;
-   int size;
+pipespace_new(struct pipe *cpipe, int size)
 {
caddr_t buffer;
int error, cnt, firstseg;
@@ -559,9 +557,7 @@ retry:
  * Wrapper for pipespace_new() that performs locking assertions.
  */
 static int
-pipespace(cpipe, size)
-   struct pipe *cpipe;
-   int size;
+pipespace(struct pipe *cpipe, int size)
 {
 
KASSERT(cpipe->pipe_state & PIPE_LOCKFL,
@@ -573,9 +569,7 @@ pipespace(cpipe, size)
  * lock a pipe for I/O, blocking other access
  */
 static __inline int
-pipelock(cpipe, catch)
-   struct pipe *cpipe;
-   int catch;
+pipelock(struct pipe *cpipe, int catch)
 {
int error;
 
@@ -596,8 +590,7 @@ pipelock(cpipe, catch)
  * unlock a pipe I/O lock
  */
 static __inline void
-pipeunlock(cpipe)
-   struct pipe *cpipe;
+pipeunlock(struct pipe *cpipe)
 {
 
PIPE_LOCK_ASSERT(cpipe, MA_OWNED);
@@ -611,8 +604,7 @@ pipeunlock(cpipe)
 }
 
 void
-pipeselwakeup(cpipe)
-   struct pipe *cpipe;
+pipeselwakeup(struct pipe *cpipe)
 {
 
PIPE_LOCK_ASSERT(cpipe, MA_OWNED);
@@ -631,9 +623,7 @@ pipeselwakeup(cpipe)
  * will start out zero'd from the ctor, so we just manage the kmem.
  */
 static void
-pipe_create(pipe, backing)
-   struct pipe *pipe;
-   int backing;
+pipe_create(struct pipe *pipe, int backing)
 {
 
if (backing) {
@@ -655,12 +645,8 @@ pipe_create(pipe, backing)
 
 /* ARGSUSED */
 static int
-pipe_read(fp, uio, active_cred, flags, td)
-   struct file *fp;
-   struct uio *uio;
-   struct ucred *active_cred;
-   struct thread *td;
-   int flags;
+pipe_read(struct file *fp, struct uio *uio, struct ucred *active_cred,
+int flags, struct thread *td)
 {
struct pipe *rpipe;
int error;
@@ -834,9 +820,7 @@ unlocked_error:
  * This is similar to a physical write operation.
  */
 static int
-pipe_build_write_buffer(wpipe, uio)
-   struct pipe *wpipe;
-   struct uio *uio;
+pipe_build_write_buffer(struct pipe *wpipe, struct uio *uio)
 {
u_int size;
int i;
@@ -880,8 +864,7 @@ pipe_build_write_buffer(wpipe, uio)
  * unmap and unwire the process buffer
  */
 static void
-pipe_destroy_write_buffer(wpipe)
-   struct pipe *wpipe;
+pipe_destroy_write_buffer(struct pipe *wpipe)
 {
 
PIPE_LOCK_ASSERT(wpipe, MA_OWNED);
@@ -895,8 +878,7 @@ pipe_destroy_write_buffer(wpipe)
  * pages can be freed without loss of data.
  */
 static void
-pipe_clone_write_buffer(wpipe)
-   struct pipe *wpipe;
+pipe_clone_write_buffer(struct pipe *wpipe)
 {
struct uio uio;
struct iovec iov;
@@ -935,9 +917,7 @@ pipe_clone_write_buffer(wpipe)
  * the pipe buffer.  Then the direct mapping write is set-up.
  */
 static int

svn commit: r334485 - head/sys/powerpc/ofw

2018-06-01 Thread Breno Leitao
Author: leitao
Date: Fri Jun  1 12:43:13 2018
New Revision: 334485
URL: https://svnweb.freebsd.org/changeset/base/334485

Log:
  powerpc64: Avoid overwriting initrd area
  
  Currently kexec loads an initrd file into the main memory but does not
  mark that region as reserved, thus the area is not protected.
  
  If any initrd/md file is loaded from kexec/petitboot, the region might become
  corarupted/overwritten since FreeBSD does not know the region is 'reserved'.
  
  This patch simply adds the initrd area as a reserved memory region.
  
  Approved by: jhibbits
  Differential Revision: https://reviews.freebsd.org/D15610

Modified:
  head/sys/powerpc/ofw/ofw_machdep.c

Modified: head/sys/powerpc/ofw/ofw_machdep.c
==
--- head/sys/powerpc/ofw/ofw_machdep.c  Fri Jun  1 12:09:07 2018
(r334484)
+++ head/sys/powerpc/ofw/ofw_machdep.c  Fri Jun  1 12:43:13 2018
(r334485)
@@ -225,41 +225,19 @@ parse_ofw_memory(phandle_t node, const char *prop, str
 
 #ifdef FDT
 static int
-excise_fdt_reserved(struct mem_region *avail, int asz)
+excise_reserved_regions(struct mem_region *avail, int asz,
+   struct mem_region *exclude, int esz)
 {
-   struct {
-   uint64_t address;
-   uint64_t size;
-   } fdtmap[32];
-   ssize_t fdtmapsize;
-   phandle_t chosen;
int i, j, k;
 
-   chosen = OF_finddevice("/chosen");
-   fdtmapsize = OF_getprop(chosen, "fdtmemreserv", fdtmap, sizeof(fdtmap));
-
-   for (j = 0; j < fdtmapsize/sizeof(fdtmap[0]); j++) {
-   fdtmap[j].address = be64toh(fdtmap[j].address) & ~PAGE_MASK;
-   fdtmap[j].size = round_page(be64toh(fdtmap[j].size));
-   }
-
-   KASSERT(j*sizeof(fdtmap[0]) < sizeof(fdtmap),
-   ("Exceeded number of FDT reservations"));
-   /* Add a virtual entry for the FDT itself */
-   if (fdt != NULL) {
-   fdtmap[j].address = (vm_offset_t)fdt & ~PAGE_MASK;
-   fdtmap[j].size = round_page(fdt_totalsize(fdt));
-   fdtmapsize += sizeof(fdtmap[0]);
-   }
-
for (i = 0; i < asz; i++) {
-   for (j = 0; j < fdtmapsize/sizeof(fdtmap[0]); j++) {
+   for (j = 0; j < esz; j++) {
/*
 * Case 1: Exclusion region encloses complete
 * available entry. Drop it and move on.
 */
-   if (fdtmap[j].address <= avail[i].mr_start &&
-   fdtmap[j].address + fdtmap[j].size >=
+   if (exclude[j].mr_start <= avail[i].mr_start &&
+   exclude[j].mr_start + exclude[j].mr_size >=
avail[i].mr_start + avail[i].mr_size) {
for (k = i+1; k < asz; k++)
avail[k-1] = avail[k];
@@ -274,20 +252,20 @@ excise_fdt_reserved(struct mem_region *avail, int asz)
 * a new available entry with the region after
 * the excluded region, if any.
 */
-   if (fdtmap[j].address >= avail[i].mr_start &&
-   fdtmap[j].address < avail[i].mr_start +
+   if (exclude[j].mr_start >= avail[i].mr_start &&
+   exclude[j].mr_start < avail[i].mr_start +
avail[i].mr_size) {
-   if (fdtmap[j].address + fdtmap[j].size < 
+   if (exclude[j].mr_start + exclude[j].mr_size <
avail[i].mr_start + avail[i].mr_size) {
avail[asz].mr_start =
-   fdtmap[j].address + fdtmap[j].size;
+   exclude[j].mr_start + 
exclude[j].mr_size;
avail[asz].mr_size = avail[i].mr_start +
 avail[i].mr_size -
 avail[asz].mr_start;
asz++;
}
 
-   avail[i].mr_size = fdtmap[j].address -
+   avail[i].mr_size = exclude[j].mr_start -
avail[i].mr_start;
}
 
@@ -297,13 +275,13 @@ excise_fdt_reserved(struct mem_region *avail, int asz)
 * The case of a contained exclusion zone has already
 * been caught in case 2.
 */
-   if (fdtmap[j].address + fdtmap[j].size >=
-   avail[i].mr_start && fdtmap[j].address +
-   fdtmap[j].size < avail[i].mr_start +
+   if (exclude[j].mr_start + 

svn commit: r334484 - head/sys/compat/linuxkpi/common/include/linux

2018-06-01 Thread Hans Petter Selasky
Author: hselasky
Date: Fri Jun  1 12:09:07 2018
New Revision: 334484
URL: https://svnweb.freebsd.org/changeset/base/334484

Log:
  Implement the __sg_alloc_table_from_pages() function based on the existing
  sg_alloc_table_from_pages() function in the LinuxKPI.
  
  This basically allow segments to have a limit, max_segment.
  
  Submitted by: Johannes Lundberg 
  MFC after:1 week
  Sponsored by: Mellanox Technologies
  Sponsored by: Limelight Networks

Modified:
  head/sys/compat/linuxkpi/common/include/linux/scatterlist.h

Modified: head/sys/compat/linuxkpi/common/include/linux/scatterlist.h
==
--- head/sys/compat/linuxkpi/common/include/linux/scatterlist.h Fri Jun  1 
11:42:09 2018(r334483)
+++ head/sys/compat/linuxkpi/common/include/linux/scatterlist.h Fri Jun  1 
12:09:07 2018(r334484)
@@ -64,6 +64,8 @@ struct sg_page_iter {
} internal;
 };
 
+#defineSCATTERLIST_MAX_SEGMENT (-1U & ~(PAGE_SIZE - 1))
+
 #defineSG_MAX_SINGLE_ALLOC (PAGE_SIZE / sizeof(struct scatterlist))
 
 #defineSG_MAGIC0x87654321UL
@@ -286,18 +288,26 @@ sg_alloc_table(struct sg_table *table, unsigned int ne
 }
 
 static inline int
-sg_alloc_table_from_pages(struct sg_table *sgt,
+__sg_alloc_table_from_pages(struct sg_table *sgt,
 struct page **pages, unsigned int count,
 unsigned long off, unsigned long size,
-gfp_t gfp_mask)
+unsigned int max_segment, gfp_t gfp_mask)
 {
-   unsigned int i, segs, cur;
+   unsigned int i, segs, cur, len;
int rc;
struct scatterlist *s;
 
+   if (__predict_false(!max_segment || offset_in_page(max_segment)))
+   return (-EINVAL);
+
+   len = 0;
for (segs = i = 1; i < count; ++i) {
-   if (page_to_pfn(pages[i]) != page_to_pfn(pages[i - 1]) + 1)
+   len += PAGE_SIZE;
+   if (len >= max_segment ||
+   page_to_pfn(pages[i]) != page_to_pfn(pages[i - 1]) + 1) {
++segs;
+   len = 0;
+   }
}
if (__predict_false((rc = sg_alloc_table(sgt, segs, gfp_mask
return (rc);
@@ -307,10 +317,13 @@ sg_alloc_table_from_pages(struct sg_table *sgt,
unsigned long seg_size;
unsigned int j;
 
-   for (j = cur + 1; j < count; ++j)
-   if (page_to_pfn(pages[j]) !=
+   len = 0;
+   for (j = cur + 1; j < count; ++j) {
+   len += PAGE_SIZE;
+   if (len >= max_segment || page_to_pfn(pages[j]) !=
page_to_pfn(pages[j - 1]) + 1)
break;
+   }
 
seg_size = ((j - cur) << PAGE_SHIFT) - off;
sg_set_page(s, pages[cur], min(size, seg_size), off);
@@ -321,6 +334,16 @@ sg_alloc_table_from_pages(struct sg_table *sgt,
return (0);
 }
 
+static inline int
+sg_alloc_table_from_pages(struct sg_table *sgt,
+struct page **pages, unsigned int count,
+unsigned long off, unsigned long size,
+gfp_t gfp_mask)
+{
+
+   return (__sg_alloc_table_from_pages(sgt, pages, count, off, size,
+   SCATTERLIST_MAX_SEGMENT, gfp_mask));
+}
 
 static inline int
 sg_nents(struct scatterlist *sg)
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r334483 - in head/sys/compat/linuxkpi/common: include/linux src

2018-06-01 Thread Hans Petter Selasky
Author: hselasky
Date: Fri Jun  1 11:42:09 2018
New Revision: 334483
URL: https://svnweb.freebsd.org/changeset/base/334483

Log:
  Implement radix_tree_iter_delete() in the LinuxKPI.
  
  Submitted by: Johannes Lundberg 
  MFC after:1 week
  Sponsored by: Mellanox Technologies
  Sponsored by: Limelight Networks

Modified:
  head/sys/compat/linuxkpi/common/include/linux/radix-tree.h
  head/sys/compat/linuxkpi/common/src/linux_radix.c

Modified: head/sys/compat/linuxkpi/common/include/linux/radix-tree.h
==
--- head/sys/compat/linuxkpi/common/include/linux/radix-tree.h  Fri Jun  1 
11:33:14 2018(r334482)
+++ head/sys/compat/linuxkpi/common/include/linux/radix-tree.h  Fri Jun  1 
11:42:09 2018(r334483)
@@ -79,5 +79,6 @@ void  *radix_tree_lookup(struct radix_tree_root *, unsi
 void   *radix_tree_delete(struct radix_tree_root *, unsigned long);
 intradix_tree_insert(struct radix_tree_root *, unsigned long, void *);
 bool   radix_tree_iter_find(struct radix_tree_root *, struct radix_tree_iter 
*, void ***);
+void   radix_tree_iter_delete(struct radix_tree_root *, struct radix_tree_iter 
*, void **);
 
 #endif /* _LINUX_RADIX_TREE_H_ */

Modified: head/sys/compat/linuxkpi/common/src/linux_radix.c
==
--- head/sys/compat/linuxkpi/common/src/linux_radix.c   Fri Jun  1 11:33:14 
2018(r334482)
+++ head/sys/compat/linuxkpi/common/src/linux_radix.c   Fri Jun  1 11:42:09 
2018(r334483)
@@ -162,6 +162,13 @@ out:
return (item);
 }
 
+void
+radix_tree_iter_delete(struct radix_tree_root *root,
+struct radix_tree_iter *iter, void **slot)
+{
+   radix_tree_delete(root, iter->index);
+}
+
 int
 radix_tree_insert(struct radix_tree_root *root, unsigned long index, void 
*item)
 {
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r334482 - in head/sys/compat/linuxkpi/common: include/linux src

2018-06-01 Thread Hans Petter Selasky
Author: hselasky
Date: Fri Jun  1 11:33:14 2018
New Revision: 334482
URL: https://svnweb.freebsd.org/changeset/base/334482

Log:
  Improve high resolution timer support in the LinuxKPI.
  
  Submitted by: Johannes Lundberg 
  MFC after:1 week
  Sponsored by: Mellanox Technologies
  Sponsored by: Limelight Networks

Modified:
  head/sys/compat/linuxkpi/common/include/linux/hrtimer.h
  head/sys/compat/linuxkpi/common/src/linux_hrtimer.c

Modified: head/sys/compat/linuxkpi/common/include/linux/hrtimer.h
==
--- head/sys/compat/linuxkpi/common/include/linux/hrtimer.h Fri Jun  1 
11:14:59 2018(r334481)
+++ head/sys/compat/linuxkpi/common/include/linux/hrtimer.h Fri Jun  1 
11:33:14 2018(r334482)
@@ -36,6 +36,7 @@
 
 enum hrtimer_mode {
HRTIMER_MODE_REL,
+   HRTIMER_MODE_REL_PINNED = HRTIMER_MODE_REL,
 };
 
 enum hrtimer_restart {
@@ -47,31 +48,42 @@ struct hrtimer {
enum hrtimer_restart (*function)(struct hrtimer *);
struct mtx mtx;
struct callout callout;
+   s64 expires;/* relative time in nanoseconds */
+   s64 precision;  /* in nanoseconds */
 };
 
 #definehrtimer_active(hrtimer) linux_hrtimer_active(hrtimer)
 #definehrtimer_cancel(hrtimer) linux_hrtimer_cancel(hrtimer)
+
 #definehrtimer_init(hrtimer, clock, mode) do { \
CTASSERT((clock) == CLOCK_MONOTONIC);   \
CTASSERT((mode) == HRTIMER_MODE_REL);   \
linux_hrtimer_init(hrtimer);\
 } while (0)
+
 #definehrtimer_set_expires(hrtimer, time)  \
linux_hrtimer_set_expires(hrtimer, time)
+
 #definehrtimer_start(hrtimer, time, mode) do { \
CTASSERT((mode) == HRTIMER_MODE_REL);   \
linux_hrtimer_start(hrtimer, time); \
 } while (0)
+
 #definehrtimer_start_range_ns(hrtimer, time, prec, mode) do {  \
CTASSERT((mode) == HRTIMER_MODE_REL);   \
linux_hrtimer_start_range_ns(hrtimer, time, prec);  \
 } while (0)
 
+#definehrtimer_forward_now(hrtimer, interval) do { \
+   linux_hrtimer_forward_now(hrtimer, interval);   \
+} while (0)
+
 bool   linux_hrtimer_active(struct hrtimer *);
 intlinux_hrtimer_cancel(struct hrtimer *);
 void   linux_hrtimer_init(struct hrtimer *);
 void   linux_hrtimer_set_expires(struct hrtimer *, ktime_t);
 void   linux_hrtimer_start(struct hrtimer *, ktime_t);
 void   linux_hrtimer_start_range_ns(struct hrtimer *, ktime_t, int64_t);
+void   linux_hrtimer_forward_now(struct hrtimer *, ktime_t);
 
 #endif /* _LINUX_HRTIMER_H_ */

Modified: head/sys/compat/linuxkpi/common/src/linux_hrtimer.c
==
--- head/sys/compat/linuxkpi/common/src/linux_hrtimer.c Fri Jun  1 11:14:59 
2018(r334481)
+++ head/sys/compat/linuxkpi/common/src/linux_hrtimer.c Fri Jun  1 11:33:14 
2018(r334482)
@@ -44,8 +44,13 @@ hrtimer_call_handler(void *arg)
 
hrtimer = arg;
ret = hrtimer->function(hrtimer);
-   MPASS(ret == HRTIMER_NORESTART);
-   callout_deactivate(>callout);
+
+   if (ret == HRTIMER_RESTART) {
+   callout_schedule_sbt(>callout,
+   nstosbt(hrtimer->expires), nstosbt(hrtimer->precision), 0);
+   } else {
+   callout_deactivate(>callout);
+   }
 }
 
 bool
@@ -56,6 +61,7 @@ linux_hrtimer_active(struct hrtimer *hrtimer)
mtx_lock(>mtx);
ret = callout_active(>callout);
mtx_unlock(>mtx);
+
return (ret);
 }
 
@@ -74,15 +80,16 @@ void
 linux_hrtimer_init(struct hrtimer *hrtimer)
 {
 
-   hrtimer->function = NULL;
-   mtx_init(>mtx, "hrtimer", NULL, MTX_DEF | MTX_RECURSE);
+   memset(hrtimer, 0, sizeof(*hrtimer));
+   mtx_init(>mtx, "hrtimer", NULL,
+   MTX_DEF | MTX_RECURSE | MTX_NOWITNESS);
callout_init_mtx(>callout, >mtx, 0);
 }
 
 void
-linux_hrtimer_set_expires(struct hrtimer *hrtimer __unused,
-ktime_t time __unused)
+linux_hrtimer_set_expires(struct hrtimer *hrtimer, ktime_t time)
 {
+   hrtimer->expires = ktime_to_ns(time);
 }
 
 void
@@ -93,11 +100,24 @@ linux_hrtimer_start(struct hrtimer *hrtimer, ktime_t t
 }
 
 void
-linux_hrtimer_start_range_ns(struct hrtimer *hrtimer, ktime_t time, int64_t 
nsec)
+linux_hrtimer_start_range_ns(struct hrtimer *hrtimer, ktime_t time,
+int64_t nsec)
 {
 
mtx_lock(>mtx);
-   callout_reset_sbt(>callout, nstosbt(time), nstosbt(nsec),
-   hrtimer_call_handler, hrtimer, 0);
+   hrtimer->precision = nsec;
+   callout_reset_sbt(>callout, nstosbt(ktime_to_ns(time)),
+   nstosbt(nsec), hrtimer_call_handler, hrtimer, 0);
mtx_unlock(>mtx);
 }
+
+void
+linux_hrtimer_forward_now(struct hrtimer 

svn commit: r334481 - head/sys/compat/linuxkpi/common/include/linux

2018-06-01 Thread Hans Petter Selasky
Author: hselasky
Date: Fri Jun  1 11:14:59 2018
New Revision: 334481
URL: https://svnweb.freebsd.org/changeset/base/334481

Log:
  Add more GFP macro definitions in the LinuxKPI.
  
  Submitted by: Johannes Lundberg 
  MFC after:1 week
  Sponsored by: Mellanox Technologies
  Sponsored by: Limelight Networks

Modified:
  head/sys/compat/linuxkpi/common/include/linux/gfp.h

Modified: head/sys/compat/linuxkpi/common/include/linux/gfp.h
==
--- head/sys/compat/linuxkpi/common/include/linux/gfp.h Fri Jun  1 09:58:44 
2018(r334480)
+++ head/sys/compat/linuxkpi/common/include/linux/gfp.h Fri Jun  1 11:14:59 
2018(r334481)
@@ -49,6 +49,9 @@
 #define__GFP_NORETRY   0
 #define__GFP_RECLAIM   0
 #define__GFP_RECLAIMABLE   0
+#define__GFP_RETRY_MAYFAIL 0
+#define__GFP_MOVABLE   0
+#define__GFP_COMP  0
 
 #define__GFP_IO0
 #define__GFP_NO_KSWAPD 0
@@ -56,6 +59,7 @@
 #define__GFP_DMA32 (1U << 24) /* LinuxKPI only */
 #define__GFP_BITS_SHIFT 25
 #define__GFP_BITS_MASK ((1 << __GFP_BITS_SHIFT) - 1)
+#define__GFP_NOFAILM_WAITOK
 
 #defineGFP_NOWAIT  M_NOWAIT
 #defineGFP_ATOMIC  (M_NOWAIT | M_USE_RESERVE)
@@ -68,6 +72,7 @@
 #defineGFP_DMA32   __GFP_DMA32
 #defineGFP_TEMPORARY   M_NOWAIT
 #defineGFP_NATIVE_MASK (M_NOWAIT | M_WAITOK | M_USE_RESERVE | M_ZERO)
+#defineGFP_TRANSHUGE   0
 
 CTASSERT((__GFP_DMA32 & GFP_NATIVE_MASK) == 0);
 CTASSERT((__GFP_BITS_MASK & GFP_NATIVE_MASK) == GFP_NATIVE_MASK);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r334480 - in head/usr.bin/indent: . tests

2018-06-01 Thread Piotr Pawel Stefaniak
Author: pstef
Date: Fri Jun  1 09:58:44 2018
New Revision: 334480
URL: https://svnweb.freebsd.org/changeset/base/334480

Log:
  indent(1): don't add unneeded space to function pointer declarations
  
  If the current token is an opening parenthesis, it's either a function call
  (or sizeof or offsetof) or a declaration. The former doesn't need a space
  before the parenthesis.

Modified:
  head/usr.bin/indent/indent.c
  head/usr.bin/indent/tests/declarations.0.stdout

Modified: head/usr.bin/indent/indent.c
==
--- head/usr.bin/indent/indent.cFri Jun  1 09:44:23 2018
(r334479)
+++ head/usr.bin/indent/indent.cFri Jun  1 09:58:44 2018
(r334480)
@@ -542,15 +542,6 @@ check_type:
nitems(ps.paren_indents));
ps.p_l_follow--;
}
-   if (ps.want_blank && *token != '[' &&
-   ((ps.last_token != ident && ps.last_token != funcname) ||
-   proc_calls_space ||
-   /* offsetof (1) is never allowed a space; sizeof (2) gets
-* one iff -bs; all other keywords (>2) always get a space
-* before lparen */
-   ps.keyword + Bill_Shannon > 2))
-   *e_code++ = ' ';
-   ps.want_blank = false;
if (ps.in_decl && !ps.block_init && !ps.dumped_decl_indent &&
!is_procname && ps.paren_level == 0) {
/* function pointer declarations */
@@ -563,6 +554,14 @@ check_type:
}
ps.dumped_decl_indent = true;
}
+   else if (ps.want_blank && *token != '[' &&
+   ((ps.last_token != ident && ps.last_token != funcname) ||
+   /* offsetof (1) is never allowed a space; sizeof (2) gets
+* one iff -bs; all other keywords (>2) always get a space
+* before lparen */
+   ps.keyword + Bill_Shannon > 2))
+   *e_code++ = ' ';
+   ps.want_blank = false;
if (!troff)
*e_code++ = token[0];
ps.paren_indents[ps.p_l_follow - 1] = count_spaces_until(1, s_code, 
e_code) - 1;

Modified: head/usr.bin/indent/tests/declarations.0.stdout
==
--- head/usr.bin/indent/tests/declarations.0.stdout Fri Jun  1 09:44:23 
2018(r334479)
+++ head/usr.bin/indent/tests/declarations.0.stdout Fri Jun  1 09:58:44 
2018(r334480)
@@ -32,7 +32,7 @@ t2(char *x, int y)
int a, b, c;
int
   *d, *e, *f;
-   int (*g) (), (*h) (), (*i) ();
+   int (*g) (), (*h) (), (*i) ();
int j, k, l;
int m
   ,n
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r334479 - head/sys/dev/acpica

2018-06-01 Thread Andriy Gapon
Author: avg
Date: Fri Jun  1 09:44:23 2018
New Revision: 334479
URL: https://svnweb.freebsd.org/changeset/base/334479

Log:
  call AcpiLeaveSleepStatePrep after re-enabling interrupts
  
  I want to do this change because this call (actually,
  AcpiHwLegacyWakePrep) does a memory allocation and ACPI namespace
  evaluation.  Although it is not very likely to run into any trouble, it
  is still not safe to make those calls with interrupts disabled.
  witness(4) and malloc(9) do not currently check for a context with
  interrupts disabled via intr_disable and we lack a facility for doing
  that.  So, those unsafe operations fly under the radar.  But if
  intr_disable in acpi_EnterSleepState was replaced with spinlock_enter
  (which it probably should be), then witness and malloc would immediately
  complain.
  
  Also, AcpiLeaveSleepStatePrep is documented as called when interrupts
  are enabled.  It used to require disabled interrupts, but that
  requirement was changed a long time ago when support for _BFS and _GTS
  was removed from ACPICA.
  
  The ACPI wakeup sequence is very sensitive to changes. I consider this
  change to be correct, but there can be fallouts from it.
  
  What AcpiHwLegacyWakePrep essentially does is writing a value
  corresponding to S0 into SLP_TYPx bits of PM1 Control Register(s).
  According to ACPI specifications that write should be a NOP as SLP_EN
  bit is not set.  But I see in some chipset specifications that they
  allow to ignore SLP_EN altogether and to act on a change of SLP_TYPx
  alone.
  
  Also, there are a couple of accesses to ACPI hardware before the new
  location of the call to AcpiLeaveSleepStatePrep.  One is to clear the
  power button status and the other is to enable SCI.  So, the move may
  affect the interaction between then OS and ACPI platform.
  
  I have not seen any regressions on my test system, but it's a desktop.
  
  MFC after:5 weeks

Modified:
  head/sys/dev/acpica/acpi.c

Modified: head/sys/dev/acpica/acpi.c
==
--- head/sys/dev/acpica/acpi.c  Fri Jun  1 09:41:15 2018(r334478)
+++ head/sys/dev/acpica/acpi.c  Fri Jun  1 09:44:23 2018(r334479)
@@ -2977,8 +2977,6 @@ acpi_EnterSleepState(struct acpi_softc *sc, int state)
if (sleep_result == 1 && state != ACPI_STATE_S4)
AcpiWriteBitRegister(ACPI_BITREG_SCI_ENABLE, ACPI_ENABLE_EVENT);
 
-   AcpiLeaveSleepStatePrep(state);
-
if (sleep_result == 1 && state == ACPI_STATE_S3) {
/*
 * Prevent mis-interpretation of the wakeup by power button
@@ -3007,6 +3005,8 @@ acpi_EnterSleepState(struct acpi_softc *sc, int state)
/* call acpi_wakeup_machdep() again with interrupt enabled */
acpi_wakeup_machdep(sc, state, sleep_result, 1);
 
+   AcpiLeaveSleepStatePrep(state);
+
if (sleep_result == -1)
goto backout;
 
@@ -3015,8 +3015,8 @@ acpi_EnterSleepState(struct acpi_softc *sc, int state)
AcpiEnable();
 } else {
status = AcpiEnterSleepState(state);
-   AcpiLeaveSleepStatePrep(state);
intr_restore(intr);
+   AcpiLeaveSleepStatePrep(state);
if (ACPI_FAILURE(status)) {
device_printf(sc->acpi_dev, "AcpiEnterSleepState failed - %s\n",
  AcpiFormatException(status));
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r334477 - in head/usr.bin/indent: . tests

2018-06-01 Thread Piotr Pawel Stefaniak
Author: pstef
Date: Fri Jun  1 09:32:42 2018
New Revision: 334477
URL: https://svnweb.freebsd.org/changeset/base/334477

Log:
  indent(1): consider tab characters when forcing a newline after a comma

Modified:
  head/usr.bin/indent/indent.c
  head/usr.bin/indent/tests/declarations.0
  head/usr.bin/indent/tests/declarations.0.stdout

Modified: head/usr.bin/indent/indent.c
==
--- head/usr.bin/indent/indent.cFri Jun  1 09:17:20 2018
(r334476)
+++ head/usr.bin/indent/indent.cFri Jun  1 09:32:42 2018
(r334477)
@@ -1058,7 +1058,9 @@ check_type:
if (ps.p_l_follow == 0) {
if (ps.block_init_level <= 0)
ps.block_init = 0;
-   if (break_comma && (!ps.leave_comma || compute_code_target() + 
(e_code - s_code) > max_col - tabsize))
+   if (break_comma && (!ps.leave_comma ||
+   count_spaces_until(compute_code_target(), s_code, e_code) >
+   max_col - tabsize))
force_nl = true;
}
break;

Modified: head/usr.bin/indent/tests/declarations.0
==
--- head/usr.bin/indent/tests/declarations.0Fri Jun  1 09:17:20 2018
(r334476)
+++ head/usr.bin/indent/tests/declarations.0Fri Jun  1 09:32:42 2018
(r334477)
@@ -44,6 +44,7 @@ void t2 (char *x, int y)
,n
,o
;
+   int chars[ /* push the comma beyond column 74  */ ], x;
 }
 
 const int  int_minimum_size =

Modified: head/usr.bin/indent/tests/declarations.0.stdout
==
--- head/usr.bin/indent/tests/declarations.0.stdout Fri Jun  1 09:17:20 
2018(r334476)
+++ head/usr.bin/indent/tests/declarations.0.stdout Fri Jun  1 09:32:42 
2018(r334477)
@@ -36,6 +36,8 @@ t2(char *x, int y)
   ,n
   ,o
   ;
+   int chars[ /* push the comma beyond column 74  */ ],
+   x;
 }
 
 const int  int_minimum_size =
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r333174 - head/sys/amd64/vmm/io

2018-06-01 Thread Harry Schmalzbauer

Am 02.05.2018 um 20:20 schrieb Peter Grehan:

That places the MFC right before the optional 11.2 Beta3, I would rather
see this "low risk" change merged before May 11th, the code freeze
date and Beta1, if it is desired in 11.2, for maximal test exposure.


 Sure, that can be done.


Hope it's not too late to do so and somebody doing MFCs can take care of 
this one?


Thanks,

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


svn commit: r334478 - in head/usr.bin/indent: . tests

2018-06-01 Thread Piotr Pawel Stefaniak
Author: pstef
Date: Fri Jun  1 09:41:15 2018
New Revision: 334478
URL: https://svnweb.freebsd.org/changeset/base/334478

Log:
  indent(1): don't indent typedef declarations as object declarations

Modified:
  head/usr.bin/indent/indent.c
  head/usr.bin/indent/indent_codes.h
  head/usr.bin/indent/lexi.c
  head/usr.bin/indent/tests/declarations.0
  head/usr.bin/indent/tests/declarations.0.stdout

Modified: head/usr.bin/indent/indent.c
==
--- head/usr.bin/indent/indent.cFri Jun  1 09:32:42 2018
(r334477)
+++ head/usr.bin/indent/indent.cFri Jun  1 09:41:15 2018
(r334478)
@@ -937,6 +937,7 @@ check_type:
}
goto copy_id;   /* move the token into line */
 
+   case type_def:
case storage:
prefix_blankline_requested = 0;
goto copy_id;
@@ -955,7 +956,7 @@ check_type:
}
ps.in_or_st = true; /* this might be a structure or initialization
 * declaration */
-   ps.in_decl = ps.decl_on_line = true;
+   ps.in_decl = ps.decl_on_line = ps.last_token != type_def;
if ( /* !ps.in_or_st && */ ps.dec_nest <= 0)
ps.just_saw_decl = 2;
prefix_blankline_requested = 0;

Modified: head/usr.bin/indent/indent_codes.h
==
--- head/usr.bin/indent/indent_codes.h  Fri Jun  1 09:32:42 2018
(r334477)
+++ head/usr.bin/indent/indent_codes.h  Fri Jun  1 09:41:15 2018
(r334478)
@@ -73,3 +73,5 @@
 #define strpfx 33
 #define storage34
 #define funcname   35
+#define type_def   36
+

Modified: head/usr.bin/indent/lexi.c
==
--- head/usr.bin/indent/lexi.c  Fri Jun  1 09:32:42 2018(r334477)
+++ head/usr.bin/indent/lexi.c  Fri Jun  1 09:41:15 2018(r334478)
@@ -100,7 +100,7 @@ struct templ specials[] =
 {"static", 10},
 {"struct", 3},
 {"switch", 7},
-{"typedef", 10},
+{"typedef", 11},
 {"union", 3},
 {"unsigned", 4},
 {"void", 4},
@@ -349,6 +349,9 @@ lexi(void)
 
case 10:/* storage class specifier */
return (storage);
+
+   case 11:/* typedef */
+   return (type_def);
 
default:/* all others are treated like any other
 * identifier */

Modified: head/usr.bin/indent/tests/declarations.0
==
--- head/usr.bin/indent/tests/declarations.0Fri Jun  1 09:32:42 2018
(r334477)
+++ head/usr.bin/indent/tests/declarations.0Fri Jun  1 09:41:15 2018
(r334478)
@@ -1,6 +1,8 @@
 /* $FreeBSD$ */
 /* See r303570 */
 
+typedef void   (*voidptr) (int *);
+
 static const struct
 {
double  x;

Modified: head/usr.bin/indent/tests/declarations.0.stdout
==
--- head/usr.bin/indent/tests/declarations.0.stdout Fri Jun  1 09:32:42 
2018(r334477)
+++ head/usr.bin/indent/tests/declarations.0.stdout Fri Jun  1 09:41:15 
2018(r334478)
@@ -1,6 +1,8 @@
 /* $FreeBSD$ */
 /* See r303570 */
 
+typedef void (*voidptr) (int *);
+
 static const struct {
double  x;
double  y, z;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r334476 - head/sys/dev/usb/template

2018-06-01 Thread Edward Tomasz Napierala
Author: trasz
Date: Fri Jun  1 09:17:20 2018
New Revision: 334476
URL: https://svnweb.freebsd.org/changeset/base/334476

Log:
  Set bDeviceClass properly for composite device (template 8).  There should
  be no functional change.
  
  PR:   203289
  Reviewed by:  hselasky@
  MFC after:2 weeks
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/dev/usb/template/usb_template_serialnet.c

Modified: head/sys/dev/usb/template/usb_template_serialnet.c
==
--- head/sys/dev/usb/template/usb_template_serialnet.c  Fri Jun  1 08:54:51 
2018(r334475)
+++ head/sys/dev/usb/template/usb_template_serialnet.c  Fri Jun  1 09:17:20 
2018(r334476)
@@ -342,7 +342,7 @@ struct usb_temp_device_desc usb_template_serialnet = {
.idVendor = SERIALNET_DEFAULT_VENDOR_ID,
.idProduct = SERIALNET_DEFAULT_PRODUCT_ID,
.bcdDevice = 0x0100,
-   .bDeviceClass = UDCLASS_COMM,
+   .bDeviceClass = UDCLASS_IN_INTERFACE,
.bDeviceSubClass = 0,
.bDeviceProtocol = 0,
.iManufacturer = SERIALNET_MANUFACTURER_INDEX,
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r334475 - in head/usr.bin/indent: . tests

2018-06-01 Thread Piotr Pawel Stefaniak
Author: pstef
Date: Fri Jun  1 08:54:51 2018
New Revision: 334475
URL: https://svnweb.freebsd.org/changeset/base/334475

Log:
  indent(1): identifiers inside parentheses are not declarations
  
  Also make lparen position calculation consider tab stops.
  
  This improves function pointer typedef formatting.

Added:
  head/usr.bin/indent/tests/parens.0   (contents, props changed)
  head/usr.bin/indent/tests/parens.0.pro   (contents, props changed)
  head/usr.bin/indent/tests/parens.0.stdout   (contents, props changed)
Modified:
  head/usr.bin/indent/indent.c
  head/usr.bin/indent/tests/Makefile

Modified: head/usr.bin/indent/indent.c
==
--- head/usr.bin/indent/indent.cFri Jun  1 05:51:40 2018
(r334474)
+++ head/usr.bin/indent/indent.cFri Jun  1 08:54:51 2018
(r334475)
@@ -552,7 +552,7 @@ check_type:
*e_code++ = ' ';
ps.want_blank = false;
if (ps.in_decl && !ps.block_init && !ps.dumped_decl_indent &&
-   !is_procname) {
+   !is_procname && ps.paren_level == 0) {
/* function pointer declarations */
if (troff) {
sprintf(e_code, "\n.Du %dp+\200p \"%s\"\n", dec_ind * 7, 
token);
@@ -565,7 +565,7 @@ check_type:
}
if (!troff)
*e_code++ = token[0];
-   ps.paren_indents[ps.p_l_follow - 1] = e_code - s_code;
+   ps.paren_indents[ps.p_l_follow - 1] = count_spaces_until(1, s_code, 
e_code) - 1;
if (sp_sw && ps.p_l_follow == 1 && extra_expression_indent
&& ps.paren_indents[0] < 2 * ps.ind_size)
ps.paren_indents[0] = 2 * ps.ind_size;
@@ -620,7 +620,7 @@ check_type:
 
case unary_op:  /* this could be any unary operation */
if (!ps.dumped_decl_indent && ps.in_decl && !is_procname &&
-   !ps.block_init) {
+   !ps.block_init && ps.paren_level == 0) {
/* pointer declarations */
if (troff) {
if (ps.want_blank)
@@ -755,7 +755,7 @@ check_type:
ps.just_saw_decl--;
 
if (ps.in_decl && s_code == e_code && !ps.block_init &&
-   !ps.dumped_decl_indent) {
+   !ps.dumped_decl_indent && ps.paren_level == 0) {
/* indent stray semicolons in declarations */
indent_declaration(dec_ind - 1, tabs_to_var);
ps.dumped_decl_indent = true;
@@ -977,7 +977,7 @@ check_type:
if (ps.in_decl) {   /* if we are in a declaration, we must indent
 * identifier */
if (type_code != funcname || !procnames_start_line) {
-   if (!ps.block_init && !ps.dumped_decl_indent) {
+   if (!ps.block_init && !ps.dumped_decl_indent && 
ps.paren_level == 0) {
if (troff) {
if (ps.want_blank)
*e_code++ = ' ';
@@ -1049,7 +1049,7 @@ check_type:
 * if comma does not start the
 * line */
if (ps.in_decl && is_procname == 0 && !ps.block_init &&
-   !ps.dumped_decl_indent) {
+   !ps.dumped_decl_indent && ps.paren_level == 0) {
/* indent leading commas and not the actual identifiers */
indent_declaration(dec_ind - 1, tabs_to_var);
ps.dumped_decl_indent = true;

Modified: head/usr.bin/indent/tests/Makefile
==
--- head/usr.bin/indent/tests/Makefile  Fri Jun  1 05:51:40 2018
(r334474)
+++ head/usr.bin/indent/tests/Makefile  Fri Jun  1 08:54:51 2018
(r334475)
@@ -23,6 +23,9 @@ ${PACKAGE}FILES+= nsac.0.stdout
 ${PACKAGE}FILES+=  nsac.0.pro
 ${PACKAGE}FILES+=  offsetof.0
 ${PACKAGE}FILES+=  offsetof.0.stdout
+${PACKAGE}FILES+=   parens.0
+${PACKAGE}FILES+=   parens.0.stdout
+${PACKAGE}FILES+=   parens.0.pro
 ${PACKAGE}FILES+=  sac.0
 ${PACKAGE}FILES+=  sac.0.stdout
 ${PACKAGE}FILES+=  sac.0.pro

Added: head/usr.bin/indent/tests/parens.0
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/usr.bin/indent/tests/parens.0  Fri Jun  1 08:54:51 2018
(r334475)
@@ -0,0 +1,24 @@
+/* $FreeBSD$ */
+typedef void   (*xxx) (int,
+   char);
+
+typedef char   (*) (int *,
+unsigned *,
+char,
+float *);
+
+void
+test(void)
+{
+   charchars[secondf(firstf(B),
+   

Re: svn commit: r334474 - head/usr.bin/top

2018-06-01 Thread Eitan Adler
On 31 May 2018 at 22:51, Eitan Adler  wrote:
> Author: eadler
> Date: Fri Jun  1 05:51:40 2018
> New Revision: 334474
> URL: https://svnweb.freebsd.org/changeset/base/334474
>
> Log:
>   top(1): Display of TID when using 'H' flag
>
>   Some users prefer seeing the TID when viewing individual threads. This
>   makes sense as the PID will be the same for multiple entries. An attempt
>   was made to include both, but there is insufficient room. As such, using
>   the TID.
>
>   While here, rename the header variables to be more understandable.
>
>   Discussed with:   mmacy
>   Reported on:  2009-10-07
PR: 139389


-- 
Eitan Adler
Source, Ports, Doc committer
Bugmeister, Ports Security teams
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r334474 - head/usr.bin/top

2018-06-01 Thread Eitan Adler
Author: eadler
Date: Fri Jun  1 05:51:40 2018
New Revision: 334474
URL: https://svnweb.freebsd.org/changeset/base/334474

Log:
  top(1): Display of TID when using 'H' flag
  
  Some users prefer seeing the TID when viewing individual threads. This
  makes sense as the PID will be the same for multiple entries. An attempt
  was made to include both, but there is insufficient room. As such, using
  the TID.
  
  While here, rename the header variables to be more understandable.
  
  Discussed with:   mmacy
  Reported on:  2009-10-07

Modified:
  head/usr.bin/top/machine.c
  head/usr.bin/top/top.1

Modified: head/usr.bin/top/machine.c
==
--- head/usr.bin/top/machine.c  Fri Jun  1 05:48:28 2018(r334473)
+++ head/usr.bin/top/machine.c  Fri Jun  1 05:51:40 2018(r334474)
@@ -97,18 +97,18 @@ static char io_header[] =
 #define io_Proc_format \
 "%5d%*s %-*.*s %6ld %6ld %6ld %6ld %6ld %6ld %6.2f%% %.*s"
 
-static char smp_header_thr[] =
+static char smp_header_thr_and_pid[] =
 "  PID%*s %-*.*s  THR PRI NICE   SIZERES%*s STATE   C   TIME %7s 
COMMAND";
-static char smp_header[] =
-"  PID%*s %-*.*s "   "PRI NICE   SIZERES%*s STATE   C   TIME %7s 
COMMAND";
+static char smp_header_tid_only[] =
+"  THR%*s %-*.*s "   "PRI NICE   SIZERES%*s STATE   C   TIME %7s 
COMMAND";
 
 #define smp_Proc_format \
 "%5d%*s %-*.*s %s%3d %4s%7s %6s%*.*s %-6.6s %2d%7s %6.2f%% %.*s"
 
-static char up_header_thr[] =
+static char up_header_thr_and_pid[] =
 "  PID%*s %-*.*s  THR PRI NICE   SIZERES%*s STATETIME %7s COMMAND";
-static char up_header[] =
-"  PID%*s %-*.*s "   "PRI NICE   SIZERES%*s STATETIME %7s COMMAND";
+static char up_header_tid_only[] =
+"  THR%*s %-*.*s "   "PRI NICE   SIZERES%*s STATETIME %7s COMMAND";
 
 #define up_Proc_format \
 "%5d%*s %-*.*s %s%3d %4s%7s %6s%*.*s %-6.6s%.0d%7s %6.2f%% %.*s"
@@ -436,8 +436,8 @@ format_header(char *uname_field)
 * separate lines).
 */
prehead = smpmode ?
-   (ps.thread ? smp_header : smp_header_thr) :
-   (ps.thread ? up_header : up_header_thr);
+   (ps.thread ? smp_header_tid_only : smp_header_thr_and_pid) :
+   (ps.thread ? up_header_tid_only : up_header_thr_and_pid);
snprintf(Header, sizeof(Header), prehead,
jidlength, ps.jail ? " JID" : "",
namelength, namelength, uname_field,
@@ -1145,7 +1145,7 @@ format_next_process(caddr_t xhandle, char *(*get_useri
(int)(sizeof(thr_buf) - 2), pp->ki_numthreads);
 
snprintf(fmt, sizeof(fmt), proc_fmt,
-   pp->ki_pid,
+   (ps.thread) ? pp->ki_tid : pp->ki_pid,
jidlength, jid_buf,
namelength, namelength, (*get_userid)(pp->ki_ruid),
thr_buf,

Modified: head/usr.bin/top/top.1
==
--- head/usr.bin/top/top.1  Fri Jun  1 05:48:28 2018(r334473)
+++ head/usr.bin/top/top.1  Fri Jun  1 05:51:40 2018(r334474)
@@ -331,6 +331,7 @@ command.
 .TP
 .B H
 Toggle the display of threads.
+Also toggles the display of PID or TID.
 .TP
 .B i
 (or
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"