Re: svn commit: r349391 - head/sys/kern

2019-07-17 Thread Bruce Evans

On Tue, 16 Jul 2019, Alan Somers wrote:


On Tue, Jul 16, 2019 at 3:48 AM Bruce Evans  wrote:


On Mon, 15 Jul 2019, John Baldwin wrote:

...
I'm not sure which variants are most readable:

...

C)
   if (fp->f_seqcount + howmany(resid, 16384) < fp->f_seqcount)
   fp->f_seqcount = IO_SEQMAX;
   else
   fp->f_seqcount = lmin(IO_SEQMAX,
   fp->f_seqcount + howmany(resid, 16384));

I'm probably not a fan of C).


On supported arches, it recovers from overflow in howmany(), but only if
the compiler doesn't optimize away the recovery.

The first part can be done better:

if (uio->uio_resid >= IO_SEQMAX * 16384)
fp->f_seqcount = IO_SEQMAX;

Then for the second part, any version works since all values are small and
non-negative, but I prefer to restore the the version that I rewrote 15-20
years ago and committed 11 years ago (r175106):

fp->f_seqcount += howmany(uio->uio_resid, 16384);
if (fp->f_seqcount > IO_SEQMAX)
fp->f_seqcount = IO_SEQMAX;
...

Bruce,
   Is this how you want it?
Index: sys/kern/vfs_vnops.c
===
--- sys/kern/vfs_vnops.c(revision 349977)
+++ sys/kern/vfs_vnops.c(working copy)
@@ -499,8 +499,13 @@
 * closely related to the best I/O size for real disks than
 * to any block size used by software.
 */
-fp->f_seqcount += lmin(IO_SEQMAX,
-howmany(uio->uio_resid, 16384));
+if (uio->uio_resid >= IO_SEQMAX * 16384)
+fp->f_seqcount = IO_SEQMAX;
+else {
+fp->f_seqcount += howmany(uio->uio_resid, 16384);
+if (fp->f_seqcount > IO_SEQMAX)
+fp->f_seqcount = IO_SEQMAX;
+}
return (fp->f_seqcount << IO_SEQSHIFT);
}


That looks OK, except it is misformatted with tabs corrupted to other than
8 spaces.

I checked that uio_resid is checked by some callers to be >= 0, so we
don't have to check that here.  (Callers between userland and here
start with size_t nbytes or an array of sizes for readv(), and have
to check that nbytes or the sum of the sizes fits in ssize_t, else
overflow would alread have occurred on assigment to uio_resid.  Callers
that construct a uio that is not so directly controlled by userland
presumably don't construct ones with unusable sizes.)

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"


Re: svn commit: r350079 - in head: share/zoneinfo usr.sbin/tzsetup

2019-07-17 Thread Philip Paeps

On 2019-07-17 06:17:28 (+), Thomas Munro wrote:

Author: tmunro
Date: Wed Jul 17 06:17:27 2019
New Revision: 350079
URL: https://svnweb.freebsd.org/changeset/base/350079

Log:
 tzsetup: upgrade to zone1970.tab

 zone.tab is deprecated.  Install zone1970.tab alongside it, and use it
 for tzsetup(8).  This is also useful for other applications that need
 the modern better maintained file.

 Reviewed by: philip
 Approved by: allanjude (mentor)
 MFC after: 2 weeks
 Differential Revision: https://reviews.freebsd.org/D20646


Thank you!

Philip

--
Philip Paeps
Senior Reality Engineer
Alternative Enterprises
___
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: r349391 - head/sys/kern

2019-07-17 Thread Alan Somers
On Wed, Jul 17, 2019 at 8:07 AM Bruce Evans  wrote:
>
> On Tue, 16 Jul 2019, Alan Somers wrote:
>
> > On Tue, Jul 16, 2019 at 3:48 AM Bruce Evans  wrote:
> >>
> >> On Mon, 15 Jul 2019, John Baldwin wrote:
> >>> ...
> >>> I'm not sure which variants are most readable:
> >> ...
> >>> C)
> >>>if (fp->f_seqcount + howmany(resid, 16384) < fp->f_seqcount)
> >>>fp->f_seqcount = IO_SEQMAX;
> >>>else
> >>>fp->f_seqcount = lmin(IO_SEQMAX,
> >>>fp->f_seqcount + howmany(resid, 16384));
> >>>
> >>> I'm probably not a fan of C).
> >>
> >> On supported arches, it recovers from overflow in howmany(), but only if
> >> the compiler doesn't optimize away the recovery.
> >>
> >> The first part can be done better:
> >>
> >> if (uio->uio_resid >= IO_SEQMAX * 16384)
> >> fp->f_seqcount = IO_SEQMAX;
> >>
> >> Then for the second part, any version works since all values are small and
> >> non-negative, but I prefer to restore the the version that I rewrote 15-20
> >> years ago and committed 11 years ago (r175106):
> >>
> >> fp->f_seqcount += howmany(uio->uio_resid, 16384);
> >> if (fp->f_seqcount > IO_SEQMAX)
> >> fp->f_seqcount = IO_SEQMAX;
> >> ...
> > Bruce,
> >Is this how you want it?
> > Index: sys/kern/vfs_vnops.c
> > ===
> > --- sys/kern/vfs_vnops.c(revision 349977)
> > +++ sys/kern/vfs_vnops.c(working copy)
> > @@ -499,8 +499,13 @@
> >  * closely related to the best I/O size for real disks than
> >  * to any block size used by software.
> >  */
> > -fp->f_seqcount += lmin(IO_SEQMAX,
> > -howmany(uio->uio_resid, 16384));
> > +if (uio->uio_resid >= IO_SEQMAX * 16384)
> > +fp->f_seqcount = IO_SEQMAX;
> > +else {
> > +fp->f_seqcount += howmany(uio->uio_resid, 16384);
> > +if (fp->f_seqcount > IO_SEQMAX)
> > +fp->f_seqcount = IO_SEQMAX;
> > +}
> > return (fp->f_seqcount << IO_SEQSHIFT);
> > }
>
> That looks OK, except it is misformatted with tabs corrupted to other than
> 8 spaces.

The screwed up whitespace is just an artifact of gmail.

>
> I checked that uio_resid is checked by some callers to be >= 0, so we
> don't have to check that here.  (Callers between userland and here
> start with size_t nbytes or an array of sizes for readv(), and have
> to check that nbytes or the sum of the sizes fits in ssize_t, else
> overflow would alread have occurred on assigment to uio_resid.  Callers
> that construct a uio that is not so directly controlled by userland
> presumably don't construct ones with unusable sizes.)
>
> Bruce

Ok, I'll commit it then.
___
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: r350082 - head/cddl/contrib/opensolaris/lib/libctf/common

2019-07-17 Thread Mark Johnston
Author: markj
Date: Wed Jul 17 16:31:50 2019
New Revision: 350082
URL: https://svnweb.freebsd.org/changeset/base/350082

Log:
  Reference stdint.h types in ctf.5.
  
  MFC after:1 week

