svn commit: r337452 - head

2018-08-08 Thread Roger Pau Monné
Author: royger
Date: Wed Aug  8 07:58:29 2018
New Revision: 337452
URL: https://svnweb.freebsd.org/changeset/base/337452

Log:
  build: skip the database check for the distributeworld target
  
  distributeworld is used to generate install media, so it makes no
  sense to check the host database since the install media can be
  generated from any box, regardless of the version of FreeBSD it's
  running.
  
  Sponsored by: Citrix Systems R&D
  Reviewed by:  ian, gjb
  Differential revision:https://reviews.freebsd.org/D16507

Modified:
  head/Makefile.inc1

Modified: head/Makefile.inc1
==
--- head/Makefile.inc1  Wed Aug  8 07:32:14 2018(r337451)
+++ head/Makefile.inc1  Wed Aug  8 07:58:29 2018(r337452)
@@ -830,6 +830,13 @@ IMAKE+=__MAKE_SHELL=${INSTALLTMP}/sh
 .else
 IMAKEENV+= PATH=${TMPPATH}:${INSTALLTMP}
 .endif
+
+# When generating install media, do not allow user and group information from
+# the build host to affect the contents of the distribution.
+.if make(distributeworld)
+DB_FROM_SRC=   yes
+.endif
+
 .if defined(DB_FROM_SRC)
 INSTALLFLAGS+= -N ${.CURDIR}/etc
 MTREEFLAGS+=   -N ${.CURDIR}/etc
___
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: r337453 - head/sys/fs/ext2fs

2018-08-08 Thread Fedor Uporov
Author: fsu
Date: Wed Aug  8 12:07:45 2018
New Revision: 337453
URL: https://svnweb.freebsd.org/changeset/base/337453

Log:
  Fix directory blocks checksum updating logic.
  
  The checksum updating functions were not called in case of dir index inode 
splitting
  and in case of dir entry removing, when the entry was first in the block.
  Fix and move the dir entry adding logic when i_count == 0 to new function.
  
  MFC after:  3 months

Modified:
  head/sys/fs/ext2fs/ext2_htree.c
  head/sys/fs/ext2fs/ext2_lookup.c

