Re: svn commit: r314322 - head/lib/librss

2017-02-26 Thread Cy Schubert
In message 

Re: svn commit: r314322 - head/lib/librss

2017-02-26 Thread Warner Losh
> Then why even test for RC being NULL?

So rc->rss_bucket_map doesn't dereference a null pointer and core dump maybe?

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


Re: svn commit: r314322 - head/lib/librss

2017-02-26 Thread Pedro Giffuni



On 2/26/2017 9:37 PM, Cy Schubert wrote:

In message <404d743b-735b-0605-5ab5-ccb95ce24...@freebsd.org>, Pedro
Giffuni wr
ites:

This is a multi-part message in MIME format.
--C3FC59CAC7D072A09BF70AAF
Content-Type: text/plain; charset=windows-1252; format=flowed
Content-Transfer-Encoding: 7bit

Hello;

On 2/26/2017 8:51 PM, Cy Schubert wrote:

In message <201702270010.v1r0a1wm074...@repo.freebsd.org>, "Pedro F.
Giffuni" w
rites:

Author: pfg
Date: Mon Feb 27 00:10:00 2017
New Revision: 314322
URL: https://svnweb.freebsd.org/changeset/base/314322

Log:
librss: simplify some NULL checks.

MFC after:	1 week


Modified:
head/lib/librss/librss.c

Modified: head/lib/librss/librss.c
==

===

=
--- head/lib/librss/librss.cSun Feb 26 22:17:06 2017(r31432

1)

+++ head/lib/librss/librss.cMon Feb 27 00:10:00 2017(r31432

2)

@@ -244,10 +244,10 @@ rss_config_get(void)
return (rc);
   
   error:

-   if ((rc != NULL) && rc->rss_bucket_map)
+   if (rc != NULL) {
free(rc->rss_bucket_map);

What happens if rc is not NULL and rc->rss_bucket_map is NULL?

According the free(3): " If /ptr/ is *NULL*, no action occurs."


Good point.

Then why even test for RC being NULL?


If rc is NULL, there is a chance that rc->rss_bucket_map is random 
garbage and you might be "double freeing" something.



The only reason I can think of doing any test for NULL before free(3) is
that if the likelihood of *ptr being NULL is greater than the likelihood of
*ptr not being NULL then you save running the extra instructions to make
that determination in free(), e.g. pushes, call, return, pops.



The check for rc NULL is necessary, the only optimization is that having 
done the check we already know if we need to free(rc), so while we could 
leave the second free() outside the branch it is better to leave it 
within the "if" .


Pedro.

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


Re: svn commit: r314322 - head/lib/librss

2017-02-26 Thread Cy Schubert
In message <404d743b-735b-0605-5ab5-ccb95ce24...@freebsd.org>, Pedro 
Giffuni wr
ites:
> This is a multi-part message in MIME format.
> --C3FC59CAC7D072A09BF70AAF
> Content-Type: text/plain; charset=windows-1252; format=flowed
> Content-Transfer-Encoding: 7bit
> 
> Hello;
> 
> On 2/26/2017 8:51 PM, Cy Schubert wrote:
> > In message <201702270010.v1r0a1wm074...@repo.freebsd.org>, "Pedro F.
> > Giffuni" w
> > rites:
> >> Author: pfg
> >> Date: Mon Feb 27 00:10:00 2017
> >> New Revision: 314322
> >> URL: https://svnweb.freebsd.org/changeset/base/314322
> >>
> >> Log:
> >>librss: simplify some NULL checks.
> >>
> >>MFC after:  1 week
> >>
> >> Modified:
> >>head/lib/librss/librss.c
> >>
> >> Modified: head/lib/librss/librss.c
> >> ==
> ===
> >> =
> >> --- head/lib/librss/librss.c   Sun Feb 26 22:17:06 2017(r31432
> 1)
> >> +++ head/lib/librss/librss.c   Mon Feb 27 00:10:00 2017(r31432
> 2)
> >> @@ -244,10 +244,10 @@ rss_config_get(void)
> >>return (rc);
> >>   
> >>   error:
> >> -  if ((rc != NULL) && rc->rss_bucket_map)
> >> +  if (rc != NULL) {
> >>free(rc->rss_bucket_map);
> > What happens if rc is not NULL and rc->rss_bucket_map is NULL?
> 
> According the free(3): " If /ptr/ is *NULL*, no action occurs."
> 

Good point.

Then why even test for RC being NULL?

The only reason I can think of doing any test for NULL before free(3) is 
that if the likelihood of *ptr being NULL is greater than the likelihood of 
*ptr not being NULL then you save running the extra instructions to make 
that determination in free(), e.g. pushes, call, return, pops.


-- 
Cheers,
Cy Schubert 
FreeBSD UNIX:     Web:  http://www.FreeBSD.org

The need of the many outweighs the greed of the few.


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


Re: svn commit: r314322 - head/lib/librss

2017-02-26 Thread Pedro Giffuni

Hello;

On 2/26/2017 8:51 PM, Cy Schubert wrote:

In message <201702270010.v1r0a1wm074...@repo.freebsd.org>, "Pedro F.
Giffuni" w
rites:

Author: pfg
Date: Mon Feb 27 00:10:00 2017
New Revision: 314322
URL: https://svnweb.freebsd.org/changeset/base/314322

Log:
   librss: simplify some NULL checks.
   
   MFC after:	1 week


Modified:
   head/lib/librss/librss.c

Modified: head/lib/librss/librss.c
=
=
--- head/lib/librss/librss.cSun Feb 26 22:17:06 2017(r314321)
+++ head/lib/librss/librss.cMon Feb 27 00:10:00 2017(r314322)
@@ -244,10 +244,10 @@ rss_config_get(void)
return (rc);
  
  error:

-   if ((rc != NULL) && rc->rss_bucket_map)
+   if (rc != NULL) {
free(rc->rss_bucket_map);

What happens if rc is not NULL and rc->rss_bucket_map is NULL?


According the free(3): " If /ptr/ is *NULL*, no action occurs."

Pedro.

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


Re: svn commit: r314322 - head/lib/librss

2017-02-26 Thread Cy Schubert
In message <201702270010.v1r0a1wm074...@repo.freebsd.org>, "Pedro F. 
Giffuni" w
rites:
> Author: pfg
> Date: Mon Feb 27 00:10:00 2017
> New Revision: 314322
> URL: https://svnweb.freebsd.org/changeset/base/314322
> 
> Log:
>   librss: simplify some NULL checks.
>   
>   MFC after:  1 week
> 
> Modified:
>   head/lib/librss/librss.c
> 
> Modified: head/lib/librss/librss.c
> =
> =
> --- head/lib/librss/librss.c  Sun Feb 26 22:17:06 2017(r314321)
> +++ head/lib/librss/librss.c  Mon Feb 27 00:10:00 2017(r314322)
> @@ -244,10 +244,10 @@ rss_config_get(void)
>   return (rc);
>  
>  error:
> - if ((rc != NULL) && rc->rss_bucket_map)
> + if (rc != NULL) {
>   free(rc->rss_bucket_map);

What happens if rc is not NULL and rc->rss_bucket_map is NULL?

> - if (rc != NULL)
>   free(rc);
> + }
>   return (NULL);
>  }
>  
> 
> 


-- 
Cheers,
Cy Schubert 
FreeBSD UNIX:     Web:  http://www.FreeBSD.org

The need of the many outweighs the greed of the few.



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


svn commit: r314322 - head/lib/librss

2017-02-26 Thread Pedro F. Giffuni
Author: pfg
Date: Mon Feb 27 00:10:00 2017
New Revision: 314322
URL: https://svnweb.freebsd.org/changeset/base/314322

Log:
  librss: simplify some NULL checks.
  
  MFC after:1 week

Modified:
  head/lib/librss/librss.c

Modified: head/lib/librss/librss.c
==
--- head/lib/librss/librss.cSun Feb 26 22:17:06 2017(r314321)
+++ head/lib/librss/librss.cMon Feb 27 00:10:00 2017(r314322)
@@ -244,10 +244,10 @@ rss_config_get(void)
return (rc);
 
 error:
-   if ((rc != NULL) && rc->rss_bucket_map)
+   if (rc != NULL) {
free(rc->rss_bucket_map);
-   if (rc != NULL)
free(rc);
+   }
return (NULL);
 }
 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r314321 - head/usr.bin/dc

2017-02-26 Thread Pedro F. Giffuni
Author: pfg
Date: Sun Feb 26 22:17:06 2017
New Revision: 314321
URL: https://svnweb.freebsd.org/changeset/base/314321

Log:
  dc(1): Merge minor changes from OpenBSD.
  
  Prefer setvbuf() to setlinebuf() for portability.
  Some style(9) and redundant tests for NULL.
  
  These are only meant to ease up merging newer changes but we are skipping
  changes done in order to accomodate OpenBSD's pledge support.
  
  Obtained from:OpenBSD
  MFC after:2 weeks

Modified:
  head/usr.bin/dc/bcode.c
  head/usr.bin/dc/dc.c
  head/usr.bin/dc/stack.c

Modified: head/usr.bin/dc/bcode.c
==
--- head/usr.bin/dc/bcode.c Sun Feb 26 22:15:39 2017(r314320)
+++ head/usr.bin/dc/bcode.c Sun Feb 26 22:17:06 2017(r314321)
@@ -960,9 +960,8 @@ badd(void)
struct number   *a, *b, *r;
 
a = pop_number();
-   if (a == NULL) {
+   if (a == NULL)
return;
-   }
b = pop_number();
if (b == NULL) {
push_number(a);
@@ -987,9 +986,8 @@ bsub(void)
struct number   *a, *b, *r;
 
a = pop_number();
-   if (a == NULL) {
+   if (a == NULL)
return;
-   }
b = pop_number();
if (b == NULL) {
push_number(a);
@@ -1035,9 +1033,8 @@ bmul(void)
struct number *a, *b, *r;
 
a = pop_number();
-   if (a == NULL) {
+   if (a == NULL)
return;
-   }
b = pop_number();
if (b == NULL) {
push_number(a);
@@ -1060,9 +1057,8 @@ bdiv(void)
u_int scale;
 
a = pop_number();
-   if (a == NULL) {
+   if (a == NULL)
return;
-   }
b = pop_number();
if (b == NULL) {
push_number(a);
@@ -1097,9 +1093,8 @@ bmod(void)
u_int scale;
 
a = pop_number();
-   if (a == NULL) {
+   if (a == NULL)
return;
-   }
b = pop_number();
if (b == NULL) {
push_number(a);
@@ -1134,9 +1129,8 @@ bdivmod(void)
u_int scale;
 
a = pop_number();
-   if (a == NULL) {
+   if (a == NULL)
return;
-   }
b = pop_number();
if (b == NULL) {
push_number(a);
@@ -1176,9 +1170,8 @@ bexp(void)
u_int   rscale;
 
p = pop_number();
-   if (p == NULL) {
+   if (p == NULL)
return;
-   }
a = pop_number();
if (a == NULL) {
push_number(p);
@@ -1299,9 +1292,8 @@ bsqrt(void)
 
onecount = 0;
n = pop_number();
-   if (n == NULL) {
+   if (n == NULL)
return;
-   }
if (BN_is_zero(n->number)) {
r = new_number();
push_number(r);
@@ -1342,9 +1334,8 @@ not(void)
struct number *a;
 
a = pop_number();
-   if (a == NULL) {
+   if (a == NULL)
return;
-   }
a->scale = 0;
bn_check(BN_set_word(a->number, BN_get_word(a->number) ? 0 : 1));
push_number(a);
@@ -1363,9 +1354,8 @@ equal_numbers(void)
struct number *a, *b, *r;
 
a = pop_number();
-   if (a == NULL) {
+   if (a == NULL)
return;
-   }
b = pop_number();
if (b == NULL) {
push_number(a);
@@ -1383,9 +1373,8 @@ less_numbers(void)
struct number *a, *b, *r;
 
a = pop_number();
-   if (a == NULL) {
+   if (a == NULL)
return;
-   }
b = pop_number();
if (b == NULL) {
push_number(a);
@@ -1403,9 +1392,8 @@ lesseq_numbers(void)
struct number *a, *b, *r;
 
a = pop_number();
-   if (a == NULL) {
+   if (a == NULL)
return;
-   }
b = pop_number();
if (b == NULL) {
push_number(a);
@@ -1736,9 +1724,8 @@ eval_tos(void)
char *p;
 
p = pop_string();
-   if (p == NULL)
-   return;
-   eval_string(p);
+   if (p != NULL)
+   eval_string(p);
 }
 
 void

Modified: head/usr.bin/dc/dc.c
==
--- head/usr.bin/dc/dc.cSun Feb 26 22:15:39 2017(r314320)
+++ head/usr.bin/dc/dc.cSun Feb 26 22:17:06 2017(r314321)
@@ -125,8 +125,8 @@ main(int argc, char *argv[])
 
if (!preproc_done)
init_bmachine(extended_regs);
-   setlinebuf(stdout);
-   setlinebuf(stderr);
+   (void)setvbuf(stdout, NULL, _IOLBF, 0);
+   (void)setvbuf(stderr, NULL, _IOLBF, 0);
 
if (argc > 1)
usage();

Modified: head/usr.bin/dc/stack.c
==
--- head/usr.bin/dc/stack.c Sun Feb 26 22:15:39 2017(r314320)
+++ head/usr.bin/dc/stack.c Sun Feb 26 

svn commit: r314320 - head/lib/libc/x86/sys

2017-02-26 Thread Mariusz Zaborski
Author: oshogbo
Date: Sun Feb 26 22:15:39 2017
New Revision: 314320
URL: https://svnweb.freebsd.org/changeset/base/314320

Log:
  Remove unneeded variable initialization from r314319.
  
  Pointed out by:   kib

Modified:
  head/lib/libc/x86/sys/__vdso_gettc.c

Modified: head/lib/libc/x86/sys/__vdso_gettc.c
==
--- head/lib/libc/x86/sys/__vdso_gettc.cSun Feb 26 22:07:26 2017
(r314319)
+++ head/lib/libc/x86/sys/__vdso_gettc.cSun Feb 26 22:15:39 2017
(r314320)
@@ -146,7 +146,6 @@ __vdso_init_hpet(uint32_t u)
if (old_map != NULL)
return;
 
-   mode = 0;
if (cap_getmode() == 0 && mode != 0)
goto fail;
 
@@ -186,7 +185,6 @@ __vdso_init_hyperv_tsc(void)
int fd;
unsigned int mode;
 
-   mode = 0;
if (cap_getmode() == 0 && mode != 0)
goto fail;
 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r314319 - head/lib/libc/x86/sys

2017-02-26 Thread Mariusz Zaborski
Author: oshogbo
Date: Sun Feb 26 22:07:26 2017
New Revision: 314319
URL: https://svnweb.freebsd.org/changeset/base/314319

Log:
  Don't try to open devices in the gettc() function  which will always
  fail in the Capability mode. Instead silently fallback to the syscall
  method, which is done for example in the gettimeofday(2) function.
  
  Reviewed by:  kib

Modified:
  head/lib/libc/x86/sys/__vdso_gettc.c

Modified: head/lib/libc/x86/sys/__vdso_gettc.c
==
--- head/lib/libc/x86/sys/__vdso_gettc.cSun Feb 26 22:05:22 2017
(r314318)
+++ head/lib/libc/x86/sys/__vdso_gettc.cSun Feb 26 22:07:26 2017
(r314319)
@@ -33,6 +33,7 @@ __FBSDID("$FreeBSD$");
 
 #include 
 #include "namespace.h"
+#include 
 #include 
 #include 
 #include 
@@ -124,6 +125,7 @@ __vdso_init_hpet(uint32_t u)
static const char devprefix[] = "/dev/hpet";
char devname[64], *c, *c1, t;
volatile char *new_map, *old_map;
+   unsigned int mode;
uint32_t u1;
int fd;
 
@@ -144,18 +146,26 @@ __vdso_init_hpet(uint32_t u)
if (old_map != NULL)
return;
 
+   mode = 0;
+   if (cap_getmode() == 0 && mode != 0)
+   goto fail;
+
fd = _open(devname, O_RDONLY);
-   if (fd == -1) {
-   atomic_cmpset_rel_ptr((volatile uintptr_t *)_dev_map[u],
-   (uintptr_t)old_map, (uintptr_t)MAP_FAILED);
-   return;
-   }
+   if (fd == -1)
+   goto fail;
+
new_map = mmap(NULL, PAGE_SIZE, PROT_READ, MAP_SHARED, fd, 0);
_close(fd);
if (atomic_cmpset_rel_ptr((volatile uintptr_t *)_dev_map[u],
(uintptr_t)old_map, (uintptr_t)new_map) == 0 &&
new_map != MAP_FAILED)
-   munmap((void *)new_map, PAGE_SIZE);
+   munmap((void *)new_map, PAGE_SIZE);
+
+   return;
+fail:
+   /* Prevent the caller from re-entering. */
+   atomic_cmpset_rel_ptr((volatile uintptr_t *)_dev_map[u],
+   (uintptr_t)old_map, (uintptr_t)MAP_FAILED);
 }
 
 #ifdef WANT_HYPERV
@@ -174,16 +184,23 @@ static void
 __vdso_init_hyperv_tsc(void)
 {
int fd;
+   unsigned int mode;
+
+   mode = 0;
+   if (cap_getmode() == 0 && mode != 0)
+   goto fail;
 
fd = _open(HYPERV_REFTSC_DEVPATH, O_RDONLY);
-   if (fd < 0) {
-   /* Prevent the caller from re-entering. */
-   hyperv_ref_tsc = MAP_FAILED;
-   return;
-   }
+   if (fd < 0)
+   goto fail;
hyperv_ref_tsc = mmap(NULL, sizeof(*hyperv_ref_tsc), PROT_READ,
MAP_SHARED, fd, 0);
_close(fd);
+
+   return;
+fail:
+   /* Prevent the caller from re-entering. */
+   hyperv_ref_tsc = MAP_FAILED;
 }
 
 static int
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


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

2017-02-26 Thread Jayachandran C.
Author: jchandra
Date: Sun Feb 26 22:05:22 2017
New Revision: 314318
URL: https://svnweb.freebsd.org/changeset/base/314318

Log:
  Enable pl011 UART FIFOs
  
  The pl011 UART has a 16 entry Tx FIFO and a 16 entry Rx FIFO that
  have not been used so far. Update the driver to enable the FIFOs
  and use them in transmit and receive.
  
  Reviewed by:  andrew
  Differential Revision:https://reviews.freebsd.org/D8819

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

Modified: head/sys/dev/uart/uart_dev_pl011.c
==
--- head/sys/dev/uart/uart_dev_pl011.c  Sun Feb 26 21:33:18 2017
(r314317)
+++ head/sys/dev/uart/uart_dev_pl011.c  Sun Feb 26 22:05:22 2017
(r314318)
@@ -61,6 +61,7 @@ __FBSDID("$FreeBSD$");
 #defineDR_OE   (1 << 11)   /* Overrun error */
 
 #defineUART_FR 0x06/* Flag register */
+#defineFR_RXFE (1 << 4)/* Receive FIFO/reg empty */
 #defineFR_TXFF (1 << 5)/* Transmit FIFO/reg full */
 #defineFR_RXFF (1 << 6)/* Receive FIFO/reg full */
 #defineFR_TXFE (1 << 7)/* Transmit FIFO/reg empty */
@@ -171,9 +172,9 @@ uart_pl011_param(struct uart_bas *bas, i
line |= LCR_H_PEN;
else
line &= ~LCR_H_PEN;
+   line |= LCR_H_FEN;
 
/* Configure the rest */
-   line &= ~LCR_H_FEN;
ctrl |= (CR_RXE | CR_TXE | CR_UARTEN);
 
if (bas->rclk != 0 && baudrate != 0) {
@@ -219,7 +220,7 @@ static int
 uart_pl011_rxready(struct uart_bas *bas)
 {
 
-   return (__uart_getreg(bas, UART_FR) & FR_RXFF);
+   return !(__uart_getreg(bas, UART_FR) & FR_RXFE);
 }
 
 static int
@@ -417,8 +418,8 @@ uart_pl011_bus_probe(struct uart_softc *
 
device_set_desc(sc->sc_dev, "PrimeCell UART (PL011)");
 
-   sc->sc_rxfifosz = 1;
-   sc->sc_txfifosz = 1;
+   sc->sc_rxfifosz = 16;
+   sc->sc_txfifosz = 16;
 
return (0);
 }
@@ -440,7 +441,6 @@ uart_pl011_bus_receive(struct uart_softc
break;
}
 
-   __uart_setreg(bas, UART_ICR, (UART_RXREADY | RIS_RTIM));
xc = __uart_getreg(bas, UART_DR);
rx = xc & 0xff;
 
@@ -481,20 +481,12 @@ uart_pl011_bus_transmit(struct uart_soft
uart_barrier(bas);
}
 
-   /* If not empty wait until it is */
-   if ((__uart_getreg(bas, UART_FR) & FR_TXFE) != FR_TXFE) {
-   sc->sc_txbusy = 1;
-
-   /* Enable TX interrupt */
-   __uart_setreg(bas, UART_IMSC, psc->imsc);
-   }
+   /* Mark busy and enable TX interrupt */
+   sc->sc_txbusy = 1;
+   __uart_setreg(bas, UART_IMSC, psc->imsc);
 
uart_unlock(sc->sc_hwmtx);
 
-   /* No interrupt expected, schedule the next fifo write */
-   if (!sc->sc_txbusy)
-   uart_sched_softih(sc, SER_INT_TXIDLE);
-
return (0);
 }
 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r314087 - head/sys/x86/x86

2017-02-26 Thread Rick Macklem
Warner Losh wrote:
> On Sun, Feb 26, 2017 at 5:44 AM, Konstantin Belousov  
> wrote:
> > On Sun, Feb 26, 2017 at 04:43:12AM +1100, Bruce Evans wrote:
> > 2.9 BSD was a port to PDP-11, AFAIK, with 16bit ints.
>
> A bit off topic, but 2BSD was basically[**] a continuation of Research
> Unix which started out life on the PDP-11 (well, OK, it started life
> in assembler on the PDP-7, but then was rewritten in C on the PDP-11).
More off topic...this C was defined by Dennis Richie (sp?) and I heard him
once say "ANSI C isn't a bad language, but it isn't C". It didn't have 
"unsigned int"
because he noted that a "char *" behaved the same, so why is it needed?

> Or a compiler more modern than K[*].
I could be wrong (lost my K C book long ago), but I think K had:
char - 1byte
short - 2bytes
long - 4 bytes
long long - 8bytes
int - whatever the arch preferred, with a minimum of 2bytes
(And, yes, Brian did disagree with Dennis and added "unsigned".)

Personally, I think "long" should have remained 4bytes on all arches
and that would have made code less painful to port...
(I could live with "int" assumed to be at least 4bytes.)

rick
ps: And, yes, I still prefer "old C", but suffer through the ANSIisms.;-)
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r314317 - in head/sys: mips/nlm mips/rmi powerpc/powermac sparc64/pci

2017-02-26 Thread Warner Losh
Author: imp
Date: Sun Feb 26 21:33:18 2017
New Revision: 314317
URL: https://svnweb.freebsd.org/changeset/base/314317

Log:
  Include pcib_private.h for prototypes.
  
  Noticed by: rpokala@
  Sponsored by: Netflix

Modified:
  head/sys/mips/nlm/xlp_pci.c
  head/sys/mips/rmi/xlr_pci.c
  head/sys/powerpc/powermac/cpcht.c
  head/sys/sparc64/pci/fire.c
  head/sys/sparc64/pci/psycho.c
  head/sys/sparc64/pci/schizo.c

Modified: head/sys/mips/nlm/xlp_pci.c
==
--- head/sys/mips/nlm/xlp_pci.c Sun Feb 26 21:24:35 2017(r314316)
+++ head/sys/mips/nlm/xlp_pci.c Sun Feb 26 21:33:18 2017(r314317)
@@ -73,6 +73,7 @@ __FBSDID("$FreeBSD$");
 #include 
 
 #include "pcib_if.h"
+#include 
 #include "pci_if.h"
 
 static int

Modified: head/sys/mips/rmi/xlr_pci.c
==
--- head/sys/mips/rmi/xlr_pci.c Sun Feb 26 21:24:35 2017(r314316)
+++ head/sys/mips/rmi/xlr_pci.c Sun Feb 26 21:33:18 2017(r314317)
@@ -60,6 +60,7 @@ __FBSDID("$FreeBSD$");
 #include 
 
 #include "pcib_if.h"
+#include 
 
 #define pci_cfg_offset(bus,slot,devfn,where) (((bus)<<16) + ((slot) << 
11)+((devfn)<<8)+(where))
 #define PCIE_LINK_STATE0x4000

Modified: head/sys/powerpc/powermac/cpcht.c
==
--- head/sys/powerpc/powermac/cpcht.c   Sun Feb 26 21:24:35 2017
(r314316)
+++ head/sys/powerpc/powermac/cpcht.c   Sun Feb 26 21:33:18 2017
(r314317)
@@ -57,6 +57,7 @@ __FBSDID("$FreeBSD$");
 #include 
 
 #include "pcib_if.h"
+#include 
 #include "pic_if.h"
 
 /*

Modified: head/sys/sparc64/pci/fire.c
==
--- head/sys/sparc64/pci/fire.c Sun Feb 26 21:24:35 2017(r314316)
+++ head/sys/sparc64/pci/fire.c Sun Feb 26 21:33:18 2017(r314317)
@@ -73,6 +73,7 @@ __FBSDID("$FreeBSD$");
 
 #include 
 #include 
+#include 
 
 #include 
 #include 

Modified: head/sys/sparc64/pci/psycho.c
==
--- head/sys/sparc64/pci/psycho.c   Sun Feb 26 21:24:35 2017
(r314316)
+++ head/sys/sparc64/pci/psycho.c   Sun Feb 26 21:33:18 2017
(r314317)
@@ -69,6 +69,7 @@ __FBSDID("$FreeBSD$");
 
 #include 
 #include 
+#include 
 
 #include 
 #include 

Modified: head/sys/sparc64/pci/schizo.c
==
--- head/sys/sparc64/pci/schizo.c   Sun Feb 26 21:24:35 2017
(r314316)
+++ head/sys/sparc64/pci/schizo.c   Sun Feb 26 21:33:18 2017
(r314317)
@@ -68,6 +68,7 @@ __FBSDID("$FreeBSD$");
 
 #include 
 #include 
+#include 
 
 #include 
 #include 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r314316 - head/usr.bin/dc

2017-02-26 Thread Pedro F. Giffuni
Author: pfg
Date: Sun Feb 26 21:24:35 2017
New Revision: 314316
URL: https://svnweb.freebsd.org/changeset/base/314316

Log:
  dc(1): Catch up with OpenBSD tag.
  
  OpenBSD rev 1.12 corresponds to our SVN r275162. Update the tag to make
  easier future updates. No functional change.
  
  MFC after:3 days

Modified:
  head/usr.bin/dc/stack.c

Modified: head/usr.bin/dc/stack.c
==
--- head/usr.bin/dc/stack.c Sun Feb 26 20:49:35 2017(r314315)
+++ head/usr.bin/dc/stack.c Sun Feb 26 21:24:35 2017(r314316)
@@ -1,4 +1,4 @@
-/* $OpenBSD: stack.c,v 1.11 2009/10/27 23:59:37 deraadt Exp $  */
+/* $OpenBSD: stack.c,v 1.12 2014/11/26 15:05:51 otto Exp $ */
 
 /*
  * Copyright (c) 2003, Otto Moerbeek 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r314293 - head/sys/compat/linux

2017-02-26 Thread Bruce Evans

On Sun, 26 Feb 2017, Dmitry Chagin wrote:


Log:
 Return EOVERFLOW error in case then the size of tv_sec field of struct timespec
 in COMPAT_LINUX32 Linuxulator's not equal to the size of native tv_sec.


This has several bugs, and it is silly to check the range of times (where
overflow can't happen occurs for normal times) while blindly truncating
security-related things like uids (where overflow happens for normal uids).


Modified: head/sys/compat/linux/linux_time.c
==
--- head/sys/compat/linux/linux_time.c  Sun Feb 26 09:37:25 2017
(r314292)
+++ head/sys/compat/linux/linux_time.c  Sun Feb 26 09:40:42 2017
(r314293)
...
-void
+int
native_to_linux_timespec(struct l_timespec *ltp, struct timespec *ntp)
{

LIN_SDT_PROBE2(time, native_to_linux_timespec, entry, ltp, ntp);
-
+#ifdef COMPAT_LINUX32
+   if (ntp->tv_sec > INT_MAX &&


This doesn't use the parametrization that l_time_t is l_long = int32_t
when COMPAT_LINUX32, but uses an ugly ifdef, then assumes than
int == int32_t.


+   sizeof(ltp->tv_sec) != sizeof(ntp->tv_sec))
+   return (EOVERFLOW);
+#endif


Negative values are not checked for, so overflow can still occur.  Sometimes
negative values overlow to a positive value(e.g., bit pattern
0x8001 -> 1 in 2's complement.  Other times they overflow to
a negative value (e.g., 0x80008001 -> 0x8001 in 2's complement).

Overflowing values are very unlikely, and the check doesn't prevent them.
E.g., even COMPAT_32 APIs might set a time to 0x7fff.  The time overflows
to INT32_MIN 1 second later on 32-bit kernels.  The kernel shouldn't allow
setting such times, but does.  It is left to the user to avoid this foot-
shooting.  Since setting critical times is privileged, the user usually
doesn't do this.  On 64-bit kernels, setting such times works and no
overflow occurs for native times, but unsuspecting 32-bit applications
are broken, so again it is left to privileged users to avoid this foot-
shooting (now for 32-bit feet).

Similarly for negative times.  They are even less useful than times after
32-bit time_t overflows, but in some cases they are not errors so must
not be rejected or blindly truncated by conversion functions.

Overflow of tv_nsec is not checked for.  It really can't happen, since
although native time_t is required to be long by historical mistakes,
and long might tbe 64 bits or larger, on values between 0 and 10**9-1
are valid for it, and these are representable by 32-bit long.  This
depends on the conversion function only being from native times which
are presumably already active so have been checked for validity.

uids overflow routinely.  E.g., the error uid is (uid_t)-1 = 0x
and blind truncation of this in linux_uid16.c overflows to 0x which
is the 16-bit error uid (uid16_t)-1.  But 0x = 65535 is a valid
native uid.  The valid native uid 0x1 overflows to 0 (root).
The valid native uid 0xfffe (nobody for nfs) overflows to 0xfffe
(nobody).

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


svn commit: r314315 - in head/sys/dev: bwi bwn iwm iwn otus ral rtwn usb/wlan wpi

2017-02-26 Thread Andriy Voskoboinyk
Author: avos
Date: Sun Feb 26 20:49:35 2017
New Revision: 314315
URL: https://svnweb.freebsd.org/changeset/base/314315

Log:
  net80211 drivers: fix rate setup for EAPOL frames, obtain Tx parameters
  directly from the node.
  
  - Use ni_txparms directly instead of calculating them manually every time
  - Move M_EAPOL flag check upper; otherwise it may be skipped due to
  'ucastrate' / 'mcastrate' check
  - Use 'mgtrate' for control frames too (see ifconfig(8), mgtrate parameter)
  - Add few more M_EAPOL checks where it was missing (zyd(4), ural(4),
  urtw(4))
  - Few unrelated cleanups
  
  Tested with:
   - Intel 6205 (iwn(4)), STA mode;
   - WUSB54GC (rum(4)), HOSTAP mode + RTL8188EU (rtwn(4)), STA mode.
  
  Reviewed by:  adrian
  Differential Revision:https://reviews.freebsd.org/D9811

Modified:
  head/sys/dev/bwi/if_bwi.c
  head/sys/dev/bwn/if_bwn.c
  head/sys/dev/iwm/if_iwm.c
  head/sys/dev/iwn/if_iwn.c
  head/sys/dev/otus/if_otus.c
  head/sys/dev/ral/rt2560.c
  head/sys/dev/ral/rt2661.c
  head/sys/dev/ral/rt2860.c
  head/sys/dev/rtwn/if_rtwn_tx.c
  head/sys/dev/usb/wlan/if_rum.c
  head/sys/dev/usb/wlan/if_run.c
  head/sys/dev/usb/wlan/if_ural.c
  head/sys/dev/usb/wlan/if_urtw.c
  head/sys/dev/usb/wlan/if_zyd.c
  head/sys/dev/wpi/if_wpi.c

Modified: head/sys/dev/bwi/if_bwi.c
==
--- head/sys/dev/bwi/if_bwi.c   Sun Feb 26 20:01:58 2017(r314314)
+++ head/sys/dev/bwi/if_bwi.c   Sun Feb 26 20:49:35 2017(r314315)
@@ -2930,7 +2930,7 @@ bwi_encap(struct bwi_softc *sc, int idx,
struct bwi_mac *mac;
struct bwi_txbuf_hdr *hdr;
struct ieee80211_frame *wh;
-   const struct ieee80211_txparam *tp;
+   const struct ieee80211_txparam *tp = ni->ni_txparms;
uint8_t rate, rate_fb;
uint32_t mac_ctrl;
uint16_t phy_ctrl;
@@ -2955,7 +2955,6 @@ bwi_encap(struct bwi_softc *sc, int idx,
/*
 * Find TX rate
 */
-   tp = >iv_txparms[ieee80211_chan2mode(ic->ic_curchan)];
if (type != IEEE80211_FC0_TYPE_DATA || (m->m_flags & M_EAPOL)) {
rate = rate_fb = tp->mgmtrate;
} else if (ismcast) {

Modified: head/sys/dev/bwn/if_bwn.c
==
--- head/sys/dev/bwn/if_bwn.c   Sun Feb 26 20:01:58 2017(r314314)
+++ head/sys/dev/bwn/if_bwn.c   Sun Feb 26 20:49:35 2017(r314315)
@@ -6189,7 +6189,7 @@ bwn_set_txhdr(struct bwn_mac *mac, struc
struct ieee80211_frame *protwh;
struct ieee80211_frame_cts *cts;
struct ieee80211_frame_rts *rts;
-   const struct ieee80211_txparam *tp;
+   const struct ieee80211_txparam *tp = ni->ni_txparms;
struct ieee80211vap *vap = ni->ni_vap;
struct ieee80211com *ic = >sc_ic;
struct mbuf *mprot;
@@ -6214,7 +6214,6 @@ bwn_set_txhdr(struct bwn_mac *mac, struc
/*
 * Find TX rate
 */
-   tp = >iv_txparms[ieee80211_chan2mode(ic->ic_curchan)];
if (type != IEEE80211_FC0_TYPE_DATA || (m->m_flags & M_EAPOL))
rate = rate_fb = tp->mgmtrate;
else if (ismcast)

Modified: head/sys/dev/iwm/if_iwm.c
==
--- head/sys/dev/iwm/if_iwm.c   Sun Feb 26 20:01:58 2017(r314314)
+++ head/sys/dev/iwm/if_iwm.c   Sun Feb 26 20:49:35 2017(r314315)
@@ -3549,7 +3549,9 @@ iwm_tx_fill_cmd(struct iwm_softc *sc, st
tx->rts_retry_limit = IWM_RTS_DFAULT_RETRY_LIMIT;
tx->data_retry_limit = IWM_DEFAULT_TX_RETRY;
 
-   if (type == IEEE80211_FC0_TYPE_MGT) {
+   if (type == IEEE80211_FC0_TYPE_MGT ||
+   type == IEEE80211_FC0_TYPE_CTL ||
+   (m->m_flags & M_EAPOL) != 0) {
ridx = iwm_tx_rateidx_global_lookup(sc, tp->mgmtrate);
IWM_DPRINTF(sc, IWM_DEBUG_TXRATE,
"%s: MGT (%d)\n", __func__, tp->mgmtrate);
@@ -3561,11 +3563,7 @@ iwm_tx_fill_cmd(struct iwm_softc *sc, st
ridx = iwm_tx_rateidx_global_lookup(sc, tp->ucastrate);
IWM_DPRINTF(sc, IWM_DEBUG_TXRATE,
"%s: FIXED_RATE (%d)\n", __func__, tp->ucastrate);
-   } else if (m->m_flags & M_EAPOL) {
-   ridx = iwm_tx_rateidx_global_lookup(sc, tp->mgmtrate);
-   IWM_DPRINTF(sc, IWM_DEBUG_TXRATE,
-   "%s: EAPOL\n", __func__);
-   } else if (type == IEEE80211_FC0_TYPE_DATA) {
+   } else {
int i;
 
/* for data frames, use RS table */
@@ -3582,10 +3580,6 @@ iwm_tx_fill_cmd(struct iwm_softc *sc, st
IWM_DPRINTF(sc, IWM_DEBUG_XMIT | IWM_DEBUG_TXRATE,
"%s: start with i=%d, txrate %d\n",
__func__, i, iwm_rates[ridx].rate);
-   } else {
-   ridx = iwm_tx_rateidx_global_lookup(sc, tp->mgmtrate);
-   IWM_DPRINTF(sc, 

svn commit: r314314 - head/sys/compat/linux

2017-02-26 Thread Dmitry Chagin
Author: dchagin
Date: Sun Feb 26 20:01:58 2017
New Revision: 314314
URL: https://svnweb.freebsd.org/changeset/base/314314

Log:
  Return EINVAL in case when an invalid size of signal mask specified.
  
  MFC after:1 month

Modified:
  head/sys/compat/linux/linux_event.c

Modified: head/sys/compat/linux/linux_event.c
==
--- head/sys/compat/linux/linux_event.c Sun Feb 26 19:59:28 2017
(r314313)
+++ head/sys/compat/linux/linux_event.c Sun Feb 26 20:01:58 2017
(r314314)
@@ -622,6 +622,8 @@ linux_epoll_pwait(struct thread *td, str
int error;
 
if (args->mask != NULL) {
+   if (args->sigsetsize != sizeof(l_sigset_t))
+   return (EINVAL);
error = copyin(args->mask, , sizeof(l_sigset_t));
if (error != 0)
return (error);
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r314313 - in head/sys: amd64/linux amd64/linux32 i386/linux

2017-02-26 Thread Dmitry Chagin
Author: dchagin
Date: Sun Feb 26 19:59:28 2017
New Revision: 314313
URL: https://svnweb.freebsd.org/changeset/base/314313

Log:
  Regen for r314312 (Linux epoll_pwait).
  
  MFC after:1 month

Modified:
  head/sys/amd64/linux/linux_proto.h
  head/sys/amd64/linux/linux_systrace_args.c
  head/sys/amd64/linux32/linux32_proto.h
  head/sys/amd64/linux32/linux32_systrace_args.c
  head/sys/i386/linux/linux_proto.h
  head/sys/i386/linux/linux_systrace_args.c

Modified: head/sys/amd64/linux/linux_proto.h
==
--- head/sys/amd64/linux/linux_proto.h  Sun Feb 26 19:57:18 2017
(r314312)
+++ head/sys/amd64/linux/linux_proto.h  Sun Feb 26 19:59:28 2017
(r314313)
@@ -995,6 +995,7 @@ struct linux_epoll_pwait_args {
char maxevents_l_[PADL_(l_int)]; l_int maxevents; char 
maxevents_r_[PADR_(l_int)];
char timeout_l_[PADL_(l_int)]; l_int timeout; char 
timeout_r_[PADR_(l_int)];
char mask_l_[PADL_(l_sigset_t *)]; l_sigset_t * mask; char 
mask_r_[PADR_(l_sigset_t *)];
+   char sigsetsize_l_[PADL_(l_size_t)]; l_size_t sigsetsize; char 
sigsetsize_r_[PADR_(l_size_t)];
 };
 struct linux_signalfd_args {
register_t dummy;

Modified: head/sys/amd64/linux/linux_systrace_args.c
==
--- head/sys/amd64/linux/linux_systrace_args.c  Sun Feb 26 19:57:18 2017
(r314312)
+++ head/sys/amd64/linux/linux_systrace_args.c  Sun Feb 26 19:59:28 2017
(r314313)
@@ -2068,7 +2068,8 @@ systrace_args(int sysnum, void *params, 
iarg[2] = p->maxevents; /* l_int */
iarg[3] = p->timeout; /* l_int */
uarg[4] = (intptr_t) p->mask; /* l_sigset_t * */
-   *n_args = 5;
+   iarg[5] = p->sigsetsize; /* l_size_t */
+   *n_args = 6;
break;
}
/* linux_signalfd */
@@ -5646,6 +5647,9 @@ systrace_entry_setargdesc(int sysnum, in
case 4:
p = "userland l_sigset_t *";
break;
+   case 5:
+   p = "l_size_t";
+   break;
default:
break;
};

Modified: head/sys/amd64/linux32/linux32_proto.h
==
--- head/sys/amd64/linux32/linux32_proto.h  Sun Feb 26 19:57:18 2017
(r314312)
+++ head/sys/amd64/linux32/linux32_proto.h  Sun Feb 26 19:59:28 2017
(r314313)
@@ -1051,6 +1051,7 @@ struct linux_epoll_pwait_args {
char maxevents_l_[PADL_(l_int)]; l_int maxevents; char 
maxevents_r_[PADR_(l_int)];
char timeout_l_[PADL_(l_int)]; l_int timeout; char 
timeout_r_[PADR_(l_int)];
char mask_l_[PADL_(l_sigset_t *)]; l_sigset_t * mask; char 
mask_r_[PADR_(l_sigset_t *)];
+   char sigsetsize_l_[PADL_(l_size_t)]; l_size_t sigsetsize; char 
sigsetsize_r_[PADR_(l_size_t)];
 };
 struct linux_utimensat_args {
char dfd_l_[PADL_(l_int)]; l_int dfd; char dfd_r_[PADR_(l_int)];

Modified: head/sys/amd64/linux32/linux32_systrace_args.c
==
--- head/sys/amd64/linux32/linux32_systrace_args.c  Sun Feb 26 19:57:18 
2017(r314312)
+++ head/sys/amd64/linux32/linux32_systrace_args.c  Sun Feb 26 19:59:28 
2017(r314313)
@@ -2169,7 +2169,8 @@ systrace_args(int sysnum, void *params, 
iarg[2] = p->maxevents; /* l_int */
iarg[3] = p->timeout; /* l_int */
uarg[4] = (intptr_t) p->mask; /* l_sigset_t * */
-   *n_args = 5;
+   iarg[5] = p->sigsetsize; /* l_size_t */
+   *n_args = 6;
break;
}
/* linux_utimensat */
@@ -5981,6 +5982,9 @@ systrace_entry_setargdesc(int sysnum, in
case 4:
p = "userland l_sigset_t *";
break;
+   case 5:
+   p = "l_size_t";
+   break;
default:
break;
};

Modified: head/sys/i386/linux/linux_proto.h
==
--- head/sys/i386/linux/linux_proto.h   Sun Feb 26 19:57:18 2017
(r314312)
+++ head/sys/i386/linux/linux_proto.h   Sun Feb 26 19:59:28 2017
(r314313)
@@ -1069,6 +1069,7 @@ struct linux_epoll_pwait_args {
char maxevents_l_[PADL_(l_int)]; l_int maxevents; char 
maxevents_r_[PADR_(l_int)];
char timeout_l_[PADL_(l_int)]; l_int timeout; char 
timeout_r_[PADR_(l_int)];
char mask_l_[PADL_(l_sigset_t *)]; l_sigset_t * mask; char 
mask_r_[PADR_(l_sigset_t *)];
+   char sigsetsize_l_[PADL_(l_size_t)]; l_size_t sigsetsize; char 
sigsetsize_r_[PADR_(l_size_t)];
 };
 struct linux_utimensat_args {

svn commit: r314312 - in head/sys: amd64/linux amd64/linux32 i386/linux

2017-02-26 Thread Dmitry Chagin
Author: dchagin
Date: Sun Feb 26 19:57:18 2017
New Revision: 314312
URL: https://svnweb.freebsd.org/changeset/base/314312

Log:
  Change Linux epoll_pwait syscall definition to match Linux actual one.
  
  MFC after:1 month

Modified:
  head/sys/amd64/linux/syscalls.master
  head/sys/amd64/linux32/syscalls.master
  head/sys/i386/linux/syscalls.master

Modified: head/sys/amd64/linux/syscalls.master
==
--- head/sys/amd64/linux/syscalls.masterSun Feb 26 19:54:17 2017
(r314311)
+++ head/sys/amd64/linux/syscalls.masterSun Feb 26 19:57:18 2017
(r314312)
@@ -473,7 +473,8 @@
 280AUE_FUTIMESAT   STD { int linux_utimensat(l_int dfd, const char 
*pathname, \
const struct l_timespec *times, l_int 
flags); }
 281 AUE_NULLSTD { int linux_epoll_pwait(l_int epfd, struct 
epoll_event *events, \
-l_int maxevents, l_int timeout, 
l_sigset_t *mask); }
+l_int maxevents, l_int timeout, 
l_sigset_t *mask, \
+l_size_t sigsetsize); }
 282AUE_NULLSTD { int linux_signalfd(void); }
 283AUE_NULLSTD { int linux_timerfd_create(l_int clockid, l_int 
flags); }
 284AUE_NULLSTD { int linux_eventfd(l_uint initval); }

Modified: head/sys/amd64/linux32/syscalls.master
==
--- head/sys/amd64/linux32/syscalls.master  Sun Feb 26 19:54:17 2017
(r314311)
+++ head/sys/amd64/linux32/syscalls.master  Sun Feb 26 19:57:18 2017
(r314312)
@@ -533,7 +533,8 @@
 ; linux 2.6.19:
 318AUE_NULLSTD { int linux_getcpu(void); }
 319 AUE_NULLSTD { int linux_epoll_pwait(l_int epfd, struct 
epoll_event *events, \
-l_int maxevents, l_int timeout, 
l_sigset_t *mask); }
+l_int maxevents, l_int timeout, 
l_sigset_t *mask, \
+l_size_t sigsetsize); }
 ; linux 2.6.22:
 320AUE_FUTIMESAT   STD { int linux_utimensat(l_int dfd, const char 
*pathname, \
const struct l_timespec *times, l_int 
flags); }

Modified: head/sys/i386/linux/syscalls.master
==
--- head/sys/i386/linux/syscalls.master Sun Feb 26 19:54:17 2017
(r314311)
+++ head/sys/i386/linux/syscalls.master Sun Feb 26 19:57:18 2017
(r314312)
@@ -541,7 +541,8 @@
 ; linux 2.6.19:
 318AUE_NULLSTD { int linux_getcpu(void); }
 319AUE_NULLSTD { int linux_epoll_pwait(l_int epfd, struct 
epoll_event *events, \
-   l_int maxevents, l_int timeout, 
l_sigset_t *mask); }
+   l_int maxevents, l_int timeout, 
l_sigset_t *mask, \
+   l_size_t sigsetsize); }
 ; linux 2.6.22:
 320AUE_FUTIMESAT   STD { int linux_utimensat(l_int dfd, const char 
*pathname, \
const struct l_timespec *times, l_int 
flags); }
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r314311 - head/sys/compat/linux

2017-02-26 Thread Dmitry Chagin
Author: dchagin
Date: Sun Feb 26 19:54:17 2017
New Revision: 314311
URL: https://svnweb.freebsd.org/changeset/base/314311

Log:
  Restore signal mask in epoll_pwait.
  
  MFC after:1 month

Modified:
  head/sys/compat/linux/linux_event.c

Modified: head/sys/compat/linux/linux_event.c
==
--- head/sys/compat/linux/linux_event.c Sun Feb 26 19:54:02 2017
(r314310)
+++ head/sys/compat/linux/linux_event.c Sun Feb 26 19:54:17 2017
(r314311)
@@ -530,23 +530,32 @@ static int
 linux_epoll_wait_common(struct thread *td, int epfd, struct epoll_event 
*events,
 int maxevents, int timeout, sigset_t *uset)
 {
-   struct file *epfp;
-   struct timespec ts, *tsp;
-   cap_rights_t rights;
struct epoll_copyout_args coargs;
struct kevent_copyops k_ops = { ,
epoll_kev_copyout,
NULL};
+   struct timespec ts, *tsp;
+   cap_rights_t rights;
+   struct file *epfp;
+   sigset_t omask;
int error;
 
if (maxevents <= 0 || maxevents > LINUX_MAX_EVENTS)
return (EINVAL);
 
+   error = fget(td, epfd,
+   cap_rights_init(, CAP_KQUEUE_EVENT), );
+   if (error != 0)
+   return (error);
+   if (epfp->f_type != DTYPE_KQUEUE) {
+   error = EINVAL;
+   goto leave1;
+   }
if (uset != NULL) {
error = kern_sigprocmask(td, SIG_SETMASK, uset,
-   >td_oldsigmask, 0);
+   , 0);
if (error != 0)
-   return (error);
+   goto leave1;
td->td_pflags |= TDP_OLDMASK;
/*
 * Make sure that ast() is called on return to
@@ -558,14 +567,6 @@ linux_epoll_wait_common(struct thread *t
thread_unlock(td);
}
 
-   error = fget(td, epfd,
-   cap_rights_init(, CAP_KQUEUE_EVENT), );
-   if (error != 0)
-   return (error);
-   if (epfp->f_type != DTYPE_KQUEUE) {
-   error = EINVAL;
-   goto leave;
-   }
 
coargs.leventlist = events;
coargs.p = td->td_proc;
@@ -575,7 +576,7 @@ linux_epoll_wait_common(struct thread *t
if (timeout != -1) {
if (timeout < 0) {
error = EINVAL;
-   goto leave;
+   goto leave0;
}
/* Convert from milliseconds to timespec. */
ts.tv_sec = timeout / 1000;
@@ -595,7 +596,12 @@ linux_epoll_wait_common(struct thread *t
 */
if (error == 0)
td->td_retval[0] = coargs.count;
-leave:
+
+leave0:
+   if (uset != NULL)
+   error = kern_sigprocmask(td, SIG_SETMASK, ,
+   NULL, 0);
+leave1:
fdrop(epfp, td);
return (error);
 }
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


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

2017-02-26 Thread Alan Cox
Author: alc
Date: Sun Feb 26 19:54:02 2017
New Revision: 314310
URL: https://svnweb.freebsd.org/changeset/base/314310

Log:
  Refine the fix from r312954.  Specifically, add a new PDE-only flag,
  PG_PROMOTED, that indicates whether lingering 4KB page mappings might
  need to be flushed on a PDE change that restricts or destroys a 2MB
  page mapping.  This flag allows the pmap to avoid range invalidations
  that are both unnecessary and costly.
  
  Reviewed by:  kib, markj
  MFC after:6 weeks
  Differential Revision:https://reviews.freebsd.org/D9665

Modified:
  head/sys/amd64/amd64/pmap.c
  head/sys/amd64/include/pmap.h
  head/sys/i386/i386/pmap.c
  head/sys/i386/include/pmap.h

Modified: head/sys/amd64/amd64/pmap.c
==
--- head/sys/amd64/amd64/pmap.c Sun Feb 26 19:51:44 2017(r314309)
+++ head/sys/amd64/amd64/pmap.c Sun Feb 26 19:54:02 2017(r314310)
@@ -613,6 +613,8 @@ static vm_page_t pmap_enter_quick_locked
 vm_page_t m, vm_prot_t prot, vm_page_t mpte, struct rwlock **lockp);
 static void pmap_fill_ptp(pt_entry_t *firstpte, pt_entry_t newpte);
 static int pmap_insert_pt_page(pmap_t pmap, vm_page_t mpte);
+static void pmap_invalidate_pde_page(pmap_t pmap, vm_offset_t va,
+   pd_entry_t pde);
 static void pmap_kenter_attr(vm_offset_t va, vm_paddr_t pa, int mode);
 static void pmap_pde_attr(pd_entry_t *pde, int cache_bits, int mask);
 static void pmap_promote_pde(pmap_t pmap, pd_entry_t *pde, vm_offset_t va,
@@ -1838,6 +1840,27 @@ pmap_update_pde(pmap_t pmap, vm_offset_t
 }
 #endif /* !SMP */
 
+static void
+pmap_invalidate_pde_page(pmap_t pmap, vm_offset_t va, pd_entry_t pde)
+{
+
+   /*
+* When the PDE has PG_PROMOTED set, the 2MB page mapping was created
+* by a promotion that did not invalidate the 512 4KB page mappings
+* that might exist in the TLB.  Consequently, at this point, the TLB
+* may hold both 4KB and 2MB page mappings for the address range [va,
+* va + NBPDR).  Therefore, the entire range must be invalidated here.
+* In contrast, when PG_PROMOTED is clear, the TLB will not hold any
+* 4KB page mappings for the address range [va, va + NBPDR), and so a
+* single INVLPG suffices to invalidate the 2MB page mapping from the
+* TLB.
+*/
+   if ((pde & PG_PROMOTED) != 0)
+   pmap_invalidate_range(pmap, va, va + NBPDR - 1);
+   else
+   pmap_invalidate_page(pmap, va);
+}
+
 #define PMAP_CLFLUSH_THRESHOLD   (2 * 1024 * 1024)
 
 void
@@ -3472,7 +3495,8 @@ pmap_demote_pde_locked(pmap_t pmap, pd_e
SLIST_INIT();
sva = trunc_2mpage(va);
pmap_remove_pde(pmap, pde, sva, , lockp);
-   pmap_invalidate_range(pmap, sva, sva + NBPDR - 1);
+   if ((oldpde & PG_G) == 0)
+   pmap_invalidate_pde_page(pmap, sva, oldpde);
pmap_free_zero_pages();
CTR2(KTR_PMAP, "pmap_demote_pde: failure for va %#lx"
" in pmap %p", va, pmap);
@@ -3612,25 +3636,8 @@ pmap_remove_pde(pmap_t pmap, pd_entry_t 
oldpde = pte_load_clear(pdq);
if (oldpde & PG_W)
pmap->pm_stats.wired_count -= NBPDR / PAGE_SIZE;
-
-   /*
-* When workaround_erratum383 is false, a promotion to a 2M
-* page mapping does not invalidate the 512 4K page mappings
-* from the TLB.  Consequently, at this point, the TLB may
-* hold both 4K and 2M page mappings.  Therefore, the entire
-* range of addresses must be invalidated here.  In contrast,
-* when workaround_erratum383 is true, a promotion does
-* invalidate the 512 4K page mappings, and so a single INVLPG
-* suffices to invalidate the 2M page mapping.
-*/
-   if ((oldpde & PG_G) != 0) {
-   if (workaround_erratum383)
-   pmap_invalidate_page(kernel_pmap, sva);
-   else
-   pmap_invalidate_range(kernel_pmap, sva,
-   sva + NBPDR - 1);
-   }
-
+   if ((oldpde & PG_G) != 0)
+   pmap_invalidate_pde_page(kernel_pmap, sva, oldpde);
pmap_resident_count_dec(pmap, NBPDR / PAGE_SIZE);
if (oldpde & PG_MANAGED) {
CHANGE_PV_LIST_LOCK_TO_PHYS(lockp, oldpde & PG_PS_FRAME);
@@ -4010,16 +4017,16 @@ retry:
if ((prot & VM_PROT_EXECUTE) == 0)
newpde |= pg_nx;
if (newpde != oldpde) {
-   if (!atomic_cmpset_long(pde, oldpde, newpde))
+   /*
+* As an optimization to future operations on this PDE, clear
+* PG_PROMOTED.  The impending invalidation will remove any
+* lingering 4KB page mappings from the TLB.
+*/
+   

svn commit: r314309 - head/sys/compat/linux

2017-02-26 Thread Dmitry Chagin
Author: dchagin
Date: Sun Feb 26 19:51:44 2017
New Revision: 314309
URL: https://svnweb.freebsd.org/changeset/base/314309

Log:
  Return EINVAL when an invalid file descriptor is specified.
  
  MFC after:1 month

Modified:
  head/sys/compat/linux/linux_event.c

Modified: head/sys/compat/linux/linux_event.c
==
--- head/sys/compat/linux/linux_event.c Sun Feb 26 19:25:33 2017
(r314308)
+++ head/sys/compat/linux/linux_event.c Sun Feb 26 19:51:44 2017
(r314309)
@@ -462,8 +462,10 @@ linux_epoll_ctl(struct thread *td, struc
cap_rights_init(, CAP_KQUEUE_CHANGE), );
if (error != 0)
return (error);
-   if (epfp->f_type != DTYPE_KQUEUE)
+   if (epfp->f_type != DTYPE_KQUEUE) {
+   error = EINVAL;
goto leave1;
+   }
 
 /* Protect user data vector from incorrectly supplied fd. */
error = fget(td, args->fd, cap_rights_init(, CAP_POLL_EVENT), 
);
@@ -560,6 +562,10 @@ linux_epoll_wait_common(struct thread *t
cap_rights_init(, CAP_KQUEUE_EVENT), );
if (error != 0)
return (error);
+   if (epfp->f_type != DTYPE_KQUEUE) {
+   error = EINVAL;
+   goto leave;
+   }
 
coargs.leventlist = events;
coargs.p = td->td_proc;
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r314308 - head/sys/dev/aic7xxx

2017-02-26 Thread Alexander Motin
Author: mav
Date: Sun Feb 26 19:25:33 2017
New Revision: 314308
URL: https://svnweb.freebsd.org/changeset/base/314308

Log:
  Fix LUN enabling on wildcard target, as done by CTL.
  
  MFC after:2 weeks

Modified:
  head/sys/dev/aic7xxx/aic79xx.c
  head/sys/dev/aic7xxx/aic7xxx.c

Modified: head/sys/dev/aic7xxx/aic79xx.c
==
--- head/sys/dev/aic7xxx/aic79xx.c  Sun Feb 26 19:23:03 2017
(r314307)
+++ head/sys/dev/aic7xxx/aic79xx.c  Sun Feb 26 19:25:33 2017
(r314308)
@@ -9918,7 +9918,8 @@ ahd_handle_en_lun(struct ahd_softc *ahd,
u_int  our_id;
 
our_id = ahd->our_id;
-   if (ccb->ccb_h.target_id != our_id) {
+   if (ccb->ccb_h.target_id != our_id
+&& ccb->ccb_h.target_id != CAM_TARGET_WILDCARD) {
if ((ahd->features & AHD_MULTI_TID) != 0
 && (ahd->flags & AHD_INITIATORROLE) != 0) {
/*

Modified: head/sys/dev/aic7xxx/aic7xxx.c
==
--- head/sys/dev/aic7xxx/aic7xxx.c  Sun Feb 26 19:23:03 2017
(r314307)
+++ head/sys/dev/aic7xxx/aic7xxx.c  Sun Feb 26 19:25:33 2017
(r314308)
@@ -7347,7 +7347,8 @@ ahc_handle_en_lun(struct ahc_softc *ahc,
else
our_id = ahc->our_id_b;
 
-   if (ccb->ccb_h.target_id != our_id) {
+   if (ccb->ccb_h.target_id != our_id
+&& ccb->ccb_h.target_id != CAM_TARGET_WILDCARD) {
/*
 * our_id represents our initiator ID, or
 * the ID of the first target to have an
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r314307 - head/sys/cam/ctl

2017-02-26 Thread Alexander Motin
Author: mav
Date: Sun Feb 26 19:23:03 2017
New Revision: 314307
URL: https://svnweb.freebsd.org/changeset/base/314307

Log:
  Add support for SIMs without autosense.
  
  If we asked to send sense data by setting CAM_SEND_SENSE, but SIM didn't
  confirm transmission by setting CAM_SENT_SENSE, assume it was not sent.
  Queue the I/O back to CTL for later REQUEST SENSE with ctl_queue_sense().
  This is needed for error reporting on SPI HBAs like ahc(4)/ahd(4).
  
  MFC after:2 weeks

Modified:
  head/sys/cam/ctl/scsi_ctl.c

Modified: head/sys/cam/ctl/scsi_ctl.c
==
--- head/sys/cam/ctl/scsi_ctl.c Sun Feb 26 19:00:55 2017(r314306)
+++ head/sys/cam/ctl/scsi_ctl.c Sun Feb 26 19:23:03 2017(r314307)
@@ -1223,6 +1223,20 @@ ctlfedone(struct cam_periph *periph, uni
 * datamove done routine.
 */
if ((io->io_hdr.flags & CTL_FLAG_DMA_INPROG) == 0) {
+   /*
+* If we asked to send sense data but it wasn't sent,
+* queue the I/O back to CTL for later REQUEST SENSE.
+*/
+   if ((done_ccb->ccb_h.flags & CAM_SEND_SENSE) != 0 &&
+   (done_ccb->ccb_h.status & CAM_STATUS_MASK) == 
CAM_REQ_CMP &&
+   (done_ccb->ccb_h.status & CAM_SENT_SENSE) == 0 &&
+   (io = 
ctl_alloc_io_nowait(bus_softc->port.ctl_pool_ref)) != NULL) {
+   PRIV_INFO(io) = PRIV_INFO(
+   (union ctl_io *)atio->ccb_h.io_ptr);
+   ctl_queue_sense(atio->ccb_h.io_ptr);
+   atio->ccb_h.io_ptr = io;
+   }
+
/* Abort ATIO if CTIO sending status has failed. */
if ((done_ccb->ccb_h.status & CAM_STATUS_MASK) !=
CAM_REQ_CMP) {
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r314306 - head/crypto/openssh

2017-02-26 Thread Dag-Erling Smørgrav
Author: des
Date: Sun Feb 26 19:00:55 2017
New Revision: 314306
URL: https://svnweb.freebsd.org/changeset/base/314306

Log:
  Avoid picking up MIT Kerberos from ports (if installed).

Modified:
  head/crypto/openssh/freebsd-configure.sh

Modified: head/crypto/openssh/freebsd-configure.sh
==
--- head/crypto/openssh/freebsd-configure.shSun Feb 26 18:17:12 2017
(r314305)
+++ head/crypto/openssh/freebsd-configure.shSun Feb 26 19:00:55 2017
(r314306)
@@ -30,7 +30,7 @@ export PATH=/bin:/sbin:/usr/bin:/usr/sbi
 unset LD_LIBRARY_PATH
 
 # generate config.h with krb5 and stash it
-sh configure $configure_args --with-kerberos5
+sh configure $configure_args --with-kerberos5=/usr
 mv config.log config.log.orig
 mv config.h config.h.orig
 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r314087 - head/sys/x86/x86

2017-02-26 Thread Mike Karels

Tangential, but:

On 26 Feb 2017, at 6:44, Konstantin Belousov wrote:


On Sun, Feb 26, 2017 at 04:43:12AM +1100, Bruce Evans wrote:
2.9 BSD was a port to PDP-11, AFAIK, with 16bit ints.


All of the 2BSD systems ran on PDP-11 with 16-bit ints, as did Research 
versions 1 through 7th Edition.  2.9BSD just happens to be the version 
for which I was principal developer.  I spent a lot of time back-porting 
from 4BSD (for the VAX), and int vs long was the main issue.


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


Re: svn commit: r314087 - head/sys/x86/x86

2017-02-26 Thread Warner Losh
On Sun, Feb 26, 2017 at 5:44 AM, Konstantin Belousov
 wrote:
> On Sun, Feb 26, 2017 at 04:43:12AM +1100, Bruce Evans wrote:
> 2.9 BSD was a port to PDP-11, AFAIK, with 16bit ints.

A bit off topic, but 2BSD was basically[**] a continuation of Research
Unix which started out life on the PDP-11 (well, OK, it started life
in assembler on the PDP-7, but then was rewritten in C on the PDP-11).
PDP-11 had 16-bit ints, 32-bit longs, 16-bit shorts, 16-bit pointers,
8-bit chars and 20-bit physical addresses. After 2.9, it also required
weird things like separate I space where you could have a function
pointer and a data pointer that had the same bit pattern, but referred
to different objects because instruction space and address space were
different (effectively giving 17-bits of address space, kinda). But
you also had things like an overlay manager from hell that would page
in different parts of the code if the program couldn't fit int 64k,
and many of the limitations of the BSD 2.11 TCP stack were based on
limitations of how deep you could do the overlays. It didn't have long
longs. Or a compiler more modern than K[*].

Other than that, ULL vs explicit casts

Warner

[*] OK, gcc can produce pdp-11 output, even to this day. But it's far
far to large to run on a pdp-11 natively.
[**] Lots of cross pollination between BSD and Bell Labs is noted and
documented extensively elsewhere.
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r314304 - head/crypto/openssh

2017-02-26 Thread Dag-Erling Smørgrav
Author: des
Date: Sun Feb 26 16:34:58 2017
New Revision: 314304
URL: https://svnweb.freebsd.org/changeset/base/314304

Log:
  Fix amusingly harmless mis-merge.

Modified:
  head/crypto/openssh/readconf.c

Modified: head/crypto/openssh/readconf.c
==
--- head/crypto/openssh/readconf.c  Sun Feb 26 16:00:20 2017
(r314303)
+++ head/crypto/openssh/readconf.c  Sun Feb 26 16:34:58 2017
(r314304)
@@ -319,7 +319,6 @@ add_local_forward(Options *options, cons
 #else
ipport_reserved = IPPORT_RESERVED;
 #endif
-   if (newfwd->listen_port < ipport_reserved && original_real_uid != 0)
if (newfwd->listen_port < ipport_reserved && original_real_uid != 0 &&
newfwd->listen_path == NULL)
fatal("Privileged ports can only be forwarded by root.");
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r314303 - in head/sys/arm/allwinner: . clkng h3

2017-02-26 Thread Emmanuel Vadot
Author: manu
Date: Sun Feb 26 16:00:20 2017
New Revision: 314303
URL: https://svnweb.freebsd.org/changeset/base/314303

Log:
  Add clkng driver for Allwinner SoC
  
  Since Linux 4.9-4.10 DTS doesn't have clocks under /clocks but only a ccu 
node.
  Currently only H3 is supported with almost the same state as HEAD.
  (video pll aren't supported for now but we don't support video).
  This driver and clocks will also be used for other SoC (A64, A31, H5, H2 etc 
...)
  
  Reviewed by:  jmcneill
  Differential Revision:https://reviews.freebsd.org/D9517

Added:
  head/sys/arm/allwinner/clkng/
  head/sys/arm/allwinner/clkng/aw_ccung.c   (contents, props changed)
  head/sys/arm/allwinner/clkng/aw_ccung.h   (contents, props changed)
  head/sys/arm/allwinner/clkng/aw_clk.h   (contents, props changed)
  head/sys/arm/allwinner/clkng/aw_clk_nkmp.c   (contents, props changed)
  head/sys/arm/allwinner/clkng/aw_clk_nkmp.h   (contents, props changed)
  head/sys/arm/allwinner/clkng/aw_clk_nm.c   (contents, props changed)
  head/sys/arm/allwinner/clkng/aw_clk_nm.h   (contents, props changed)
  head/sys/arm/allwinner/clkng/aw_clk_prediv_mux.c   (contents, props changed)
  head/sys/arm/allwinner/clkng/aw_clk_prediv_mux.h   (contents, props changed)
  head/sys/arm/allwinner/clkng/ccu_h3.c   (contents, props changed)
  head/sys/arm/allwinner/clkng/ccu_h3.h   (contents, props changed)
Modified:
  head/sys/arm/allwinner/files.allwinner
  head/sys/arm/allwinner/h3/files.h3

Added: head/sys/arm/allwinner/clkng/aw_ccung.c
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/arm/allwinner/clkng/aw_ccung.c Sun Feb 26 16:00:20 2017
(r314303)
@@ -0,0 +1,348 @@
+/*-
+ * Copyright (c) 2017 Emmanuel Vadot 
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $FreeBSD$
+ */
+
+/*
+ * Allwinner Clock Control Unit
+ */
+
+#include 
+__FBSDID("$FreeBSD$");
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+
+#include 
+#include 
+
+#include 
+#include 
+
+#include 
+
+#include 
+#include 
+
+#if defined(SOC_ALLWINNER_H3)
+#include 
+#endif
+
+#include "clkdev_if.h"
+#include "hwreset_if.h"
+
+static struct resource_spec aw_ccung_spec[] = {
+   { SYS_RES_MEMORY,   0,  RF_ACTIVE },
+   { -1, 0 }
+};
+
+#if defined(SOC_ALLWINNER_H3)
+#defineH3_CCU  1
+#endif
+
+static struct ofw_compat_data compat_data[] = {
+#if defined(SOC_ALLWINNER_H3)
+   { "allwinner,sun8i-h3-ccu", H3_CCU },
+#endif
+   {NULL, 0 }
+};
+
+#defineCCU_READ4(sc, reg)  bus_read_4((sc)->res, (reg))
+#defineCCU_WRITE4(sc, reg, val)bus_write_4((sc)->res, (reg), 
(val))
+
+static int
+aw_ccung_write_4(device_t dev, bus_addr_t addr, uint32_t val)
+{
+   struct aw_ccung_softc *sc;
+
+   sc = device_get_softc(dev);
+   CCU_WRITE4(sc, addr, val);
+   return (0);
+}
+
+static int
+aw_ccung_read_4(device_t dev, bus_addr_t addr, uint32_t *val)
+{
+   struct aw_ccung_softc *sc;
+
+   sc = device_get_softc(dev);
+
+   *val = CCU_READ4(sc, addr);
+   return (0);
+}
+
+static int
+aw_ccung_modify_4(device_t dev, bus_addr_t addr, uint32_t clr, uint32_t set)
+{
+   struct aw_ccung_softc *sc;
+   uint32_t reg;
+
+   sc = device_get_softc(dev);
+
+   reg = CCU_READ4(sc, addr);
+   reg &= ~clr;
+   reg |= set;
+   CCU_WRITE4(sc, addr, reg);
+
+   return (0);
+}
+
+static int
+aw_ccung_reset_assert(device_t dev, intptr_t id, bool reset)
+{
+   struct aw_ccung_softc *sc;
+   uint32_t val;
+
+   sc = device_get_softc(dev);
+
+   if (id >= 

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

2017-02-26 Thread Alexander Motin
Author: mav
Date: Sun Feb 26 14:29:09 2017
New Revision: 314302
URL: https://svnweb.freebsd.org/changeset/base/314302

Log:
  Return better error code in case of too long CDB.
  
  Its more important for SPI HBAs, as they don't support CDBs above 12 bytes.
  The new error code makes CAM to fall back to alternative commands.
  
  MFC after:2 weeks

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

Modified: head/sys/dev/isp/isp.c
==
--- head/sys/dev/isp/isp.c  Sun Feb 26 13:25:56 2017(r314301)
+++ head/sys/dev/isp/isp.c  Sun Feb 26 14:29:09 2017(r314302)
@@ -4317,7 +4317,7 @@ isp_start(XS_T *xs)
 
if (XS_CDBLEN(xs) > (IS_FC(isp)? 16 : 44) || XS_CDBLEN(xs) == 0) {
isp_prt(isp, ISP_LOGERR, "unsupported cdb length (%d, 
CDB[0]=0x%x)", XS_CDBLEN(xs), XS_CDBP(xs)[0] & 0xff);
-   XS_SETERR(xs, HBA_BOTCH);
+   XS_SETERR(xs, HBA_REQINVAL);
return (CMD_COMPLETE);
}
 
@@ -4494,7 +4494,7 @@ isp_start(XS_T *xs)
if (IS_SCSI(isp)) {
if (cdblen > sizeof (reqp->req_cdb)) {
isp_prt(isp, ISP_LOGERR, "Command Length %u too long 
for this chip", cdblen);
-   XS_SETERR(xs, HBA_BOTCH);
+   XS_SETERR(xs, HBA_REQINVAL);
return (CMD_COMPLETE);
}
reqp->req_target = target | (XS_CHANNEL(xs) << 7);
@@ -4506,7 +4506,7 @@ isp_start(XS_T *xs)
 
if (cdblen > sizeof (t7->req_cdb)) {
isp_prt(isp, ISP_LOGERR, "Command Length %u too long 
for this chip", cdblen);
-   XS_SETERR(xs, HBA_BOTCH);
+   XS_SETERR(xs, HBA_REQINVAL);
return (CMD_COMPLETE);
}
 
@@ -4539,7 +4539,7 @@ isp_start(XS_T *xs)
 
if (cdblen > sizeof t2->req_cdb) {
isp_prt(isp, ISP_LOGERR, "Command Length %u too long 
for this chip", cdblen);
-   XS_SETERR(xs, HBA_BOTCH);
+   XS_SETERR(xs, HBA_REQINVAL);
return (CMD_COMPLETE);
}
if (FCPARAM(isp, XS_CHANNEL(xs))->fctape_enabled && 
(lp->prli_word3 & PRLI_WD3_RETRY)) {
@@ -6567,6 +6567,7 @@ isp_parse_status(ispsoftc_t *isp, ispsta
case RQCS_PORT_BUSY:
isp_prt(isp, ISP_LOGWARN, "port busy for target %d", 
XS_TGT(xs));
if (XS_NOERR(xs)) {
+   *XS_STSP(xs) = SCSI_BUSY;
XS_SETERR(xs, HBA_TGTBSY);
}
return;

Modified: head/sys/dev/isp/isp_freebsd.h
==
--- head/sys/dev/isp/isp_freebsd.h  Sun Feb 26 13:25:56 2017
(r314301)
+++ head/sys/dev/isp/isp_freebsd.h  Sun Feb 26 14:29:09 2017
(r314302)
@@ -574,6 +574,7 @@ default:
\
 #  define  HBA_CMDTIMEOUT  CAM_CMD_TIMEOUT
 #  define  HBA_SELTIMEOUT  CAM_SEL_TIMEOUT
 #  define  HBA_TGTBSY  CAM_SCSI_STATUS_ERROR
+#  define  HBA_REQINVALCAM_REQ_INVALID
 #  define  HBA_BUSRESETCAM_SCSI_BUS_RESET
 #  define  HBA_ABORTED CAM_REQ_ABORTED
 #  define  HBA_DATAOVR CAM_DATA_RUN_ERR
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r314301 - head/sys/x86/x86

2017-02-26 Thread Takahashi Yoshihiro
Author: nyan
Date: Sun Feb 26 13:25:56 2017
New Revision: 314301
URL: https://svnweb.freebsd.org/changeset/base/314301

Log:
  Fix the acpi idle support on i386 which was broken by r312910.
  
  The ifdefs were '#if !defined(__i386__) || !defined(PC98)' previously,
  so cpu_idle_acpi was enabled both i386 and amd64 except PC98.
  
  I was obfuscated by '#if !defined(__i386__)' condition.
  
  Submitted by: bde
  Reported by:  bde

Modified:
  head/sys/x86/x86/cpu_machdep.c

Modified: head/sys/x86/x86/cpu_machdep.c
==
--- head/sys/x86/x86/cpu_machdep.c  Sun Feb 26 12:54:27 2017
(r314300)
+++ head/sys/x86/x86/cpu_machdep.c  Sun Feb 26 13:25:56 2017
(r314301)
@@ -451,9 +451,7 @@ struct {
{ cpu_idle_spin, "spin" },
{ cpu_idle_mwait, "mwait" },
{ cpu_idle_hlt, "hlt" },
-#if !defined(__i386__)
{ cpu_idle_acpi, "acpi" },
-#endif
{ NULL, NULL }
 };
 
@@ -470,11 +468,9 @@ idle_sysctl_available(SYSCTL_HANDLER_ARG
if (strstr(idle_tbl[i].id_name, "mwait") &&
(cpu_feature2 & CPUID2_MON) == 0)
continue;
-#if !defined(__i386__)
if (strcmp(idle_tbl[i].id_name, "acpi") == 0 &&
cpu_idle_hook == NULL)
continue;
-#endif
p += sprintf(p, "%s%s", p != avail ? ", " : "",
idle_tbl[i].id_name);
}
@@ -509,11 +505,9 @@ idle_sysctl(SYSCTL_HANDLER_ARGS)
if (strstr(idle_tbl[i].id_name, "mwait") &&
(cpu_feature2 & CPUID2_MON) == 0)
continue;
-#if !defined(__i386__)
if (strcmp(idle_tbl[i].id_name, "acpi") == 0 &&
cpu_idle_hook == NULL)
continue;
-#endif
if (strcmp(idle_tbl[i].id_name, buf))
continue;
cpu_idle_fn = idle_tbl[i].id_fn;
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r314300 - head/sys/cam/ctl

2017-02-26 Thread Alexander Motin
Author: mav
Date: Sun Feb 26 12:54:27 2017
New Revision: 314300
URL: https://svnweb.freebsd.org/changeset/base/314300

Log:
  Use resid field of CTIO to detect under/overruns.
  
  MFC after:2 weeks

Modified:
  head/sys/cam/ctl/scsi_ctl.c

Modified: head/sys/cam/ctl/scsi_ctl.c
==
--- head/sys/cam/ctl/scsi_ctl.c Sun Feb 26 12:52:44 2017(r314299)
+++ head/sys/cam/ctl/scsi_ctl.c Sun Feb 26 12:54:27 2017(r314300)
@@ -1253,7 +1253,8 @@ ctlfedone(struct cam_periph *periph, uni
 */
switch (done_ccb->ccb_h.status & CAM_STATUS_MASK) {
case CAM_REQ_CMP:
-   io->scsiio.kern_data_resid -= csio->dxfer_len;
+   io->scsiio.kern_data_resid -=
+   csio->dxfer_len - csio->resid;
io->io_hdr.port_status = 0;
break;
default:
@@ -1280,8 +1281,8 @@ ctlfedone(struct cam_periph *periph, uni
 * pieces, figure out where we are in the list, and
 * continue sending pieces if necessary.
 */
-   if ((cmd_info->flags & CTLFE_CMD_PIECEWISE)
-&& (io->io_hdr.port_status == 0)) {
+   if ((cmd_info->flags & CTLFE_CMD_PIECEWISE) &&
+   io->io_hdr.port_status == 0 && csio->resid == 0) {
ccb_flags flags;
uint8_t *data_ptr;
uint32_t dxfer_len;
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


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

2017-02-26 Thread Alexander Motin
Author: mav
Date: Sun Feb 26 12:52:44 2017
New Revision: 314299
URL: https://svnweb.freebsd.org/changeset/base/314299

Log:
  Fix residual length reporting in target mode.
  
  This allows to properly handle cases when target wants to receive or send
  more data then initiator wants to send or receive.  Previously in such
  cases isp(4) returned CAM_DATA_RUN_ERR, while now it returns resid > 0.
  
  MFC after:2 weeks

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

Modified: head/sys/dev/isp/isp_freebsd.c
==
--- head/sys/dev/isp/isp_freebsd.c  Sun Feb 26 11:02:14 2017
(r314298)
+++ head/sys/dev/isp/isp_freebsd.c  Sun Feb 26 12:52:44 2017
(r314299)
@@ -1316,13 +1316,24 @@ isp_target_start_ctio(ispsoftc_t *isp, u
/*
 * Check for overflow
 */
-   tmp = atp->bytes_xfered + atp->bytes_in_transit + xfrlen;
-   if (tmp > atp->orig_datalen) {
-   isp_prt(isp, ISP_LOGERR, "%s: [0x%x] data overflow by 
%u bytes", __func__, cso->tag_id, tmp - atp->orig_datalen);
+   tmp = atp->bytes_xfered + atp->bytes_in_transit;
+   if (xfrlen > 0 && tmp > atp->orig_datalen) {
+   isp_prt(isp, ISP_LOGERR,
+   "%s: [0x%x] data overflow by %u bytes", __func__,
+   cso->tag_id, tmp + xfrlen - atp->orig_datalen);
ccb->ccb_h.status = CAM_DATA_RUN_ERR;
xpt_done(ccb);
continue;
}
+   if (xfrlen > atp->orig_datalen - tmp) {
+   xfrlen = atp->orig_datalen - tmp;
+   if (xfrlen == 0 && !sendstatus) {
+   cso->resid = cso->dxfer_len;
+   ccb->ccb_h.status = CAM_REQ_CMP;
+   xpt_done(ccb);
+   continue;
+   }
+   }
 
if (IS_24XX(isp)) {
ct7_entry_t *cto = (ct7_entry_t *) local;
@@ -1352,16 +1363,13 @@ isp_target_start_ctio(ispsoftc_t *isp, u
cto->ct_flags |= CT7_SENDSTATUS | CT7_NO_DATA;
resid = atp->orig_datalen - atp->bytes_xfered - 
atp->bytes_in_transit;
if (sense_length <= MAXRESPLEN_24XX) {
-   if (resid < 0) {
-   cto->ct_resid = -resid;
-   } else if (resid > 0) {
-   cto->ct_resid = resid;
-   }
cto->ct_flags |= CT7_FLAG_MODE1;
cto->ct_scsi_status = cso->scsi_status;
if (resid < 0) {
+   cto->ct_resid = -resid;
cto->ct_scsi_status |= 
(FCP_RESID_OVERFLOW << 8);
} else if (resid > 0) {
+   cto->ct_resid = resid;
cto->ct_scsi_status |= 
(FCP_RESID_UNDERFLOW << 8);
}
if (fctape) {
@@ -2238,10 +2246,10 @@ static void
 isp_handle_platform_ctio(ispsoftc_t *isp, void *arg)
 {
union ccb *ccb;
-   int sentstatus = 0, ok = 0, notify_cam = 0, resid = 0, failure = 0;
+   int sentstatus = 0, ok = 0, notify_cam = 0, failure = 0;
atio_private_data_t *atp = NULL;
int bus;
-   uint32_t handle, moved_data = 0, data_requested;
+   uint32_t handle, data_requested, resid;
 
handle = ((ct2_entry_t *)arg)->ct_syshandle;
ccb = isp_find_xs(isp, handle);
@@ -2250,7 +2258,7 @@ isp_handle_platform_ctio(ispsoftc_t *isp
return;
}
isp_destroy_handle(isp, handle);
-   data_requested = PISP_PCMD(ccb)->datalen;
+   resid = data_requested = PISP_PCMD(ccb)->datalen;
isp_free_pcmd(isp, ccb);
if (isp->isp_nactive) {
isp->isp_nactive--;
@@ -2296,10 +2304,8 @@ isp_handle_platform_ctio(ispsoftc_t *isp
sentstatus = ct->ct_flags & CT7_SENDSTATUS;
ok = (ct->ct_nphdl == CT7_OK);
notify_cam = (ct->ct_header.rqs_seqno & 
ATPD_SEQ_NOTIFY_CAM) != 0;
-   if ((ct->ct_flags & CT7_DATAMASK) != CT7_NO_DATA) {
+   if ((ct->ct_flags & CT7_DATAMASK) != CT7_NO_DATA)
resid = ct->ct_resid;
-   moved_data = data_requested - resid;
-   }
  

Re: svn commit: r312679 - head/sys/arm/freescale/imx

2017-02-26 Thread Yoshiro MIHIRA
I tried Ian-san's patch, unfortunately it was not solved... If you have any
idea, please let me know...

2017年2月16日(木) 8:32 Ian Lepore :

> > > Author: ian
> > > Date: Tue Jan 24 02:09:30 2017
> > > New Revision: 312679
> > > URL: https://svnweb.freebsd.org/changeset/base/312679
> [...]
> On Wed, 2017-02-15 at 10:31 +, Yoshiro MIHIRA wrote:
> > Hi.
> > Ian
> >
> > Thank you for your strong effort to support imx6 board.
> >
> > I have SolidRun HummingBoard-i2(imx6dl-hummingboard).
> >
> > I have reboot issue(never reset after reboot) and if I use Linux, I
> > reproduce this issue So I reported this issue to SolidRun Forum.
> > http://forum.solid-run.com/linux-on-cubox-i-and-hummingboard-f8/need-
> > to-push-reset-button-to-reboot-linux-system-t3122.html
> > But I could not get any information.
> >
> > I tested latest kernel(r313280) unfortunately it was not solved.
> >
> > Do you know other information about reset issue, please let me know.
> >
> > Currently I need to push reset button when I restart system...
> >
> > Yours
> > Yoshiro MIHIRA
> >
>
> [adding arm@ list]
>
> Are you set up to build and test a custom kernel?  If so, try applying
> the patch I'm attaching to this mail and let me know if it helps.  This
> turns on a bit in the control register that is described in the manual
> as "use a new more robust method to generate a software reset" (if it's
> better, I wonder why they didn't make it the hardware default?).
>
> -- Ian
>
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Re: svn commit: r314087 - head/sys/x86/x86

2017-02-26 Thread Konstantin Belousov
On Sun, Feb 26, 2017 at 04:43:12AM +1100, Bruce Evans wrote:
> On Sat, 25 Feb 2017, Konstantin Belousov wrote:
> 
> > On Sat, Feb 25, 2017 at 02:17:23PM +1100, Bruce Evans wrote:
> >> On Fri, 24 Feb 2017, Konstantin Belousov wrote:
> >>
> >>> On Thu, Feb 23, 2017 at 06:33:43AM +1100, Bruce Evans wrote:
>  On Wed, 22 Feb 2017, Konstantin Belousov wrote:
> 
> > Log:
> >  More fixes for regression in r313898 on i386.
> >  Use long long constants where needed.
> 
>  The long long abomination is never needed, and is always a style bug.
> >>> I never saw any explanation behind this claim.  Esp. the first part
> >>> of it, WRT 'never needed'.
> >>
> >> I hope I wrote enough about this in log messages when I cleaned up the
> >> long longs 20 years ago :-).
> >>
> >> long long was a hack to work around intmax_t not existing and long being
> >> unexpandable in practice because it was used in ABIs.  It should have gone
> >> away when intmax_t was standardized.  Unfortunately, long long was
> >> standardised too.
> > It does not make a sense even more.  long long is native compiler type,
> 
> It is only native since C99 broke C under pressure from misimplementatations
> with long long.  In unbroken C, long is the longest type, and lots of code
> depended on this (the main correct main was casting integers to long for
> printing, and the main incorrect use was using long for almost everything
> while assuming that int is 16 or 32 bits and not using typedefs much).
> Correct implementations used an extended integer type (extended integer
> types were also nonstandard before C99, and making them longer than long
> also breaks C).
> 
> 4.4BSD used quad_t and required it to be not actually a quad int, but
> precisely 64 bits, and used long excessively (for example, pid_t was
> long on all arches).  This is essentially the long long mistake, with
> long long spelled better as quad_t, combined with similar mistakes
> from a previous generation where int was 16 bits.  Long was used
> excessively as a simple way to get integers with at least 32 bits,
> although BSD never supported systems with int smaller than 32 bits
> AFAIK, and 4.4BSD certainly didn't support such systems.
2.9 BSD was a port to PDP-11, AFAIK, with 16bit ints.

> But BSD
> broke the type of at least pid_t by sprinkling longs.  In FreeBSD-1
> from Net/2, pid_t was short.  BSD wanted to expand PID_MAX from 3,
> and did this wrong by expanding pid_t from short to long, just in time
> for this to be wrong in practice since 64-bit systems were becoming
> available so that long could easily be longer than int.
> 
> (Net)BSD for alpha wasn't burdened with ABIs requiring long to be 32
> bits, so it made long 64 bits and didn't need long long (except even
> plain long should be actually long, so it should be twice as wide as
> a register and thus 128 bits on alpha).  NetBSD cleaned up the
> sprinkling of longs at much the same time that 4.4BSD-Lite1 sprinkled
> them, to avoid getting silly sizes like 64 bits for pid_t and related
> compatibilityroblems.  I think NetBSD actually never imported 4.4BSD-
> Lite1, but later merged Lite1 or Lite2 and kept its typedefs instead
> of clobbering them with the long sprinkling.  FreeBSD was handicapped
> by the USL lawsuit.  It had to import Lite1.  It only fixed the long
> sprinkling much later by merging Lite2.  I think Lite2 got got the
> better types from NetBSD.  This is summarised in the FreeBSD commit
> log using essentially "Splat!" :-(.
> 
> > while anything_t is a typename to provide MI fixed type.  long long was
> > obviosvly choosen to extend types without requiring new keyword.
> 
> Abusing a standard keyword doesn't do much except ensure a syntax error
> if code with the extended type is compiler with a compiler that doesn't
> support the extension.  BSD's quad_t is in the application namespace.
> __quad_t would be better.
> 
> The errors are now being repeated with extensions to 128-bit integers.
> At least they are being spelled better as __int128_t instead of long
> long long or full doubling (long long long long = 128 bits).  C doesn't
> alllow __int128_t even as an extended type unless intmax_t is at least
> 128 bits.  Compatibility, ABI and bloat problems prevent enlarging
> intmax_t from 64 bits to 128 bits on LP64 systems just like they prevented
> the misimplementations enlarging long from 32 bits on LP32 and L32P64
> systems.
> 
> >> It is "never needed" since anything that can be done with it can be done
> >> better using intmax_t or intN_t or int_fastN_T or int_leastN_t.  Except,
> >> there is no suffix for explicit intmax_t constants, so you would have to
> >> write such constants using INTMAX_C() or better a cast to intmax_t if
> >> the constant is not needed in a cpp expression.
> > If you replace long long with int there, the same logical structure of
> > sentences will hold.  Does it mean that 'int' is abomination since we
> > have int32_t which allows everything to 

svn commit: r314295 - in head/sys: amd64/linux amd64/linux32 compat/linux i386/linux sys

2017-02-26 Thread Dmitry Chagin
Author: dchagin
Date: Sun Feb 26 09:48:18 2017
New Revision: 314295
URL: https://svnweb.freebsd.org/changeset/base/314295

Log:
  Implement timerfd family syscalls.
  
  MFC after:1 month

Modified:
  head/sys/amd64/linux/linux_dummy.c
  head/sys/amd64/linux32/linux32_dummy.c
  head/sys/compat/linux/linux_event.c
  head/sys/compat/linux/linux_event.h
  head/sys/compat/linux/linux_time.c
  head/sys/compat/linux/linux_timer.h
  head/sys/i386/linux/linux_dummy.c
  head/sys/sys/file.h

Modified: head/sys/amd64/linux/linux_dummy.c
==
--- head/sys/amd64/linux/linux_dummy.c  Sun Feb 26 09:42:34 2017
(r314294)
+++ head/sys/amd64/linux/linux_dummy.c  Sun Feb 26 09:48:18 2017
(r314295)
@@ -103,10 +103,6 @@ DUMMY(vmsplice);
 DUMMY(move_pages);
 /* linux 2.6.22: */
 DUMMY(signalfd);
-DUMMY(timerfd_create);
-/* linux 2.6.25: */
-DUMMY(timerfd_settime);
-DUMMY(timerfd_gettime);
 /* linux 2.6.27: */
 DUMMY(signalfd4);
 DUMMY(inotify_init1);

Modified: head/sys/amd64/linux32/linux32_dummy.c
==
--- head/sys/amd64/linux32/linux32_dummy.c  Sun Feb 26 09:42:34 2017
(r314294)
+++ head/sys/amd64/linux32/linux32_dummy.c  Sun Feb 26 09:48:18 2017
(r314295)
@@ -103,10 +103,6 @@ DUMMY(move_pages);
 DUMMY(getcpu);
 /* linux 2.6.22: */
 DUMMY(signalfd);
-DUMMY(timerfd_create);
-/* linux 2.6.25: */
-DUMMY(timerfd_settime);
-DUMMY(timerfd_gettime);
 /* linux 2.6.27: */
 DUMMY(signalfd4);
 DUMMY(inotify_init1);

Modified: head/sys/compat/linux/linux_event.c
==
--- head/sys/compat/linux/linux_event.c Sun Feb 26 09:42:34 2017
(r314294)
+++ head/sys/compat/linux/linux_event.c Sun Feb 26 09:48:18 2017
(r314295)
@@ -37,6 +37,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -63,6 +64,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
 
 /*
@@ -161,6 +163,41 @@ static struct filterops eventfd_wfiltops
.f_event = filt_eventfdwrite
 };
 
+/* timerfd */
+typedef uint64_t   timerfd_t;
+
+static fo_rdwr_t   timerfd_read;
+static fo_poll_t   timerfd_poll;
+static fo_kqfilter_t   timerfd_kqfilter;
+static fo_stat_t   timerfd_stat;
+static fo_close_t  timerfd_close;
+static fo_fill_kinfo_t timerfd_fill_kinfo;
+
+static struct fileops timerfdops = {
+   .fo_read = timerfd_read,
+   .fo_write = invfo_rdwr,
+   .fo_truncate = invfo_truncate,
+   .fo_ioctl = invfo_ioctl,
+   .fo_poll = timerfd_poll,
+   .fo_kqfilter = timerfd_kqfilter,
+   .fo_stat = timerfd_stat,
+   .fo_close = timerfd_close,
+   .fo_chmod = invfo_chmod,
+   .fo_chown = invfo_chown,
+   .fo_sendfile = invfo_sendfile,
+   .fo_fill_kinfo = timerfd_fill_kinfo,
+   .fo_flags = DFLAG_PASSABLE
+};
+
+static voidfilt_timerfddetach(struct knote *kn);
+static int filt_timerfdread(struct knote *kn, long hint);
+
+static struct filterops timerfd_rfiltops = {
+   .f_isfd = 1,
+   .f_detach = filt_timerfddetach,
+   .f_event = filt_timerfdread
+};
+
 struct eventfd {
eventfd_t   efd_count;
uint32_tefd_flags;
@@ -168,7 +205,19 @@ struct eventfd {
struct mtx  efd_lock;
 };
 
+struct timerfd {
+   clockid_t   tfd_clockid;
+   struct itimerspec tfd_time;
+   struct callout  tfd_callout;
+   timerfd_t   tfd_count;
+   booltfd_canceled;
+   struct selinfo  tfd_sel;
+   struct mtx  tfd_lock;
+};
+
 static int eventfd_create(struct thread *td, uint32_t initval, int flags);
+static voidlinux_timerfd_expire(void *);
+static voidlinux_timerfd_curval(struct timerfd *, struct itimerspec *);
 
 
 static void
@@ -901,3 +950,360 @@ eventfd_fill_kinfo(struct file *fp, stru
kif->kf_type = KF_TYPE_UNKNOWN;
return (0);
 }
+
+int
+linux_timerfd_create(struct thread *td, struct linux_timerfd_create_args *args)
+{
+   struct filedesc *fdp;
+   struct timerfd *tfd;
+   struct file *fp;
+   clockid_t clockid;
+   int fflags, fd, error;
+
+   if ((args->flags & ~LINUX_TFD_CREATE_FLAGS) != 0)
+   return (EINVAL);
+
+   error = linux_to_native_clockid(, args->clockid);
+   if (error != 0)
+   return (error);
+   if (clockid != CLOCK_REALTIME && clockid != CLOCK_MONOTONIC)
+   return (EINVAL);
+
+   fflags = 0;
+   if ((args->flags & LINUX_TFD_CLOEXEC) != 0)
+   fflags |= O_CLOEXEC;
+
+   fdp = td->td_proc->p_fd;
+   error = falloc(td, , , fflags);
+   if (error != 0)
+   return (error);
+
+   tfd = malloc(sizeof(*tfd), M_EPOLL, M_WAITOK | M_ZERO);
+   tfd->tfd_clockid = clockid;
+   mtx_init(>tfd_lock, "timerfd", 

svn commit: r314294 - head/sys/compat/linux

2017-02-26 Thread Dmitry Chagin
Author: dchagin
Date: Sun Feb 26 09:42:34 2017
New Revision: 314294
URL: https://svnweb.freebsd.org/changeset/base/314294

Log:
  Nostly style(9) changes, replace unused eventfd_truncate()
  by default invfo_truncate() method.
  
  MFC after:1 month

Modified:
  head/sys/compat/linux/linux_event.c

Modified: head/sys/compat/linux/linux_event.c
==
--- head/sys/compat/linux/linux_event.c Sun Feb 26 09:40:42 2017
(r314293)
+++ head/sys/compat/linux/linux_event.c Sun Feb 26 09:42:34 2017
(r314294)
@@ -123,7 +123,6 @@ typedef uint64_teventfd_t;
 
 static fo_rdwr_t   eventfd_read;
 static fo_rdwr_t   eventfd_write;
-static fo_truncate_t   eventfd_truncate;
 static fo_ioctl_t  eventfd_ioctl;
 static fo_poll_t   eventfd_poll;
 static fo_kqfilter_t   eventfd_kqfilter;
@@ -134,7 +133,7 @@ static fo_fill_kinfo_t  eventfd_fill_kinf
 static struct fileops eventfdops = {
.fo_read = eventfd_read,
.fo_write = eventfd_write,
-   .fo_truncate = eventfd_truncate,
+   .fo_truncate = invfo_truncate,
.fo_ioctl = eventfd_ioctl,
.fo_poll = eventfd_poll,
.fo_kqfilter = eventfd_kqfilter,
@@ -207,7 +206,7 @@ epoll_create_common(struct thread *td, i
int error;
 
error = kern_kqueue(td, flags, NULL);
-   if (error)
+   if (error != 0)
return (error);
 
epoll_fd_install(td, EPOLL_DEF_SZ, 0);
@@ -378,7 +377,7 @@ epoll_kev_copyin(void *arg, struct keven
struct epoll_copyin_args *args;
 
args = (struct epoll_copyin_args*) arg;
-   
+
memcpy(kevp, args->changelist, count * sizeof(*kevp));
args->changelist += count;
 
@@ -438,7 +437,7 @@ linux_epoll_ctl(struct thread *td, struc
 * EVFILT_READ and EVFILT_WRITE, ignoring any errors
 */
error = epoll_delete_all_events(td, epfp, args->fd);
-   if (error)
+   if (error != 0)
goto leave0;
/* FALLTHROUGH */
 
@@ -458,7 +457,7 @@ linux_epoll_ctl(struct thread *td, struc
 
error = epoll_to_kevent(td, epfp, args->fd, , _flags,
kev, );
-   if (error)
+   if (error != 0)
goto leave0;
 
epoll_fd_install(td, args->fd, le.data);
@@ -622,7 +621,7 @@ eventfd_create(struct thread *td, uint32
 
fdp = td->td_proc->p_fd;
error = falloc(td, , , fflags);
-   if (error)
+   if (error != 0)
return (error);
 
efd = malloc(sizeof(*efd), M_EPOLL, M_WAITOK | M_ZERO);
@@ -681,7 +680,7 @@ eventfd_close(struct file *fp, struct th
 
 static int
 eventfd_read(struct file *fp, struct uio *uio, struct ucred *active_cred,
-   int flags, struct thread *td)
+int flags, struct thread *td)
 {
struct eventfd *efd;
eventfd_t count;
@@ -727,7 +726,7 @@ retry:
 
 static int
 eventfd_write(struct file *fp, struct uio *uio, struct ucred *active_cred,
-int flags, struct thread *td)
+ int flags, struct thread *td)
 {
struct eventfd *efd;
eventfd_t count;
@@ -741,7 +740,7 @@ eventfd_write(struct file *fp, struct ui
return (EINVAL);
 
error = uiomove(, sizeof(eventfd_t), uio);
-   if (error)
+   if (error != 0)
return (error);
if (count == UINT64_MAX)
return (EINVAL);
@@ -773,7 +772,7 @@ retry:
 
 static int
 eventfd_poll(struct file *fp, int events, struct ucred *active_cred,
-   struct thread *td)
+struct thread *td)
 {
struct eventfd *efd;
int revents = 0;
@@ -862,17 +861,8 @@ filt_eventfdwrite(struct knote *kn, long
 
 /*ARGSUSED*/
 static int
-eventfd_truncate(struct file *fp, off_t length, struct ucred *active_cred,
-   struct thread *td)
-{
-
-   return (ENXIO);
-}
-
-/*ARGSUSED*/
-static int
 eventfd_ioctl(struct file *fp, u_long cmd, void *data,
-   struct ucred *active_cred, struct thread *td)
+struct ucred *active_cred, struct thread *td)
 {
struct eventfd *efd;
 
@@ -897,7 +887,7 @@ eventfd_ioctl(struct file *fp, u_long cm
 /*ARGSUSED*/
 static int
 eventfd_stat(struct file *fp, struct stat *st, struct ucred *active_cred,
-   struct thread *td)
+struct thread *td)
 {
 
return (ENXIO);
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r314293 - head/sys/compat/linux

2017-02-26 Thread Dmitry Chagin
Author: dchagin
Date: Sun Feb 26 09:40:42 2017
New Revision: 314293
URL: https://svnweb.freebsd.org/changeset/base/314293

Log:
  Return EOVERFLOW error in case then the size of tv_sec field of struct 
timespec
  in COMPAT_LINUX32 Linuxulator's not equal to the size of native tv_sec.
  
  MFC after:1 month

Modified:
  head/sys/compat/linux/linux_misc.c
  head/sys/compat/linux/linux_time.c
  head/sys/compat/linux/linux_timer.h

Modified: head/sys/compat/linux/linux_misc.c
==
--- head/sys/compat/linux/linux_misc.c  Sun Feb 26 09:37:25 2017
(r314292)
+++ head/sys/compat/linux/linux_misc.c  Sun Feb 26 09:40:42 2017
(r314293)
@@ -2290,8 +2290,9 @@ linux_pselect6(struct thread *td, struct
 
TIMEVAL_TO_TIMESPEC(, );
 
-   native_to_linux_timespec(, );
-   error = copyout(, args->tsp, sizeof(lts));
+   error = native_to_linux_timespec(, );
+   if (error == 0)
+   error = copyout(, args->tsp, sizeof(lts));
}
 
return (error);
@@ -2343,8 +2344,9 @@ linux_ppoll(struct thread *td, struct li
} else
timespecclear();
 
-   native_to_linux_timespec(, );
-   error = copyout(, args->tsp, sizeof(lts));
+   error = native_to_linux_timespec(, );
+   if (error == 0)
+   error = copyout(, args->tsp, sizeof(lts));
}
 
return (error);
@@ -2438,7 +2440,9 @@ linux_sched_rr_get_interval(struct threa
PROC_UNLOCK(tdt->td_proc);
if (error != 0)
return (error);
-   native_to_linux_timespec(, );
+   error = native_to_linux_timespec(, );
+   if (error != 0)
+   return (error);
return (copyout(, uap->interval, sizeof(lts)));
 }
 

Modified: head/sys/compat/linux/linux_time.c
==
--- head/sys/compat/linux/linux_time.c  Sun Feb 26 09:37:25 2017
(r314292)
+++ head/sys/compat/linux/linux_time.c  Sun Feb 26 09:40:42 2017
(r314293)
@@ -41,6 +41,7 @@ __KERNEL_RCSID(0, "$NetBSD: linux_time.c
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -118,16 +119,21 @@ LIN_SDT_PROBE_DEFINE1(time, linux_clock_
 LIN_SDT_PROBE_DEFINE1(time, linux_clock_nanosleep, return, "int");
 
 
-void
+int
 native_to_linux_timespec(struct l_timespec *ltp, struct timespec *ntp)
 {
 
LIN_SDT_PROBE2(time, native_to_linux_timespec, entry, ltp, ntp);
-
+#ifdef COMPAT_LINUX32
+   if (ntp->tv_sec > INT_MAX &&
+   sizeof(ltp->tv_sec) != sizeof(ntp->tv_sec))
+   return (EOVERFLOW);
+#endif
ltp->tv_sec = ntp->tv_sec;
ltp->tv_nsec = ntp->tv_nsec;
 
LIN_SDT_PROBE0(time, native_to_linux_timespec, return);
+   return (0);
 }
 
 int
@@ -322,8 +328,9 @@ linux_clock_gettime(struct thread *td, s
LIN_SDT_PROBE1(time, linux_clock_gettime, return, error);
return (error);
}
-   native_to_linux_timespec(, );
-
+   error = native_to_linux_timespec(, );
+   if (error != 0)
+   return (error);
error = copyout(, args->tp, sizeof lts);
if (error != 0)
LIN_SDT_PROBE1(time, linux_clock_gettime, copyout_error, error);
@@ -450,8 +457,9 @@ linux_clock_getres(struct thread *td, st
LIN_SDT_PROBE1(time, linux_clock_getres, return, error);
return (error);
}
-   native_to_linux_timespec(, );
-
+   error = native_to_linux_timespec(, );
+   if (error != 0)
+   return (error);
error = copyout(, args->tp, sizeof lts);
if (error != 0)
LIN_SDT_PROBE1(time, linux_clock_getres, copyout_error, error);
@@ -490,7 +498,9 @@ linux_nanosleep(struct thread *td, struc
}
error = kern_nanosleep(td, , rmtp);
if (args->rmtp != NULL) {
-   native_to_linux_timespec(, rmtp);
+   error2 = native_to_linux_timespec(, rmtp);
+   if (error2 != 0)
+   return (error2);
error2 = copyout(, args->rmtp, sizeof(lrmts));
if (error2 != 0) {
LIN_SDT_PROBE1(time, linux_nanosleep, copyout_error,
@@ -553,7 +563,9 @@ linux_clock_nanosleep(struct thread *td,
error = kern_nanosleep(td, , rmtp);
if (args->rmtp != NULL) {
/* XXX. Not for TIMER_ABSTIME */
-   native_to_linux_timespec(, rmtp);
+   error2 = native_to_linux_timespec(, rmtp);
+   if (error2 != 0)
+   return (error2);
error2 = copyout(, args->rmtp, sizeof(lrmts));
if (error2 != 0) {
LIN_SDT_PROBE1(time, linux_clock_nanosleep,

Modified: head/sys/compat/linux/linux_timer.h

svn commit: r314292 - in head/sys: amd64/linux amd64/linux32 i386/linux

2017-02-26 Thread Dmitry Chagin
Author: dchagin
Date: Sun Feb 26 09:37:25 2017
New Revision: 314292
URL: https://svnweb.freebsd.org/changeset/base/314292

Log:
  Regen after r314291 (timerfd definition).
  
  MFC after:1 month

Modified:
  head/sys/amd64/linux/linux_proto.h
  head/sys/amd64/linux/linux_sysent.c
  head/sys/amd64/linux/linux_systrace_args.c
  head/sys/amd64/linux32/linux32_proto.h
  head/sys/amd64/linux32/linux32_sysent.c
  head/sys/amd64/linux32/linux32_systrace_args.c
  head/sys/i386/linux/linux_proto.h
  head/sys/i386/linux/linux_sysent.c
  head/sys/i386/linux/linux_systrace_args.c

Modified: head/sys/amd64/linux/linux_proto.h
==
--- head/sys/amd64/linux/linux_proto.h  Sun Feb 26 09:35:44 2017
(r314291)
+++ head/sys/amd64/linux/linux_proto.h  Sun Feb 26 09:37:25 2017
(r314292)
@@ -1000,7 +1000,8 @@ struct linux_signalfd_args {
register_t dummy;
 };
 struct linux_timerfd_create_args {
-   register_t dummy;
+   char clockid_l_[PADL_(l_int)]; l_int clockid; char 
clockid_r_[PADR_(l_int)];
+   char flags_l_[PADL_(l_int)]; l_int flags; char flags_r_[PADR_(l_int)];
 };
 struct linux_eventfd_args {
char initval_l_[PADL_(l_uint)]; l_uint initval; char 
initval_r_[PADR_(l_uint)];
@@ -1012,10 +1013,14 @@ struct linux_fallocate_args {
char len_l_[PADL_(l_loff_t)]; l_loff_t len; char 
len_r_[PADR_(l_loff_t)];
 };
 struct linux_timerfd_settime_args {
-   register_t dummy;
+   char fd_l_[PADL_(l_int)]; l_int fd; char fd_r_[PADR_(l_int)];
+   char flags_l_[PADL_(l_int)]; l_int flags; char flags_r_[PADR_(l_int)];
+   char new_value_l_[PADL_(const struct l_itimerspec *)]; const struct 
l_itimerspec * new_value; char new_value_r_[PADR_(const struct l_itimerspec *)];
+   char old_value_l_[PADL_(struct l_itimerspec *)]; struct l_itimerspec * 
old_value; char old_value_r_[PADR_(struct l_itimerspec *)];
 };
 struct linux_timerfd_gettime_args {
-   register_t dummy;
+   char fd_l_[PADL_(l_int)]; l_int fd; char fd_r_[PADR_(l_int)];
+   char old_value_l_[PADL_(struct l_itimerspec *)]; struct l_itimerspec * 
old_value; char old_value_r_[PADR_(struct l_itimerspec *)];
 };
 struct linux_accept4_args {
char s_l_[PADL_(l_int)]; l_int s; char s_r_[PADR_(l_int)];

Modified: head/sys/amd64/linux/linux_sysent.c
==
--- head/sys/amd64/linux/linux_sysent.c Sun Feb 26 09:35:44 2017
(r314291)
+++ head/sys/amd64/linux/linux_sysent.c Sun Feb 26 09:37:25 2017
(r314292)
@@ -300,11 +300,11 @@ struct sysent linux_sysent[] = {
{ AS(linux_utimensat_args), (sy_call_t *)linux_utimensat, 
AUE_FUTIMESAT, NULL, 0, 0, 0, SY_THR_STATIC },/* 280 = linux_utimensat 
*/
{ AS(linux_epoll_pwait_args), (sy_call_t *)linux_epoll_pwait, AUE_NULL, 
NULL, 0, 0, 0, SY_THR_STATIC }, /* 281 = linux_epoll_pwait */
{ 0, (sy_call_t *)linux_signalfd, AUE_NULL, NULL, 0, 0, 0, 
SY_THR_STATIC }, /* 282 = linux_signalfd */
-   { 0, (sy_call_t *)linux_timerfd_create, AUE_NULL, NULL, 0, 0, 0, 
SY_THR_STATIC },   /* 283 = linux_timerfd_create */
+   { AS(linux_timerfd_create_args), (sy_call_t *)linux_timerfd_create, 
AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },   /* 283 = linux_timerfd_create */
{ AS(linux_eventfd_args), (sy_call_t *)linux_eventfd, AUE_NULL, NULL, 
0, 0, 0, SY_THR_STATIC }, /* 284 = linux_eventfd */
{ AS(linux_fallocate_args), (sy_call_t *)linux_fallocate, AUE_NULL, 
NULL, 0, 0, 0, SY_THR_STATIC }, /* 285 = linux_fallocate */
-   { 0, (sy_call_t *)linux_timerfd_settime, AUE_NULL, NULL, 0, 0, 0, 
SY_THR_STATIC },  /* 286 = linux_timerfd_settime */
-   { 0, (sy_call_t *)linux_timerfd_gettime, AUE_NULL, NULL, 0, 0, 0, 
SY_THR_STATIC },  /* 287 = linux_timerfd_gettime */
+   { AS(linux_timerfd_settime_args), (sy_call_t *)linux_timerfd_settime, 
AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 286 = linux_timerfd_settime */
+   { AS(linux_timerfd_gettime_args), (sy_call_t *)linux_timerfd_gettime, 
AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 287 = linux_timerfd_gettime */
{ AS(linux_accept4_args), (sy_call_t *)linux_accept4, AUE_ACCEPT, NULL, 
0, 0, 0, SY_THR_STATIC },   /* 288 = linux_accept4 */
{ 0, (sy_call_t *)linux_signalfd4, AUE_NULL, NULL, 0, 0, 0, 
SY_THR_STATIC },/* 289 = linux_signalfd4 */
{ AS(linux_eventfd2_args), (sy_call_t *)linux_eventfd2, AUE_NULL, NULL, 
0, 0, 0, SY_THR_STATIC },   /* 290 = linux_eventfd2 */

Modified: head/sys/amd64/linux/linux_systrace_args.c
==
--- head/sys/amd64/linux/linux_systrace_args.c  Sun Feb 26 09:35:44 2017
(r314291)
+++ head/sys/amd64/linux/linux_systrace_args.c  Sun Feb 26 09:37:25 2017
(r314292)
@@ -2078,7 +2078,10 @@ systrace_args(int sysnum, void *params, 
}
  

svn commit: r314291 - in head/sys: amd64/linux amd64/linux32 i386/linux

2017-02-26 Thread Dmitry Chagin
Author: dchagin
Date: Sun Feb 26 09:35:44 2017
New Revision: 314291
URL: https://svnweb.freebsd.org/changeset/base/314291

Log:
  Change Linuxulator timerfd syscalls definition to match actual Linux one.
  
  MFC after:1 month

Modified:
  head/sys/amd64/linux/syscalls.master
  head/sys/amd64/linux32/syscalls.master
  head/sys/i386/linux/syscalls.master

Modified: head/sys/amd64/linux/syscalls.master
==
--- head/sys/amd64/linux/syscalls.masterSun Feb 26 06:25:55 2017
(r314290)
+++ head/sys/amd64/linux/syscalls.masterSun Feb 26 09:35:44 2017
(r314291)
@@ -475,12 +475,15 @@
 281 AUE_NULLSTD { int linux_epoll_pwait(l_int epfd, struct 
epoll_event *events, \
 l_int maxevents, l_int timeout, 
l_sigset_t *mask); }
 282AUE_NULLSTD { int linux_signalfd(void); }
-283AUE_NULLSTD { int linux_timerfd_create(void); }
+283AUE_NULLSTD { int linux_timerfd_create(l_int clockid, l_int 
flags); }
 284AUE_NULLSTD { int linux_eventfd(l_uint initval); }
 285AUE_NULLSTD { int linux_fallocate(l_int fd, l_int mode, \
l_loff_t offset, l_loff_t len); }
-286AUE_NULLSTD { int linux_timerfd_settime(void); }
-287AUE_NULLSTD { int linux_timerfd_gettime(void); }
+286AUE_NULLSTD { int linux_timerfd_settime(l_int fd, l_int 
flags,  \
+   const struct l_itimerspec *new_value,   
\
+   struct l_itimerspec *old_value); }
+287AUE_NULLSTD { int linux_timerfd_gettime(l_int fd,   \
+   struct l_itimerspec *old_value); }
 288AUE_ACCEPT  STD { int linux_accept4(l_int s, l_uintptr_t addr, \
l_uintptr_t namelen, int flags); }
 ; linux 2.6.27:

Modified: head/sys/amd64/linux32/syscalls.master
==
--- head/sys/amd64/linux32/syscalls.master  Sun Feb 26 06:25:55 2017
(r314290)
+++ head/sys/amd64/linux32/syscalls.master  Sun Feb 26 09:35:44 2017
(r314291)
@@ -538,14 +538,17 @@
 320AUE_FUTIMESAT   STD { int linux_utimensat(l_int dfd, const char 
*pathname, \
const struct l_timespec *times, l_int 
flags); }
 321AUE_NULLSTD { int linux_signalfd(void); }
-322AUE_NULLSTD { int linux_timerfd_create(void); }
+322AUE_NULLSTD { int linux_timerfd_create(l_int clockid, l_int 
flags); }
 323AUE_NULLSTD { int linux_eventfd(l_uint initval); }
 ; linux 2.6.23:
 324AUE_NULLSTD { int linux_fallocate(l_int fd, l_int mode, \
l_loff_t offset, l_loff_t len); }
 ; linux 2.6.25:
-325AUE_NULLSTD { int linux_timerfd_settime(void); }
-326AUE_NULLSTD { int linux_timerfd_gettime(void); }
+325AUE_NULLSTD { int linux_timerfd_settime(l_int fd, l_int 
flags,  \
+   const struct l_itimerspec *new_value,   
\
+   struct l_itimerspec *old_value); }
+326AUE_NULLSTD { int linux_timerfd_gettime(l_int fd,   \
+   struct l_itimerspec *old_value); }
 ; linux 2.6.27:
 327AUE_NULLSTD { int linux_signalfd4(void); }
 328AUE_NULLSTD { int linux_eventfd2(l_uint initval, l_int 
flags); }

Modified: head/sys/i386/linux/syscalls.master
==
--- head/sys/i386/linux/syscalls.master Sun Feb 26 06:25:55 2017
(r314290)
+++ head/sys/i386/linux/syscalls.master Sun Feb 26 09:35:44 2017
(r314291)
@@ -546,14 +546,17 @@
 320AUE_FUTIMESAT   STD { int linux_utimensat(l_int dfd, const char 
*pathname, \
const struct l_timespec *times, l_int 
flags); }
 321AUE_NULLSTD { int linux_signalfd(void); }
-322AUE_NULLSTD { int linux_timerfd_create(void); }
+322AUE_NULLSTD { int linux_timerfd_create(l_int clockid, l_int 
flags); }
 323AUE_NULLSTD { int linux_eventfd(l_uint initval); }
 ; linux 2.6.23:
 324AUE_NULLSTD { int linux_fallocate(l_int fd, l_int mode, \
l_loff_t offset, l_loff_t len); }
 ; linux 2.6.25:
-325AUE_NULLSTD { int linux_timerfd_settime(void); }
-326AUE_NULLSTD { int linux_timerfd_gettime(void); }
+325AUE_NULLSTD { int linux_timerfd_settime(l_int fd, l_int 
flags,  \
+   const struct l_itimerspec *new_value,   
   

Re: svn commit: r314212 - head/sys/dev/uart

2017-02-26 Thread Emmanuel Vadot

 Hello,

 This break uart in ARM.
 Based on the comment of the macros since we're using our own device
the ealier code was correct.

 Cheers,

On Fri, 24 Feb 2017 16:37:35 + (UTC)
Ruslan Bukin  wrote:

> Author: br
> Date: Fri Feb 24 16:37:35 2017
> New Revision: 314212
> URL: https://svnweb.freebsd.org/changeset/base/314212
> 
> Log:
>   Use correct macro for Synopsys UART driver declaration.
> 
> Modified:
>   head/sys/dev/uart/uart_dev_snps.c
> 
> Modified: head/sys/dev/uart/uart_dev_snps.c
> ==
> --- head/sys/dev/uart/uart_dev_snps.c Fri Feb 24 16:11:55 2017
> (r314211)
> +++ head/sys/dev/uart/uart_dev_snps.c Fri Feb 24 16:37:35 2017
> (r314212)
> @@ -104,7 +104,7 @@ static struct ofw_compat_data compat_dat
>   { "snps,dw-apb-uart",   (uintptr_t)_snps_class },
>   { NULL, (uintptr_t)NULL }
>  };
> -UART_FDT_CLASS(compat_data);
> +UART_FDT_CLASS_AND_DEVICE(compat_data);
>  
>  #ifdef EXT_RESOURCES
>  static int


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


Re: svn commit: r314036 - head/usr.sbin/bsdinstall/scripts

2017-02-26 Thread Joel Dahl
On Wed, Feb 22, 2017 at 06:10:04PM -0500, Allan Jude wrote:



> Core is soon to announce a more formalized way to discuss and reach
> consensus on these types of changes. robak@ can I ask that you back this
> out for now, and we use that process to determine what the right set of
> knobs to turn on by default is, and which should be up to the user.

This hasn't been backed out yet.

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