Modified:
  head/cddl/contrib/opensolaris/lib/libctf/common/ctf.5

Modified: head/cddl/contrib/opensolaris/lib/libctf/common/ctf.5
==
--- head/cddl/contrib/opensolaris/lib/libctf/common/ctf.5   Wed Jul 17 
14:17:50 2019(r350081)
+++ head/cddl/contrib/opensolaris/lib/libctf/common/ctf.5   Wed Jul 17 
16:31:50 2019(r350082)
@@ -231,9 +231,9 @@ The
 is defined as follows:
 .Bd -literal
 typedef struct ctf_preamble {
-   ushort_t ctp_magic; /* magic number (CTF_MAGIC) */
-   uchar_t ctp_version;/* data format version number (CTF_VERSION) */
-   uchar_t ctp_flags;  /* flags (see below) */
+   uint16_t ctp_magic; /* magic number (CTF_MAGIC) */
+   uint8_t ctp_version;/* data format version number (CTF_VERSION) */
+   uint8_t ctp_flags;  /* flags (see below) */
 } ctf_preamble_t;
 .Ed
 .Pp
@@ -313,14 +313,14 @@ and the two have a combined size of 36 bytes.
 .Bd -literal
 typedef struct ctf_header {
ctf_preamble_t cth_preamble;
-   uint_t cth_parlabel;/* ref to name of parent lbl uniq'd against */
-   uint_t cth_parname; /* ref to basename of parent */
-   uint_t cth_lbloff;  /* offset of label section */
-   uint_t cth_objtoff; /* offset of object section */
-   uint_t cth_funcoff; /* offset of function section */
-   uint_t cth_typeoff; /* offset of type section */
-   uint_t cth_stroff;  /* offset of string section */
-   uint_t cth_strlen;  /* length of string section in bytes */
+   uint32_t cth_parlabel;  /* ref to name of parent lbl uniq'd against */
+   uint32_t cth_parname;   /* ref to basename of parent */
+   uint32_t cth_lbloff;/* offset of label section */
+   uint32_t cth_objtoff;   /* offset of object section */
+   uint32_t cth_funcoff;   /* offset of function section */
+   uint32_t cth_typeoff;   /* offset of type section */
+   uint32_t cth_stroff;/* offset of string section */
+   uint32_t cth_strlen;/* length of string section in bytes */
 } ctf_header_t;
 .Ed
 .Pp
@@ -541,8 +541,8 @@ Each label is encoded in the file format using the fol
 structure:
 .Bd -literal
 typedef struct ctf_lblent {
-   uint_t ctl_label;   /* ref to name of label */
-   uint_t ctl_typeidx; /* last type associated with this label */
+   uint32_t ctl_label; /* ref to name of label */
+   uint32_t ctl_typeidx;   /* last type associated with this label */
 } ctf_lblent_t;
 .Ed
 .Lp
@@ -728,23 +728,23 @@ The following definitions describe the short and long 
 #defineCTF_MAX_LSIZE   UINT64_MAX
 
 typedef struct ctf_stype {
-   uint_t ctt_name;/* reference to name in string table */
-   ushort_t ctt_info;  /* encoded kind, variant length */
+   uint32_t ctt_name;  /* reference to name in string table */
+   uint16_t ctt_info;  /* encoded kind, variant length */
union {
-   ushort_t _size; /* size of entire type in bytes */
-   ushort_t _type; /* reference to another type */
+   uint16_t _size; /* size of entire type in bytes */
+   uint16_t _type; /* reference to another type */
} _u;
 } ctf_stype_t;
 
 typedef struct ctf_type {
-   uint_t ctt_name;/* reference to name in string table */
-   ushort_t ctt_info;  /* encoded kind, variant length */
+   uint32_t ctt_name;  /* reference to name in string table */
+   uint16_t ctt_info;  /* encoded kind, variant length */
union {
-   ushort_t _size; /* always CTF_LSIZE_SENT */
-   ushort_t _type; /* do not use */
+   uint16_t _size; /* always CTF_LSIZE_SENT */
+   uint16_t _type; /* do not use */
} _u;
-   uint_t ctt_lsizehi; /* high 32 bits of type size in bytes */
-   uint_t ctt_lsizelo; /* low 32 bits of type size in bytes */
+   uint32_t ctt_lsizehi;   /* high 32 bits of type size in bytes */
+   uint32_t ctt_lsizelo;   /* low 32 bits of type size in bytes */
 } ctf_type_t;
 
 #definectt_size _u._size   /* for fundamental types that have a 
size */
@@ -754,7 +754,7 @@ typedef struct ctf_type {
 Type sizes are stored in
 .Sy bytes .
 The basic small form uses a
-.Sy ushort_t
+.Sy uint16_t
 to store the number of bytes.
 If the number of bytes in a structure would exceed 0xfffe, then the alternate
 form, the
@@ -806,8 +806,8 @@ various kinds.
 Integers, which are of type
 .Sy CTF_K_INTEGER ,
 have no variable length arguments.
-Instead, they are followed by a four byte
-.Sy uint_t
+Instead, they are followed by a
+.Sy uint32_t
 which describes their encoding.
 All i

svn commit: r350084 - in head/sys/cddl/contrib/opensolaris/uts/common: dtrace sys

2019-07-17 Thread Mark Johnston
Author: markj
Date: Wed Jul 17 16:38:29 2019
New Revision: 350084
URL: https://svnweb.freebsd.org/changeset/base/350084

Log:
  Fix FASTTRAPIOC_GETINSTR.
  
  This ioctl is used when a breakpoint is encountered while disassembling
  a symbol in the target process.  Since only one DTrace consumer can
  toggle or enumerate fasttrap probes from a given process at time, this
  ioctl does not appear to be used in practice.

Modified:
  head/sys/cddl/contrib/opensolaris/uts/common/dtrace/fasttrap.c
  head/sys/cddl/contrib/opensolaris/uts/common/sys/fasttrap.h

Modified: head/sys/cddl/contrib/opensolaris/uts/common/dtrace/fasttrap.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/dtrace/fasttrap.c  Wed Jul 
17 16:34:32 2019(r350083)
+++ head/sys/cddl/contrib/opensolaris/uts/common/dtrace/fasttrap.c  Wed Jul 
17 16:38:29 2019(r350084)
@@ -2326,10 +2326,8 @@ err:
int ret;
 #endif
 
-#ifdef illumos
if (copyin((void *)arg, &instr, sizeof (instr)) != 0)
return (EFAULT);
-#endif
 
 #ifdef notyet
if (!PRIV_POLICY_CHOICE(cr, PRIV_ALL, B_FALSE)) {

Modified: head/sys/cddl/contrib/opensolaris/uts/common/sys/fasttrap.h
==
--- head/sys/cddl/contrib/opensolaris/uts/common/sys/fasttrap.h Wed Jul 17 
16:34:32 2019(r350083)
+++ head/sys/cddl/contrib/opensolaris/uts/common/sys/fasttrap.h Wed Jul 17 
16:38:29 2019(r350084)
@@ -42,7 +42,7 @@ extern "C" {
 #defineFASTTRAPIOC_MAKEPROBE   (FASTTRAPIOC | 1)
 #defineFASTTRAPIOC_GETINSTR(FASTTRAPIOC | 2)
 #else
-#defineFASTTRAPIOC_GETINSTR_IOWR('f', 2, uint8_t)
+#defineFASTTRAPIOC_GETINSTR_IO('f', 2)
 #defineFASTTRAPIOC_MAKEPROBE   _IO('f', 3)
 #endif
 
___
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: r350086 - head/usr.sbin/rtadvd

2019-07-17 Thread Mark Johnston
Author: markj
Date: Wed Jul 17 16:50:53 2019
New Revision: 350086
URL: https://svnweb.freebsd.org/changeset/base/350086

Log:
  Remove obsolete compatibility code from rtadvd.
  
  MFC after:1 week

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

Modified: head/usr.sbin/rtadvd/rtadvd.c
==
--- head/usr.sbin/rtadvd/rtadvd.c   Wed Jul 17 16:38:40 2019
(r350085)
+++ head/usr.sbin/rtadvd/rtadvd.c   Wed Jul 17 16:50:53 2019
(r350086)
@@ -1052,15 +1052,8 @@ check_accept_rtadv(int idx)
__func__, idx);
return (0);
}
-#if (__FreeBSD_version < 90)
+
/*
-* RA_RECV: !ip6.forwarding && ip6.accept_rtadv
-* RA_SEND: ip6.forwarding
-*/
-   return ((getinet6sysctl(IPV6CTL_FORWARDING) == 0) &&
-   (getinet6sysctl(IPV6CTL_ACCEPT_RTADV) == 1));
-#else
-   /*
 * RA_RECV: ND6_IFF_ACCEPT_RTADV
 * RA_SEND: ip6.forwarding
 */
@@ -1070,7 +1063,6 @@ check_accept_rtadv(int idx)
}
 