Modified: head/sys/fs/ext2fs/ext2_htree.c
==
--- head/sys/fs/ext2fs/ext2_htree.c Wed Aug  8 07:58:29 2018
(r337452)
+++ head/sys/fs/ext2fs/ext2_htree.c Wed Aug  8 12:07:45 2018
(r337453)
@@ -800,7 +800,7 @@ ext2_htree_add_entry(struct vnode *dvp, struct ext2fs_
cursize = roundup(ip->i_size, blksize);
dirsize = cursize + blksize;
blknum = dirsize / blksize - 1;
-
+   ext2_dx_csum_set(ip, (struct ext2fs_direct_2 *)newidxblock);
error = ext2_htree_append_block(dvp, newidxblock,
cnp, blksize);
if (error)

Modified: head/sys/fs/ext2fs/ext2_lookup.c
==
--- head/sys/fs/ext2fs/ext2_lookup.cWed Aug  8 07:58:29 2018
(r337452)
+++ head/sys/fs/ext2fs/ext2_lookup.cWed Aug  8 12:07:45 2018
(r337453)
@@ -859,6 +859,68 @@ ext2_dirbadentry(struct vnode *dp, struct ext2fs_direc
 }
 
 /*
+ * Insert an entry into the fresh directory block.
+ * Initialize entry tail if the metadata_csum feature is turned on.
+ */
+static int
+ext2_add_first_entry(struct vnode *dvp, struct ext2fs_direct_2 *entry,
+struct componentname *cnp)
+{
+   struct inode *dp;
+   struct iovec aiov;
+   struct uio auio;
+   char* buf = NULL;
+   int dirblksize, error;
+
+   dp = VTOI(dvp);
+   dirblksize = dp->i_e2fs->e2fs_bsize;
+
+   if (dp->i_offset & (dirblksize - 1))
+   panic("ext2_add_first_entry: bad directory offset");
+
+   if (EXT2_HAS_RO_COMPAT_FEATURE(dp->i_e2fs,
+   EXT2F_ROCOMPAT_METADATA_CKSUM)) {
+   entry->e2d_reclen = dirblksize - sizeof(struct 
ext2fs_direct_tail);
+   buf = malloc(dirblksize, M_TEMP, M_WAITOK);
+   if (!buf) {
+   error = ENOMEM;
+   goto out;
+   }
+   memcpy(buf, entry, EXT2_DIR_REC_LEN(entry->e2d_namlen));
+   ext2_init_dirent_tail(EXT2_DIRENT_TAIL(buf, dirblksize));
+   ext2_dirent_csum_set(dp, (struct ext2fs_direct_2 *)buf);
+
+   auio.uio_offset = dp->i_offset;
+   auio.uio_resid = dirblksize;
+   aiov.iov_len = auio.uio_resid;
+   aiov.iov_base = (caddr_t)buf;
+   } else {
+   entry->e2d_reclen = dirblksize;
+   auio.uio_offset = dp->i_offset;
+   auio.uio_resid = EXT2_DIR_REC_LEN(entry->e2d_namlen);
+   aiov.iov_len = auio.uio_resid;
+   aiov.iov_base = (caddr_t)entry;
+   }
+
+   auio.uio_iov = &aiov;
+   auio.uio_iovcnt = 1;
+   auio.uio_rw = UIO_WRITE;
+   auio.uio_segflg = UIO_SYSSPACE;
+   auio.uio_td = (struct thread *)0;
+   error = VOP_WRITE(dvp, &auio, IO_SYNC, cnp->cn_cred);
+   if (error)
+   goto out;
+
+   dp->i_size = roundup2(dp->i_size, dirblksize);
+   dp->i_flag |= IN_CHANGE;
+
+out:
+   free(buf, M_TEMP);
+   return (error);
+
+}
+
+/*
  * Write a directory entry after a call to namei, using the parameters
  * that it left in nameidata.  The argument ip is the inode which the new
  * directory entry will refer to.  Dvp is a pointer to the directory to
@@ -871,7 +933,6 @@ ext2_direnter(struct inode *ip, struct vnode *dvp, str
 {
struct inode *dp;
struct ext2fs_direct_2 newdir;
-   struct buf *bp;
int DIRBLKSIZ = ip->i_e2fs->e2fs_bsize;
int error;
 
@@ -911,36 +972,15 @@ ext2_direnter(struct inode *ip, struct vnode *dvp, str
}
}
 
-   if (dp->i_count == 0) {
-   /*
-* If dp->i_count is 0, then namei could find no
-* space in the directory. Here, dp->i_offset will
-* be on a directory block boundary and we will write the
-* new entry into a fresh block.
-*/
-   if (dp->i_offset & (DIRBLKSIZ - 1))
-   panic("ext2_direnter: newblk");
+   /*
+* If dp->i_count is 0, then namei could find no
+* space in the directory. Here, dp->i_offset will
+* be on a directory block boundary and we will write the
+* new entry into a fresh block.
+*/
+   if (dp->i_count == 0)
+   return ext2_add_first

svn commit: r337454 - head/sys/fs/ext2fs

2018-08-08 Thread Fedor Uporov
Author: fsu
Date: Wed Aug  8 12:08:46 2018
New Revision: 337454
URL: https://svnweb.freebsd.org/changeset/base/337454

Log:
  Split the dir_index and dir_nlink features.
  
  Do not allow to create more that EXT4_LINK_MAX links to directory in case
  if the dir_nlink is not set, like it is done in the fresh e2fsprogs updates.
  
  MFC after:  3 months

Modified:
  head/sys/fs/ext2fs/ext2_dir.h
  head/sys/fs/ext2fs/ext2_vnops.c

Modified: head/sys/fs/ext2fs/ext2_dir.h
==
--- head/sys/fs/ext2fs/ext2_dir.h   Wed Aug  8 12:07:45 2018
(r337453)
+++ head/sys/fs/ext2fs/ext2_dir.h   Wed Aug  8 12:08:46 2018
(r337454)
@@ -89,7 +89,6 @@ struct ext2fs_direct_tail {
 /*
  * Maximal count of links to a file
  */
-#defineEXT2_LINK_MAX   32000
 #defineEXT4_LINK_MAX   65000
 
 /*

Modified: head/sys/fs/ext2fs/ext2_vnops.c
==
--- head/sys/fs/ext2fs/ext2_vnops.c Wed Aug  8 12:07:45 2018
(r337453)
+++ head/sys/fs/ext2fs/ext2_vnops.c Wed Aug  8 12:08:46 2018
(r337454)
@@ -675,19 +675,6 @@ out:
return (error);
 }
 
-static unsigned short
-ext2_max_nlink(struct inode *ip)
-{
-   struct m_ext2fs *fs;
-
-   fs = ip->i_e2fs;
-
-   if (EXT2_HAS_RO_COMPAT_FEATURE(fs, EXT2F_ROCOMPAT_DIR_NLINK))
-   return (EXT4_LINK_MAX);
-   else
-   return (EXT2_LINK_MAX);
-}
-
 /*
  * link vnode call
  */
@@ -705,7 +692,7 @@ ext2_link(struct vop_link_args *ap)
panic("ext2_link: no name");
 #endif
ip = VTOI(vp);
-   if ((nlink_t)ip->i_nlink >= ext2_max_nlink(ip)) {
+   if ((nlink_t)ip->i_nlink >= EXT4_LINK_MAX) {
error = EMLINK;
goto out;
}
@@ -732,10 +719,12 @@ ext2_inc_nlink(struct inode *ip)
 
ip->i_nlink++;
 
-   if (ext2_htree_has_idx(ip) && ip->i_nlink > 1) {
-   if (ip->i_nlink >= ext2_max_nlink(ip) || ip->i_nlink == 2)
+   if (S_ISDIR(ip->i_mode) &&
+   EXT2_HAS_RO_COMPAT_FEATURE(ip->i_e2fs, EXT2F_ROCOMPAT_DIR_NLINK) &&
+   ip->i_nlink > 1) {
+   if (ip->i_nlink >= EXT4_LINK_MAX || ip->i_nlink == 2)
ip->i_nlink = 1;
-   } else if (ip->i_nlink > ext2_max_nlink(ip)) {
+   } else if (ip->i_nlink > EXT4_LINK_MAX) {
ip->i_nlink--;
return (EMLINK);
}
@@ -833,7 +822,8 @@ abortit:
goto abortit;
dp = VTOI(fdvp);
ip = VTOI(fvp);
-   if (ip->i_nlink >= ext2_max_nlink(ip) && !ext2_htree_has_idx(ip)) {
+   if (ip->i_nlink >= EXT4_LINK_MAX &&
+   !EXT2_HAS_RO_COMPAT_FEATURE(ip->i_e2fs, EXT2F_ROCOMPAT_DIR_NLINK)) {
VOP_UNLOCK(fvp, 0);
error = EMLINK;
goto abortit;
@@ -1304,8 +1294,8 @@ ext2_mkdir(struct vop_mkdir_args *ap)
panic("ext2_mkdir: no name");
 #endif
dp = VTOI(dvp);
-   if ((nlink_t)dp->i_nlink >= ext2_max_nlink(dp) &&
-   !ext2_htree_has_idx(dp)) {
+   if ((nlink_t)dp->i_nlink >= EXT4_LINK_MAX &&
+   !EXT2_HAS_RO_COMPAT_FEATURE(dp->i_e2fs, EXT2F_ROCOMPAT_DIR_NLINK)) {
error = EMLINK;
goto out;
}
@@ -1655,10 +1645,11 @@ ext2_pathconf(struct vop_pathconf_args *ap)
 
switch (ap->a_name) {
case _PC_LINK_MAX:
-   if (ext2_htree_has_idx(VTOI(ap->a_vp)))
+   if (EXT2_HAS_RO_COMPAT_FEATURE(VTOI(ap->a_vp)->i_e2fs,
+   EXT2F_ROCOMPAT_DIR_NLINK))
*ap->a_retval = INT_MAX;
else
-   *ap->a_retval = ext2_max_nlink(VTOI(ap->a_vp));
+   *ap->a_retval = EXT4_LINK_MAX;
break;
case _PC_NAME_MAX:
*ap->a_retval = NAME_MAX;
___
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: r337455 - head/sys/netinet/tcp_stacks

2018-08-08 Thread Randall Stewart
Author: rrs
Date: Wed Aug  8 13:36:49 2018
New Revision: 337455
URL: https://svnweb.freebsd.org/changeset/base/337455

Log:
  Fix a small bug in rack where it will
  end up sending the FIN twice.
  Sponsored by: Netflix Inc.
  Differential Revision:https://reviews.freebsd.org/D16604

Modified:
  head/sys/netinet/tcp_stacks/rack.c

Modified: head/sys/netinet/tcp_stacks/rack.c
==
--- head/sys/netinet/tcp_stacks/rack.c  Wed Aug  8 12:08:46 2018
(r337454)
+++ head/sys/netinet/tcp_stacks/rack.c  Wed Aug  8 13:36:49 2018
(r337455)
@@ -7603,13 +7603,10 @@ dontupdate:
 * If our state indicates that FIN should be sent and we have not
 * yet done so, then we need to send.
 */
-   if (flags & TH_FIN) {
-   if ((tp->t_flags & TF_SENTFIN) ||
-   (((tp->t_flags & TF_SENTFIN) == 0) &&
-(tp->snd_nxt == tp->snd_una))) {
-   pass = 11;
-   goto send;
-   }
+   if ((flags & TH_FIN) &&
+   (tp->snd_nxt == tp->snd_una)) {
+   pass = 11;
+   goto send;
}
/*
 * No reason to send a segment, just return.
___
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: r337456 - head/sys/fs/msdosfs

2018-08-08 Thread Pedro F. Giffuni
Author: pfg
Date: Wed Aug  8 15:08:22 2018
New Revision: 337456
URL: https://svnweb.freebsd.org/changeset/base/337456

Log:
  msdosfs: fixes for Undefined Behavior.
  
  These were found by the Undefined Behaviour GsoC project at NetBSD:
  
  Do not change signedness bit with left shift.
  While there avoid signed integer overflow.
  Address both issues with using unsigned type.
  
  msdosfs_fat.c:512:42, left shift of 1 by 31 places cannot be represented
  in type 'int'
  msdosfs_fat.c:521:44, left shift of 1 by 31 places cannot be represented
  in type 'int'
  msdosfs_fat.c:744:14, left shift of 1 by 31 places cannot be represented
  in type 'int'
  msdosfs_fat.c:744:24, signed integer overflow: -2147483648 - 1 cannot be
  represented in type 'int [20]'
  msdosfs_fat.c:840:13, left shift of 1 by 31 places cannot be represented
  in type 'int'
  msdosfs_fat.c:840:36, signed integer overflow: -2147483648 - 1 cannot be
  represented in type 'int [20]'
  
  Detected with micro-UBSan in the user mode.
  
  Hinted from:  NetBSD (CVS 1.33)
  MFC after:2 weeks
  Differenctial Revision:   https://reviews.freebsd.org/D16615

Modified:
  head/sys/fs/msdosfs/msdosfs_fat.c

Modified: head/sys/fs/msdosfs/msdosfs_fat.c
==
--- head/sys/fs/msdosfs/msdosfs_fat.c   Wed Aug  8 13:36:49 2018
(r337455)
+++ head/sys/fs/msdosfs/msdosfs_fat.c   Wed Aug  8 15:08:22 2018
(r337456)
@@ -391,7 +391,7 @@ usemap_alloc(struct msdosfsmount *pmp, u_long cn)
KASSERT((pmp->pm_inusemap[cn / N_INUSEBITS] & (1 << (cn % N_INUSEBITS)))
== 0, ("Allocating used sector %ld %ld %x", cn, cn % N_INUSEBITS,
(unsigned)pmp->pm_inusemap[cn / N_INUSEBITS]));
-   pmp->pm_inusemap[cn / N_INUSEBITS] |= 1 << (cn % N_INUSEBITS);
+   pmp->pm_inusemap[cn / N_INUSEBITS] |= 1U << (cn % N_INUSEBITS);
KASSERT(pmp->pm_freeclustercount > 0, ("usemap_alloc: too little"));
pmp->pm_freeclustercount--;
pmp->pm_flags |= MSDOSFS_FSIMOD;
@@ -412,7 +412,7 @@ usemap_free(struct msdosfsmount *pmp, u_long cn)
KASSERT((pmp->pm_inusemap[cn / N_INUSEBITS] & (1 << (cn % N_INUSEBITS)))
!= 0, ("Freeing unused sector %ld %ld %x", cn, cn % N_INUSEBITS,
(unsigned)pmp->pm_inusemap[cn / N_INUSEBITS]));
-   pmp->pm_inusemap[cn / N_INUSEBITS] &= ~(1 << (cn % N_INUSEBITS));
+   pmp->pm_inusemap[cn / N_INUSEBITS] &= ~(1U << (cn % N_INUSEBITS));
 }
 
 int
@@ -775,7 +775,7 @@ clusteralloc1(struct msdosfsmount *pmp, u_long start, 
for (cn = newst; cn <= pmp->pm_maxcluster;) {
idx = cn / N_INUSEBITS;
map = pmp->pm_inusemap[idx];
-   map |= (1 << (cn % N_INUSEBITS)) - 1;
+   map |= (1U << (cn % N_INUSEBITS)) - 1;
if (map != FULL_RUN) {
cn = idx * N_INUSEBITS + ffs(map ^ FULL_RUN) - 1;
if ((l = chainlength(pmp, cn, count)) >= count)
@@ -792,7 +792,7 @@ clusteralloc1(struct msdosfsmount *pmp, u_long start, 
for (cn = 0; cn < newst;) {
idx = cn / N_INUSEBITS;
map = pmp->pm_inusemap[idx];
-   map |= (1 << (cn % N_INUSEBITS)) - 1;
+   map |= (1U << (cn % N_INUSEBITS)) - 1;
if (map != FULL_RUN) {
cn = idx * N_INUSEBITS + ffs(map ^ FULL_RUN) - 1;
if ((l = chainlength(pmp, cn, count)) >= count)
@@ -950,7 +950,7 @@ fillinusemap(struct msdosfsmount *pmp)
 
for (cn = pmp->pm_maxcluster + 1; cn < (pmp->pm_maxcluster +
N_INUSEBITS) / N_INUSEBITS; cn++)
-   pmp->pm_inusemap[cn / N_INUSEBITS] |= 1 << (cn % N_INUSEBITS);
+   pmp->pm_inusemap[cn / N_INUSEBITS] |= 1U << (cn % N_INUSEBITS);
 
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"


svn commit: r337457 - head/usr.bin/printf

2018-08-08 Thread Pedro F. Giffuni
Author: pfg
Date: Wed Aug  8 15:12:32 2018
New Revision: 337457
URL: https://svnweb.freebsd.org/changeset/base/337457

Log:
  Revert r337440: the log message is wrong.

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

Modified: head/usr.bin/printf/printf.c
==
--- head/usr.bin/printf/printf.cWed Aug  8 15:08:22 2018
(r337456)
+++ head/usr.bin/printf/printf.cWed Aug  8 15:12:32 2018
(r337457)
@@ -1,7 +1,6 @@
 /*-
  * SPDX-License-Identifier: BSD-3-Clause
  *
- * Copyright 2018 Staysail Systems, Inc. 
  * Copyright 2014 Garrett D'Amore 
  * Copyright 2010 Nexenta Systems, Inc.  All rights reserved.
  * Copyright (c) 1989, 1993
@@ -376,19 +375,16 @@ printf_doformat(char *fmt, int *rval)
char *p;
int getout;
 
-   /* Convert "b" to "s" for output. */
-   start[strlen(start) - 1] = 's';
-   if ((p = strdup(getstr())) == NULL) {
+   p = strdup(getstr());
+   if (p == NULL) {
warnx("%s", strerror(ENOMEM));
return (NULL);
}
getout = escape(p, 0, &len);
-   PF(start, p);
-   /* Restore format for next loop. */
-
+   fputs(p, stdout);
free(p);
if (getout)
-   exit(*rval);
+   return (end_fmt);
break;
}
case 'c': {
___
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: r337458 - head/usr.bin/printf

2018-08-08 Thread Pedro F. Giffuni
Author: pfg
Date: Wed Aug  8 15:25:01 2018
New Revision: 337458
URL: https://svnweb.freebsd.org/changeset/base/337458

Log:
  Fix printf(1) ignores width and precision in %b format.
  
  The precision with the conversion specifier b is specified by POSIX: see
  point 7 in the reference documentation.
  
  This corrects previous wrong log in r337440.
  
  Reference: 
http://pubs.opengroup.org/onlinepubs/9699919799/utilities/printf.html
  
  PR:   229641
  Reported by:  Rudolf Cejka
  Submitted by: Garrett D'Amore (illumos)
  MFC after:1 week

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

Modified: head/usr.bin/printf/printf.c
==
--- head/usr.bin/printf/printf.cWed Aug  8 15:12:32 2018
(r337457)
+++ head/usr.bin/printf/printf.cWed Aug  8 15:25:01 2018
(r337458)
@@ -1,6 +1,7 @@
 /*-
  * SPDX-License-Identifier: BSD-3-Clause
  *
+ * Copyright 2018 Staysail Systems, Inc. 
  * Copyright 2014 Garrett D'Amore 
  * Copyright 2010 Nexenta Systems, Inc.  All rights reserved.
  * Copyright (c) 1989, 1993
@@ -375,16 +376,19 @@ printf_doformat(char *fmt, int *rval)
char *p;
int getout;
 
-   p = strdup(getstr());
-   if (p == NULL) {
+   /* Convert "b" to "s" for output. */
+   start[strlen(start) - 1] = 's';
+   if ((p = strdup(getstr())) == NULL) {
warnx("%s", strerror(ENOMEM));
return (NULL);
}
getout = escape(p, 0, &len);
-   fputs(p, stdout);
+   PF(start, p);
+   /* Restore format for next loop. */
+
free(p);
if (getout)
-   return (end_fmt);
+   exit(*rval);
break;
}
case 'c': {
___
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: r336526 - head

2018-08-08 Thread Roger Pau Monné
On Thu, Jul 26, 2018 at 05:41:46PM +, Brooks Davis wrote:
> On Thu, Jul 26, 2018 at 06:15:46PM +0200, Roger Pau Monn?? wrote:
> > On Thu, Jul 26, 2018 at 09:05:18AM -0600, Ian Lepore wrote:
> > > On Thu, 2018-07-26 at 16:54 +0200, Roger Pau Monn? wrote:
> > > > On Thu, Jul 26, 2018 at 08:49:12AM -0600, Ian Lepore wrote:
> > > > > 
> > > > > On Thu, 2018-07-26 at 15:58 +0200, Roger Pau Monn? wrote:
> > > > > > 
> > > > > > On Fri, Jul 20, 2018 at 12:44:04AM +, Ian Lepore wrote:
> > > > > > > 
> > > > > > > 
> > > > > > > Author: ian
> > > > > > > Date: Fri Jul 20 00:44:04 2018
> > > > > > > New Revision: 336526
> > > > > > > URL: https://svnweb.freebsd.org/changeset/base/336526
> > > > > > > 
> > > > > > > Log:
> > > > > > > ? Add ntpd to the list of users/groups to check before
> > > > > > > installing.
> > > > > > The Xen CI loop is getting this when trying to create dist media
> > > > > > for HEAD FreeBSD (`make -C release ftp`):
> > > > > > 
> > > > > > + LC_ALL=C
> > > > > > + export LC_ALL
> > > > > > +
> > > > > > PATH=/usr/lib/ccache:/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbi
> > > > > > n:/u
> > > > > > sr/local/bin:/root/bin:/usr/lib/git-core
> > > > > > + http_proxy=http://cache:3128/
> > > > > > + export http_proxy
> > > > > > + https_proxy=http://cache:3128/
> > > > > > + export https_proxy
> > > > > > + exec
> > > > > > + cd /home/osstest/build.125515.build-amd64-freebsd
> > > > > > + rm -f build-ok-stamp
> > > > > > + cd freebsd
> > > > > > + export 'MAKEOBJDIRPREFIX=/home/osstest/build.125515.build-
> > > > > > amd64-
> > > > > > freebsd/obj'
> > > > > > + export 'TARGET=amd64'
> > > > > > + make -C release ftp -DWITHOUT_AUTO_OBJ
> > > > > > + tee ../release-ftp-log
> > > > > > mkdir -p dist
> > > > > > cd /usr/home/osstest/build.125515.build-amd64-
> > > > > > freebsd/freebsd/release/.. && make TARGET_ARCH=amd64 TARGET=amd64
> > > > > > distributeworld DISTDIR=/usr/home/osstest/build.125515.build-
> > > > > > amd64-
> > > > > > freebsd/freebsd/release/dist
> > > > > > make[2]: "/usr/home/osstest/build.125515.build-amd64-
> > > > > > freebsd/obj/usr/home/osstest/build.125515.build-amd64-
> > > > > > freebsd/freebsd/amd64.amd64/toolchain-metadata.mk" line 1: Using
> > > > > > cached toolchain metadata from build at??on Mon Jul 23 10:29:23
> > > > > > UTC
> > > > > > 2018
> > > > > > ERROR: Required ntpd user is missing, see /usr/src/UPDATING.
> > > > > > *** Error code 1
> > > > > > 
> > > > > > Stop.
> > > > > > make[2]: stopped in /usr/home/osstest/build.125515.build-amd64-
> > > > > > freebsd/freebsd
> > > > > > *** Error code 1
> > > > > > 
> > > > > > Stop.
> > > > > > make[1]: stopped in /usr/home/osstest/build.125515.build-amd64-
> > > > > > freebsd/freebsd
> > > > > > *** Error code 1
> > > > > > 
> > > > > > Stop.
> > > > > > make: stopped in /usr/home/osstest/build.125515.build-amd64-
> > > > > > freebsd/freebsd/release
> > > > > > 
> > > > > > The full build log can be found at:
> > > > > > 
> > > > > > http://logs.test-lab.xenproject.org/osstest/logs/125569/build-amd
> > > > > > 64-f
> > > > > > reebsd/7.ts-freebsd-build.log
> > > > > > 
> > > > > > Note that it's ~100MB.
> > > > > > 
> > > > > > Thanks, Roger.
> > > > > > 
> > > > > If the script is creating a new distribution image from scratch, it
> > > > > should be using -DDB_FROM_SRC on all distrib* and install* make
> > > > > targets, to avoid using (and verifying against) the passwd database
> > > > > on
> > > > > the build system.
> > > > Shouldn't then that be set by default for the ftp release target?
> > > > The sole purpose of that target is to create the sets that go to the
> > > > servers AFAICT.
> > > > 
> > > > Or maybe it's the distributeworld target the one missing the
> > > > DB_FROM_SRC?
> > > > 
> > > > Roger.
> > > > 
> > > 
> > > I don't know anything about the release scripts or how they work.
> > > 
> > > I started down the path of trying to make the build system
> > > automatically set DB_FROM_SRC if DESTDIR is anything other than "/",
> > > but I realized that's wrong too... I occasionally mount an sdcard from
> > > some embedded system on my build machine and update it from a
> > > crossbuild using DESTDIR=/mnt, and in a case like that, using the
> > > passwd database from the system being updated is the right thing to do
> > > and DB_FROM_SRC isn't right (although it would work most of the time
> > > for most people).
> > > 
> > > Right now there's no way to even properly use the passwd data from the
> > > target system, and when I tried to do that, I ran into other bugs. The
> > > only options now are to use the running system even when it's not
> > > what's being installed (clearly wrong) or use DB_FROM_SRC to bypass the
> > > checks, but also bypass using the passwd data from the target system
> > > (but it works okay as long as none of the names/uids < 1024 have been
> > > changed on the target system/image).
> > 
> > But when executing something like the distributeworld target there's
>

svn commit: r337459 - in head/sys/riscv: include riscv

2018-08-08 Thread Ruslan Bukin
Author: br
Date: Wed Aug  8 16:08:38 2018
New Revision: 337459
URL: https://svnweb.freebsd.org/changeset/base/337459

Log:
  Implement uma_small_alloc(), uma_small_free().
  
  Reviewed by:  markj
  Obtained from:arm64
  Sponsored by: DARPA, AFRL
  Differential Revision:https://reviews.freebsd.org/D16628

Modified:
  head/sys/riscv/include/vmparam.h
  head/sys/riscv/riscv/uma_machdep.c

Modified: head/sys/riscv/include/vmparam.h
==
--- head/sys/riscv/include/vmparam.hWed Aug  8 15:25:01 2018
(r337458)
+++ head/sys/riscv/include/vmparam.hWed Aug  8 16:08:38 2018
(r337459)
@@ -223,10 +223,7 @@
 #defineVM_INITIAL_PAGEIN   16
 #endif
 
-/*
- * RISCVTODO
- * #define UMA_MD_SMALL_ALLOC
- */
+#defineUMA_MD_SMALL_ALLOC
 
 #ifndef LOCORE
 extern vm_paddr_t dmap_phys_base;

Modified: head/sys/riscv/riscv/uma_machdep.c
==
--- head/sys/riscv/riscv/uma_machdep.c  Wed Aug  8 15:25:01 2018
(r337458)
+++ head/sys/riscv/riscv/uma_machdep.c  Wed Aug  8 16:08:38 2018
(r337459)
@@ -32,6 +32,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -44,13 +45,39 @@ void *
 uma_small_alloc(uma_zone_t zone, vm_size_t bytes, int domain, u_int8_t *flags,
 int wait)
 {
+   vm_page_t m;
+   vm_paddr_t pa;
+   void *va;
 
-   panic("uma_small_alloc");
+   *flags = UMA_SLAB_PRIV;
+   m = vm_page_alloc_domain(NULL, 0, domain,
+   malloc2vm_flags(wait) | VM_ALLOC_NOOBJ | VM_ALLOC_WIRED);
+   if (m == NULL)
+   return (NULL);
+   pa = m->phys_addr;
+#if 0
+   /* RISCVTODO: minidump */
+   if ((wait & M_NODUMP) == 0)
+   dump_add_page(pa);
+#endif
+   va = (void *)PHYS_TO_DMAP(pa);
+   if ((wait & M_ZERO) && (m->flags & PG_ZERO) == 0)
+   bzero(va, PAGE_SIZE);
+   return (va);
 }
 
 void
 uma_small_free(void *mem, vm_size_t size, u_int8_t flags)
 {
+   vm_page_t m;
+   vm_paddr_t pa;
 
-   panic("uma_small_free");
+   pa = DMAP_TO_PHYS((vm_offset_t)mem);
+#if 0
+   /* RISCVTODO: minidump */
+   dump_drop_page(pa);
+#endif
+   m = PHYS_TO_VM_PAGE(pa);
+   vm_page_unwire_noq(m);
+   vm_page_free(m);
 }
___
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: r337463 - in head/sys: arm/arm arm/include vm

2018-08-08 Thread Alan Cox
Author: alc
Date: Wed Aug  8 16:55:01 2018
New Revision: 337463
URL: https://svnweb.freebsd.org/changeset/base/337463

Log:
  Add support for pmap_enter(..., psind=1) to the armv6 pmap.  In other words,
  add support for explicitly requesting that pmap_enter() create a 1 MB page
  mapping.  (Essentially, this feature allows the machine-independent layer
  to create superpage mappings preemptively, and not wait for automatic
  promotion to occur.)
  
  Export pmap_ps_enabled() to the machine-independent layer.
  
  Add a flag to pmap_pv_insert_pte1() that specifies whether it should fail
  or reclaim a PV entry when one is not available.
  
  Refactor pmap_enter_pte1() into two functions, one by the same name, that
  is a general-purpose function for creating pte1 mappings, and another,
  pmap_enter_1mpage(), that is used to prefault 1 MB read- and/or execute-
  only mappings for execve(2), mmap(2), and shmat(2).
  
  In addition, as an optimization to pmap_enter(..., psind=0), eliminate the
  use of pte2_is_managed() from pmap_enter().  Unlike the x86 pmap
  implementations, armv6 does not have a managed bit defined within the PTE.
  So, pte2_is_managed() is actually a call to PHYS_TO_VM_PAGE(), which is O(n)
  in the number of vm_phys_segs[].  All but one call to PHYS_TO_VM_PAGE() in
  pmap_enter() can be avoided.
  
  Reviewed by:  kib, markj, mmel
  Tested by:mmel
  MFC after:6 weeks
  Differential Revision:https://reviews.freebsd.org/D16555

Modified:
  head/sys/arm/arm/pmap-v6.c
  head/sys/arm/include/pmap-v6.h
  head/sys/vm/vm_fault.c

Modified: head/sys/arm/arm/pmap-v6.c
==
--- head/sys/arm/arm/pmap-v6.c  Wed Aug  8 16:17:50 2018(r337462)
+++ head/sys/arm/arm/pmap-v6.c  Wed Aug  8 16:55:01 2018(r337463)
@@ -323,9 +323,17 @@ SYSCTL_INT(_debug, OID_AUTO, PMAP1unchanged, CTLFLAG_R
 "Number of times pmap_pte2_quick didn't change PMAP1");
 static struct mtx PMAP2mutex;
 
+/*
+ * Internal flags for pmap_enter()'s helper functions.
+ */
+#definePMAP_ENTER_NORECLAIM0x100   /* Don't reclaim PV 
entries. */
+#definePMAP_ENTER_NOREPLACE0x200   /* Don't replace 
mappings. */
+
 static __inline void pt2_wirecount_init(vm_page_t m);
 static boolean_t pmap_demote_pte1(pmap_t pmap, pt1_entry_t *pte1p,
 vm_offset_t va);
+static int pmap_enter_pte1(pmap_t pmap, vm_offset_t va, pt1_entry_t pte1,
+u_int flags, vm_page_t m);
 void cache_icache_sync_fresh(vm_offset_t va, vm_paddr_t pa, vm_size_t size);
 
 /*
@@ -1557,6 +1565,13 @@ static int sp_enabled = 1;
 SYSCTL_INT(_vm_pmap, OID_AUTO, sp_enabled, CTLFLAG_RDTUN | CTLFLAG_NOFETCH,
 &sp_enabled, 0, "Are large page mappings enabled?");
 
+bool
+pmap_ps_enabled(pmap_t pmap __unused)
+{
+
+   return (sp_enabled != 0);
+}
+
 static SYSCTL_NODE(_vm_pmap, OID_AUTO, pte1, CTLFLAG_RD, 0,
 "1MB page mapping counters");
 
@@ -3227,21 +3242,22 @@ pmap_try_insert_pv_entry(pmap_t pmap, vm_offset_t va, 
 /*
  *  Create the pv entries for each of the pages within a section.
  */
-static boolean_t
-pmap_pv_insert_pte1(pmap_t pmap, vm_offset_t va, vm_paddr_t pa)
+static bool
+pmap_pv_insert_pte1(pmap_t pmap, vm_offset_t va, pt1_entry_t pte1, u_int flags)
 {
struct md_page *pvh;
pv_entry_t pv;
+   bool noreclaim;
 
rw_assert(&pvh_global_lock, RA_WLOCKED);
-   if (pv_entry_count < pv_entry_high_water &&
-   (pv = get_pv_entry(pmap, TRUE)) != NULL) {
-   pv->pv_va = va;
-   pvh = pa_to_pvh(pa);
-   TAILQ_INSERT_TAIL(&pvh->pv_list, pv, pv_next);
-   return (TRUE);
-   } else
-   return (FALSE);
+   noreclaim = (flags & PMAP_ENTER_NORECLAIM) != 0;
+   if ((noreclaim && pv_entry_count >= pv_entry_high_water) ||
+   (pv = get_pv_entry(pmap, noreclaim)) == NULL)
+   return (false);
+   pv->pv_va = va;
+   pvh = pa_to_pvh(pte1_pa(pte1));
+   TAILQ_INSERT_TAIL(&pvh->pv_list, pv, pv_next);
+   return (true);
 }
 
 static inline void
@@ -3879,7 +3895,7 @@ pmap_enter(pmap_t pmap, vm_offset_t va, vm_page_t m, v
if ((prot & VM_PROT_WRITE) == 0)
npte2 |= PTE2_RO;
KASSERT((npte2 & (PTE2_NM | PTE2_RO)) != PTE2_RO,
-   ("pmap_enter: flags includes VM_PROT_WRITE but prot doesn't"));
+   ("%s: flags includes VM_PROT_WRITE but prot doesn't", __func__));
if ((prot & VM_PROT_EXECUTE) == 0)
npte2 |= PTE2_NX;
if ((flags & PMAP_ENTER_WIRED) != 0)
@@ -3892,6 +3908,15 @@ pmap_enter(pmap_t pmap, vm_offset_t va, vm_page_t m, v
rw_wlock(&pvh_global_lock);
PMAP_LOCK(pmap);
sched_pin();
+   if (psind == 1) {
+   /* Assert the required virtual and physical alignment. */
+   KASSERT((va & PTE1_OFFSET) == 0,
+   ("%s: va unaligned", __func__));
+   KAS

svn commit: r337468 - head/usr.sbin/newsyslog

2018-08-08 Thread Mark Johnston
Author: markj
Date: Wed Aug  8 17:26:51 2018
New Revision: 337468
URL: https://svnweb.freebsd.org/changeset/base/337468

Log:
  Simplify compression code.
  
  - Remove the compression suffix macros and move them directly into the
compress_type array.
  - Remove the hardcoded sizes on the suffix and compression args arrays.
  - Simplify the compression args arrays at the expense of a __DECONST
when calling execv().
  - Rewrite do_zipwork.  The COMPRESS_* macros can directly index the
compress_types array, so the outer loop is not needed. Convert
fixed-length strings into asprintf or sbuf calls.
  
  Submitted by: Dan Nelson 
  Reviewed by:  gad
  MFC after:2 weeks
  Differential Revision:https://reviews.freebsd.org/D16518

Modified:
  head/usr.sbin/newsyslog/Makefile
  head/usr.sbin/newsyslog/newsyslog.c

Modified: head/usr.sbin/newsyslog/Makefile
==
--- head/usr.sbin/newsyslog/MakefileWed Aug  8 17:22:41 2018
(r337467)
+++ head/usr.sbin/newsyslog/MakefileWed Aug  8 17:26:51 2018
(r337468)
@@ -5,6 +5,7 @@
 PROG=  newsyslog
 MAN=   newsyslog.8 newsyslog.conf.5
 SRCS=  newsyslog.c ptimes.c
+LIBADD=sbuf
 
 HAS_TESTS=
 SUBDIR.${MK_TESTS}+= tests

Modified: head/usr.sbin/newsyslog/newsyslog.c
==
--- head/usr.sbin/newsyslog/newsyslog.c Wed Aug  8 17:22:41 2018
(r337467)
+++ head/usr.sbin/newsyslog/newsyslog.c Wed Aug  8 17:26:51 2018
(r337468)
@@ -60,6 +60,7 @@ __FBSDID("$FreeBSD$");
 
 #include 
 #include 
+#include 
 #include 
 #include 
 
@@ -87,27 +88,6 @@ __FBSDID("$FreeBSD$");
 #include "extern.h"
 
 /*
- * Compression suffixes
- */
-#ifndefCOMPRESS_SUFFIX_GZ
-#defineCOMPRESS_SUFFIX_GZ  ".gz"
-#endif
-
-#ifndefCOMPRESS_SUFFIX_BZ2
-#defineCOMPRESS_SUFFIX_BZ2 ".bz2"
-#endif
-
-#ifndefCOMPRESS_SUFFIX_XZ
-#defineCOMPRESS_SUFFIX_XZ  ".xz"
-#endif
-
-#ifndefCOMPRESS_SUFFIX_ZST
-#defineCOMPRESS_SUFFIX_ZST ".zst"
-#endif
-
-#defineCOMPRESS_SUFFIX_MAXLEN  
MAX(MAX(MAX(sizeof(COMPRESS_SUFFIX_GZ),sizeof(COMPRESS_SUFFIX_BZ2)),sizeof(COMPRESS_SUFFIX_XZ)),sizeof(COMPRESS_SUFFIX_ZST))
-
-/*
  * Compression types
  */
 #defineCOMPRESS_TYPES  5   /* Number of supported compression 
types */
@@ -151,24 +131,21 @@ struct compress_types {
const char *flag;   /* Flag in configuration file */
const char *suffix; /* Compression suffix */
const char *path;   /* Path to compression program */
-   char **args;/* Compression program arguments */
-   int nargs;  /* Program argument count */
+   const char **flags; /* Compression program flags */
+   int nflags; /* Program flags count */
 };
 
-static char f_arg[] = "-f";
-static char q_arg[] = "-q";
-static char rm_arg[] = "--rm";
-static char *gz_args[] = { NULL, f_arg, NULL, NULL };
-#define bz2_args gz_args
-#define xz_args gz_args
-static char *zstd_args[] = { NULL, q_arg, rm_arg, NULL, NULL };
+static const char *gzip_flags[] = { "-f" };
+#define bzip2_flags gzip_flags
+#define xz_flags gzip_flags
+static const char *zstd_flags[] = { "-q", "--rm" };
 
 static const struct compress_types compress_type[COMPRESS_TYPES] = {
-   { "", "", "", NULL, 0},
-   { "Z", COMPRESS_SUFFIX_GZ, _PATH_GZIP, gz_args, nitems(gz_args) },
-   { "J", COMPRESS_SUFFIX_BZ2, _PATH_BZIP2, bz2_args, nitems(bz2_args) },
-   { "X", COMPRESS_SUFFIX_XZ, _PATH_XZ, xz_args, nitems(xz_args) },
-   { "Y", COMPRESS_SUFFIX_ZST, _PATH_ZSTD, zstd_args, nitems(zstd_args) }
+   { "", "", "", NULL, 0 },
+   { "Z", ".gz", _PATH_GZIP, gzip_flags, nitems(gzip_flags) },
+   { "J", ".bz2", _PATH_BZIP2, bzip2_flags, nitems(bzip2_flags) },
+   { "X", ".xz", _PATH_XZ, xz_flags, nitems(xz_flags) },
+   { "Y", ".zst", _PATH_ZSTD, zstd_flags, nitems(zstd_flags) }
 };
 
 struct conf_entry {
@@ -2020,54 +1997,19 @@ do_sigwork(struct sigwork_entry *swork)
 static void
 do_zipwork(struct zipwork_entry *zwork)
 {
-   const char *pgm_name, *pgm_path;
-   int errsav, fcount, zstatus;
+   const struct compress_types *ct;
+   struct sbuf *command;
pid_t pidzip, wpid;
-   char zresult[MAXPATHLEN];
-   char command[BUFSIZ];
-   char **args;
-   int c, i, nargs;
+   int c, errsav, fcount, zstatus;
+   const char **args, *pgm_name, *pgm_path;
+   char *zresult;
 
+   command = NULL;
assert(zwork != NULL);
-   pgm_path = NULL;
-   strlcpy(zresult, zwork->zw_fname, sizeof(zresult));
-   if (zwork->zw_conf != NULL &&
-   zwork->zw_conf->compress > COMPRESS_NONE)
-   for (c = 1; c < COMPRESS_TYPES; c++) {
-   if (zwork->zw_conf->compress == c) {
-   nargs =

svn commit: r337469 - head/sys/netpfil/ipfw/pmod

2018-08-08 Thread Andrey V. Elsukov
Author: ae
Date: Wed Aug  8 17:32:02 2018
New Revision: 337469
URL: https://svnweb.freebsd.org/changeset/base/337469

Log:
  Use host byte order when comparing mss values.
  
  This fixes tcp-setmss action on little endian machines.
  
  PR:   225536
  Submitted by: John Zielinski

Modified:
  head/sys/netpfil/ipfw/pmod/tcpmod.c

Modified: head/sys/netpfil/ipfw/pmod/tcpmod.c
==
--- head/sys/netpfil/ipfw/pmod/tcpmod.c Wed Aug  8 17:26:51 2018
(r337468)
+++ head/sys/netpfil/ipfw/pmod/tcpmod.c Wed Aug  8 17:32:02 2018
(r337469)
@@ -98,7 +98,7 @@ tcpmod_setmss(struct mbuf **mp, struct tcphdr *tcp, in
ret = 0; /* report success */
bcopy(cp + 2, &oldmss, sizeof(oldmss));
/* Do not update lower MSS value */
-   if (oldmss <= mss)
+   if (ntohs(oldmss) <= ntohs(mss))
break;
bcopy(&mss, cp + 2, sizeof(mss));
/* Update checksum if it is not delayed. */
___
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: r336692 - head/sys/sys

2018-08-08 Thread Gleb Smirnoff
On Wed, Jul 25, 2018 at 12:18:21AM +, Ed Maste wrote:
E> Author: emaste
E> Date: Wed Jul 25 00:18:21 2018
E> New Revision: 336692
E> URL: https://svnweb.freebsd.org/changeset/base/336692
E> 
E> Log:
E>   sockopt.h: remove stale comment
E>   
E>   Some old compatibility bits were removed in r227503 but this comment
E>   was left behind.
E>   
E>   Reported by:   br, via review D11962
E>   Sponsored by:  The FreeBSD Foundation
E> 
E> Modified:
E>   head/sys/sys/sockopt.h
E> 
E> Modified: head/sys/sys/sockopt.h
E> 
==
E> --- head/sys/sys/sockopt.h   Wed Jul 25 00:06:18 2018(r336691)
E> +++ head/sys/sys/sockopt.h   Wed Jul 25 00:18:21 2018(r336692)
E> @@ -62,7 +62,6 @@ intsosetopt(struct socket *so, struct sockopt 
*sopt);
E>  int sogetopt(struct socket *so, struct sockopt *sopt);
E>  int sooptcopyin(struct sockopt *sopt, void *buf, size_t len, size_t minlen);
E>  int sooptcopyout(struct sockopt *sopt, const void *buf, size_t len);
E> -/* XXX; prepare mbuf for (__FreeBSD__ < 3) routines. */
E>  int soopt_getm(struct sockopt *sopt, struct mbuf **mp);
E>  int soopt_mcopyin(struct sockopt *sopt, struct mbuf *m);
E>  int soopt_mcopyout(struct sockopt *sopt, struct mbuf *m);

This comment was a good mark to note that these three functions
need to go away. But IPv6 still uses them.

-- 
Gleb Smirnoff
___
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: r337482 - head/share/man/man9

2018-08-08 Thread Alan Somers
Author: asomers
Date: Wed Aug  8 18:50:42 2018
New Revision: 337482
URL: https://svnweb.freebsd.org/changeset/base/337482

Log:
  Bring VOP_LOOKUP(9) up to date
  
  * Remove the cn_hash field (removed by r51906)
  * Add the cn_lkflags field (added by r144285)
  * Remove duplicate definition of cnp.
  
  Reviewed by:  kib
  MFC after:2 weeks
  Differential Revision:https://reviews.freebsd.org/D16629

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

Modified: head/share/man/man9/VOP_LOOKUP.9
==
--- head/share/man/man9/VOP_LOOKUP.9Wed Aug  8 18:50:32 2018
(r337481)
+++ head/share/man/man9/VOP_LOOKUP.9Wed Aug  8 18:50:42 2018
(r337482)
@@ -28,7 +28,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd November 17, 2017
+.Dd August 8, 2018
 .Dt VOP_LOOKUP 9
 .Os
 .Sh NAME
@@ -51,10 +51,7 @@ The locked vnode of the directory to search.
 The address of a variable where the resulting locked vnode should be stored.
 .It Fa cnp
 The pathname component to be searched for.
-.El
-.Pp
-.Fa Cnp
-is a pointer to a componentname structure defined as follows:
+It is a pointer to a componentname structure defined as follows:
 .Bd -literal
 struct componentname {
/*
@@ -64,13 +61,13 @@ struct componentname {
u_long  cn_flags;   /* flags to namei */
struct  thread *cn_thread;  /* thread requesting lookup */
struct  ucred *cn_cred; /* credentials */
+   int cn_lkflags; /* Lock flags LK_EXCLUSIVE or LK_SHARED */
/*
 * Shared between lookup and commit routines.
 */
char*cn_pnbuf;  /* pathname buffer */
char*cn_nameptr;/* pointer to looked up name */
longcn_namelen; /* length of looked up component */
-   u_long  cn_hash;/* hash value of looked up name */
 };
 .Ed
 .Pp
___
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: r337494 - head/share/mk

2018-08-08 Thread Bryan Drewery
Author: bdrewery
Date: Wed Aug  8 19:15:45 2018
New Revision: 337494
URL: https://svnweb.freebsd.org/changeset/base/337494

Log:
  DIRS: Ensure existing directory still has permissions set.

Modified:
  head/share/mk/bsd.dirs.mk

Modified: head/share/mk/bsd.dirs.mk
==
--- head/share/mk/bsd.dirs.mk   Wed Aug  8 19:03:06 2018(r337493)
+++ head/share/mk/bsd.dirs.mk   Wed Aug  8 19:15:45 2018(r337494)
@@ -28,9 +28,9 @@ ${dir}TAG_ARGS=   -T ${${dir}TAGS:[*]:S/ /,/g}
 
 installdirs: installdirs-${dir}
 
-installdirs-${dir}: ${DESTDIR}${${dir}}
+installdirs-${dir}: installdirs-${DESTDIR}${${dir}}
 
-${DESTDIR}${${dir}}:
+installdirs-${DESTDIR}${${dir}}:
@${ECHO} installing DIRS ${dir}
${INSTALL} ${${dir}TAG_ARGS} -d -m ${${dir}_MODE} -o ${${dir}_OWN} \
-g ${${dir}_GRP} ${${dir}_FLAG} ${DESTDIR}${${dir}}
___
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: r337495 - head/share/mk

2018-08-08 Thread Bryan Drewery
Author: bdrewery
Date: Wed Aug  8 19:15:48 2018
New Revision: 337495
URL: https://svnweb.freebsd.org/changeset/base/337495

Log:
  DIRS: Fix duplicate target warnings.

Modified:
  head/share/mk/bsd.dirs.mk

Modified: head/share/mk/bsd.dirs.mk
==
--- head/share/mk/bsd.dirs.mk   Wed Aug  8 19:15:45 2018(r337494)
+++ head/share/mk/bsd.dirs.mk   Wed Aug  8 19:15:48 2018(r337495)
@@ -30,10 +30,12 @@ installdirs: installdirs-${dir}
 
 installdirs-${dir}: installdirs-${DESTDIR}${${dir}}
 
+.  if !target(installdirs-${DESTDIR}${${dir}})
 installdirs-${DESTDIR}${${dir}}:
@${ECHO} installing DIRS ${dir}
${INSTALL} ${${dir}TAG_ARGS} -d -m ${${dir}_MODE} -o ${${dir}_OWN} \
-g ${${dir}_GRP} ${${dir}_FLAG} ${DESTDIR}${${dir}}
+.  endif
 .endif
 
 realinstall: installdirs-${dir}
___
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: r337497 - in head: . contrib/mdocml contrib/tnftp/src etc/root share/skel tools/tools/nanobsd/pcengines/Files/root tools/tools/nanobsd/rescue/Files/root usr.bin/mail usr.bin/man usr.bin...

2018-08-08 Thread Alan Somers
Author: asomers
Date: Wed Aug  8 19:24:20 2018
New Revision: 337497
URL: https://svnweb.freebsd.org/changeset/base/337497

Log:
  Switch the default pager for most commands to less
  
  Finally, a pager for the nineties.
  
  MFC after:Never
  Relnotes: Yes
  Differential Revision:https://reviews.freebsd.org/D13465
  Poll: https://reviews.freebsd.org/V7

Modified:
  head/UPDATING
  head/contrib/mdocml/apropos.1
  head/contrib/mdocml/main.c
  head/contrib/mdocml/man.1
  head/contrib/mdocml/mandoc.1
  head/contrib/tnftp/src/ftp_var.h
  head/etc/root/dot.cshrc
  head/etc/root/dot.profile
  head/share/skel/dot.cshrc
  head/share/skel/dot.mailrc
  head/share/skel/dot.profile
  head/tools/tools/nanobsd/pcengines/Files/root/.cshrc
  head/tools/tools/nanobsd/rescue/Files/root/.cshrc
  head/usr.bin/mail/cmd1.c
  head/usr.bin/mail/mail.1
  head/usr.bin/mail/pathnames.h
  head/usr.bin/man/man.1
  head/usr.bin/man/man.sh
  head/usr.bin/msgs/msgs.1
  head/usr.bin/msgs/pathnames.h
  head/usr.sbin/freebsd-update/freebsd-update.sh
  head/usr.sbin/mergemaster/mergemaster.8
  head/usr.sbin/mergemaster/mergemaster.sh

Modified: head/UPDATING
==
--- head/UPDATING   Wed Aug  8 19:21:08 2018(r337496)
+++ head/UPDATING   Wed Aug  8 19:24:20 2018(r337497)
@@ -31,6 +31,11 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 12.x IS SLOW:
disable the most expensive debugging functionality run
"ln -s 'abort:false,junk:false' /etc/malloc.conf".)
 
+20180808:
+   The default pager for most commands has been changed to "less".  To
+   restore the old behavior, set PAGER="more" and MANPAGER="more -s" in
+   your environment.
+
 20180731:
The jedec_ts(4) driver has been removed. A superset of its functionality
is available in the jedec_dimm(4) driver, and the manpage for that

Modified: head/contrib/mdocml/apropos.1
==
--- head/contrib/mdocml/apropos.1   Wed Aug  8 19:21:08 2018
(r337496)
+++ head/contrib/mdocml/apropos.1   Wed Aug  8 19:24:20 2018
(r337497)
@@ -15,7 +15,7 @@
 .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
 .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 .\"
-.Dd $Mdocdate: July 4 2017 $
+.Dd $Mdocdate: August 8 2018 $
 .Dt APROPOS 1
 .Os
 .Sh NAME
@@ -74,7 +74,7 @@ would.
 If the standard output is a terminal device and
 .Fl c
 is not specified, use
-.Xr more 1
+.Xr less 1
 to paginate them.
 In
 .Fl a
@@ -334,7 +334,7 @@ Text production:
 Any non-empty value of the environment variable
 .Ev MANPAGER
 is used instead of the standard pagination program,
-.Xr more 1 ;
+.Xr less 1 ;
 see
 .Xr man 1
 for details.
@@ -357,7 +357,7 @@ Specifies the pagination program to use when
 .Ev MANPAGER
 is not defined.
 If neither PAGER nor MANPAGER is defined,
-.Xr more 1
+.Xr less 1
 .Fl s
 is used.
 Only used if

Modified: head/contrib/mdocml/main.c
==
--- head/contrib/mdocml/main.c  Wed Aug  8 19:21:08 2018(r337496)
+++ head/contrib/mdocml/main.c  Wed Aug  8 19:24:20 2018(r337497)
@@ -1119,7 +1119,7 @@ spawn_pager(struct tag_files *tag_files)
if (pager == NULL || *pager == '\0')
pager = getenv("PAGER");
if (pager == NULL || *pager == '\0')
-   pager = "more -s";
+   pager = "less -s";
cp = mandoc_strdup(pager);
 
/*

Modified: head/contrib/mdocml/man.1
==
--- head/contrib/mdocml/man.1   Wed Aug  8 19:21:08 2018(r337496)
+++ head/contrib/mdocml/man.1   Wed Aug  8 19:24:20 2018(r337497)
@@ -31,7 +31,7 @@
 .\"
 .\" @(#)man.1  8.2 (Berkeley) 1/2/94
 .\"
-.Dd $Mdocdate: May 17 2017 $
+.Dd $Mdocdate: August 8 2018 $
 .Dt MAN 1
 .Os
 .Sh NAME
@@ -75,7 +75,7 @@ See
 for a description of the contents of this file.
 .It Fl c
 Copy the manual page to the standard output instead of using
-.Xr more 1
+.Xr less 1
 to paginate it.
 This is done by default if the standard output is not a terminal device.
 .It Fl f
@@ -233,7 +233,7 @@ is case insensitive.
 Any non-empty value of the environment variable
 .Ev MANPAGER
 is used instead of the standard pagination program,
-.Xr more 1 .
+.Xr less 1 .
 If
 .Xr less 1
 is used, the interactive
@@ -282,7 +282,7 @@ Specifies the pagination program to use when
 .Ev MANPAGER
 is not defined.
 If neither PAGER nor MANPAGER is defined,
-.Xr more 1
+.Xr less 1
 .Fl s
 is used.
 Only used if

Modified: head/contrib/mdocml/mandoc.1
==
--- head/contrib/

svn commit: r337500 - head/usr.sbin/route6d

2018-08-08 Thread Mark Johnston
Author: markj
Date: Wed Aug  8 20:15:40 2018
New Revision: 337500
URL: https://svnweb.freebsd.org/changeset/base/337500

Log:
  Use the right variable when updating interface routes.
  
  PR:   229807
  Submitted by: John Hay 
  MFC after:2 weeks

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

Modified: head/usr.sbin/route6d/route6d.c
==
--- head/usr.sbin/route6d/route6d.c Wed Aug  8 19:36:28 2018
(r337499)
+++ head/usr.sbin/route6d/route6d.c Wed Aug  8 20:15:40 2018
(r337500)
@@ -2223,8 +2223,10 @@ ifrt(struct ifc *ifcp, int again)
goto next;
}
 
-   TAILQ_REMOVE(&riprt_head, rrt, rrt_next);
-   delroute(&rrt->rrt_info, &rrt->rrt_gw);
+   TAILQ_REMOVE(&riprt_head, search_rrt, rrt_next);
+   delroute(&search_rrt->rrt_info,
+   &search_rrt->rrt_gw);
+   free(search_rrt);
}
/* Attach the route to the list */
trace(1, "route: %s/%d: register route (%s)\n",
___
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: r337501 - head/sys/fs/nfsserver

2018-08-08 Thread Rick Macklem
Author: rmacklem
Date: Wed Aug  8 20:21:45 2018
New Revision: 337501
URL: https://svnweb.freebsd.org/changeset/base/337501

Log:
  Assorted fixes to handling of LayoutRecall callbacks, mostly error handling.
  
  After a re-read of the appropriate section of RFC5661, I decided that a
  few things should be changed related to LayoutRecall callback handling.
  Here are the things fixed by this patch.
  - For two of the three cases that LayoutRecall is done, I now think
setting the clora_changed argument false is correct.
  - All errors other than NFSERR_DELAY returned by LayoutRecall appear
permanent, so don't retry for any of them. (NFSERR_DELAY is retried by
newnfs_request(), so it is not affected by this patch.)
  - Instead of waiting "forever" (actually until the process is SIGTERM'd)
for Layouts to be returned during a mirror copy, fail and return
ENXIO after about 1minute.
Waiting for a C made sense when pnfsdscopymr() was done by itself,
but did not make sense when done via find(1).
  This patch only affects the pNFS server.

Modified:
  head/sys/fs/nfsserver/nfs_nfsdstate.c

Modified: head/sys/fs/nfsserver/nfs_nfsdstate.c
==
--- head/sys/fs/nfsserver/nfs_nfsdstate.c   Wed Aug  8 20:15:40 2018
(r337500)
+++ head/sys/fs/nfsserver/nfs_nfsdstate.c   Wed Aug  8 20:21:45 2018
(r337501)
@@ -220,8 +220,8 @@ static void nfsrv_freealldevids(void);
 static void nfsrv_flexlayouterr(struct nfsrv_descript *nd, uint32_t *layp,
 int maxcnt, NFSPROC_T *p);
 static int nfsrv_recalllayout(nfsquad_t clid, nfsv4stateid_t *stateidp,
-fhandle_t *fhp, struct nfslayout *lyp, struct nfslayouthead *lyheadp,
-int laytype, NFSPROC_T *p);
+fhandle_t *fhp, struct nfslayout *lyp, int changed, int laytype,
+NFSPROC_T *p);
 static int nfsrv_findlayout(nfsquad_t *clientidp, fhandle_t *fhp, int laytype,
 NFSPROC_T *, struct nfslayout **lypp);
 static int nfsrv_fndclid(nfsquad_t *clidvec, nfsquad_t clid, int clidcnt);
@@ -4234,6 +4234,8 @@ out:
 
 /*
  * Do a server callback.
+ * The "trunc" argument is slightly overloaded and refers to different
+ * boolean arguments for CBRECALL and CBLAYOUTRECALL.
  */
 static int
 nfsrv_docallback(struct nfsclient *clp, int procnum, nfsv4stateid_t *stateidp,
@@ -4337,7 +4339,10 @@ nfsrv_docallback(struct nfsclient *clp, int procnum, n
NFSM_BUILD(tl, u_int32_t *, 4 * NFSX_UNSIGNED);
*tl++ = txdr_unsigned(laytype);
*tl++ = txdr_unsigned(NFSLAYOUTIOMODE_ANY);
-   *tl++ = newnfs_true;
+   if (trunc)
+   *tl++ = newnfs_true;
+   else
+   *tl++ = newnfs_false;
*tl = txdr_unsigned(NFSV4LAYOUTRET_FILE);
nfsm_fhtom(nd, (uint8_t *)fhp, NFSX_MYFH, 0);
NFSM_BUILD(tl, u_int32_t *, 2 * NFSX_HYPER + NFSX_STATEID);
@@ -6817,13 +6822,11 @@ nfsrv_flexmirrordel(char *devid, NFSPROC_T *p)
/*
 * The layout stateid.seqid needs to be incremented
 * before doing a LAYOUT_RECALL callback.
-* Set lay_trycnt to UINT16_MAX so it won't set up a retry.
 */
if (++lyp->lay_stateid.seqid == 0)
lyp->lay_stateid.seqid = 1;
-   lyp->lay_trycnt = UINT16_MAX;
nfsrv_recalllayout(lyp->lay_clientid, &lyp->lay_stateid,
-   &lyp->lay_fh, lyp, &loclyp, lyp->lay_type, p);
+   &lyp->lay_fh, lyp, 1, lyp->lay_type, p);
nfsrv_freelayout(&loclyp, lyp);
}
 }
@@ -6833,8 +6836,7 @@ nfsrv_flexmirrordel(char *devid, NFSPROC_T *p)
  */
 static int
 nfsrv_recalllayout(nfsquad_t clid, nfsv4stateid_t *stateidp, fhandle_t *fhp,
-struct nfslayout *lyp, struct nfslayouthead *lyheadp, int laytype,
-NFSPROC_T *p)
+struct nfslayout *lyp, int changed, int laytype, NFSPROC_T *p)
 {
struct nfsclient *clp;
int error;
@@ -6843,38 +6845,29 @@ nfsrv_recalllayout(nfsquad_t clid, nfsv4stateid_t *sta
error = nfsrv_getclient(clid, 0, &clp, NULL, (nfsquad_t)((u_quad_t)0),
0, NULL, p);
NFSD_DEBUG(4, "aft nfsrv_getclient=%d\n", error);
-   if (error != 0)
+   if (error != 0) {
+   printf("nfsrv_recalllayout: getclient err=%d\n", error);
return (error);
+   }
if ((clp->lc_flags & LCL_NFSV41) != 0) {
error = nfsrv_docallback(clp, NFSV4OP_CBLAYOUTRECALL,
-   stateidp, 0, fhp, NULL, NULL, laytype, p);
+   stateidp, changed, fhp, NULL, NULL, laytype, p);
/* If lyp != NULL, handle an error return here. */
if (error != 0 && lyp != NULL) {
NFSDRECALLLOCK();
-   if (error == NFSERR_NOMATCHLAYOUT) {
-   /*
-  

svn commit: r337502 - head/usr.sbin/pnfsdscopymr

2018-08-08 Thread Rick Macklem
Author: rmacklem
Date: Wed Aug  8 20:30:12 2018
New Revision: 337502
URL: https://svnweb.freebsd.org/changeset/base/337502

Log:
  Fix the err() arguments for a nfssvc(8) failure.
  
  argv has been incremented during argument handling, so elements of the
  array are no longer valid. Change the err() arguments so only the
  first string pointer in argv is used.
  Found during code inspection.

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

Modified: head/usr.sbin/pnfsdscopymr/pnfsdscopymr.c
==
--- head/usr.sbin/pnfsdscopymr/pnfsdscopymr.c   Wed Aug  8 20:21:45 2018
(r337501)
+++ head/usr.sbin/pnfsdscopymr/pnfsdscopymr.c   Wed Aug  8 20:30:12 2018
(r337502)
@@ -295,7 +295,7 @@ main(int argc, char *argv[])
pnfsdarg.mdspath = *argv;
ret = nfssvc(NFSSVC_PNFSDS, &pnfsdarg);
if (ret < 0 && errno != EEXIST)
-   err(1, "Copymr failed args %s, %s", argv[1], argv[2]);
+   err(1, "Copymr failed for file %s", *argv);
exit(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"


svn commit: r337503 - head/sys/powerpc/powernv

2018-08-08 Thread Breno Leitao
Author: leitao
Date: Wed Aug  8 21:19:07 2018
New Revision: 337503
URL: https://svnweb.freebsd.org/changeset/base/337503

Log:
  powerpc64/powernv: re-read RTC after polling
  
  If OPAL_RTC_READ is busy and does not return the information on the first run,
  as returning OPAL_BUSY_EVENT, the system will crash since ymd and hmsm 
variable
  will contain junk values.
  
  This is happening because we were not calling OPAL_RTC_READ again after
  OPAL_POLL_EVENTS' return, which would finally replace the old/junk hmsm and 
ymd
  values.
  
  The code was also mixing OPAL_RTC_READ and OPAL_POLL_EVENTS return values.
  
  This patch fix this logic and guarantee that we call OPAL_RTC_READ after
  OPAL_POLL_EVENTS return, and guarantee the code will only proceed if
  OPAL_RTC_READ returns OPAL_SUCCESS.
  
  Reviewed by: jhibbits
  Approved by: jhibbits (mentor)
  Differential Revision: https://reviews.freebsd.org/D16617

Modified:
  head/sys/powerpc/powernv/opal_dev.c

Modified: head/sys/powerpc/powernv/opal_dev.c
==
--- head/sys/powerpc/powernv/opal_dev.c Wed Aug  8 20:30:12 2018
(r337502)
+++ head/sys/powerpc/powernv/opal_dev.c Wed Aug  8 21:19:07 2018
(r337503)
@@ -218,13 +218,12 @@ opal_gettime(device_t dev, struct timespec *ts)
uint32_t ymd;
uint64_t hmsm;
 
-   do {
+   rv = opal_call(OPAL_RTC_READ, vtophys(&ymd), vtophys(&hmsm));
+   while (rv == OPAL_BUSY_EVENT)  {
+   opal_call(OPAL_POLL_EVENTS, 0);
+   pause("opalrtc", 1);
rv = opal_call(OPAL_RTC_READ, vtophys(&ymd), vtophys(&hmsm));
-   if (rv == OPAL_BUSY_EVENT) {
-   rv = opal_call(OPAL_POLL_EVENTS, 0);
-   pause("opalrtc", 1);
-   }
-   } while (rv == OPAL_BUSY_EVENT);
+   }
 
if (rv != OPAL_SUCCESS)
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: r337504 - head/usr.bin/apply

2018-08-08 Thread Kyle Evans
Author: kevans
Date: Wed Aug  8 21:21:28 2018
New Revision: 337504
URL: https://svnweb.freebsd.org/changeset/base/337504

Log:
  apply(1): Fix magic number substitution with magic character ' '
  
  Using a space as the magic character would result in problems if the command
  started with a number:
  
  - For a 'valid' number n, n < size of argv, it would erroneously get
replaced with that argument; e.g. `apply -a ' ' -d 1rm x => `execxrm x`
  
  - For an 'invalid' number n, n >= size of argv, it would segfault.
e.g. `apply -a ' ' 2to3 test.py` would try to access argv[2]
  
  This problem occurred because apply(1) would prepend "exec " to the command
  string before doing the actual magic number replacements, so it would come
  across "exec 2to3 1" and assume that the " 2" is also a magic number to be
  replaced.
  
  Re-work this to instead just append "exec " to the command sbuf and
  workaround the ugliness. This also simplifies stuff in the process.
  
  PR:   226948
  Submitted by: Tobias Stoeckmann 
  MFC after:1 week

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

Modified: head/usr.bin/apply/apply.c
==
--- head/usr.bin/apply/apply.c  Wed Aug  8 21:19:07 2018(r337503)
+++ head/usr.bin/apply/apply.c  Wed Aug  8 21:21:28 2018(r337504)
@@ -55,7 +55,8 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
-#define EXEC   "exec "
+#define ISMAGICNO(p) \
+   (p)[0] == magic && isdigit((unsigned char)(p)[1]) && (p)[1] != '0'
 
 static int exec_shell(const char *, const char *, const char *);
 static voidusage(void);
@@ -65,8 +66,9 @@ main(int argc, char *argv[])
 {
struct sbuf *cmdbuf;
long arg_max;
-   int ch, debug, i, magic, n, nargs, offset, rval;
+   int ch, debug, i, magic, n, nargs, rval;
size_t cmdsize;
+   char buf[4];
char *cmd, *name, *p, *shell, *slashp, *tmpshell;
 
debug = 0;
@@ -75,7 +77,7 @@ main(int argc, char *argv[])
while ((ch = getopt(argc, argv, "a:d0123456789")) != -1)
switch (ch) {
case 'a':
-   if (optarg[1] != '\0')
+   if (optarg[0] == '\0' || optarg[1] != '\0')
errx(1,
"illegal magic character specification");
magic = optarg[0];
@@ -105,7 +107,7 @@ main(int argc, char *argv[])
 * largest one.
 */
for (n = 0, p = argv[0]; *p != '\0'; ++p)
-   if (p[0] == magic && isdigit(p[1]) && p[1] != '0') {
+   if (ISMAGICNO(p)) {
++p;
if (p[0] - '0' > n)
n = p[0] - '0';
@@ -134,28 +136,19 @@ main(int argc, char *argv[])
 * Allocate enough space to hold the maximum command.  Save the
 * size to pass to snprintf().
 */
-   cmdsize = sizeof(EXEC) - 1 + strlen(argv[0])
-   + 9 * (sizeof(" %1") - 1) + 1;
-   if ((cmd = malloc(cmdsize)) == NULL)
-   err(1, NULL);
-
if (n == 0) {
+   cmdsize = strlen(argv[0]) + 9 * (sizeof(" %1") - 1) + 1;
+   if ((cmd = malloc(cmdsize)) == NULL)
+   err(1, NULL);
+   strlcpy(cmd, argv[0], cmdsize);
+
/* If nargs not set, default to a single argument. */
if (nargs == -1)
nargs = 1;
 
-   p = cmd;
-   offset = snprintf(cmd, cmdsize, EXEC "%s", argv[0]);
-   if ((size_t)offset >= cmdsize)
-   errx(1, "snprintf() failed");
-   p += offset;
-   cmdsize -= offset;
for (i = 1; i <= nargs; i++) {
-   offset = snprintf(p, cmdsize, " %c%d", magic, i);
-   if ((size_t)offset >= cmdsize)
-   errx(1, "snprintf() failed");
-   p += offset;
-   cmdsize -= offset;
+   snprintf(buf, sizeof(buf), " %c%d", magic, i);
+   strlcat(cmd, buf, cmdsize);
}
 
/*
@@ -165,9 +158,8 @@ main(int argc, char *argv[])
if (nargs == 0)
nargs = 1;
} else {
-   offset = snprintf(cmd, cmdsize, EXEC "%s", argv[0]);
-   if ((size_t)offset >= cmdsize)
-   errx(1, "snprintf() failed");
+   if ((cmd = strdup(argv[0])) == NULL)
+   err(1, NULL);
nargs = n;
}
 
@@ -184,9 +176,10 @@ main(int argc, char *argv[])
 */
for (rval = 0; argc > nargs; argc -= nargs, argv += nargs) {
sbuf_clear(cmdbuf);
+   sbuf_cat(cmdbuf, "exec ");
/* Expand command argv references. */
for (p = cmd; *p != '\0'; ++

svn commit: r337505 - head/bin/dd

2018-08-08 Thread Kyle Evans
Author: kevans
Date: Wed Aug  8 21:37:02 2018
New Revision: 337505
URL: https://svnweb.freebsd.org/changeset/base/337505

Log:
  dd: add status=progress support
  
  This reports the current status on a single line every second, mirroring
  similar functionality in GNU dd, and carefully interacts with SIGINFO.
  
  PR:   229615
  Submitted by: Thomas Hurst  (modified for style(9) nits by me)
  MFC after:1 week

Modified:
  head/bin/dd/args.c
  head/bin/dd/dd.1
  head/bin/dd/dd.c
  head/bin/dd/dd.h
  head/bin/dd/extern.h
  head/bin/dd/misc.c

Modified: head/bin/dd/args.c
==
--- head/bin/dd/args.c  Wed Aug  8 21:21:28 2018(r337504)
+++ head/bin/dd/args.c  Wed Aug  8 21:37:02 2018(r337505)
@@ -306,6 +306,8 @@ f_status(char *arg)
ddflags |= C_NOINFO;
else if (strcmp(arg, "noxfer") == 0)
ddflags |= C_NOXFER;
+   else if (strcmp(arg, "progress") == 0)
+   ddflags |= C_PROGRESS;
else
errx(1, "unknown status %s", arg);
 }

Modified: head/bin/dd/dd.1
==
--- head/bin/dd/dd.1Wed Aug  8 21:21:28 2018(r337504)
+++ head/bin/dd/dd.1Wed Aug  8 21:37:02 2018(r337505)
@@ -32,7 +32,7 @@
 .\" @(#)dd.1   8.2 (Berkeley) 1/13/94
 .\" $FreeBSD$
 .\"
-.Dd April 2, 2017
+.Dd August 8, 2018
 .Dt DD 1
 .Os
 .Sh NAME
@@ -164,12 +164,14 @@ bytes per second.
 Where
 .Cm value
 is one of the symbols from the following list.
-.Bl -tag -width "noxfer"
+.Bl -tag -width "progress"
 .It Cm noxfer
 Do not print the transfer statistics as the last line of status output.
 .It Cm none
 Do not print the status output.
 Error messages are shown; informational messages are not.
+.It Cm progress
+Print basic transfer statistics once per second.
 .El
 .It Cm conv Ns = Ns Ar value Ns Op , Ns Ar value ...
 Where

Modified: head/bin/dd/dd.c
==
--- head/bin/dd/dd.cWed Aug  8 21:21:28 2018(r337504)
+++ head/bin/dd/dd.cWed Aug  8 21:37:02 2018(r337505)
@@ -54,6 +54,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -89,6 +90,7 @@ const u_char *ctab;   /* conversion table */
 char   fill_char;  /* Character to fill with if defined */
 size_t speed = 0;  /* maximum speed, in bytes per second */
 volatile sig_atomic_t need_summary;
+volatile sig_atomic_t need_progress;
 
 int
 main(int argc __unused, char *argv[])
@@ -102,6 +104,7 @@ main(int argc __unused, char *argv[])
err(1, "unable to enter capability mode");
 
(void)signal(SIGINFO, siginfo_handler);
+   (void)signal(SIGALRM, sigalrm_handler);
(void)signal(SIGINT, terminate);
 
atexit(summary);
@@ -281,6 +284,14 @@ setup(void)
ctab = casetab;
}
 
+   if ((ddflags & C_PROGRESS)) {
+   struct itimerval timer = {
+   .it_interval = { .tv_sec = 1, .tv_usec = 0 },
+   .it_value = { .tv_sec = 1, .tv_usec = 0 },
+   };
+   setitimer(ITIMER_REAL, &timer, NULL);
+   }
+
if (clock_gettime(CLOCK_MONOTONIC, &st.start))
err(1, "clock_gettime");
 }
@@ -460,6 +471,9 @@ dd_in(void)
(*cfunc)();
if (need_summary) {
summary();
+   }
+   if (need_progress) {
+   progress();
}
}
 }

Modified: head/bin/dd/dd.h
==
--- head/bin/dd/dd.hWed Aug  8 21:21:28 2018(r337504)
+++ head/bin/dd/dd.hWed Aug  8 21:37:02 2018(r337505)
@@ -100,5 +100,6 @@ typedef struct {
 #defineC_STATUS0x0800
 #defineC_NOXFER0x1000
 #defineC_NOINFO0x2000
+#defineC_PROGRESS  0x4000
 
 #defineC_PARITY(C_PAREVEN | C_PARODD | C_PARNONE | C_PARSET)

Modified: head/bin/dd/extern.h
==
--- head/bin/dd/extern.hWed Aug  8 21:21:28 2018(r337504)
+++ head/bin/dd/extern.hWed Aug  8 21:37:02 2018(r337505)
@@ -46,7 +46,9 @@ void pos_in(void);
 void pos_out(void);
 double secs_elapsed(void);
 void summary(void);
+void progress(void);
 void siginfo_handler(int);
+void sigalrm_handler(int);
 void terminate(int);
 void unblock(void);
 void unblock_close(void);
@@ -66,3 +68,4 @@ extern const u_char a2ibm_32V[], a2ibm_POSIX[];
 extern u_char casetab[];
 extern char fill_char;
 extern volatile sig_atomic_t need_summary;
+extern volatile sig_atomic_t need_progress;

Modified: head/bin/dd/misc.c

svn commit: r337506 - head/bin/ls

2018-08-08 Thread Kyle Evans
Author: kevans
Date: Wed Aug  8 21:51:19 2018
New Revision: 337506
URL: https://svnweb.freebsd.org/changeset/base/337506

Log:
  ls(1): Enable colors with COLORTERM is set in the environment
  
  COLORTERM is the de facto standard, while CLICOLOR is generally specific to
  FreeBSD and ls(1).
  
  PR:   230101
  Submitted by: D Green  (with manpage additions by myself)
  Reviewed by:  cem ("LGTM" in PR; pre-manpage changes)
  MFC after:1 week

Modified:
  head/bin/ls/ls.1
  head/bin/ls/ls.c

Modified: head/bin/ls/ls.1
==
--- head/bin/ls/ls.1Wed Aug  8 21:37:02 2018(r337505)
+++ head/bin/ls/ls.1Wed Aug  8 21:51:19 2018(r337506)
@@ -32,7 +32,7 @@
 .\" @(#)ls.1   8.7 (Berkeley) 7/29/94
 .\" $FreeBSD$
 .\"
-.Dd January 17, 2018
+.Dd August 8, 2018
 .Dt LS 1
 .Os
 .Sh NAME
@@ -132,6 +132,8 @@ after each that is a
 Enable colorized output.
 This option is equivalent to defining
 .Ev CLICOLOR
+or
+.Ev COLORTERM
 in the environment.
 (See below.)
 This functionality can be compiled out by removing the definition of
@@ -628,6 +630,10 @@ The
 variable still needs to reference a color capable terminal however
 otherwise it is not possible to determine which color sequences to
 use.
+.It Ev COLORTERM
+See description for
+.Ev CLICOLOR
+above.
 .It Ev COLUMNS
 If this variable contains a string representing a
 decimal integer, it is used as the
@@ -652,7 +658,9 @@ for more information.
 .It Ev LSCOLORS
 The value of this variable describes what color to use for which
 attribute when colors are enabled with
-.Ev CLICOLOR .
+.Ev CLICOLOR
+or
+.Ev COLORTERM .
 This string is a concatenation of pairs of the format
 .Ar f Ns Ar b ,
 where
@@ -759,6 +767,8 @@ option for more details.
 .It Ev TERM
 The
 .Ev CLICOLOR
+and
+.Ev COLORTERM
 functionality depends on a terminal type with color capabilities.
 .It Ev TZ
 The timezone to use when displaying dates.

Modified: head/bin/ls/ls.c
==
--- head/bin/ls/ls.cWed Aug  8 21:37:02 2018(r337505)
+++ head/bin/ls/ls.cWed Aug  8 21:51:19 2018(r337506)
@@ -368,7 +368,7 @@ main(int argc, char *argv[])
f_listdot = 1;
 
/* Enabling of colours is conditional on the environment. */
-   if (getenv("CLICOLOR") &&
+   if ((getenv("CLICOLOR") || getenv("COLORTERM")) &&
(isatty(STDOUT_FILENO) || getenv("CLICOLOR_FORCE")))
 #ifdef COLORLS
if (tgetent(termcapbuf, getenv("TERM")) == 1) {
___
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: r337508 - head/contrib/flex

2018-08-08 Thread Brooks Davis
Author: brooks
Date: Wed Aug  8 22:45:30 2018
New Revision: 337508
URL: https://svnweb.freebsd.org/changeset/base/337508

Log:
  Terminate filter_create_ext() args with NULL, not 0.
  
  filter_create_ext() is documented to take a NULL terminated set of
  arguments.  0 is promoted to an int so this would fail on 64-bit
  systems if the value was not passed in a register.  On all currently
  supported 64-bit architectures it is.
  
  Obtained from:CheriBSD
  Sponsored by: DARPA, AFRL

Modified:
  head/contrib/flex/main.c

Modified: head/contrib/flex/main.c
==
--- head/contrib/flex/main.cWed Aug  8 22:42:03 2018(r337507)
+++ head/contrib/flex/main.cWed Aug  8 22:45:30 2018(r337508)
@@ -364,7 +364,7 @@ void check_options ()
 output_chain = filter_create_int(NULL, filter_tee_header, headerfilename);
 if ( !(m4 = getenv("M4")))
 m4 = M4;
-filter_create_ext(output_chain, m4, "-gP", 0);
+filter_create_ext(output_chain, m4, "-gP", NULL);
 filter_create_int(output_chain, filter_fix_linedirs, NULL);
 
 /* For debugging, only run the requested number of filters. */
___
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: r337509 - head/usr.sbin/nfsd

2018-08-08 Thread Rick Macklem
Author: rmacklem
Date: Thu Aug  9 00:15:28 2018
New Revision: 337509
URL: https://svnweb.freebsd.org/changeset/base/337509

Log:
  Fix a typo plus add a couple of sentences to pnfsserver.4.
  
  This is a content change.

Modified:
  head/usr.sbin/nfsd/pnfsserver.4

Modified: head/usr.sbin/nfsd/pnfsserver.4
==
--- head/usr.sbin/nfsd/pnfsserver.4 Wed Aug  8 22:45:30 2018
(r337508)
+++ head/usr.sbin/nfsd/pnfsserver.4 Thu Aug  9 00:15:28 2018
(r337509)
@@ -23,7 +23,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd August 5, 2018
+.Dd August 8, 2018
 .Dt PNFSSERVER 4
 .Os
 .Sh NAME
@@ -366,8 +366,17 @@ have the
 .Xr pnfsdscopymr 8
 command done on them to complete the recovery.
 .Bd -literal -offset
-# pnfsdscopymr -r /data3 
+# pnfsdscopymr -r /data3 
 .Ed
+.sp
+If this commmand fails with the error
+.br
+.Dq pnfsdscopymr: Copymr failed for file : Device not configured
+.br
+repeatedly, this may be caused by a Read/Write layout that has not
+been returned.
+The only way to get rid of such a layout is to restart the
+.Xr nfsd 8 .
 .sp
 All of these commands are designed to be
 done while the pNFS service is running and can be re-run safely.
___
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: r337505 - head/bin/dd

2018-08-08 Thread Eitan Adler
On Wed, 8 Aug 2018 at 14:37, Kyle Evans  wrote:
> +/* ARGSUSED */

We've been slowly delintifying system utilities. Why do we still keep
these comments?

> +void
> +sigalrm_handler(int signo __unused)
> +{
> +
> +   need_progress = 1;
>  }


-- 
Eitan Adler
___
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: r337505 - head/bin/dd

2018-08-08 Thread Kyle Evans
On Wed, Aug 8, 2018 at 7:58 PM, Eitan Adler  wrote:
> On Wed, 8 Aug 2018 at 14:37, Kyle Evans  wrote:
>> +/* ARGSUSED */
>
> We've been slowly delintifying system utilities. Why do we still keep
> these comments?
>

This is consistent with the style of the file, so I didn't object.
I'd rather do another pass later to de-lintify the whole thing rather
than nitpick at this patch for some otherwise harmless and matching
comments. =)

Thanks,

Kyle Evans
___
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: r337505 - head/bin/dd

2018-08-08 Thread Warner Losh
On Wed, Aug 8, 2018 at 7:01 PM, Kyle Evans  wrote:

> On Wed, Aug 8, 2018 at 7:58 PM, Eitan Adler  wrote:
> > On Wed, 8 Aug 2018 at 14:37, Kyle Evans  wrote:
> >> +/* ARGSUSED */
> >
> > We've been slowly delintifying system utilities. Why do we still keep
> > these comments?
> >
>
> This is consistent with the style of the file, so I didn't object.
> I'd rather do another pass later to de-lintify the whole thing rather
> than nitpick at this patch for some otherwise harmless and matching
> comments. =)
>

It appears to be from NetBSD upstream, so removing it would be pointless
churn that makes things harder to merge.

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"


svn commit: r337518 - in head/sys: kern sys

2018-08-08 Thread Kyle Evans
Author: kevans
Date: Thu Aug  9 01:32:09 2018
New Revision: 337518
URL: https://svnweb.freebsd.org/changeset/base/337518

Log:
  kern: Add a BOOT_TAG marker at the beginning of boot dmesg
  
  From the "newly licensed to drive" PR department, add a BOOT_TAG marker (by
  default, --<>--, to the beginning of each boot's dmesg. This makes it
  easier to do textproc magic to locate the start of each boot and, of
  particular interest to some, the dmesg of the current boot.
  
  The PR has a dmesg(8) component as well that I've opted not to include for
  the moment- it was the more contentious part of this PR.
  
  bde@ also made the statement that this boot tag should be written with an
  ordinary printf, which I've- for the moment- declined to change about this
  patch to keep it more transparent to observer of the boot process.
  
  PR:   43434
  Submitted by: dak  (basically rewritten)
  MFC after:maybe never

Modified:
  head/sys/kern/subr_prf.c
  head/sys/sys/msgbuf.h

Modified: head/sys/kern/subr_prf.c
==
--- head/sys/kern/subr_prf.cThu Aug  9 01:17:35 2018(r337517)
+++ head/sys/kern/subr_prf.cThu Aug  9 01:32:09 2018(r337518)
@@ -1027,6 +1027,7 @@ msgbufinit(void *ptr, int size)
cp = (char *)ptr;
msgbufp = (struct msgbuf *)(cp + size);
msgbuf_reinit(msgbufp, cp, size);
+   msgbuf_addstr(msgbufp, -1, BOOT_TAG, 0);
if (msgbufmapped && oldp != msgbufp)
msgbuf_copy(oldp, msgbufp);
msgbufmapped = 1;

Modified: head/sys/sys/msgbuf.h
==
--- head/sys/sys/msgbuf.h   Thu Aug  9 01:17:35 2018(r337517)
+++ head/sys/sys/msgbuf.h   Thu Aug  9 01:32:09 2018(r337518)
@@ -60,6 +60,9 @@ struct msgbuf {
 /* Subtract sequence numbers.  Note that only positive values result. */
 #defineMSGBUF_SEQSUB(mbp, seq1, seq2)  (MSGBUF_SEQNORM((mbp), (seq1) - 
(seq2)))
 
+/* Tag used to mark the start of a boot in dmesg */
+#defineBOOT_TAG  "---<>---"
+
 #ifdef _KERNEL
 extern int msgbufsize;
 extern int msgbuftrigger;
___
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: r337520 - in head/stand/i386: gptboot isoboot

2018-08-08 Thread Kyle Evans
Author: kevans
Date: Thu Aug  9 02:06:25 2018
New Revision: 337520
URL: https://svnweb.freebsd.org/changeset/base/337520

Log:
  isoboot, gptboot: Fix WITHOUT_LOADER_GELI (gptboot) and isoboot in general
  
  gptboot was broken when r316078 added the LOADER_GELI_SUPPORT #ifdef to
  not pass geliargs via __exec.  KARGS_FLAGS_EXTARG must not be used if we're
  not going to pass an additional argument to __exec.
  
  PR:   228151
  Submitted by: guy...@gmail.com
  MFC after:1 week

Modified:
  head/stand/i386/gptboot/gptboot.c
  head/stand/i386/isoboot/isoboot.c

Modified: head/stand/i386/gptboot/gptboot.c
==
--- head/stand/i386/gptboot/gptboot.c   Thu Aug  9 01:39:47 2018
(r337519)
+++ head/stand/i386/gptboot/gptboot.c   Thu Aug  9 02:06:25 2018
(r337520)
@@ -490,9 +490,10 @@ load(void)
 #endif
__exec((caddr_t)addr, RB_BOOTINFO | (opts & RBX_MASK),
MAKEBOOTDEV(dev_maj[gdsk.dsk.type], gdsk.dsk.part + 1, 
gdsk.dsk.unit, 0xff),
-   KARGS_FLAGS_EXTARG, 0, 0, VTOP(&bootinfo)
 #ifdef LOADER_GELI_SUPPORT
-   , geliargs
+   KARGS_FLAGS_EXTARG, 0, 0, VTOP(&bootinfo), geliargs
+#else
+   0, 0, 0, VTOP(&bootinfo)
 #endif
);
 }

Modified: head/stand/i386/isoboot/isoboot.c
==
--- head/stand/i386/isoboot/isoboot.c   Thu Aug  9 01:39:47 2018
(r337519)
+++ head/stand/i386/isoboot/isoboot.c   Thu Aug  9 02:06:25 2018
(r337520)
@@ -417,7 +417,7 @@ load(void)
bootinfo.bi_bios_dev = dsk.drive;
__exec((caddr_t)addr, RB_BOOTINFO | (opts & RBX_MASK),
MAKEBOOTDEV(dev_maj[dsk.type], 0, dsk.unit, 0),
-   KARGS_FLAGS_EXTARG, 0, 0, VTOP(&bootinfo));
+   0, 0, 0, VTOP(&bootinfo));
 }
 
 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"


Re: svn commit: r337520 - in head/stand/i386: gptboot isoboot

2018-08-08 Thread Kyle Evans
On Wed, Aug 8, 2018 at 9:06 PM, Kyle Evans  wrote:
> Author: kevans
> Date: Thu Aug  9 02:06:25 2018
> New Revision: 337520
> URL: https://svnweb.freebsd.org/changeset/base/337520
>
> Log:
>   isoboot, gptboot: Fix WITHOUT_LOADER_GELI (gptboot) and isoboot in general
>
>   gptboot was broken when r316078 added the LOADER_GELI_SUPPORT #ifdef to
>   not pass geliargs via __exec.  KARGS_FLAGS_EXTARG must not be used if we're
>   not going to pass an additional argument to __exec.
>
>   PR:   228151
>   Submitted by: guy...@gmail.com
>   MFC after:1 week
>
> Modified:
>   head/stand/i386/gptboot/gptboot.c
>   head/stand/i386/isoboot/isoboot.c
>
> Modified: head/stand/i386/gptboot/gptboot.c
> ==
> --- head/stand/i386/gptboot/gptboot.c   Thu Aug  9 01:39:47 2018
> (r337519)
> +++ head/stand/i386/gptboot/gptboot.c   Thu Aug  9 02:06:25 2018
> (r337520)
> @@ -490,9 +490,10 @@ load(void)
>  #endif
> __exec((caddr_t)addr, RB_BOOTINFO | (opts & RBX_MASK),
> MAKEBOOTDEV(dev_maj[gdsk.dsk.type], gdsk.dsk.part + 1, 
> gdsk.dsk.unit, 0xff),
> -   KARGS_FLAGS_EXTARG, 0, 0, VTOP(&bootinfo)
>  #ifdef LOADER_GELI_SUPPORT
> -   , geliargs
> +   KARGS_FLAGS_EXTARG, 0, 0, VTOP(&bootinfo), geliargs
> +#else
> +   0, 0, 0, VTOP(&bootinfo)
>  #endif
> );
>  }
>
> Modified: head/stand/i386/isoboot/isoboot.c
> ==
> --- head/stand/i386/isoboot/isoboot.c   Thu Aug  9 01:39:47 2018
> (r337519)
> +++ head/stand/i386/isoboot/isoboot.c   Thu Aug  9 02:06:25 2018
> (r337520)
> @@ -417,7 +417,7 @@ load(void)
> bootinfo.bi_bios_dev = dsk.drive;
> __exec((caddr_t)addr, RB_BOOTINFO | (opts & RBX_MASK),
> MAKEBOOTDEV(dev_maj[dsk.type], 0, dsk.unit, 0),
> -   KARGS_FLAGS_EXTARG, 0, 0, VTOP(&bootinfo));
> +   0, 0, 0, VTOP(&bootinfo));
>  }
>
>  static int
>

Rod,

Can you test the version of isoboot that was in stable/11 with this
patch applied? It seems highly likely that this was the source of your
boot issues.

Thanks,

Kyle Evans
___
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: r337522 - head/usr.sbin/tzsetup

2018-08-08 Thread Xin LI
Author: delphij
Date: Thu Aug  9 02:47:22 2018
New Revision: 337522
URL: https://svnweb.freebsd.org/changeset/base/337522

Log:
  In read_zones(), check if the file name actually fit in the buffer
  and make sure it would terminate with nul with strlcpy().
  
  Reviewed by:  imp (earlier revision)
  MFC after:2 weeks
  Differential Revision:https://reviews.freebsd.org/D16595

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

Modified: head/usr.sbin/tzsetup/tzsetup.c
==
--- head/usr.sbin/tzsetup/tzsetup.c Thu Aug  9 02:27:18 2018
(r337521)
+++ head/usr.sbin/tzsetup/tzsetup.c Thu Aug  9 02:47:22 2018
(r337522)
@@ -481,7 +481,7 @@ read_zones(void)
charcontbuf[16];
FILE*fp;
struct continent *cont;
-   size_t  len;
+   size_t  len, contlen;
char*line, *tlc, *file, *descr, *p;
int lineno;
 
@@ -504,12 +504,16 @@ read_zones(void)
path_zonetab, lineno, tlc);
/* coord = */ strsep(&line, "\t");   /* Unused */
file = strsep(&line, "\t");
+   /* get continent portion from continent/country */
p = strchr(file, '/');
if (p == NULL)
errx(1, "%s:%d: invalid zone name `%s'", path_zonetab,
lineno, file);
-   contbuf[0] = '\0';
-   strncat(contbuf, file, p - file);
+   contlen = p - file + 1; /* trailing nul */
+   if (contlen > sizeof(contbuf))
+   errx(1, "%s:%d: continent name in zone name `%s' too 
long",
+   path_zonetab, lineno, file);
+   strlcpy(contbuf, file, contlen);
cont = find_continent(contbuf);
if (!cont)
errx(1, "%s:%d: invalid region `%s'", path_zonetab,
___
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: r337523 - head/stand/libsa

2018-08-08 Thread Kyle Evans
Author: kevans
Date: Thu Aug  9 02:55:48 2018
New Revision: 337523
URL: https://svnweb.freebsd.org/changeset/base/337523

Log:
  libsa: exit on EOF in ngets
  
  It was possible in some rare circumstances for ngets to behave terribly with
  bhyveload and some form of redirecting user input over a pipe.
  
  PR:   198706
  Submitted by: Ivan Krivonos 
  MFC after:1 week

Modified:
  head/stand/libsa/gets.c

Modified: head/stand/libsa/gets.c
==
--- head/stand/libsa/gets.c Thu Aug  9 02:47:22 2018(r337522)
+++ head/stand/libsa/gets.c Thu Aug  9 02:55:48 2018(r337523)
@@ -44,8 +44,11 @@ ngets(char *buf, int n)
 int c;
 char *lp;
 
-for (lp = buf;;)
-   switch (c = getchar() & 0177) {
+for (lp = buf;;) {
+   c = getchar();
+   if (c == -1)
+   break;
+   switch (c & 0177) {
case '\n':
case '\r':
*lp = '\0';
@@ -79,6 +82,7 @@ ngets(char *buf, int n)
putchar(c);
}
}
+}
 /*NOTREACHED*/
 }
 
___
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: r337524 - head/stand/i386/libi386

2018-08-08 Thread Kyle Evans
Author: kevans
Date: Thu Aug  9 03:45:47 2018
New Revision: 337524
URL: https://svnweb.freebsd.org/changeset/base/337524

Log:
  libi386: Fix typo in pxe.h
  
  PR:   207337
  Submitted by: Tony Narlock 
  MFC after:1 week

Modified:
  head/stand/i386/libi386/pxe.h

Modified: head/stand/i386/libi386/pxe.h
==
--- head/stand/i386/libi386/pxe.h   Thu Aug  9 02:55:48 2018
(r337523)
+++ head/stand/i386/libi386/pxe.h   Thu Aug  9 03:45:47 2018
(r337524)
@@ -147,7 +147,7 @@ typedef struct {
PXENV_STATUS_t  Status;
ADDR32_tProtocolIni;/* Phys addr of a copy of the driver 
module */
uint8_t reserved[8];
-} PACKED t_PXENV_UNDI_INITALIZE;
+} PACKED t_PXENV_UNDI_INITIALIZE;
 
 
 #defineMAXNUM_MCADDR   8
___
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: r337505 - head/bin/dd

2018-08-08 Thread Kyle Evans
On Wed, Aug 8, 2018 at 8:15 PM, Warner Losh  wrote:
>
>
> On Wed, Aug 8, 2018 at 7:01 PM, Kyle Evans  wrote:
>>
>> On Wed, Aug 8, 2018 at 7:58 PM, Eitan Adler  wrote:
>> > On Wed, 8 Aug 2018 at 14:37, Kyle Evans  wrote:
>> >> +/* ARGSUSED */
>> >
>> > We've been slowly delintifying system utilities. Why do we still keep
>> > these comments?
>> >
>>
>> This is consistent with the style of the file, so I didn't object.
>> I'd rather do another pass later to de-lintify the whole thing rather
>> than nitpick at this patch for some otherwise harmless and matching
>> comments. =)
>
>
> It appears to be from NetBSD upstream, so removing it would be pointless
> churn that makes things harder to merge.
>

Poking at NetBSD now that I have time, it doesn't look like they
actually have this feature. They have progress= to output a dog
every n blocks, but apparently not one that actually does a
single-line summary every second like this and GNU dd (with the same
status=progress flag).
___
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: r337525 - head/sys/kern

2018-08-08 Thread Matt Macy
Author: mmacy
Date: Thu Aug  9 05:18:27 2018
New Revision: 337525
URL: https://svnweb.freebsd.org/changeset/base/337525

Log:
  epoch_block_wait: don't check TD_RUNNING
  
  struct epoch_thread is not type safe (stack allocated) and thus cannot be 
dereferenced from another CPU
  
  Reported by: novel@

Modified:
  head/sys/kern/subr_epoch.c

Modified: head/sys/kern/subr_epoch.c
==
--- head/sys/kern/subr_epoch.c  Thu Aug  9 03:45:47 2018(r337524)
+++ head/sys/kern/subr_epoch.c  Thu Aug  9 05:18:27 2018(r337525)
@@ -56,7 +56,7 @@ __FBSDID("$FreeBSD$");
 static MALLOC_DEFINE(M_EPOCH, "epoch", "epoch based reclamation");
 
 /* arbitrary --- needs benchmarking */
-#define MAX_ADAPTIVE_SPIN 1000
+#define MAX_ADAPTIVE_SPIN 100
 #define MAX_EPOCHS 64
 
 CTASSERT(sizeof(ck_epoch_entry_t) == sizeof(struct epoch_context));
@@ -240,24 +240,38 @@ epoch_block_handler_preempt(struct ck_epoch *global __
locksheld = td->td_locks;
spincount = 0;
counter_u64_add(block_count, 1);
+   /*
+* We lost a race and there's no longer any threads
+* on the CPU in an epoch section.
+*/
+   if (TAILQ_EMPTY(&record->er_tdlist))
+   return;
+
if (record->er_cpuid != curcpu) {
/*
 * If the head of the list is running, we can wait for it
 * to remove itself from the list and thus save us the
 * overhead of a migration
 */
-   if ((tdwait = TAILQ_FIRST(&record->er_tdlist)) != NULL &&
-   TD_IS_RUNNING(tdwait->et_td)) {
-   gen = record->er_gen;
-   thread_unlock(td);
-   do {
-   cpu_spinwait();
-   } while (tdwait == TAILQ_FIRST(&record->er_tdlist) &&
-   gen == record->er_gen && 
TD_IS_RUNNING(tdwait->et_td) &&
-   spincount++ < MAX_ADAPTIVE_SPIN);
-   thread_lock(td);
+   gen = record->er_gen;
+   thread_unlock(td);
+   /*
+* We can't actually check if the waiting thread is running
+* so we simply poll for it to exit before giving up and
+* migrating.
+*/
+   do {
+   cpu_spinwait();
+   } while (!TAILQ_EMPTY(&record->er_tdlist) &&
+gen == record->er_gen &&
+spincount++ < MAX_ADAPTIVE_SPIN);
+   thread_lock(td);
+   /*
+* If the generation has changed we can poll again
+* otherwise we need to migrate.
+*/
+   if (gen != record->er_gen)
return;
-   }
/*
 * Being on the same CPU as that of the record on which
 * we need to wait allows us access to the thread
___
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"