return (ifi->ifi_nd_flags & ND6_IFF_ACCEPT_RTADV);
-#endif
 }
 
 static void
___
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: r350088 - head/sys/kern

2019-07-17 Thread Alan Somers
Author: asomers
Date: Wed Jul 17 17:01:07 2019
New Revision: 350088
URL: https://svnweb.freebsd.org/changeset/base/350088

Log:
  F_READAHEAD: Fix r349248's overflow protection, broken by r349391
  
  I accidentally broke the main point of r349248 when making stylistic changes
  in r349391.  Restore the original behavior, and also fix an additional
  overflow that was possible when uio->uio_resid was nearly SSIZE_MAX.
  
  Reported by:  cem
  Reviewed by:  bde
  MFC after:2 weeks
  MFC-With: 349248
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/kern/vfs_vnops.c

Modified: head/sys/kern/vfs_vnops.c
==
--- head/sys/kern/vfs_vnops.c   Wed Jul 17 16:52:25 2019(r350087)
+++ head/sys/kern/vfs_vnops.c   Wed Jul 17 17:01:07 2019(r350088)
@@ -499,8 +499,13 @@ sequential_heuristic(struct uio *uio, struct file *fp)
 * closely related to the best I/O size for real disks than
 * to any block size used by software.
 */
-   fp->f_seqcount += lmin(IO_SEQMAX,
-   howmany(uio->uio_resid, 16384));
+   if (uio->uio_resid >= IO_SEQMAX * 16384)
+   fp->f_seqcount = IO_SEQMAX;
+   else {
+   fp->f_seqcount += howmany(uio->uio_resid, 16384);
+   if (fp->f_seqcount > IO_SEQMAX)
+   fp->f_seqcount = IO_SEQMAX;
+   }
return (fp->f_seqcount << IO_SEQSHIFT);
}
 
___
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: r350089 - head

2019-07-17 Thread Mark Johnston
Author: markj
Date: Wed Jul 17 19:09:05 2019
New Revision: 350089
URL: https://svnweb.freebsd.org/changeset/base/350089

Log:
  Add an initial RELNOTES file.
  
  The intent is to provide a convenient location to document changes
  that are relevant to users of binary FreeBSD distributions, in contrast
  with UPDATING, which exists to document caveats for users who build
  FreeBSD from source.
  
  This complements the "Relnotes:" tag in commit messages by providing a
  place to document the change in more detail, or in case a "Relnotes:"
  tag was accidentally omitted.  In particular, "Relnotes:" should be
  used if you do not intend to document the change in RELNOTES for some
  reason.
  
  Changes to the file should not be MFCed.  For now the file will exist
  only in head, but may be updated via direct commits to stable branches
  depending on how things go.
  
  I took the liberty of pre-populating the file with some recent release
  notes-worthy changes.
  
  Reviewed by:  ian (earlier version)
  Discussed with:   cy, gjb, imp, rgrimes
  Differential Revision:https://reviews.freebsd.org/D20762

Added:
  head/RELNOTES   (contents, props changed)

Added: head/RELNOTES
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/RELNOTES   Wed Jul 17 19:09:05 2019(r350089)
@@ -0,0 +1,34 @@
+Release notes for FreeBSD 13.0.
+
+This file describes new user-visible features, changes and updates relevant to
+users of binary FreeBSD releases.  Each entry should describe the change in no
+more than several sentences and should reference manual pages where an
+interested user can find more information.  Entries should wrap after 80
+columns.  Each entry should begin with one or more commit IDs on one line,
+specified as a comma separated list and/or range, followed by a colon and a
+newline.  Entries should be separated by a newline.
+
+Changes to this file should not be MFCed.
+
+r349352:
+   nand(4) and related components have been removed.
+
+r349349:
+   The UEFI loader now supports HTTP boot.
+
+r349335:
+   bhyve(8) now implements a High Definition Audio (HDA) driver, allowing
+   guests to play to and record audio data from the host.
+
+r349286:
+   swapon(8) can now erase a swap device immediately before enabling it,
+   similar to newfs(8)'s -E option.  This behaviour can be specified by
+   adding -E to swapon(8)'s command-line parameters, or by adding the
+   "trimonce" option to a swap device's /etc/fstab entry.
+
+r347908-r347923:
+   The following network drivers have been removed: bm(4), cs(4), de(4),
+   ed(4), ep(4), ex(4), fe(4), pcn(4), sf(4), sn(4), tl(4), tx(4), txp(4),
+   vx(4), wb(4), xe(4).
+
+$FreeBSD$
___
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: r350090 - head

2019-07-17 Thread Mark Johnston
Author: markj
Date: Wed Jul 17 19:11:24 2019
New Revision: 350090
URL: https://svnweb.freebsd.org/changeset/base/350090

Log:
  Remove an old warning from UPDATING.
  
  The clang switchover happened long enough ago that we can
  garbage-collect this note.
  
  Reviewed by:  emaste, imp
  Differential Revision:https://reviews.freebsd.org/D20978

Modified:
  head/UPDATING

Modified: head/UPDATING
==
--- head/UPDATING   Wed Jul 17 19:09:05 2019(r350089)
+++ head/UPDATING   Wed Jul 17 19:11:24 2019(r350090)
@@ -11,11 +11,6 @@ handbook:
 Items affecting the ports and packages system can be found in
 /usr/ports/UPDATING.  Please read that file before running portupgrade.
 
-NOTE: FreeBSD has switched from gcc to clang. If you have trouble bootstrapping
-from older versions of FreeBSD, try WITHOUT_CLANG and WITH_GCC to bootstrap to
-the tip of head, and then rebuild without this option. The bootstrap process
-from older version of current across the gcc/clang cutover is a bit fragile.
-
 NOTE TO PEOPLE WHO THINK THAT FreeBSD 13.x IS SLOW:
FreeBSD 13.x has many debugging features turned on, in both the kernel
and userland.  These features attempt to detect incorrect use of
___
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: r350091 - head/lib/libc/stdlib

2019-07-17 Thread Konstantin Belousov
Author: kib
Date: Wed Jul 17 19:29:55 2019
New Revision: 350091
URL: https://svnweb.freebsd.org/changeset/base/350091

Log:
  bsearch.3: Improve the example.
  
  Submitted by: fernape
  MFC after:1 week
  Differential revision:https://reviews.freebsd.org/D19902

Modified:
  head/lib/libc/stdlib/bsearch.3

Modified: head/lib/libc/stdlib/bsearch.3
==
--- head/lib/libc/stdlib/bsearch.3  Wed Jul 17 19:11:24 2019
(r350090)
+++ head/lib/libc/stdlib/bsearch.3  Wed Jul 17 19:29:55 2019
(r350091)
@@ -32,7 +32,7 @@
 .\" @(#)bsearch.3  8.3 (Berkeley) 4/19/94
 .\" $FreeBSD$
 .\"
-.Dd May 15, 2019
+.Dd July 17, 2019
 .Dt BSEARCH 3
 .Os
 .Sh NAME
@@ -93,26 +93,29 @@ A sample program that searches people by age in a sort
 #include 
 
 struct person {
-   char name[5];
-   int age;
+   const char  *name;
+   int age;
 };
 
-int
-compare(const void *key, const void *array_member)
+static int
+compare(const void *a, const void *b)
 {
-   int age = (intptr_t) key;
-   struct person person = *(struct person *) array_member;
+   const int *age;
+   const struct person *person;
 
-   return (age - person.age);
+   age = a;
+   person = b;
+
+   return (*age - person->age);
 }
 
 int
-main()
+main(void)
 {
struct person *friend;
-
+   int age;
/* Sorted array */
-   struct person friends[6] = {
+   const struct person friends[] = {
{ "paul", 22 },
{ "anne", 25 },
{ "fred", 25 },
@@ -120,22 +123,28 @@ main()
{ "mark", 35 },
{ "bill", 50 }
};
+   const size_t len = sizeof(friends) / sizeof(friends[0]);
 
-   size_t array_size = sizeof(friends) / sizeof(struct person);
-
-   friend = bsearch((void *)22, &friends, array_size, sizeof(struct 
person), compare);
+   age = 22;
+   friend = bsearch(&age, friends, len, sizeof(friends[0]), compare);
assert(strcmp(friend->name, "paul") == 0);
printf("name: %s\enage: %d\en", friend->name, friend->age);
 
-   friend = bsearch((void *)25, &friends, array_size, sizeof(struct 
person), compare);
-   assert(strcmp(friend->name, "fred") == 0 || strcmp(friend->name, 
"anne") == 0);
+   age = 25;
+   friend = bsearch(&age, friends, len, sizeof(friends[0]), compare);
+
+   /*
+* For multiple elements with the same key, it is implementation
+* defined which will be returned
+*/
+   assert(strcmp(friend->name, "fred") == 0 ||
+   strcmp(friend->name, "anne") == 0);
printf("name: %s\enage: %d\en", friend->name, friend->age);
 
-   friend = bsearch((void *)30, &friends, array_size, sizeof(struct 
person), compare);
+   age = 30;
+   friend = bsearch(&age, friends, len, sizeof(friends[0]), compare);
assert(friend == NULL);
printf("friend aged 30 not found\en");
-
-   return (EXIT_SUCCESS);
 }
 .Ed
 .Sh SEE ALSO
___
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: r350094 - head/sys/dev/nvme

2019-07-17 Thread Warner Losh
Author: imp
Date: Wed Jul 17 20:43:14 2019
New Revision: 350094
URL: https://svnweb.freebsd.org/changeset/base/350094

Log:
  Remove now-obsolete comment.

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

Modified: head/sys/dev/nvme/nvme.c
==
--- head/sys/dev/nvme/nvme.cWed Jul 17 19:41:44 2019(r350093)
+++ head/sys/dev/nvme/nvme.cWed Jul 17 20:43:14 2019(r350094)
@@ -452,8 +452,7 @@ nvme_register_consumer(nvme_cons_ns_fn_t ns_fn, nvme_c
int i;
 
/*
-* TODO: add locking around consumer registration.  Not an issue
-*  right now since we only have one nvme consumer - nvd(4).
+* TODO: add locking around consumer registration.
 */
for (i = 0; i < NVME_MAX_CONSUMERS; i++)
if (nvme_consumer[i].id == INVALID_CONSUMER_ID) {
___
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: r350095 - head/sys/riscv/riscv

2019-07-17 Thread Kristof Provost
Author: kp
Date: Wed Jul 17 21:25:26 2019
New Revision: 350095
URL: https://svnweb.freebsd.org/changeset/base/350095

Log:
  riscv: Return vm_paddr_t in pmap_early_vtophys()
  
  We can't use a u_int to compute the physical address in
  pmap_early_vtophys(). Our int is 32-bit, but the physical address is
  64-bit. This works fine if everything lives in below 0x1, but as
  soon as it doesn't this breaks.
  
  MFC after:1 week
  Sponsored by: Axiado

Modified:
  head/sys/riscv/riscv/pmap.c

Modified: head/sys/riscv/riscv/pmap.c
==
--- head/sys/riscv/riscv/pmap.c Wed Jul 17 20:43:14 2019(r350094)
+++ head/sys/riscv/riscv/pmap.c Wed Jul 17 21:25:26 2019(r350095)
@@ -464,7 +464,7 @@ pmap_early_vtophys(vm_offset_t l1pt, vm_offset_t va)
 {
u_int l1_slot, l2_slot;
pt_entry_t *l2;
-   u_int ret;
+   vm_paddr_t ret;
 
l2 = pmap_early_page_idx(l1pt, va, &l1_slot, &l2_slot);
 
___
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: r350096 - in head/sys/ufs: ffs ufs

2019-07-17 Thread Kirk McKusick
Author: mckusick
Date: Wed Jul 17 22:07:43 2019
New Revision: 350096
URL: https://svnweb.freebsd.org/changeset/base/350096

Log:
  The error reported in FS-14-UFS-3 can only happen on UFS/FFS
  filesystems that have block pointers that are out-of-range for their
  filesystem. These out-of-range block pointers are corrected by
  fsck(8) so are only encountered when an unchecked filesystem is
  mounted.
  
  A new "untrusted" flag has been added to the generic mount interface
  that can be set when mounting media of unknown provenance or integrity.
  For example, a daemon that automounts a filesystem on a flash drive
  when it is plugged into a system.
  
  This commit adds a test to UFS/FFS that validates all block numbers
  before using them. Because checking for out-of-range blocks adds
  unnecessary overhead to normal operation, the tests are only done
  when the filesystem is mounted as an "untrusted" filesystem.
  
  Reported by:  Christopher Krah, Thomas Barabosch, and Jan-Niclas Hilgert of 
Fraunhofer FKIE
  Reported as:  FS-14-UFS-3: Out of bounds read in write-2 (ffs_alloccg)
  Reviewed by:  kib
  Sponsored by: Netflix

Modified:
  head/sys/ufs/ffs/ffs_alloc.c
  head/sys/ufs/ffs/ffs_balloc.c
  head/sys/ufs/ffs/ffs_extern.h
  head/sys/ufs/ffs/ffs_softdep.c
  head/sys/ufs/ffs/ffs_subr.c
  head/sys/ufs/ffs/ffs_vfsops.c
  head/sys/ufs/ufs/ufs_bmap.c
  head/sys/ufs/ufs/ufsmount.h

Modified: head/sys/ufs/ffs/ffs_alloc.c
==
--- head/sys/ufs/ffs/ffs_alloc.cWed Jul 17 21:25:26 2019
(r350095)
+++ head/sys/ufs/ffs/ffs_alloc.cWed Jul 17 22:07:43 2019
(r350096)
@@ -1374,7 +1374,7 @@ ffs_blkpref_ufs1(ip, lbn, indx, bap)
struct fs *fs;
u_int cg, inocg;
u_int avgbfree, startcg;
-   ufs2_daddr_t pref;
+   ufs2_daddr_t pref, prevbn;
 
KASSERT(indx <= 0 || bap != NULL, ("need non-NULL bap"));
mtx_assert(UFS_MTX(ITOUMP(ip)), MA_OWNED);
@@ -1424,7 +1424,15 @@ ffs_blkpref_ufs1(ip, lbn, indx, bap)
 * have a block allocated immediately preceding us, then we need
 * to decide where to start allocating new blocks.
 */
-   if (indx % fs->fs_maxbpg == 0 || bap[indx - 1] == 0) {
+   if (indx ==  0) {
+   prevbn = 0;
+   } else {
+   prevbn = bap[indx - 1];
+   if (UFS_CHECK_BLKNO(ITOVFS(ip), ip->i_number, prevbn,
+   fs->fs_bsize) != 0)
+   prevbn = 0;
+   }
+   if (indx % fs->fs_maxbpg == 0 || prevbn == 0) {
/*
 * If we are allocating a directory data block, we want
 * to place it in the metadata area.
@@ -1442,10 +1450,10 @@ ffs_blkpref_ufs1(ip, lbn, indx, bap)
 * Find a cylinder with greater than average number of
 * unused data blocks.
 */
-   if (indx == 0 || bap[indx - 1] == 0)
+   if (indx == 0 || prevbn == 0)
startcg = inocg + lbn / fs->fs_maxbpg;
else
-   startcg = dtog(fs, bap[indx - 1]) + 1;
+   startcg = dtog(fs, prevbn) + 1;
startcg %= fs->fs_ncg;
avgbfree = fs->fs_cstotal.cs_nbfree / fs->fs_ncg;
for (cg = startcg; cg < fs->fs_ncg; cg++)
@@ -1463,7 +1471,7 @@ ffs_blkpref_ufs1(ip, lbn, indx, bap)
/*
 * Otherwise, we just always try to lay things out contiguously.
 */
-   return (bap[indx - 1] + fs->fs_frag);
+   return (prevbn + fs->fs_frag);
 }
 
 /*
@@ -1479,7 +1487,7 @@ ffs_blkpref_ufs2(ip, lbn, indx, bap)
struct fs *fs;
u_int cg, inocg;
u_int avgbfree, startcg;
-   ufs2_daddr_t pref;
+   ufs2_daddr_t pref, prevbn;
 
KASSERT(indx <= 0 || bap != NULL, ("need non-NULL bap"));
mtx_assert(UFS_MTX(ITOUMP(ip)), MA_OWNED);
@@ -1529,7 +1537,15 @@ ffs_blkpref_ufs2(ip, lbn, indx, bap)
 * have a block allocated immediately preceding us, then we need
 * to decide where to start allocating new blocks.
 */
-   if (indx % fs->fs_maxbpg == 0 || bap[indx - 1] == 0) {
+   if (indx ==  0) {
+   prevbn = 0;
+   } else {
+   prevbn = bap[indx - 1];
+   if (UFS_CHECK_BLKNO(ITOVFS(ip), ip->i_number, prevbn,
+   fs->fs_bsize) != 0)
+   prevbn = 0;
+   }
+   if (indx % fs->fs_maxbpg == 0 || prevbn == 0) {
/*
 * If we are allocating a directory data block, we want
 * to place it in the metadata area.
@@ -1547,10 +1563,10 @@ ffs_blkpref_ufs2(ip, lbn, indx, bap)
 * Find a cylinder with greater than average number of
 * unused data blocks.
 */
-   if (indx == 0 || bap[indx - 1] == 0)
+   if (indx == 0 || prevbn == 0)
   

svn commit: r350098 - head/contrib/tcp_wrappers

2019-07-17 Thread Brooks Davis
Author: brooks
Date: Wed Jul 17 23:09:40 2019
New Revision: 350098
URL: https://svnweb.freebsd.org/changeset/base/350098

Log:
  Use ANSI C function definitions and declerations.
  
  Obtained from:CheriBSD
  MFC after:1 week
  Sponsored by: DARPA, AFRL

Modified:
  head/contrib/tcp_wrappers/hosts_access.c
  head/contrib/tcp_wrappers/inetcf.c
  head/contrib/tcp_wrappers/inetcf.h
  head/contrib/tcp_wrappers/mystdarg.h
  head/contrib/tcp_wrappers/options.c
  head/contrib/tcp_wrappers/rfc931.c
  head/contrib/tcp_wrappers/scaffold.h
  head/contrib/tcp_wrappers/shell_cmd.c
  head/contrib/tcp_wrappers/socket.c
  head/contrib/tcp_wrappers/tcpdchk.c
  head/contrib/tcp_wrappers/tcpdmatch.c

Modified: head/contrib/tcp_wrappers/hosts_access.c
==
--- head/contrib/tcp_wrappers/hosts_access.cWed Jul 17 22:45:43 2019
(r350097)
+++ head/contrib/tcp_wrappers/hosts_access.cWed Jul 17 23:09:40 2019
(r350098)
@@ -87,16 +87,17 @@ int resident = (-1);/* -1, 0: unknown; +1: 
yes *
 
 /* Forward declarations. */
 
-static int table_match();
-static int list_match();
-static int server_match();
-static int client_match();
-static int host_match();
-static int string_match();
-static int masked_match();
+static int table_match(char *table, struct request_info *request);
+static int list_match(char *list, struct request_info *request,
+int (*match_fn)(char *, struct request_info *));
+static int server_match(char *tok, struct request_info *request);
+static int client_match(char *tok, struct request_info *request);
+static int host_match(char *tok, struct host_info *host);
+static int string_match(char *tok, char *string);
+static int masked_match(char *net_tok, char *mask_tok, char *string);
 #ifdef INET6
-static int masked_match4();
-static int masked_match6();
+static int masked_match4(char *net_tok, char *mask_tok, char *string);
+static int masked_match6(char *net_tok, char *mask_tok, char *string);
 #endif
 
 /* Size of logical line buffer. */
@@ -213,10 +214,8 @@ struct request_info *request;
 
 /* list_match - match a request against a list of patterns with exceptions */
 
-static int list_match(list, request, match_fn)
-char   *list;
-struct request_info *request;
-int   (*match_fn) ();
+static int list_match(char *list, struct request_info *request,
+int (*match_fn)(char *, struct request_info *))
 {
 char   *tok;
 

Modified: head/contrib/tcp_wrappers/inetcf.c
==
--- head/contrib/tcp_wrappers/inetcf.c  Wed Jul 17 22:45:43 2019
(r350097)
+++ head/contrib/tcp_wrappers/inetcf.c  Wed Jul 17 23:09:40 2019
(r350098)
@@ -39,8 +39,9 @@ char   *inet_files[] = {
 0,
 };
 
-static void inet_chk();
-static char *base_name();
+static void inet_chk(char *protocol, char *path, char *arg0, char *arg1);
+static char *base_name(char *path);
+extern char *percent_m(char *obuf, char *ibuf);
 
  /*
   * Structure with everything we know about a service.
@@ -69,7 +70,6 @@ char   *conf;
 char   *arg0;
 char   *arg1;
 struct tcpd_context saved_context;
-char   *percent_m();
 int i;
 struct stat st;
 

Modified: head/contrib/tcp_wrappers/inetcf.h
==
--- head/contrib/tcp_wrappers/inetcf.h  Wed Jul 17 22:45:43 2019
(r350097)
+++ head/contrib/tcp_wrappers/inetcf.h  Wed Jul 17 23:09:40 2019
(r350098)
@@ -4,9 +4,9 @@
   * Author: Wietse Venema, Eindhoven University of Technology, The Netherlands.
   */
 
-extern char *inet_cfg();   /* read inetd.conf file */
-extern void inet_set();/* remember internet service */
-extern int inet_get(); /* look up internet service */
+extern char *inet_cfg(char *conf); /* read inetd.conf file */
+extern void inet_set(char *name, int type);/* remember internet service */
+extern int inet_get(char *name);   /* look up internet service */
 
 #defineWR_UNKNOWN  (-1)/* service unknown */
 #defineWR_NOT  1   /* may not be wrapped */

Modified: head/contrib/tcp_wrappers/mystdarg.h
==
--- head/contrib/tcp_wrappers/mystdarg.hWed Jul 17 22:45:43 2019
(r350097)
+++ head/contrib/tcp_wrappers/mystdarg.hWed Jul 17 23:09:40 2019
(r350098)
@@ -16,4 +16,4 @@
 #defineVAEND(ap)  va_end(ap);}
 #endif
 
-extern char *percent_m();
+extern char *percent_m(char *obuf, char *ibuf);

Modified: head/contrib/tcp_wrappers/options.c
==
--- head/contrib/tcp_wrappers/options.c Wed Jul 17 22:45:43 2019
(r350097)
+++ head/contrib/tcp_wrappers/options.c Wed Jul 17 2

svn commit: r350099 - head/stand/common

2019-07-17 Thread Simon J. Gerraty
Author: sjg
Date: Wed Jul 17 23:33:14 2019
New Revision: 350099
URL: https://svnweb.freebsd.org/changeset/base/350099

Log:
  loader: ignore some variable settings if input unverified
  
  libsecureboot can tell us if the most recent file opened was
  verfied or not.
  If it's state is VE_UNVERIFIED_OK, skip if variable
  matches one of the restricted prefixes.
  
  Reviewed by:  stevek
  MFC after:1 week
  Sponsored by: Juniper Networks
  Differential Revision:https://reviews.freebsd.org//D20909

Modified:
  head/stand/common/commands.c

Modified: head/stand/common/commands.c
==
--- head/stand/common/commands.cWed Jul 17 23:09:40 2019
(r350098)
+++ head/stand/common/commands.cWed Jul 17 23:33:14 2019
(r350099)
@@ -304,6 +304,36 @@ command_set(int argc, char *argv[])
command_errmsg = "wrong number of arguments";
return (CMD_ERROR);
} else {
+#ifdef LOADER_VERIEXEC
+   /*
+* Impose restrictions if input is not verified
+*/
+   const char *restricted[] = {
+   "boot",
+   "init",
+   "loader.ve.",
+   "rootfs",
+   "secur",
+   "vfs.",
+   NULL,
+   };
+   const char **cp;
+   int ves;
+
+   ves = ve_status_get(-1);
+   if (ves == VE_UNVERIFIED_OK) {
+#ifdef LOADER_VERIEXEC_TESTING
+   printf("Checking: %s\n", argv[1]);
+#endif
+   for (cp = restricted; *cp; cp++) {
+   if (strncmp(argv[1], *cp, strlen(*cp)) == 0) {
+   printf("Ignoring restricted variable: 
%s\n",
+   argv[1]);
+   return (CMD_OK);
+   }
+   }
+   }
+#endif
if ((err = putenv(argv[1])) != 0) {
command_errmsg = strerror(err);
return (CMD_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: r350100 - head/contrib/tcp_wrappers

2019-07-17 Thread Brooks Davis
Author: brooks
Date: Wed Jul 17 23:36:36 2019
New Revision: 350100
URL: https://svnweb.freebsd.org/changeset/base/350100

Log:
  Use headers instead of manual declerations of standard functions and
  variables.

Modified:
  head/contrib/tcp_wrappers/inetcf.c
  head/contrib/tcp_wrappers/scaffold.c
  head/contrib/tcp_wrappers/tcpd.c
  head/contrib/tcp_wrappers/tcpdchk.c
  head/contrib/tcp_wrappers/tcpdmatch.c

Modified: head/contrib/tcp_wrappers/inetcf.c
==
--- head/contrib/tcp_wrappers/inetcf.c  Wed Jul 17 23:33:14 2019
(r350099)
+++ head/contrib/tcp_wrappers/inetcf.c  Wed Jul 17 23:36:36 2019
(r350100)
@@ -14,11 +14,8 @@ static char sccsid[] = "@(#) inetcf.c 1.7 97/02/12 02:
 #include 
 #include 
 #include 
-#include 
 #include 
-
-extern int errno;
-extern void exit();
+#include 
 
 #include "tcpd.h"
 #include "inetcf.h"

Modified: head/contrib/tcp_wrappers/scaffold.c
==
--- head/contrib/tcp_wrappers/scaffold.cWed Jul 17 23:33:14 2019
(r350099)
+++ head/contrib/tcp_wrappers/scaffold.cWed Jul 17 23:36:36 2019
(r350100)
@@ -21,6 +21,7 @@ static char sccs_id[] = "@(#) scaffold.c 1.6 97/03/21 
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 

Modified: head/contrib/tcp_wrappers/tcpd.c
==
--- head/contrib/tcp_wrappers/tcpd.cWed Jul 17 23:33:14 2019
(r350099)
+++ head/contrib/tcp_wrappers/tcpd.cWed Jul 17 23:36:36 2019
(r350100)
@@ -26,6 +26,7 @@ static char sccsid[] = "@(#) tcpd.c 1.10 96/02/11 17:0
 #include 
 #include 
 #include 
+#include 
 
 #ifndef MAXPATHNAMELEN
 #define MAXPATHNAMELEN BUFSIZ

Modified: head/contrib/tcp_wrappers/tcpdchk.c
==
--- head/contrib/tcp_wrappers/tcpdchk.c Wed Jul 17 23:33:14 2019
(r350099)
+++ head/contrib/tcp_wrappers/tcpdchk.c Wed Jul 17 23:36:36 2019
(r350100)
@@ -34,14 +34,9 @@ static char sccsid[] = "@(#) tcpdchk.c 1.8 97/02/12 02
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
-#include 
-
-extern int errno;
-extern void exit();
-extern int optind;
-extern char *optarg;
 
 #ifndef INADDR_NONE
 #define INADDR_NONE (-1)   /* XXX should be 0x */

Modified: head/contrib/tcp_wrappers/tcpdmatch.c
==
--- head/contrib/tcp_wrappers/tcpdmatch.c   Wed Jul 17 23:33:14 2019
(r350099)
+++ head/contrib/tcp_wrappers/tcpdmatch.c   Wed Jul 17 23:36:36 2019
(r350100)
@@ -30,12 +30,9 @@ static char sccsid[] = "@(#) tcpdmatch.c 1.5 96/02/11 
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
-
-extern void exit();
-extern int optind;
-extern char *optarg;
 
 #ifndefINADDR_NONE
 #defineINADDR_NONE (-1)/* XXX should be 0x */
___
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: r350101 - head/contrib/tcp_wrappers

2019-07-17 Thread Brooks Davis
Author: brooks
Date: Wed Jul 17 23:43:14 2019
New Revision: 350101
URL: https://svnweb.freebsd.org/changeset/base/350101

Log:
  Remove a duplicate global (rfc931_timeout).
  
  It is declared here and in rfc931.c and unused here so keep that copy
  and discard this one.
  
  Obtained from:CheriBSD
  MFC after:1 week
  Sponsored by: DARPA, AFRL

Modified:
  head/contrib/tcp_wrappers/scaffold.c

Modified: head/contrib/tcp_wrappers/scaffold.c
==
--- head/contrib/tcp_wrappers/scaffold.cWed Jul 17 23:36:36 2019
(r350100)
+++ head/contrib/tcp_wrappers/scaffold.cWed Jul 17 23:43:14 2019
(r350101)
@@ -39,7 +39,6 @@ static char sccs_id[] = "@(#) scaffold.c 1.6 97/03/21 
   */
 int allow_severity = SEVERITY;
 int deny_severity = LOG_WARNING;
-int rfc931_timeout = RFC931_TIMEOUT;
 
 #ifndef INET6
 /* dup_hostent - create hostent in one memory block */
___
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: r350102 - head/lib/libc/gen

2019-07-17 Thread Brooks Davis
Author: brooks
Date: Wed Jul 17 23:46:47 2019
New Revision: 350102
URL: https://svnweb.freebsd.org/changeset/base/350102

Log:
  Remove redundent decleration of __elf_phdr_match_addr().
  
  Obtained from:CheriBSD
  MFC after:1 week
  Sponsored by: DARPA, AFRL

Modified:
  head/lib/libc/gen/elf_utils.c

Modified: head/lib/libc/gen/elf_utils.c
==
--- head/lib/libc/gen/elf_utils.c   Wed Jul 17 23:43:14 2019
(r350101)
+++ head/lib/libc/gen/elf_utils.c   Wed Jul 17 23:46:47 2019
(r350102)
@@ -38,7 +38,6 @@
 #include "libc_private.h"
 #include "static_tls.h"
 
-int __elf_phdr_match_addr(struct dl_phdr_info *, void *);
 void __pthread_map_stacks_exec(void);
 void __pthread_distribute_static_tls(size_t, void *, size_t, size_t);
 
___
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: r350103 - in head/contrib/sqlite3: . tea

2019-07-17 Thread Cy Schubert
Author: cy
Date: Thu Jul 18 00:27:28 2019
New Revision: 350103
URL: https://svnweb.freebsd.org/changeset/base/350103

Log:
  MFV r350080:
  
  Update sqlite3-3.28.0 (328) --> sqlite3-3.29.0 (329)
  
  MFC after:1 week

Modified:
  head/contrib/sqlite3/configure
  head/contrib/sqlite3/configure.ac
  head/contrib/sqlite3/shell.c
  head/contrib/sqlite3/sqlite3.c
  head/contrib/sqlite3/sqlite3.h
  head/contrib/sqlite3/tea/configure
  head/contrib/sqlite3/tea/configure.ac
Directory Properties:
  head/contrib/sqlite3/   (props changed)

Modified: head/contrib/sqlite3/configure
==
--- head/contrib/sqlite3/configure  Wed Jul 17 23:46:47 2019
(r350102)
+++ head/contrib/sqlite3/configure  Thu Jul 18 00:27:28 2019
(r350103)
@@ -1,6 +1,6 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for sqlite 3.28.0.
+# Generated by GNU Autoconf 2.69 for sqlite 3.29.0.
 #
 # Report bugs to .
 #
@@ -590,8 +590,8 @@ MAKEFLAGS=
 # Identity of this package.
 PACKAGE_NAME='sqlite'
 PACKAGE_TARNAME='sqlite'
-PACKAGE_VERSION='3.28.0'
-PACKAGE_STRING='sqlite 3.28.0'
+PACKAGE_VERSION='3.29.0'
+PACKAGE_STRING='sqlite 3.29.0'
 PACKAGE_BUGREPORT='http://www.sqlite.org'
 PACKAGE_URL=''
 
@@ -1341,7 +1341,7 @@ if test "$ac_init_help" = "long"; then
   # Omit some internal or obsolete options to make the list less imposing.
   # This message is too long to be a string in the A/UX 3.1 sh.
   cat <<_ACEOF
-\`configure' configures sqlite 3.28.0 to adapt to many kinds of systems.
+\`configure' configures sqlite 3.29.0 to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -1412,7 +1412,7 @@ fi
 
 if test -n "$ac_init_help"; then
   case $ac_init_help in
- short | recursive ) echo "Configuration of sqlite 3.28.0:";;
+ short | recursive ) echo "Configuration of sqlite 3.29.0:";;
esac
   cat <<\_ACEOF
 
@@ -1537,7 +1537,7 @@ fi
 test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
-sqlite configure 3.28.0
+sqlite configure 3.29.0
 generated by GNU Autoconf 2.69
 
 Copyright (C) 2012 Free Software Foundation, Inc.
@@ -1952,7 +1952,7 @@ cat >config.log <<_ACEOF
 This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
 
-It was created by sqlite $as_me 3.28.0, which was
+It was created by sqlite $as_me 3.29.0, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   $ $0 $@
@@ -2818,7 +2818,7 @@ fi
 
 # Define the identity of the package.
  PACKAGE='sqlite'
- VERSION='3.28.0'
+ VERSION='3.29.0'
 
 
 cat >>confdefs.h <<_ACEOF
@@ -14438,7 +14438,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
 # report actual input values of CONFIG_FILES etc. instead of their
 # values after options handling.
 ac_log="
-This file was extended by sqlite $as_me 3.28.0, which was
+This file was extended by sqlite $as_me 3.29.0, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   CONFIG_FILES= $CONFIG_FILES
@@ -14495,7 +14495,7 @@ _ACEOF
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; 
s/[\\""\`\$]/&/g'`"
 ac_cs_version="\\
-sqlite config.status 3.28.0
+sqlite config.status 3.29.0
 configured by $0, generated by GNU Autoconf 2.69,
   with options \\"\$ac_cs_config\\"
 

Modified: head/contrib/sqlite3/configure.ac
==
--- head/contrib/sqlite3/configure.ac   Wed Jul 17 23:46:47 2019
(r350102)
+++ head/contrib/sqlite3/configure.ac   Thu Jul 18 00:27:28 2019
(r350103)
@@ -10,7 +10,7 @@
 #
 
 AC_PREREQ(2.61)
-AC_INIT(sqlite, 3.28.0, http://www.sqlite.org)
+AC_INIT(sqlite, 3.29.0, http://www.sqlite.org)
 AC_CONFIG_SRCDIR([sqlite3.c])
 AC_CONFIG_AUX_DIR([.])
 

Modified: head/contrib/sqlite3/shell.c
==
--- head/contrib/sqlite3/shell.cWed Jul 17 23:46:47 2019
(r350102)
+++ head/contrib/sqlite3/shell.cThu Jul 18 00:27:28 2019
(r350103)
@@ -983,6 +983,7 @@ static void shellAddSchemaName(
 ** We need several support functions from the SQLite core.
 */
 
+/* #include "sqlite3.h" */
 
 /*
 ** We need several things from the ANSI and MSVCRT headers.
@@ -1336,6 +1337,7 @@ INT closedir(
 ** is used.  If SIZE is included it must be one of the integers 224, 256,
 ** 384, or 512, to determine SHA3 hash variant that is computed.
 */
+/* #include "sqlite3ext.h" */
 SQLITE_EXTENSION_INIT1
 #include 
 #include 
@@ -2099,6 +2101,7 @@ int sqlite3_shathree_init(
 **   And the paths returned in the "name" column of the table are also 
 **   relative to directory $dir.
 */
+/* #include "sqlite3ext.h" */
 SQLITE_EXTENSION_INIT1
 #include 
 #include 
@

svn commit: r350104 - head/sys/dev/iicbus

2019-07-17 Thread Ian Lepore
Author: ian
Date: Thu Jul 18 01:30:56 2019
New Revision: 350104
URL: https://svnweb.freebsd.org/changeset/base/350104

Log:
  Handle the PCF2127 RTC chip the same as PCF2129 when init'ing the chip.
  
  This affects the detection of 24-hour vs AM/PM mode... the ampm bit is in a
  different location on 2127 and 2129 chips compared to other nxp rtc chips.
  I noticed the 2127 case wasn't being handled correctly when I accidentally
  misconfiged my system by claiming my PCF2129 was a 2127.

Modified:
  head/sys/dev/iicbus/nxprtc.c

Modified: head/sys/dev/iicbus/nxprtc.c
==
--- head/sys/dev/iicbus/nxprtc.cThu Jul 18 00:27:28 2019
(r350103)
+++ head/sys/dev/iicbus/nxprtc.cThu Jul 18 01:30:56 2019
(r350104)
@@ -351,9 +351,18 @@ pcf8523_start(struct nxprtc_softc *sc)
 {
int err;
uint8_t cs1, cs3, clkout;
-   bool is2129;
+   bool is212x;
 
-   is2129 = (sc->chiptype == TYPE_PCA2129 || sc->chiptype == TYPE_PCF2129);
+   switch (sc->chiptype) {
+   case TYPE_PCF2127:
+   case TYPE_PCA2129:
+   case TYPE_PCF2129:
+   is212x = true;
+   break;
+   default:
+   is212x = true;
+   break;
+   }
 
/* Read and sanity-check the control registers. */
if ((err = read_reg(sc, PCF85xx_R_CS1, &cs1)) != 0) {
@@ -389,7 +398,7 @@ pcf8523_start(struct nxprtc_softc *sc)
 * to zero then back to 1, then wait 100ms for the refresh, and
 * finally set the bit back to zero with the COF_HIGHZ write.
 */
-   if (is2129) {
+   if (is212x) {
clkout = PCF2129_B_CLKOUT_HIGHZ;
if ((err = write_reg(sc, PCF8523_R_TMR_CLKOUT,
clkout)) != 0) {
@@ -429,7 +438,7 @@ pcf8523_start(struct nxprtc_softc *sc)
device_printf(sc->dev, "WARNING: RTC battery is low\n");
 
/* Remember whether we're running in AM/PM mode. */
-   if (is2129) {
+   if (is212x) {
if (cs1 & PCF2129_B_CS1_12HR)
sc->use_ampm = true;
} else {
___
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: r350106 - head/sys/dev/iicbus

2019-07-17 Thread Ian Lepore
Author: ian
Date: Thu Jul 18 01:37:00 2019
New Revision: 350106
URL: https://svnweb.freebsd.org/changeset/base/350106

Log:
  Fix a paste-o, set is212x = false for other chip types.  Doh!

Modified:
  head/sys/dev/iicbus/nxprtc.c

Modified: head/sys/dev/iicbus/nxprtc.c
==
--- head/sys/dev/iicbus/nxprtc.cThu Jul 18 01:33:00 2019
(r350105)
+++ head/sys/dev/iicbus/nxprtc.cThu Jul 18 01:37:00 2019
(r350106)
@@ -360,7 +360,7 @@ pcf8523_start(struct nxprtc_softc *sc)
is212x = true;
break;
default:
-   is212x = true;
+   is212x = false;
break;
}
 
___
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"