svn commit: r317932 - stable/11/contrib/elftoolchain/elfcopy

2017-05-07 Thread Ed Maste
Author: emaste
Date: Mon May  8 01:29:40 2017
New Revision: 317932
URL: https://svnweb.freebsd.org/changeset/base/317932

Log:
  MFC r317371: elfcopy: allow empty symbol list files

Modified:
  stable/11/contrib/elftoolchain/elfcopy/main.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/contrib/elftoolchain/elfcopy/main.c
==
--- stable/11/contrib/elftoolchain/elfcopy/main.c   Mon May  8 00:45:05 
2017(r317931)
+++ stable/11/contrib/elftoolchain/elfcopy/main.c   Mon May  8 01:29:40 
2017(r317932)
@@ -1285,8 +1285,9 @@ parse_symlist_file(struct elfcopy *ecp, 
err(EXIT_FAILURE, "can not open %s", fn);
if ((data = malloc(sb.st_size + 1)) == NULL)
err(EXIT_FAILURE, "malloc failed");
-   if (fread(data, 1, sb.st_size, fp) == 0 || ferror(fp))
-   err(EXIT_FAILURE, "fread failed");
+   if (sb.st_size > 0)
+   if (fread(data, sb.st_size, 1, fp) != 1)
+   err(EXIT_FAILURE, "fread failed");
fclose(fp);
data[sb.st_size] = '\0';
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r317931 - head/sbin/mount_nfs

2017-05-07 Thread Rick Macklem
Author: rmacklem
Date: Mon May  8 00:45:05 2017
New Revision: 317931
URL: https://svnweb.freebsd.org/changeset/base/317931

Log:
  Fix mount_nfs so that it doesn't create mounttab entries for NFSv4 mounts.
  
  The NFSv4 protocol doesn't use the Mount protocol, so it doesn't make sense
  to add an entry for an NFSv4 mount to /var/db/mounttab. Also, r308871
  modified umount so that it doesn't remove any entry created by mount_nfs.
  Reported on freebsd-current@.
  
  Reported by:  clbuis...@orange.fr
  MFC after:2 weeks

Modified:
  head/sbin/mount_nfs/mount_nfs.c

Modified: head/sbin/mount_nfs/mount_nfs.c
==
--- head/sbin/mount_nfs/mount_nfs.c Sun May  7 22:18:05 2017
(r317930)
+++ head/sbin/mount_nfs/mount_nfs.c Mon May  8 00:45:05 2017
(r317931)
@@ -636,7 +636,7 @@ getnfsargs(char *spec, struct iovec **io
 
build_iovec(iov, iovlen, "hostname", nam, (size_t)-1);
/* Add mounted file system to PATH_MOUNTTAB */
-   if (!add_mtab(hostp, spec))
+   if (mountmode != V4 && !add_mtab(hostp, spec))
warnx("can't update %s for %s:%s", PATH_MOUNTTAB, hostp, spec);
return (1);
 }
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r317930 - stable/10/sys/fs/nfs

2017-05-07 Thread Rick Macklem
Author: rmacklem
Date: Sun May  7 22:18:05 2017
New Revision: 317930
URL: https://svnweb.freebsd.org/changeset/base/317930

Log:
  MFC: r317276
  Don't set ND_NOMOREDATA for a failed Setattr operation (NFSv4).
  
  The NFSv4 Setattr operation always has reply data even when it fails,
  so don't set the ND_NOMOREDATA for it. This would only affect unusual
  cases where Setattr fails and the RPC code wants to parse the rest of
  the compound. Detected during recent development related to the pNFS server.

Modified:
  stable/10/sys/fs/nfs/nfs_commonkrpc.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/fs/nfs/nfs_commonkrpc.c
==
--- stable/10/sys/fs/nfs/nfs_commonkrpc.c   Sun May  7 22:10:55 2017
(r317929)
+++ stable/10/sys/fs/nfs/nfs_commonkrpc.c   Sun May  7 22:18:05 2017
(r317930)
@@ -1044,8 +1044,10 @@ tryagain:
/*
 * If this op's status is non-zero, mark
 * that there is no more data to process.
+* The exception is Setattr, which always has xdr
+* when it has failed.
 */
-   if (j)
+   if (j != 0 && i != NFSV4OP_SETATTR)
nd->nd_flag |= ND_NOMOREDATA;
 
/*
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r317929 - stable/11/sys/fs/nfs

2017-05-07 Thread Rick Macklem
Author: rmacklem
Date: Sun May  7 22:10:55 2017
New Revision: 317929
URL: https://svnweb.freebsd.org/changeset/base/317929

Log:
  MFC: r317276
  Don't set ND_NOMOREDATA for a failed Setattr operation (NFSv4).
  
  The NFSv4 Setattr operation always has reply data even when it fails,
  so don't set the ND_NOMOREDATA for it. This would only affect unusual
  cases where Setattr fails and the RPC code wants to parse the rest of
  the compound. Detected during recent development related to the pNFS server.

Modified:
  stable/11/sys/fs/nfs/nfs_commonkrpc.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/fs/nfs/nfs_commonkrpc.c
==
--- stable/11/sys/fs/nfs/nfs_commonkrpc.c   Sun May  7 22:04:12 2017
(r317928)
+++ stable/11/sys/fs/nfs/nfs_commonkrpc.c   Sun May  7 22:10:55 2017
(r317929)
@@ -1043,8 +1043,10 @@ tryagain:
/*
 * If this op's status is non-zero, mark
 * that there is no more data to process.
+* The exception is Setattr, which always has xdr
+* when it has failed.
 */
-   if (j)
+   if (j != 0 && i != NFSV4OP_SETATTR)
nd->nd_flag |= ND_NOMOREDATA;
 
/*
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r317928 - head/sys/contrib/octeon-sdk

2017-05-07 Thread Justin Hibbits
Author: jhibbits
Date: Sun May  7 22:04:12 2017
New Revision: 317928
URL: https://svnweb.freebsd.org/changeset/base/317928

Log:
  Add necessary bits to get FreeBSD booting on the Unifi Security Gateway
  
  Summary:
  The Ubiquiti Unifi Security Gateway is virtually identical to the
  EdgeRouter Lite, with a smaller PCB and apparently a different board 
identifier.
  Simply adding the new board identifier alongside the ERL identifier, FreeBSD
  boots successfully, and can access the needed peripherals (tested with USB
  booting, and basic pings on one ethernet interface)
  
  Reviewed By:  adrian
  MFC after:2 weeks
  Differential Revision:https://reviews.freebsd.org/D10639

Modified:
  head/sys/contrib/octeon-sdk/cvmx-app-init.h
  head/sys/contrib/octeon-sdk/cvmx-helper-board.c

Modified: head/sys/contrib/octeon-sdk/cvmx-app-init.h
==
--- head/sys/contrib/octeon-sdk/cvmx-app-init.h Sun May  7 21:57:46 2017
(r317927)
+++ head/sys/contrib/octeon-sdk/cvmx-app-init.h Sun May  7 22:04:12 2017
(r317928)
@@ -311,6 +311,7 @@ enum cvmx_board_types_enum {
 #endif
 #if defined(OCTEON_VENDOR_UBIQUITI)
 CVMX_BOARD_TYPE_CUST_UBIQUITI_E100=20002,
+CVMX_BOARD_TYPE_CUST_UBIQUITI_USG= 20004,
 #endif
 #if defined(OCTEON_VENDOR_RADISYS)
 CVMX_BOARD_TYPE_CUST_RADISYS_RSYS4GBE=20002,
@@ -457,6 +458,7 @@ static inline const char *cvmx_board_typ
 #endif
 #if defined(OCTEON_VENDOR_UBIQUITI)
ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_CUST_UBIQUITI_E100)
+   ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_CUST_UBIQUITI_USG)
 #endif
 #if defined(OCTEON_VENDOR_RADISYS)
ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_CUST_RADISYS_RSYS4GBE)

Modified: head/sys/contrib/octeon-sdk/cvmx-helper-board.c
==
--- head/sys/contrib/octeon-sdk/cvmx-helper-board.c Sun May  7 21:57:46 
2017(r317927)
+++ head/sys/contrib/octeon-sdk/cvmx-helper-board.c Sun May  7 22:04:12 
2017(r317928)
@@ -598,6 +598,7 @@ int cvmx_helper_board_get_mii_address(in
 #endif
 #if defined(OCTEON_VENDOR_UBIQUITI)
case CVMX_BOARD_TYPE_CUST_UBIQUITI_E100:
+   case CVMX_BOARD_TYPE_CUST_UBIQUITI_USG:
if (ipd_port > 2)
return -1;
return (7 - ipd_port);
@@ -1499,7 +1500,8 @@ int __cvmx_helper_board_hardware_enable(
 }
 }
 #if defined(OCTEON_VENDOR_UBIQUITI)
-else if (cvmx_sysinfo_get()->board_type == 
CVMX_BOARD_TYPE_CUST_UBIQUITI_E100)
+else if (cvmx_sysinfo_get()->board_type == 
CVMX_BOARD_TYPE_CUST_UBIQUITI_E100 ||
+cvmx_sysinfo_get()->board_type == CVMX_BOARD_TYPE_CUST_UBIQUITI_USG)
 {
/* Configure ASX cloks for all ports on interface 0.  */
if (interface == 0)
@@ -1590,6 +1592,7 @@ cvmx_helper_board_usb_clock_types_t __cv
 #endif
 #if defined(OCTEON_VENDOR_UBIQUITI)
 case CVMX_BOARD_TYPE_CUST_UBIQUITI_E100:
+case CVMX_BOARD_TYPE_CUST_UBIQUITI_USG:
 #endif
 #if defined(OCTEON_BOARD_CAPK_0100ND)
case CVMX_BOARD_TYPE_CN3010_EVB_HS5:
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r317927 - in stable/10/sys/fs: nfs nfsclient

2017-05-07 Thread Rick Macklem
Author: rmacklem
Date: Sun May  7 21:57:46 2017
New Revision: 317927
URL: https://svnweb.freebsd.org/changeset/base/317927

Log:
  MFC: r317275, r317344
  Don't create a backchannel for a DS connection.
  
  An NFSv4.1 client connection to a Data Server (DS) should not have a
  backchannel. This patch fixes the NFSv4.1/pNFS client to not do a backchannel
  for this case.
  Found during recent testing with the pNFS server under development.

Modified:
  stable/10/sys/fs/nfs/nfs_commonkrpc.c
  stable/10/sys/fs/nfsclient/nfs_clrpcops.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/fs/nfs/nfs_commonkrpc.c
==
--- stable/10/sys/fs/nfs/nfs_commonkrpc.c   Sun May  7 21:42:02 2017
(r317926)
+++ stable/10/sys/fs/nfs/nfs_commonkrpc.c   Sun May  7 21:57:46 2017
(r317927)
@@ -281,7 +281,8 @@ newnfs_connect(struct nfsmount *nmp, str
retries = nmp->nm_retry;
} else
retries = INT_MAX;
-   if (NFSHASNFSV4N(nmp)) {
+   /* cred == NULL for DS connects. */
+   if (NFSHASNFSV4N(nmp) && cred != NULL) {
/*
 * Make sure the nfscbd_pool doesn't get destroyed
 * while doing this.

Modified: stable/10/sys/fs/nfsclient/nfs_clrpcops.c
==
--- stable/10/sys/fs/nfsclient/nfs_clrpcops.c   Sun May  7 21:42:02 2017
(r317926)
+++ stable/10/sys/fs/nfsclient/nfs_clrpcops.c   Sun May  7 21:57:46 2017
(r317927)
@@ -4610,7 +4610,7 @@ nfsrpc_createsession(struct nfsmount *nm
*tl++ = sep->nfsess_clientid.lval[1];
*tl++ = txdr_unsigned(sequenceid);
crflags = (NFSMNT_RDONLY(nmp->nm_mountp) ? 0 : NFSV4CRSESS_PERSIST);
-   if (nfscl_enablecallb != 0 && nfs_numnfscbd > 0)
+   if (nfscl_enablecallb != 0 && nfs_numnfscbd > 0 && mds != 0)
crflags |= NFSV4CRSESS_CONNBACKCHAN;
*tl = txdr_unsigned(crflags);
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r317926 - in stable/11/sys/fs: nfs nfsclient

2017-05-07 Thread Rick Macklem
Author: rmacklem
Date: Sun May  7 21:42:02 2017
New Revision: 317926
URL: https://svnweb.freebsd.org/changeset/base/317926

Log:
  MFC: r317275, r317344
  Don't create a backchannel for a DS connection.
  
  An NFSv4.1 client connection to a Data Server (DS) should not have a
  backchannel. This patch fixes the NFSv4.1/pNFS client to not do a backchannel
  for this case.
  Found during recent testing with the pNFS server under development.

Modified:
  stable/11/sys/fs/nfs/nfs_commonkrpc.c
  stable/11/sys/fs/nfsclient/nfs_clrpcops.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/fs/nfs/nfs_commonkrpc.c
==
--- stable/11/sys/fs/nfs/nfs_commonkrpc.c   Sun May  7 21:32:55 2017
(r317925)
+++ stable/11/sys/fs/nfs/nfs_commonkrpc.c   Sun May  7 21:42:02 2017
(r317926)
@@ -280,7 +280,8 @@ newnfs_connect(struct nfsmount *nmp, str
retries = nmp->nm_retry;
} else
retries = INT_MAX;
-   if (NFSHASNFSV4N(nmp)) {
+   /* cred == NULL for DS connects. */
+   if (NFSHASNFSV4N(nmp) && cred != NULL) {
/*
 * Make sure the nfscbd_pool doesn't get destroyed
 * while doing this.

Modified: stable/11/sys/fs/nfsclient/nfs_clrpcops.c
==
--- stable/11/sys/fs/nfsclient/nfs_clrpcops.c   Sun May  7 21:32:55 2017
(r317925)
+++ stable/11/sys/fs/nfsclient/nfs_clrpcops.c   Sun May  7 21:42:02 2017
(r317926)
@@ -4613,7 +4613,7 @@ nfsrpc_createsession(struct nfsmount *nm
*tl++ = sep->nfsess_clientid.lval[1];
*tl++ = txdr_unsigned(sequenceid);
crflags = (NFSMNT_RDONLY(nmp->nm_mountp) ? 0 : NFSV4CRSESS_PERSIST);
-   if (nfscl_enablecallb != 0 && nfs_numnfscbd > 0)
+   if (nfscl_enablecallb != 0 && nfs_numnfscbd > 0 && mds != 0)
crflags |= NFSV4CRSESS_CONNBACKCHAN;
*tl = txdr_unsigned(crflags);
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r317925 - stable/10/sys/fs/nfsclient

2017-05-07 Thread Rick Macklem
Author: rmacklem
Date: Sun May  7 21:32:55 2017
New Revision: 317925
URL: https://svnweb.freebsd.org/changeset/base/317925

Log:
  MFC: r317272
  Add checks for failed operations to the NFSv4 client function nfscl_mtofh().
  
  The nfscl_mtofh() function didn't check for failed operations and, as such,
  would have returned EBADRPC for these cases, due to parsing failure.
  This patch adds checks, so that it returns with ND_NOMOREDATA set.
  This is needed for future use in the pNFS server and acts as a safety
  belt in the meantime.

Modified:
  stable/10/sys/fs/nfsclient/nfs_clcomsubs.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/fs/nfsclient/nfs_clcomsubs.c
==
--- stable/10/sys/fs/nfsclient/nfs_clcomsubs.c  Sun May  7 21:22:47 2017
(r317924)
+++ stable/10/sys/fs/nfsclient/nfs_clcomsubs.c  Sun May  7 21:32:55 2017
(r317925)
@@ -471,6 +471,11 @@ nfscl_mtofh(struct nfsrv_descript *nd, s
flag = fxdr_unsigned(int, *tl);
} else if (nd->nd_flag & ND_NFSV4) {
NFSM_DISSECT(tl, u_int32_t *, 2 * NFSX_UNSIGNED);
+   /* If the GetFH failed, clear flag. */
+   if (*++tl != 0) {
+   nd->nd_flag |= ND_NOMOREDATA;
+   flag = 0;
+   }
}
if (flag) {
error = nfsm_getfh(nd, nfhpp);
@@ -481,8 +486,12 @@ nfscl_mtofh(struct nfsrv_descript *nd, s
/*
 * Now, get the attributes.
 */
-   if (nd->nd_flag & ND_NFSV4) {
+   if (flag != 0 && (nd->nd_flag & ND_NFSV4) != 0) {
NFSM_DISSECT(tl, u_int32_t *, 2 * NFSX_UNSIGNED);
+   if (*++tl != 0) {
+   nd->nd_flag |= ND_NOMOREDATA;
+   flag = 0;
+   }
} else if (nd->nd_flag & ND_NFSV3) {
NFSM_DISSECT(tl, u_int32_t *, NFSX_UNSIGNED);
if (flag) {
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r317924 - stable/11/sys/fs/nfsclient

2017-05-07 Thread Rick Macklem
Author: rmacklem
Date: Sun May  7 21:22:47 2017
New Revision: 317924
URL: https://svnweb.freebsd.org/changeset/base/317924

Log:
  MFC: r317272
  Add checks for failed operations to the NFSv4 client function nfscl_mtofh().
  
  The nfscl_mtofh() function didn't check for failed operations and, as such,
  would have returned EBADRPC for these cases, due to parsing failure.
  This patch adds checks, so that it returns with ND_NOMOREDATA set.
  This is needed for future use in the pNFS server and acts as a safety
  belt in the meantime.

Modified:
  stable/11/sys/fs/nfsclient/nfs_clcomsubs.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/fs/nfsclient/nfs_clcomsubs.c
==
--- stable/11/sys/fs/nfsclient/nfs_clcomsubs.c  Sun May  7 21:11:28 2017
(r317923)
+++ stable/11/sys/fs/nfsclient/nfs_clcomsubs.c  Sun May  7 21:22:47 2017
(r317924)
@@ -471,6 +471,11 @@ nfscl_mtofh(struct nfsrv_descript *nd, s
flag = fxdr_unsigned(int, *tl);
} else if (nd->nd_flag & ND_NFSV4) {
NFSM_DISSECT(tl, u_int32_t *, 2 * NFSX_UNSIGNED);
+   /* If the GetFH failed, clear flag. */
+   if (*++tl != 0) {
+   nd->nd_flag |= ND_NOMOREDATA;
+   flag = 0;
+   }
}
if (flag) {
error = nfsm_getfh(nd, nfhpp);
@@ -481,8 +486,12 @@ nfscl_mtofh(struct nfsrv_descript *nd, s
/*
 * Now, get the attributes.
 */
-   if (nd->nd_flag & ND_NFSV4) {
+   if (flag != 0 && (nd->nd_flag & ND_NFSV4) != 0) {
NFSM_DISSECT(tl, u_int32_t *, 2 * NFSX_UNSIGNED);
+   if (*++tl != 0) {
+   nd->nd_flag |= ND_NOMOREDATA;
+   flag = 0;
+   }
} else if (nd->nd_flag & ND_NFSV3) {
NFSM_DISSECT(tl, u_int32_t *, NFSX_UNSIGNED);
if (flag) {
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r317923 - head/sbin/dhclient

2017-05-07 Thread Nick Hibma
Author: n_hibma
Date: Sun May  7 21:11:28 2017
New Revision: 317923
URL: https://svnweb.freebsd.org/changeset/base/317923

Log:
  Fix the output of very large rebind, renew and lease time options in
  lease file.
  
  Some routers set very large values for rebind time (Netgear) and these
  are erroneously reported as negative in the leasefile. This was due to a
  wrong printf format specification of %ld for an unsigned long on 32-bit
  platforms.

Modified:
  head/sbin/dhclient/options.c

Modified: head/sbin/dhclient/options.c
==
--- head/sbin/dhclient/options.cSun May  7 21:06:23 2017
(r317922)
+++ head/sbin/dhclient/options.cSun May  7 21:11:28 2017
(r317923)
@@ -783,7 +783,7 @@ pretty_print_option(unsigned int code, u
dp += 4;
break;
case 'L':
-   opcount = snprintf(op, opleft, "%ld",
+   opcount = snprintf(op, opleft, "%lu",
(unsigned long)getULong(dp));
if (opcount >= opleft || opcount == -1)
goto toobig;
@@ -799,7 +799,7 @@ pretty_print_option(unsigned int code, u
dp += 2;
break;
case 'S':
-   opcount = snprintf(op, opleft, "%d",
+   opcount = snprintf(op, opleft, "%u",
getUShort(dp));
if (opcount >= opleft || opcount == -1)
goto toobig;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r317922 - stable/10/usr.sbin/nfsuserd

2017-05-07 Thread Rick Macklem
Author: rmacklem
Date: Sun May  7 21:06:23 2017
New Revision: 317922
URL: https://svnweb.freebsd.org/changeset/base/317922

Log:
  MFC: r317270
  Get rid of bogus statement in the nfsuserd.8 man page.
  
  The nfsuserd.8 man page stated that a usertimeout of 0 would disable
  the cache timeout. This was simply not true, so this patch deletes
  the sentence.
  
  This is a content change.

Modified:
  stable/10/usr.sbin/nfsuserd/nfsuserd.8
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/usr.sbin/nfsuserd/nfsuserd.8
==
--- stable/10/usr.sbin/nfsuserd/nfsuserd.8  Sun May  7 20:57:13 2017
(r317921)
+++ stable/10/usr.sbin/nfsuserd/nfsuserd.8  Sun May  7 21:06:23 2017
(r317922)
@@ -24,7 +24,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd November 1, 2015
+.Dd April 21, 2017
 .Dt NFSUSERD 8
 .Os
 .Sh NAME
@@ -64,8 +64,8 @@ if that name is not a fully qualified ho
 reported by
 .Xr getaddrinfo 3 .
 .It Fl usertimeout Ar minutes
-Overrides the default timeout for cache entries, in minutes. If the
-timeout is specified as 0, cache entries never time out. The longer the
+Overrides the default timeout for cache entries, in minutes.
+The longer the
 time out, the better the performance, but the longer it takes for replaced
 entries to be seen. If your user/group database management system almost
 never re-uses the same names or id numbers, a large timeout is recommended.
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r317921 - stable/11/usr.sbin/nfsuserd

2017-05-07 Thread Rick Macklem
Author: rmacklem
Date: Sun May  7 20:57:13 2017
New Revision: 317921
URL: https://svnweb.freebsd.org/changeset/base/317921

Log:
  MFC: r317270
  Get rid of bogus statement in the nfsuserd.8 man page.
  
  The nfsuserd.8 man page stated that a usertimeout of 0 would disable
  the cache timeout. This was simply not true, so this patch deletes
  the sentence.
  
  This is a content change.

Modified:
  stable/11/usr.sbin/nfsuserd/nfsuserd.8
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/usr.sbin/nfsuserd/nfsuserd.8
==
--- stable/11/usr.sbin/nfsuserd/nfsuserd.8  Sun May  7 20:50:32 2017
(r317920)
+++ stable/11/usr.sbin/nfsuserd/nfsuserd.8  Sun May  7 20:57:13 2017
(r317921)
@@ -24,7 +24,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd November 1, 2015
+.Dd April 21, 2017
 .Dt NFSUSERD 8
 .Os
 .Sh NAME
@@ -64,8 +64,8 @@ if that name is not a fully qualified ho
 reported by
 .Xr getaddrinfo 3 .
 .It Fl usertimeout Ar minutes
-Overrides the default timeout for cache entries, in minutes. If the
-timeout is specified as 0, cache entries never time out. The longer the
+Overrides the default timeout for cache entries, in minutes.
+The longer the
 time out, the better the performance, but the longer it takes for replaced
 entries to be seen. If your user/group database management system almost
 never re-uses the same names or id numbers, a large timeout is recommended.
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r317920 - stable/10/usr.sbin/nfsuserd

2017-05-07 Thread Rick Macklem
Author: rmacklem
Date: Sun May  7 20:50:32 2017
New Revision: 317920
URL: https://svnweb.freebsd.org/changeset/base/317920

Log:
  MFC: r317350
  Fix the default uid/gid values in nfsuserd.c
  
  This patch sets the default uid/gid values for "nobody" and "nogroup"
  to the values in the password and group databases. Normally nfsuserd(8)
  will override these with whatever is in the password/group databases,
  so these values are only used when the databases entries aren't available.
  It would be nice to use the definitions in sys/conf.h, but those are
  in the _KERNEL section of the file.

Modified:
  stable/10/usr.sbin/nfsuserd/nfsuserd.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/usr.sbin/nfsuserd/nfsuserd.c
==
--- stable/10/usr.sbin/nfsuserd/nfsuserd.c  Sun May  7 20:42:01 2017
(r317919)
+++ stable/10/usr.sbin/nfsuserd/nfsuserd.c  Sun May  7 20:50:32 2017
(r317920)
@@ -88,9 +88,9 @@ struct info {
 
 u_char *dnsname = "default.domain";
 u_char *defaultuser = "nobody";
-uid_t defaultuid = (uid_t)32767;
+uid_t defaultuid = 65534;
 u_char *defaultgroup = "nogroup";
-gid_t defaultgid = (gid_t)32767;
+gid_t defaultgid = 65533;
 int verbose = 0, im_a_slave = 0, nfsuserdcnt = -1, forcestart = 0;
 int defusertimeout = DEFUSERTIMEOUT, manage_gids = 0;
 pid_t slaves[MAXNFSUSERD];
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r317919 - stable/11/usr.sbin/nfsuserd

2017-05-07 Thread Rick Macklem
Author: rmacklem
Date: Sun May  7 20:42:01 2017
New Revision: 317919
URL: https://svnweb.freebsd.org/changeset/base/317919

Log:
  MFC: r317350
  Fix the default uid/gid values in nfsuserd.c
  
  This patch sets the default uid/gid values for "nobody" and "nogroup"
  to the values in the password and group databases. Normally nfsuserd(8)
  will override these with whatever is in the password/group databases,
  so these values are only used when the databases entries aren't available.
  It would be nice to use the definitions in sys/conf.h, but those are
  in the _KERNEL section of the file.

Modified:
  stable/11/usr.sbin/nfsuserd/nfsuserd.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/usr.sbin/nfsuserd/nfsuserd.c
==
--- stable/11/usr.sbin/nfsuserd/nfsuserd.c  Sun May  7 20:32:07 2017
(r317918)
+++ stable/11/usr.sbin/nfsuserd/nfsuserd.c  Sun May  7 20:42:01 2017
(r317919)
@@ -88,9 +88,9 @@ struct info {
 
 u_char *dnsname = "default.domain";
 u_char *defaultuser = "nobody";
-uid_t defaultuid = (uid_t)32767;
+uid_t defaultuid = 65534;
 u_char *defaultgroup = "nogroup";
-gid_t defaultgid = (gid_t)32767;
+gid_t defaultgid = 65533;
 int verbose = 0, im_a_slave = 0, nfsuserdcnt = -1, forcestart = 0;
 int defusertimeout = DEFUSERTIMEOUT, manage_gids = 0;
 pid_t slaves[MAXNFSUSERD];
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r317918 - stable/9/sys/fs/nfsserver

2017-05-07 Thread Rick Macklem
Author: rmacklem
Date: Sun May  7 20:32:07 2017
New Revision: 317918
URL: https://svnweb.freebsd.org/changeset/base/317918

Log:
  MFC: r317236
  Fix the setting of atime for Linux client NFSv4 mounts.
  
  The FreeBSD NFSv4 server did not set the attribute bit for TimeAccess in
  the reply to an Open with exclusive_create, as required by the RFCs.
  (This is required since the FreeBSD NFS server stores the create_verifier
   in the va_atime attribute.)
  As such, the Linux NFSv4 client did not set the TimeAccess (atime) in
  the Setattr done in an RPC after the one with the Open/exclusive_create.
  This patch fixes the server to set the TimeAccess bit in the reply.
  
  I believe that storing the create_verifier in an extended attribute for
  file systems that support extended attributes might be a good idea,
  but I will wait for a discussion of this on the freebsd-fs@ email list
  before considering committing a patch to do this.

Modified:
  stable/9/sys/fs/nfsserver/nfs_nfsdport.c
Directory Properties:
  stable/9/sys/   (props changed)
  stable/9/sys/fs/   (props changed)

Modified: stable/9/sys/fs/nfsserver/nfs_nfsdport.c
==
--- stable/9/sys/fs/nfsserver/nfs_nfsdport.cSun May  7 20:21:59 2017
(r317917)
+++ stable/9/sys/fs/nfsserver/nfs_nfsdport.cSun May  7 20:32:07 2017
(r317918)
@@ -1422,7 +1422,9 @@ nfsvno_open(struct nfsrv_descript *nd, s
vput(ndp->ni_vp);
ndp->ni_vp = NULL;
nd->nd_repstat = NFSERR_NOTSUPP;
-   }
+   } else
+   NFSSETBIT_ATTRBIT(attrbitp,
+   NFSATTRBIT_TIMEACCESS);
} else {
nfsrv_fixattr(nd, ndp->ni_vp, nvap,
aclp, p, attrbitp, exp);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r317917 - in stable/10/sys: fs/nfs sys

2017-05-07 Thread Rick Macklem
Author: rmacklem
Date: Sun May  7 20:21:59 2017
New Revision: 317917
URL: https://svnweb.freebsd.org/changeset/base/317917

Log:
  MFC: r317269
  Set default uid/gid to nobody/nogroup for NFSv4 mapping.
  
  The default uid/gid for NFSv4 are set by the nfsuserd(8) daemon.
  However, they were 0 until the nfsuserd(8) was run. Since it is
  possible to use NFSv4 without running the nfsuserd(8) daemon, set them
  to nobody/nogroup initially.
  Without this patch, the values would be set by the nfsuserd(8) daemon
  and left changed even if the nfsuserd(8) daemon was killed. The default
  values of 0 meant that setting a group to "wheel" would fail even when
  done by root.
  It also adds a definition of GID_NOGROUP to sys/conf.h.

Modified:
  stable/10/sys/fs/nfs/nfs_commonsubs.c
  stable/10/sys/sys/conf.h
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/fs/nfs/nfs_commonsubs.c
==
--- stable/10/sys/fs/nfs/nfs_commonsubs.c   Sun May  7 20:11:58 2017
(r317916)
+++ stable/10/sys/fs/nfs/nfs_commonsubs.c   Sun May  7 20:21:59 2017
(r317917)
@@ -63,8 +63,8 @@ int nfsrv_useacl = 1;
 struct nfssockreq nfsrv_nfsuserdsock;
 int nfsrv_nfsuserd = 0;
 struct nfsreqhead nfsd_reqq;
-uid_t nfsrv_defaultuid;
-gid_t nfsrv_defaultgid;
+uid_t nfsrv_defaultuid = UID_NOBODY;
+gid_t nfsrv_defaultgid = GID_NOGROUP;
 int nfsrv_lease = NFSRV_LEASE;
 int ncl_mbuf_mlen = MLEN;
 int nfsd_enable_stringtouid = 0;

Modified: stable/10/sys/sys/conf.h
==
--- stable/10/sys/sys/conf.hSun May  7 20:11:58 2017(r317916)
+++ stable/10/sys/sys/conf.hSun May  7 20:21:59 2017(r317917)
@@ -335,6 +335,7 @@ voiddevfs_free_cdp_inode(ino_t ino);
 #defineGID_BIN 7
 #defineGID_GAMES   13
 #defineGID_DIALER  68
+#defineGID_NOGROUP 65533
 #defineGID_NOBODY  65534
 
 typedef void (*dev_clone_fn)(void *arg, struct ucred *cred, char *name,
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r317916 - in stable/11/sys: fs/nfs sys

2017-05-07 Thread Rick Macklem
Author: rmacklem
Date: Sun May  7 20:11:58 2017
New Revision: 317916
URL: https://svnweb.freebsd.org/changeset/base/317916

Log:
  MFC: r317269
  Set default uid/gid to nobody/nogroup for NFSv4 mapping.
  
  The default uid/gid for NFSv4 are set by the nfsuserd(8) daemon.
  However, they were 0 until the nfsuserd(8) was run. Since it is
  possible to use NFSv4 without running the nfsuserd(8) daemon, set them
  to nobody/nogroup initially.
  Without this patch, the values would be set by the nfsuserd(8) daemon
  and left changed even if the nfsuserd(8) daemon was killed. The default
  values of 0 meant that setting a group to "wheel" would fail even when
  done by root.
  It also adds a definition of GID_NOGROUP to sys/conf.h.

Modified:
  stable/11/sys/fs/nfs/nfs_commonsubs.c
  stable/11/sys/sys/conf.h
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/fs/nfs/nfs_commonsubs.c
==
--- stable/11/sys/fs/nfs/nfs_commonsubs.c   Sun May  7 19:59:37 2017
(r317915)
+++ stable/11/sys/fs/nfs/nfs_commonsubs.c   Sun May  7 20:11:58 2017
(r317916)
@@ -63,8 +63,8 @@ int nfsrv_useacl = 1;
 struct nfssockreq nfsrv_nfsuserdsock;
 int nfsrv_nfsuserd = 0;
 struct nfsreqhead nfsd_reqq;
-uid_t nfsrv_defaultuid;
-gid_t nfsrv_defaultgid;
+uid_t nfsrv_defaultuid = UID_NOBODY;
+gid_t nfsrv_defaultgid = GID_NOGROUP;
 int nfsrv_lease = NFSRV_LEASE;
 int ncl_mbuf_mlen = MLEN;
 int nfsd_enable_stringtouid = 0;

Modified: stable/11/sys/sys/conf.h
==
--- stable/11/sys/sys/conf.hSun May  7 19:59:37 2017(r317915)
+++ stable/11/sys/sys/conf.hSun May  7 20:11:58 2017(r317916)
@@ -315,6 +315,7 @@ voiddevfs_free_cdp_inode(ino_t ino);
 #defineGID_GAMES   13
 #defineGID_VIDEO   44
 #defineGID_DIALER  68
+#defineGID_NOGROUP 65533
 #defineGID_NOBODY  65534
 
 typedef void (*dev_clone_fn)(void *arg, struct ucred *cred, char *name,
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r317915 - head/sbin/dhclient

2017-05-07 Thread Nick Hibma
Author: n_hibma
Date: Sun May  7 19:59:37 2017
New Revision: 317915
URL: https://svnweb.freebsd.org/changeset/base/317915

Log:
  Fix handling of large DHCP expiry values.
  
  They would overflow a signed 32-bit time_t on 32 bit architectures. This
  was taken care of, but a compiler optimisation makes this behave
  erratically. This could be resolved by adding a -fwrapv flag, but
  instead we can check the value before adding the current timestamp to
  it.
  
  In the lease file values are still wrong though:
  
option dhcp-rebinding-time -644245096;
  
  PR:   218980
  Reported by:  Bob Eager
  MFC after:2 weeks

Modified:
  head/sbin/dhclient/dhclient.c

Modified: head/sbin/dhclient/dhclient.c
==
--- head/sbin/dhclient/dhclient.c   Sun May  7 19:57:45 2017
(r317914)
+++ head/sbin/dhclient/dhclient.c   Sun May  7 19:59:37 2017
(r317915)
@@ -108,7 +108,11 @@ struct pidfh *pidfile;
  */
 #define ASSERT_STATE(state_is, state_shouldbe) {}
 
-#define TIME_MAX 2147483647
+/*
+ * We need to check that the expiry, renewal and rebind times are not beyond
+ * the end of time (~2038 when a 32-bit time_t is being used).
+ */
+#define TIME_MAXtime_t) 1 << (sizeof(time_t) * CHAR_BIT - 2)) - 1) 
* 2 + 1)
 
 intlog_priority;
 intno_daemon;
@@ -766,15 +770,17 @@ dhcpack(struct packet *packet)
else
ip->client->new->expiry = default_lease_time;
/* A number that looks negative here is really just very large,
-  because the lease expiry offset is unsigned. */
-   if (ip->client->new->expiry < 0)
-   ip->client->new->expiry = TIME_MAX;
+  because the lease expiry offset is unsigned. Also make sure that
+   the addition of cur_time below does not overflow (a 32 bit) time_t. 
*/
+   if (ip->client->new->expiry < 0 ||
+ip->client->new->expiry > TIME_MAX - cur_time)
+   ip->client->new->expiry = TIME_MAX - cur_time;
/* XXX should be fixed by resetting the client state */
if (ip->client->new->expiry < 60)
ip->client->new->expiry = 60;
 
 /* Unless overridden in the config, take the server-provided renewal
- * time if there is one; otherwise figure it out according to the spec.
+ * time if there is one. Otherwise figure it out according to the spec.
  * Also make sure the renewal time does not exceed the expiry time.
  */
 if (ip->client->config->default_actions[DHO_DHCP_RENEWAL_TIME] ==
@@ -786,7 +792,8 @@ dhcpack(struct packet *packet)
ip->client->new->options[DHO_DHCP_RENEWAL_TIME].data);
else
ip->client->new->renewal = ip->client->new->expiry / 2;
-if (ip->client->new->renewal > ip->client->new->expiry / 2)
+if (ip->client->new->renewal < 0 ||
+ip->client->new->renewal > ip->client->new->expiry / 2)
 ip->client->new->renewal = ip->client->new->expiry / 2;
 
/* Same deal with the rebind time. */
@@ -798,20 +805,15 @@ dhcpack(struct packet *packet)
ip->client->new->rebind = getULong(
ip->client->new->options[DHO_DHCP_REBINDING_TIME].data);
else
-   ip->client->new->rebind = ip->client->new->renewal * 7 / 4;
-if (ip->client->new->rebind > ip->client->new->renewal * 7 / 4)
-ip->client->new->rebind = ip->client->new->renewal * 7 / 4;
-
-   ip->client->new->expiry += cur_time;
-   /* Lease lengths can never be negative. */
-   if (ip->client->new->expiry < cur_time)
-   ip->client->new->expiry = TIME_MAX;
-   ip->client->new->renewal += cur_time;
-   if (ip->client->new->renewal < cur_time)
-   ip->client->new->renewal = TIME_MAX;
-   ip->client->new->rebind += cur_time;
-   if (ip->client->new->rebind < cur_time)
-   ip->client->new->rebind = TIME_MAX;
+   ip->client->new->rebind = ip->client->new->renewal / 4 * 7;
+   if (ip->client->new->rebind < 0 ||
+ip->client->new->rebind > ip->client->new->renewal / 4 * 7)
+ip->client->new->rebind = ip->client->new->renewal / 4 * 7;
+
+/* Convert the time offsets into seconds-since-the-epoch */
+ip->client->new->expiry += cur_time;
+ip->client->new->renewal += cur_time;
+ip->client->new->rebind += cur_time;
 
bind_lease(ip);
 }
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r317914 - stable/10/sys/fs/nfsserver

2017-05-07 Thread Rick Macklem
Author: rmacklem
Date: Sun May  7 19:57:45 2017
New Revision: 317914
URL: https://svnweb.freebsd.org/changeset/base/317914

Log:
  MFC: r317236
  Fix the setting of atime for Linux client NFSv4 mounts.
  
  The FreeBSD NFSv4 server did not set the attribute bit for TimeAccess in
  the reply to an Open with exclusive_create, as required by the RFCs.
  (This is required since the FreeBSD NFS server stores the create_verifier
   in the va_atime attribute.)
  As such, the Linux NFSv4 client did not set the TimeAccess (atime) in
  the Setattr done in an RPC after the one with the Open/exclusive_create.
  This patch fixes the server to set the TimeAccess bit in the reply.
  
  I believe that storing the create_verifier in an extended attribute for
  file systems that support extended attributes might be a good idea,
  but I will wait for a discussion of this on the freebsd-fs@ email list
  before considering committing a patch to do this.

Modified:
  stable/10/sys/fs/nfsserver/nfs_nfsdport.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/fs/nfsserver/nfs_nfsdport.c
==
--- stable/10/sys/fs/nfsserver/nfs_nfsdport.c   Sun May  7 19:52:56 2017
(r317913)
+++ stable/10/sys/fs/nfsserver/nfs_nfsdport.c   Sun May  7 19:57:45 2017
(r317914)
@@ -1431,7 +1431,9 @@ nfsvno_open(struct nfsrv_descript *nd, s
vput(ndp->ni_vp);
ndp->ni_vp = NULL;
nd->nd_repstat = NFSERR_NOTSUPP;
-   }
+   } else
+   NFSSETBIT_ATTRBIT(attrbitp,
+   NFSATTRBIT_TIMEACCESS);
} else {
nfsrv_fixattr(nd, ndp->ni_vp, nvap,
aclp, p, attrbitp, exp);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r317913 - head/lib/libc/gen

2017-05-07 Thread Jilles Tjoelker
Author: jilles
Date: Sun May  7 19:52:56 2017
New Revision: 317913
URL: https://svnweb.freebsd.org/changeset/base/317913

Log:
  glob: Fix comment about collapsing asterisks after r317749.
  
  After r317749, collapsing adjacent asterisks is still required, but for a
  different reason.

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

Modified: head/lib/libc/gen/glob.c
==
--- head/lib/libc/gen/glob.cSun May  7 19:49:46 2017(r317912)
+++ head/lib/libc/gen/glob.cSun May  7 19:52:56 2017(r317913)
@@ -581,7 +581,8 @@ glob0(const Char *pattern, glob_t *pglob
case STAR:
pglob->gl_flags |= GLOB_MAGCHAR;
/* collapse adjacent stars to one,
-* to avoid exponential behavior
+* to ensure "**" at the end continues to match the
+* empty string
 */
if (bufnext == patbuf || bufnext[-1] != M_ALL)
*bufnext++ = M_ALL;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r317912 - in head/bin/sh: . tests/builtins

2017-05-07 Thread Jilles Tjoelker
Author: jilles
Date: Sun May  7 19:49:46 2017
New Revision: 317912
URL: https://svnweb.freebsd.org/changeset/base/317912

Log:
  sh: Fix INTOFF leak after a builtin with different locale settings.
  
  After executing a builtin with different locale settings such as
LC_ALL=C true
  SIGINT handling was left disabled indefinitely.
  
  MFC after:1 week

Added:
  head/bin/sh/tests/builtins/locale2.0   (contents, props changed)
Modified:
  head/bin/sh/tests/builtins/Makefile
  head/bin/sh/var.c

Modified: head/bin/sh/tests/builtins/Makefile
==
--- head/bin/sh/tests/builtins/Makefile Sun May  7 19:47:50 2017
(r317911)
+++ head/bin/sh/tests/builtins/Makefile Sun May  7 19:49:46 2017
(r317912)
@@ -120,6 +120,7 @@ ${PACKAGE}FILES+=   local7.0
 .if ${MK_NLS} != "no"
 ${PACKAGE}FILES+=  locale1.0
 .endif
+${PACKAGE}FILES+=  locale2.0
 ${PACKAGE}FILES+=  printf1.0
 ${PACKAGE}FILES+=  printf2.0
 ${PACKAGE}FILES+=  printf3.0

Added: head/bin/sh/tests/builtins/locale2.0
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/bin/sh/tests/builtins/locale2.0Sun May  7 19:49:46 2017
(r317912)
@@ -0,0 +1,5 @@
+# $FreeBSD$
+
+$SH -c 'LC_ALL=C true; kill -INT $$; echo continued'
+r=$?
+[ "$r" -gt 128 ] && [ "$(kill -l "$r")" = INT ]

Modified: head/bin/sh/var.c
==
--- head/bin/sh/var.c   Sun May  7 19:47:50 2017(r317911)
+++ head/bin/sh/var.c   Sun May  7 19:49:46 2017(r317912)
@@ -513,7 +513,7 @@ bltinunsetlocale(void)
if (localevar(cmdenviron->args[i])) {
setlocale(LC_ALL, "");
updatecharset();
-   return;
+   break;
}
}
INTON;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r317911 - stable/11/sys/fs/nfsserver

2017-05-07 Thread Rick Macklem
Author: rmacklem
Date: Sun May  7 19:47:50 2017
New Revision: 317911
URL: https://svnweb.freebsd.org/changeset/base/317911

Log:
  MFC: r317236
  Fix the setting of atime for Linux client NFSv4 mounts.
  
  The FreeBSD NFSv4 server did not set the attribute bit for TimeAccess in
  the reply to an Open with exclusive_create, as required by the RFCs.
  (This is required since the FreeBSD NFS server stores the create_verifier
   in the va_atime attribute.)
  As such, the Linux NFSv4 client did not set the TimeAccess (atime) in
  the Setattr done in an RPC after the one with the Open/exclusive_create.
  This patch fixes the server to set the TimeAccess bit in the reply.
  
  I believe that storing the create_verifier in an extended attribute for
  file systems that support extended attributes might be a good idea,
  but I will wait for a discussion of this on the freebsd-fs@ email list
  before considering committing a patch to do this.

Modified:
  stable/11/sys/fs/nfsserver/nfs_nfsdport.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/fs/nfsserver/nfs_nfsdport.c
==
--- stable/11/sys/fs/nfsserver/nfs_nfsdport.c   Sun May  7 19:01:08 2017
(r317910)
+++ stable/11/sys/fs/nfsserver/nfs_nfsdport.c   Sun May  7 19:47:50 2017
(r317911)
@@ -1436,7 +1436,9 @@ nfsvno_open(struct nfsrv_descript *nd, s
vput(ndp->ni_vp);
ndp->ni_vp = NULL;
nd->nd_repstat = NFSERR_NOTSUPP;
-   }
+   } else
+   NFSSETBIT_ATTRBIT(attrbitp,
+   NFSATTRBIT_TIMEACCESS);
} else {
nfsrv_fixattr(nd, ndp->ni_vp, nvap,
aclp, p, attrbitp, exp);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


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

2017-05-07 Thread Benjamin Kaduk
Author: bjk (doc committer)
Date: Sun May  7 19:01:08 2017
New Revision: 317910
URL: https://svnweb.freebsd.org/changeset/base/317910

Log:
  Bring VOP_GETPAGES.9 more up-to-date
  
  Attempt to catch up to the KPI changes from r292373, and perform
  some other tidying while in the area.
  
  Reviewed by:  kib
  Differential Revision:https://reviews.freebsd.org/D10579

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

Modified: head/share/man/man9/VOP_GETPAGES.9
==
--- head/share/man/man9/VOP_GETPAGES.9  Sun May  7 17:21:22 2017
(r317909)
+++ head/share/man/man9/VOP_GETPAGES.9  Sun May  7 19:01:08 2017
(r317910)
@@ -29,7 +29,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd December 16, 2015
+.Dd May 7, 2017
 .Dt VOP_GETPAGES 9
 .Os
 .Sh NAME
@@ -41,9 +41,21 @@
 .In sys/vnode.h
 .In vm/vm.h
 .Ft int
-.Fn VOP_GETPAGES "struct vnode *vp" "vm_page_t *ma" "int count" "int *rbehind" 
"int *rahead"
+.Fo VOP_GETPAGES
+.Fa "struct vnode *vp"
+.Fa "vm_page_t *ma"
+.Fa "int count"
+.Fa "int *rbehind"
+.Fa "int *rahead"
+.Fc
 .Ft int
-.Fn VOP_PUTPAGES "struct vnode *vp" "vm_page_t *ma" "int count" "int sync" 
"int *rtvals"
+.Fo VOP_PUTPAGES
+.Fa "struct vnode *vp"
+.Fa "vm_page_t *ma"
+.Fa "int bytecount"
+.Fa "int flags"
+.Fa "int *rtvals"
+.Fc
 .Sh DESCRIPTION
 The
 .Fn VOP_GETPAGES
@@ -70,10 +82,32 @@ The file to access.
 Pointer to the first element of an array of pages representing a
 contiguous region of the file to be read or written.
 .It Fa count
-The number of bytes that should be read into the pages of the array.
-.It Fa sync
+The length of the
+.Fa ma
+array.
+.It Fa bytecount
+The number of bytes that should be written from the pages of the array.
+.It Fa flags
+A bitfield of flags affecting the function operation.
+If
 .Dv VM_PAGER_PUT_SYNC
-if the write should be synchronous.
+is set, the write should be synchronous; control must not be returned
+to the caller until after the write is finished.
+If
+.Dv VM_PAGER_PUT_INVAL
+is set, the pages are to be invalidated after being written.
+If
+.Dv VM_PAGER_PUT_NOREUSE
+is set, the I/O performed should set the IO_NOREUSE flag, to indicate
+to the filesystem that pages should be marked for fast reuse if needed.
+This could occur via a call to
+.Xr vm_page_deactivate_noreuse 9 ,
+which puts such pages onto the head of the inactive queue.
+If
+.Dv VM_PAGER_CLUSTER_OK
+is set, writes may be performed asynchronously, so that related writes
+can be coalesced for efficiency, e.g.,
+using the clustering mechanism of the buffer cache.
 .It Fa rtvals
 An array of VM system result codes indicating the status of each
 page written by
@@ -127,32 +161,33 @@ The page was not handled by this request
 .Pp
 The
 .Fn VOP_GETPAGES
-method is expected to release any pages in
+method must populate and validate all requested pages in order to
+return success.
+It is expected to release any pages in
 .Fa ma
 that it does not successfully handle, by calling
 .Xr vm_page_free 9 .
 When it succeeds,
 .Fn VOP_GETPAGES
 must set the valid bits appropriately.
+Upon entry to
+.Fn VOP_GETPAGES ,
+all pages in
+.Fa ma
+are busied exclusively.
+Upon successful return, the pages must all be busied exclusively
+as well, but pages may be unbusied during processing.
+The filesystem is responsible for activating paged-out pages, but this
+does not necessarily need to be done within
 .Fn VOP_GETPAGES
-must keep
-.Fa reqpage
-busy.
-It must unbusy all other successfully handled pages and put them
-on appropriate page queue(s).
-For example,
-.Fn VOP_GETPAGES
-may either activate a page (if its wanted bit is set)
-or deactivate it (otherwise), and finally call
-.Xr vm_page_xunbusy 9
-to arouse any threads currently waiting for the page to be faulted in.
+depending on the architecture of the particular filesystem.
 .Sh RETURN VALUES
-If it successfully reads
-.Fa ma[reqpage] ,
+If it successfully reads all pages in
+.Fa ma ,
 .Fn VOP_GETPAGES
 returns
 .Dv VM_PAGER_OK ;
-otherwise,
+otherwise, it returns
 .Dv VM_PAGER_ERROR .
 By convention, the return value of
 .Fn VOP_PUTPAGES
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r317909 - head/usr.bin/resizewin

2017-05-07 Thread Jilles Tjoelker
On Sun, May 07, 2017 at 09:01:43PM +0300, Konstantin Belousov wrote:
> On Sun, May 07, 2017 at 05:21:23PM +, Edward Tomasz Napierala wrote:
> > Author: trasz
> > Date: Sun May  7 17:21:22 2017
> > New Revision: 317909
> > URL: https://svnweb.freebsd.org/changeset/base/317909

> > Log:
> >   Make resizewin(1) discard the terminal queues, to lower the chance
> >   for "unable to parse response" error which happens when youre typing
> >   too fast for the machine you're running it on.

> >   Reviewed by:  cem, Daniel O'Connor 
> >   MFC after:2 weeks
> >   Sponsored by: DARPA, AFRL
> >   Differential Revision:https://reviews.freebsd.org/D10624

> > Modified:
> >   head/usr.bin/resizewin/resizewin.c
> > 
> > Modified: head/usr.bin/resizewin/resizewin.c
> > ==
> > --- head/usr.bin/resizewin/resizewin.c  Sun May  7 14:59:45 2017
> > (r317908)
> > +++ head/usr.bin/resizewin/resizewin.c  Sun May  7 17:21:22 2017
> > (r317909)
> > @@ -52,7 +52,7 @@ main(__unused int argc, __unused char **
> >  {
> > struct termios old, new;
> > struct winsize w;
> > -   int ret, fd, cnt, error;
> > +   int ret, fd, cnt, error, what;
> > char data[20];
> > struct timeval then, now;
> >  
> > @@ -71,6 +71,12 @@ main(__unused int argc, __unused char **
> > if (tcsetattr(fd, TCSANOW, ) == -1)
> > exit(1);
> >  
> > +   /* Discard input received so far */
> > +   what = FREAD | FWRITE;
> > +   error = ioctl(fd, TIOCFLUSH, );
> This is correctly spelled tcflush(fd, TCIOFLUSH);

Alternatively, the above TCSANOW could be changed to TCSAFLUSH. The
effect is slightly different in that pending output is drained instead
of discarded.

In any case, the TIOCFLUSH ioctl is non-standard and should not be used
directly.

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


Re: svn commit: r317909 - head/usr.bin/resizewin

2017-05-07 Thread Konstantin Belousov
On Sun, May 07, 2017 at 05:21:23PM +, Edward Tomasz Napierala wrote:
> Author: trasz
> Date: Sun May  7 17:21:22 2017
> New Revision: 317909
> URL: https://svnweb.freebsd.org/changeset/base/317909
> 
> Log:
>   Make resizewin(1) discard the terminal queues, to lower the chance
>   for "unable to parse response" error which happens when youre typing
>   too fast for the machine you're running it on.
>   
>   Reviewed by:cem, Daniel O'Connor 
>   MFC after:  2 weeks
>   Sponsored by:   DARPA, AFRL
>   Differential Revision:  https://reviews.freebsd.org/D10624
> 
> Modified:
>   head/usr.bin/resizewin/resizewin.c
> 
> Modified: head/usr.bin/resizewin/resizewin.c
> ==
> --- head/usr.bin/resizewin/resizewin.cSun May  7 14:59:45 2017
> (r317908)
> +++ head/usr.bin/resizewin/resizewin.cSun May  7 17:21:22 2017
> (r317909)
> @@ -52,7 +52,7 @@ main(__unused int argc, __unused char **
>  {
>   struct termios old, new;
>   struct winsize w;
> - int ret, fd, cnt, error;
> + int ret, fd, cnt, error, what;
>   char data[20];
>   struct timeval then, now;
>  
> @@ -71,6 +71,12 @@ main(__unused int argc, __unused char **
>   if (tcsetattr(fd, TCSANOW, ) == -1)
>   exit(1);
>  
> + /* Discard input received so far */
> + what = FREAD | FWRITE;
> + error = ioctl(fd, TIOCFLUSH, );
This is correctly spelled tcflush(fd, TCIOFLUSH);

> + if (error != 0)
> + warn("ioctl");
> +
>   if (write(fd, query, sizeof(query)) != sizeof(query)) {
>   error = 1;
>   goto out;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r317909 - head/usr.bin/resizewin

2017-05-07 Thread Edward Tomasz Napierala
Author: trasz
Date: Sun May  7 17:21:22 2017
New Revision: 317909
URL: https://svnweb.freebsd.org/changeset/base/317909

Log:
  Make resizewin(1) discard the terminal queues, to lower the chance
  for "unable to parse response" error which happens when youre typing
  too fast for the machine you're running it on.
  
  Reviewed by:  cem, Daniel O'Connor 
  MFC after:2 weeks
  Sponsored by: DARPA, AFRL
  Differential Revision:https://reviews.freebsd.org/D10624

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

Modified: head/usr.bin/resizewin/resizewin.c
==
--- head/usr.bin/resizewin/resizewin.c  Sun May  7 14:59:45 2017
(r317908)
+++ head/usr.bin/resizewin/resizewin.c  Sun May  7 17:21:22 2017
(r317909)
@@ -52,7 +52,7 @@ main(__unused int argc, __unused char **
 {
struct termios old, new;
struct winsize w;
-   int ret, fd, cnt, error;
+   int ret, fd, cnt, error, what;
char data[20];
struct timeval then, now;
 
@@ -71,6 +71,12 @@ main(__unused int argc, __unused char **
if (tcsetattr(fd, TCSANOW, ) == -1)
exit(1);
 
+   /* Discard input received so far */
+   what = FREAD | FWRITE;
+   error = ioctl(fd, TIOCFLUSH, );
+   if (error != 0)
+   warn("ioctl");
+
if (write(fd, query, sizeof(query)) != sizeof(query)) {
error = 1;
goto out;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r317901 - head/usr.bin/resizewin

2017-05-07 Thread Conrad Meyer
On Sun, May 7, 2017 at 2:19 AM, Edward Tomasz Napierala
 wrote:
> Author: trasz
> Date: Sun May  7 09:19:42 2017
> New Revision: 317901
> URL: https://svnweb.freebsd.org/changeset/base/317901
>
> Log:
>   Improve error reporting in resizewin(1).
>
>   Reviewed by:  cem (earlier version)

Also reviewed by: Daniel O'Connor (the original author) :-).

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


Re: svn commit: r317884 - head/sys/compat/linprocfs

2017-05-07 Thread Ngie Cooper

> On May 6, 2017, at 11:43, Mahdi Mokhtari  wrote:
> 
> Also I think it worths saying, I've tested this running on a X86.
> It was not panic'd and printed data as expected.
> So you mean it's possible to panic on "some" cases because of CPUID support?

You'll get a hardware trap if/when the CPU doesn't support the instruction, 
which will result in a panic.
Cheers,
-Ngie
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r317908 - head/sys/ufs/ffs

2017-05-07 Thread Konstantin Belousov
Author: kib
Date: Sun May  7 14:59:45 2017
New Revision: 317908
URL: https://svnweb.freebsd.org/changeset/base/317908

Log:
  Remove spl() calls from UFS code.
  
  Sponsored by: The FreeBSD Foundation
  MFC after:1 week

Modified:
  head/sys/ufs/ffs/ffs_rawread.c

Modified: head/sys/ufs/ffs/ffs_rawread.c
==
--- head/sys/ufs/ffs/ffs_rawread.c  Sun May  7 14:33:58 2017
(r317907)
+++ head/sys/ufs/ffs/ffs_rawread.c  Sun May  7 14:59:45 2017
(r317908)
@@ -270,7 +270,6 @@ ffs_rawread_main(struct vnode *vp,
int error, nerror;
struct buf *bp, *nbp, *tbp;
u_int iolen;
-   int spl;
caddr_t udata;
long resid;
off_t offset;
@@ -330,10 +329,7 @@ ffs_rawread_main(struct vnode *vp,
}
}

-   spl = splbio();
bwait(bp, PRIBIO, "rawrd");
-   splx(spl);
-   
vunmapbuf(bp);

iolen = bp->b_bcount - bp->b_resid;
@@ -400,9 +396,7 @@ ffs_rawread_main(struct vnode *vp,
relpbuf(bp, );
}
if (nbp != NULL) {  /* Run down readahead buffer */
-   spl = splbio();
bwait(nbp, PRIBIO, "rawrd");
-   splx(spl);
vunmapbuf(nbp);
pbrelvp(nbp);
relpbuf(nbp, );
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r317907 - head/sys/netpfil/pf

2017-05-07 Thread Kristof Provost
Author: kp
Date: Sun May  7 14:33:58 2017
New Revision: 317907
URL: https://svnweb.freebsd.org/changeset/base/317907

Log:
  pf: Fix vnet initialisation
  
  When running the vnet init code (pf_load_vnet()) we used to iterate over
  all vnets, marking them as unhooked.
  This is incorrect and leads to panics if pf is unloaded, as the unload
  code does not unregister the pfil hooks (because the vnet is marked as
  unhooked).
  
  There's no need or reason to touch other vnets during initialisation.
  Their pf_load_vnet() function will be triggered, which handles all
  required initialisation.
  
  Reviewed by:  zec, gnn
  Differential Revision:https://reviews.freebsd.org/D10592

Modified:
  head/sys/netpfil/pf/pf_ioctl.c

Modified: head/sys/netpfil/pf/pf_ioctl.c
==
--- head/sys/netpfil/pf/pf_ioctl.c  Sun May  7 12:12:45 2017
(r317906)
+++ head/sys/netpfil/pf/pf_ioctl.c  Sun May  7 14:33:58 2017
(r317907)
@@ -3712,17 +3712,8 @@ dehook_pf(void)
 static void
 pf_load_vnet(void)
 {
-   VNET_ITERATOR_DECL(vnet_iter);
-
-   VNET_LIST_RLOCK();
-   VNET_FOREACH(vnet_iter) {
-   CURVNET_SET(vnet_iter);
-   V_pf_pfil_hooked = 0;
-   TAILQ_INIT(_pf_tags);
-   TAILQ_INIT(_pf_qids);
-   CURVNET_RESTORE();
-   }
-   VNET_LIST_RUNLOCK();
+   TAILQ_INIT(_pf_tags);
+   TAILQ_INIT(_pf_qids);
 
pfattach_vnet();
V_pf_vnet_active = 1;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r317906 - head/sys/rpc

2017-05-07 Thread Rick Macklem
Author: rmacklem
Date: Sun May  7 12:12:45 2017
New Revision: 317906
URL: https://svnweb.freebsd.org/changeset/base/317906

Log:
  Fix the client side krpc from doing TCP reconnects for ERESTART from sosend().
  
  When sosend() replies ERESTART in the client side krpc, it indicates that
  the RPC message hasn't yet been sent and that the send queue is full or
  locked while a signal is posted for the process.
  Without this patch, this would result in a RPC_CANTSEND reply from
  clnt_vc_call(), which would cause clnt_reconnect_call() to create a new
  TCP transport connection. For most NFS servers, this wasn't a serious problem,
  although it did imply retries of outstanding RPCs, which could possibly
  have missed the DRC.
  For an NFSv4.1 mount to AmazonEFS, this caused a serious problem, since
  AmazonEFS often didn't retain the NFSv4.1 session and would reply with
  NFS4ERR_BAD_SESSION. This implies to the client a crash/reboot which
  requires open/lock state recovery.
  
  Three options were considered to fix this:
  - Return the ERESTART all the way up to the system call boundary and then
have the system call redone. This is fraught with risk, due to convoluted
code paths, asynchronous I/O RPCs etc. cperciva@ worked on this, but it
is still a work in prgress and may not be feasible.
  - Set SB_NOINTR for the socket buffer. This fixes the problem, but makes
the sosend() completely non interruptible, which kib@ considered
inappropriate. It also would break forced dismount when a thread
was blocked in sosend().
  - Modify the retry loop in clnt_vc_call(), so that it loops for this case
for up to 15sec. Testing showed that the sosend() usually succeeded by
the 2nd retry. The extreme case observed was 111 loop iterations, or
about 100msec of delay.
  This third alternative is what is implemented in this patch, since the
  change is:
  - localized
  - straightforward
  - forced dismount is not broken by it.
  
  This patch has been tested by cperciva@ extensively against AmazonEFS.
  
  Reported by:  cperciva
  Tested by:cperciva
  MFC after:2 weeks

Modified:
  head/sys/rpc/clnt_vc.c

Modified: head/sys/rpc/clnt_vc.c
==
--- head/sys/rpc/clnt_vc.c  Sun May  7 12:08:41 2017(r317905)
+++ head/sys/rpc/clnt_vc.c  Sun May  7 12:12:45 2017(r317906)
@@ -57,6 +57,7 @@ __FBSDID("$FreeBSD$");
 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -107,6 +108,8 @@ static struct clnt_ops clnt_vc_ops = {
 
 static void clnt_vc_upcallsdone(struct ct_data *);
 
+static int fake_wchan;
+
 /*
  * Create a client handle for a connection.
  * Default options are set, which the user can change using clnt_control()'s.
@@ -298,7 +301,7 @@ clnt_vc_call(
uint32_t xid;
struct mbuf *mreq = NULL, *results;
struct ct_request *cr;
-   int error;
+   int error, trycnt;
 
cr = malloc(sizeof(struct ct_request), M_RPC, M_WAITOK);
 
@@ -328,8 +331,20 @@ clnt_vc_call(
timeout = ct->ct_wait;  /* use default timeout */
}
 
+   /*
+* After 15sec of looping, allow it to return RPC_CANTSEND, which will
+* cause the clnt_reconnect layer to create a new TCP connection.
+*/
+   trycnt = 15 * hz;
 call_again:
mtx_assert(>ct_lock, MA_OWNED);
+   if (ct->ct_closing || ct->ct_closed) {
+   ct->ct_threads--;
+   wakeup(ct);
+   mtx_unlock(>ct_lock);
+   free(cr, M_RPC);
+   return (RPC_CANTSEND);
+   }
 
ct->ct_xid++;
xid = ct->ct_xid;
@@ -397,13 +412,16 @@ call_again:
 */
error = sosend(ct->ct_socket, NULL, NULL, mreq, NULL, 0, curthread);
mreq = NULL;
-   if (error == EMSGSIZE) {
+   if (error == EMSGSIZE || (error == ERESTART &&
+   (ct->ct_waitflag & PCATCH) == 0 && trycnt-- > 0)) {
SOCKBUF_LOCK(>ct_socket->so_snd);
sbwait(>ct_socket->so_snd);
SOCKBUF_UNLOCK(>ct_socket->so_snd);
AUTH_VALIDATE(auth, xid, NULL, NULL);
mtx_lock(>ct_lock);
TAILQ_REMOVE(>ct_pending, cr, cr_link);
+   /* Sleep for 1 clock tick before trying the sosend() again. */
+   msleep(_wchan, >ct_lock, 0, "rpclpsnd", 1);
goto call_again;
}
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r317905 - head/usr.bin/resizewin

2017-05-07 Thread Edward Tomasz Napierala
Author: trasz
Date: Sun May  7 12:08:41 2017
New Revision: 317905
URL: https://svnweb.freebsd.org/changeset/base/317905

Log:
  Rename a variable, hopefully fixing build after r317901.
  
  MFC after:2 weeks
  Sponsored by: DARPA, AFRL

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

Modified: head/usr.bin/resizewin/resizewin.c
==
--- head/usr.bin/resizewin/resizewin.c  Sun May  7 11:44:25 2017
(r317904)
+++ head/usr.bin/resizewin/resizewin.c  Sun May  7 12:08:41 2017
(r317905)
@@ -52,11 +52,11 @@ main(__unused int argc, __unused char **
 {
struct termios old, new;
struct winsize w;
-   int ret, fd, cnt, err;
+   int ret, fd, cnt, error;
char data[20];
struct timeval then, now;
 
-   err = 0;
+   error = 0;
 
if ((fd = open("/dev/tty", O_RDWR | O_NONBLOCK)) == -1)
exit(1);
@@ -72,7 +72,7 @@ main(__unused int argc, __unused char **
exit(1);
 
if (write(fd, query, sizeof(query)) != sizeof(query)) {
-   err = 1;
+   error = 1;
goto out;
}
 
@@ -89,14 +89,14 @@ main(__unused int argc, __unused char **
timersub(, , );
if (now.tv_sec >= 2) {
warnx("timeout reading from terminal");
-   err = 1;
+   error = 1;
goto out;
}
 
usleep(2);
continue;
}
-   err = 1;
+   error = 1;
goto out;
}
if (data[cnt] == 'R')
@@ -105,25 +105,25 @@ main(__unused int argc, __unused char **
cnt++;
if (cnt == sizeof(data) - 2) {
warnx("response too long");
-   err = 1;
+   error = 1;
goto out;
}
}
 
/* Parse */
if (sscanf(data, "\033[%hu;%huR", _row, _col) != 2) {
-   err = 1;
+   error = 1;
warnx("unable to parse response");
goto out;
}
 
/* Finally, what we want */
if (ioctl(fd, TIOCSWINSZ, ) == -1)
-   err = 1;
+   error = 1;
  out:
/* Restore echo */
tcsetattr(fd, TCSANOW, );
 
close(fd);
-   exit(err);
+   exit(error);
 }
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r317904 - head/bin/stty

2017-05-07 Thread Edward Tomasz Napierala
Author: trasz
Date: Sun May  7 11:44:25 2017
New Revision: 317904
URL: https://svnweb.freebsd.org/changeset/base/317904

Log:
  .Xr resizewin from stty(1) man page.
  
  MFC after:2 weeks
  Sponsored by: DARPA, AFRL

Modified:
  head/bin/stty/stty.1

Modified: head/bin/stty/stty.1
==
--- head/bin/stty/stty.1Sun May  7 11:11:51 2017(r317903)
+++ head/bin/stty/stty.1Sun May  7 11:44:25 2017(r317904)
@@ -588,6 +588,7 @@ Same as the control character
 .Sh EXIT STATUS
 .Ex -std
 .Sh SEE ALSO
+.Xr resizewin 1 ,
 .Xr termios 4
 .Sh STANDARDS
 The
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r317903 - stable/10/sys/dev/drm2/radeon

2017-05-07 Thread Takahashi Yoshihiro
Author: nyan
Date: Sun May  7 11:11:51 2017
New Revision: 317903
URL: https://svnweb.freebsd.org/changeset/base/317903

Log:
  MFC: r317591
  
Add TUNABLE_INT to radeonkms driver parameters.
They are required by PowerMac G5 DP.
  
PR:   217852
Submitted by: Hiroo Ono

Modified:
  stable/10/sys/dev/drm2/radeon/radeon_drv.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/drm2/radeon/radeon_drv.c
==
--- stable/10/sys/dev/drm2/radeon/radeon_drv.c  Sun May  7 11:09:58 2017
(r317902)
+++ stable/10/sys/dev/drm2/radeon/radeon_drv.c  Sun May  7 11:11:51 2017
(r317903)
@@ -127,54 +127,71 @@ int radeon_pcie_gen2 = -1;
 int radeon_msi = -1;
 int radeon_lockup_timeout = 1;
 
+TUNABLE_INT("drm.radeon.no_wb", _no_wb);
 MODULE_PARM_DESC(no_wb, "Disable AGP writeback for scratch registers");
 module_param_named(no_wb, radeon_no_wb, int, 0444);
 
+TUNABLE_INT("drm.radeon.modeset", _modeset);
 MODULE_PARM_DESC(modeset, "Disable/Enable modesetting");
 module_param_named(modeset, radeon_modeset, int, 0400);
 
+TUNABLE_INT("drm.radeon.dynclks", _dynclks);
 MODULE_PARM_DESC(dynclks, "Disable/Enable dynamic clocks");
 module_param_named(dynclks, radeon_dynclks, int, 0444);
 
+TUNABLE_INT("drm.radeon.r4xx_atom", _r4xx_atom);
 MODULE_PARM_DESC(r4xx_atom, "Enable ATOMBIOS modesetting for R4xx");
 module_param_named(r4xx_atom, radeon_r4xx_atom, int, 0444);
 
+TUNABLE_INT("drm.radeon.vramlimit", _vram_limit);
 MODULE_PARM_DESC(vramlimit, "Restrict VRAM for testing");
 module_param_named(vramlimit, radeon_vram_limit, int, 0600);
 
+TUNABLE_INT("drm.radeon.agpmode", _agpmode);
 MODULE_PARM_DESC(agpmode, "AGP Mode (-1 == PCI)");
 module_param_named(agpmode, radeon_agpmode, int, 0444);
 
+TUNABLE_INT("drm.radeon.gartsize", _gart_size);
 MODULE_PARM_DESC(gartsize, "Size of PCIE/IGP gart to setup in megabytes (32, 
64, etc)");
 module_param_named(gartsize, radeon_gart_size, int, 0600);
 
+TUNABLE_INT("drm.radeon.benchmark", _benchmarking);
 MODULE_PARM_DESC(benchmark, "Run benchmark");
 module_param_named(benchmark, radeon_benchmarking, int, 0444);
 
+TUNABLE_INT("drm.radeon.test", _testing);
 MODULE_PARM_DESC(test, "Run tests");
 module_param_named(test, radeon_testing, int, 0444);
 
+TUNABLE_INT("drm.radeon.connector_table", _connector_table);
 MODULE_PARM_DESC(connector_table, "Force connector table");
 module_param_named(connector_table, radeon_connector_table, int, 0444);
 
+TUNABLE_INT("drm.radeon.tv", _tv);
 MODULE_PARM_DESC(tv, "TV enable (0 = disable)");
 module_param_named(tv, radeon_tv, int, 0444);
 
+TUNABLE_INT("drm.radeon.audio", _audio);
 MODULE_PARM_DESC(audio, "Audio enable (1 = enable)");
 module_param_named(audio, radeon_audio, int, 0444);
 
+TUNABLE_INT("drm.radeon.disp_priority", _disp_priority);
 MODULE_PARM_DESC(disp_priority, "Display Priority (0 = auto, 1 = normal, 2 = 
high)");
 module_param_named(disp_priority, radeon_disp_priority, int, 0444);
 
+TUNABLE_INT("drm.radeon.hw_i2c", _hw_i2c);
 MODULE_PARM_DESC(hw_i2c, "hw i2c engine enable (0 = disable)");
 module_param_named(hw_i2c, radeon_hw_i2c, int, 0444);
 
+TUNABLE_INT("drm.radeon.pcie_gen2", _pcie_gen2);
 MODULE_PARM_DESC(pcie_gen2, "PCIE Gen2 mode (-1 = auto, 0 = disable, 1 = 
enable)");
 module_param_named(pcie_gen2, radeon_pcie_gen2, int, 0444);
 
+TUNABLE_INT("drm.radeon.msi", _msi);
 MODULE_PARM_DESC(msi, "MSI support (1 = enable, 0 = disable, -1 = auto)");
 module_param_named(msi, radeon_msi, int, 0444);
 
+TUNABLE_INT("drm.radeon.lockup_timeout", _lockup_timeout);
 MODULE_PARM_DESC(lockup_timeout, "GPU lockup timeout in ms (defaul 1 = 10 
seconds, 0 = disable)");
 module_param_named(lockup_timeout, radeon_lockup_timeout, int, 0444);
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r317902 - stable/11/sys/dev/drm2/radeon

2017-05-07 Thread Takahashi Yoshihiro
Author: nyan
Date: Sun May  7 11:09:58 2017
New Revision: 317902
URL: https://svnweb.freebsd.org/changeset/base/317902

Log:
  MFC: r317591
  
Add TUNABLE_INT to radeonkms driver parameters.
They are required by PowerMac G5 DP.
  
PR:   217852
Submitted by: Hiroo Ono

Modified:
  stable/11/sys/dev/drm2/radeon/radeon_drv.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/dev/drm2/radeon/radeon_drv.c
==
--- stable/11/sys/dev/drm2/radeon/radeon_drv.c  Sun May  7 09:19:42 2017
(r317901)
+++ stable/11/sys/dev/drm2/radeon/radeon_drv.c  Sun May  7 11:09:58 2017
(r317902)
@@ -127,54 +127,71 @@ int radeon_pcie_gen2 = -1;
 int radeon_msi = -1;
 int radeon_lockup_timeout = 1;
 
+TUNABLE_INT("drm.radeon.no_wb", _no_wb);
 MODULE_PARM_DESC(no_wb, "Disable AGP writeback for scratch registers");
 module_param_named(no_wb, radeon_no_wb, int, 0444);
 
+TUNABLE_INT("drm.radeon.modeset", _modeset);
 MODULE_PARM_DESC(modeset, "Disable/Enable modesetting");
 module_param_named(modeset, radeon_modeset, int, 0400);
 
+TUNABLE_INT("drm.radeon.dynclks", _dynclks);
 MODULE_PARM_DESC(dynclks, "Disable/Enable dynamic clocks");
 module_param_named(dynclks, radeon_dynclks, int, 0444);
 
+TUNABLE_INT("drm.radeon.r4xx_atom", _r4xx_atom);
 MODULE_PARM_DESC(r4xx_atom, "Enable ATOMBIOS modesetting for R4xx");
 module_param_named(r4xx_atom, radeon_r4xx_atom, int, 0444);
 
+TUNABLE_INT("drm.radeon.vramlimit", _vram_limit);
 MODULE_PARM_DESC(vramlimit, "Restrict VRAM for testing");
 module_param_named(vramlimit, radeon_vram_limit, int, 0600);
 
+TUNABLE_INT("drm.radeon.agpmode", _agpmode);
 MODULE_PARM_DESC(agpmode, "AGP Mode (-1 == PCI)");
 module_param_named(agpmode, radeon_agpmode, int, 0444);
 
+TUNABLE_INT("drm.radeon.gartsize", _gart_size);
 MODULE_PARM_DESC(gartsize, "Size of PCIE/IGP gart to setup in megabytes (32, 
64, etc)");
 module_param_named(gartsize, radeon_gart_size, int, 0600);
 
+TUNABLE_INT("drm.radeon.benchmark", _benchmarking);
 MODULE_PARM_DESC(benchmark, "Run benchmark");
 module_param_named(benchmark, radeon_benchmarking, int, 0444);
 
+TUNABLE_INT("drm.radeon.test", _testing);
 MODULE_PARM_DESC(test, "Run tests");
 module_param_named(test, radeon_testing, int, 0444);
 
+TUNABLE_INT("drm.radeon.connector_table", _connector_table);
 MODULE_PARM_DESC(connector_table, "Force connector table");
 module_param_named(connector_table, radeon_connector_table, int, 0444);
 
+TUNABLE_INT("drm.radeon.tv", _tv);
 MODULE_PARM_DESC(tv, "TV enable (0 = disable)");
 module_param_named(tv, radeon_tv, int, 0444);
 
+TUNABLE_INT("drm.radeon.audio", _audio);
 MODULE_PARM_DESC(audio, "Audio enable (1 = enable)");
 module_param_named(audio, radeon_audio, int, 0444);
 
+TUNABLE_INT("drm.radeon.disp_priority", _disp_priority);
 MODULE_PARM_DESC(disp_priority, "Display Priority (0 = auto, 1 = normal, 2 = 
high)");
 module_param_named(disp_priority, radeon_disp_priority, int, 0444);
 
+TUNABLE_INT("drm.radeon.hw_i2c", _hw_i2c);
 MODULE_PARM_DESC(hw_i2c, "hw i2c engine enable (0 = disable)");
 module_param_named(hw_i2c, radeon_hw_i2c, int, 0444);
 
+TUNABLE_INT("drm.radeon.pcie_gen2", _pcie_gen2);
 MODULE_PARM_DESC(pcie_gen2, "PCIE Gen2 mode (-1 = auto, 0 = disable, 1 = 
enable)");
 module_param_named(pcie_gen2, radeon_pcie_gen2, int, 0444);
 
+TUNABLE_INT("drm.radeon.msi", _msi);
 MODULE_PARM_DESC(msi, "MSI support (1 = enable, 0 = disable, -1 = auto)");
 module_param_named(msi, radeon_msi, int, 0444);
 
+TUNABLE_INT("drm.radeon.lockup_timeout", _lockup_timeout);
 MODULE_PARM_DESC(lockup_timeout, "GPU lockup timeout in ms (defaul 1 = 10 
seconds, 0 = disable)");
 module_param_named(lockup_timeout, radeon_lockup_timeout, int, 0444);
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r317901 - head/usr.bin/resizewin

2017-05-07 Thread Edward Tomasz Napierala
Author: trasz
Date: Sun May  7 09:19:42 2017
New Revision: 317901
URL: https://svnweb.freebsd.org/changeset/base/317901

Log:
  Improve error reporting in resizewin(1).
  
  Reviewed by:  cem (earlier version)
  MFC after:2 weeks
  Sponsored by: DARPA, AFRL
  Differential Revision:https://reviews.freebsd.org/D10624

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

Modified: head/usr.bin/resizewin/resizewin.c
==
--- head/usr.bin/resizewin/resizewin.c  Sun May  7 08:02:28 2017
(r317900)
+++ head/usr.bin/resizewin/resizewin.c  Sun May  7 09:19:42 2017
(r317901)
@@ -31,6 +31,7 @@
 __FBSDID("$FreeBSD$");
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -87,8 +88,7 @@ main(__unused int argc, __unused char **
gettimeofday(, NULL);
timersub(, , );
if (now.tv_sec >= 2) {
-   fprintf(stderr, "\n\n\nTimeout reading 
from terminal\n");
-   fprintf(stderr, "Read %d bytes, %s\n", 
cnt, data);
+   warnx("timeout reading from terminal");
err = 1;
goto out;
}
@@ -104,7 +104,7 @@ main(__unused int argc, __unused char **
 
cnt++;
if (cnt == sizeof(data) - 2) {
-   fprintf(stderr, "Response too long\n");
+   warnx("response too long");
err = 1;
goto out;
}
@@ -113,7 +113,7 @@ main(__unused int argc, __unused char **
/* Parse */
if (sscanf(data, "\033[%hu;%huR", _row, _col) != 2) {
err = 1;
-   fprintf(stderr, "Unable to parse response\n");
+   warnx("unable to parse response");
goto out;
}
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r317900 - stable/10/lib/libc/gen

2017-05-07 Thread Konstantin Belousov
Author: kib
Date: Sun May  7 08:02:28 2017
New Revision: 317900
URL: https://svnweb.freebsd.org/changeset/base/317900

Log:
  MFC r317611:
  Make semaphore names list mutex non-recursive.

Modified:
  stable/10/lib/libc/gen/sem_new.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/lib/libc/gen/sem_new.c
==
--- stable/10/lib/libc/gen/sem_new.cSun May  7 08:01:29 2017
(r317899)
+++ stable/10/lib/libc/gen/sem_new.cSun May  7 08:02:28 2017
(r317900)
@@ -101,12 +101,8 @@ sem_child_postfork(void)
 static void
 sem_module_init(void)
 {
-   pthread_mutexattr_t ma;
 
-   _pthread_mutexattr_init();
-   _pthread_mutexattr_settype(,  PTHREAD_MUTEX_RECURSIVE);
-   _pthread_mutex_init(_llock, );
-   _pthread_mutexattr_destroy();
+   _pthread_mutex_init(_llock, NULL);
_pthread_atfork(sem_prefork, sem_postfork, sem_child_postfork);
 }
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r317899 - stable/10/lib/libc/gen

2017-05-07 Thread Konstantin Belousov
Author: kib
Date: Sun May  7 08:01:29 2017
New Revision: 317899
URL: https://svnweb.freebsd.org/changeset/base/317899

Log:
  MFC r317610:
  Restructure normal (non-error) control flow in sem_close().

Modified:
  stable/10/lib/libc/gen/sem_new.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/lib/libc/gen/sem_new.c
==
--- stable/10/lib/libc/gen/sem_new.cSun May  7 08:00:34 2017
(r317898)
+++ stable/10/lib/libc/gen/sem_new.cSun May  7 08:01:29 2017
(r317899)
@@ -41,6 +41,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -259,6 +260,7 @@ int
 _sem_close(sem_t *sem)
 {
struct sem_nameinfo *ni;
+   bool last;
 
if (sem_check_validity(sem) != 0)
return (-1);
@@ -273,21 +275,17 @@ _sem_close(sem_t *sem)
_pthread_mutex_lock(_llock);
LIST_FOREACH(ni, _list, next) {
if (sem == ni->sem) {
-   if (--ni->open_count > 0) {
-   _pthread_mutex_unlock(_llock);
-   return (0);
+   last = --ni->open_count == 0;
+   if (last)
+   LIST_REMOVE(ni, next);
+   _pthread_mutex_unlock(_llock);
+   if (last) {
+   munmap(sem, sizeof(*sem));
+   free(ni);
}
-   break;
+   return (0);
}
}
-
-   if (ni != NULL) {
-   LIST_REMOVE(ni, next);
-   _pthread_mutex_unlock(_llock);
-   munmap(sem, sizeof(*sem));
-   free(ni);
-   return (0);
-   }
_pthread_mutex_unlock(_llock);
errno = EINVAL;
return (-1);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r317898 - stable/10/lib/libc/gen

2017-05-07 Thread Konstantin Belousov
Author: kib
Date: Sun May  7 08:00:34 2017
New Revision: 317898
URL: https://svnweb.freebsd.org/changeset/base/317898

Log:
  MFC r317606:
  Style.

Modified:
  stable/10/lib/libc/gen/sem_new.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/lib/libc/gen/sem_new.c
==
--- stable/10/lib/libc/gen/sem_new.cSun May  7 07:55:58 2017
(r317897)
+++ stable/10/lib/libc/gen/sem_new.cSun May  7 08:00:34 2017
(r317898)
@@ -74,24 +74,26 @@ struct sem_nameinfo {
 
 static pthread_once_t once = PTHREAD_ONCE_INIT;
 static pthread_mutex_t sem_llock;
-static LIST_HEAD(,sem_nameinfo) sem_list = LIST_HEAD_INITIALIZER(sem_list);
+static LIST_HEAD(, sem_nameinfo) sem_list = LIST_HEAD_INITIALIZER(sem_list);
 
 static void
-sem_prefork()
+sem_prefork(void)
 {

_pthread_mutex_lock(_llock);
 }
 
 static void
-sem_postfork()
+sem_postfork(void)
 {
+
_pthread_mutex_unlock(_llock);
 }
 
 static void
-sem_child_postfork()
+sem_child_postfork(void)
 {
+
_pthread_mutex_unlock(_llock);
 }
 
@@ -113,10 +115,8 @@ sem_check_validity(sem_t *sem)
 
if (sem->_magic == SEM_MAGIC)
return (0);
-   else {
-   errno = EINVAL;
-   return (-1);
-   }
+   errno = EINVAL;
+   return (-1);
 }
 
 int
@@ -140,13 +140,16 @@ sem_t *
 _sem_open(const char *name, int flags, ...)
 {
char path[PATH_MAX];
-
struct stat sb;
va_list ap;
-   struct sem_nameinfo *ni = NULL;
-   sem_t *sem = NULL;
-   int fd = -1, mode, len, errsave;
-   int value = 0;
+   struct sem_nameinfo *ni;
+   sem_t *sem, tmp;
+   int errsave, fd, len, mode, value;
+
+   ni = NULL;
+   sem = NULL;
+   fd = -1;
+   value = 0;
 
if (name[0] != '/') {
errno = EINVAL;
@@ -211,8 +214,6 @@ _sem_open(const char *name, int flags, .
goto error;
}
if (sb.st_size < sizeof(sem_t)) {
-   sem_t tmp;
-
tmp._magic = SEM_MAGIC;
tmp._kern._has_waiters = 0;
tmp._kern._count = value;
@@ -221,8 +222,8 @@ _sem_open(const char *name, int flags, .
goto error;
}
flock(fd, LOCK_UN);
-   sem = (sem_t *)mmap(NULL, sizeof(sem_t), PROT_READ|PROT_WRITE,
-   MAP_SHARED|MAP_NOSYNC, fd, 0);
+   sem = mmap(NULL, sizeof(sem_t), PROT_READ | PROT_WRITE,
+   MAP_SHARED | MAP_NOSYNC, fd, 0);
if (sem == MAP_FAILED) {
sem = NULL;
if (errno == ENOMEM)
@@ -276,12 +277,11 @@ _sem_close(sem_t *sem)
_pthread_mutex_unlock(_llock);
return (0);
}
-   else
-   break;
+   break;
}
}
 
-   if (ni) {
+   if (ni != NULL) {
LIST_REMOVE(ni, next);
_pthread_mutex_unlock(_llock);
munmap(sem, sizeof(*sem));
@@ -341,7 +341,8 @@ _sem_getvalue(sem_t * __restrict sem, in
 static __inline int
 usem_wake(struct _usem *sem)
 {
-   return _umtx_op(sem, UMTX_OP_SEM_WAKE, 0, NULL, NULL);
+
+   return (_umtx_op(sem, UMTX_OP_SEM_WAKE, 0, NULL, NULL));
 }
 
 static __inline int
@@ -422,7 +423,8 @@ _sem_timedwait(sem_t * __restrict sem,
 int
 _sem_wait(sem_t *sem)
 {
-   return _sem_timedwait(sem, NULL);
+
+   return (_sem_timedwait(sem, NULL));
 }
 
 /*
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r317897 - stable/11/lib/libc/gen

2017-05-07 Thread Konstantin Belousov
Author: kib
Date: Sun May  7 07:55:58 2017
New Revision: 317897
URL: https://svnweb.freebsd.org/changeset/base/317897

Log:
  MFC r317611:
  Make semaphore names list mutex non-recursive.

Modified:
  stable/11/lib/libc/gen/sem_new.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/lib/libc/gen/sem_new.c
==
--- stable/11/lib/libc/gen/sem_new.cSun May  7 07:54:21 2017
(r317896)
+++ stable/11/lib/libc/gen/sem_new.cSun May  7 07:55:58 2017
(r317897)
@@ -104,12 +104,8 @@ sem_child_postfork(void)
 static void
 sem_module_init(void)
 {
-   pthread_mutexattr_t ma;
 
-   _pthread_mutexattr_init();
-   _pthread_mutexattr_settype(,  PTHREAD_MUTEX_RECURSIVE);
-   _pthread_mutex_init(_llock, );
-   _pthread_mutexattr_destroy();
+   _pthread_mutex_init(_llock, NULL);
_pthread_atfork(sem_prefork, sem_postfork, sem_child_postfork);
 }
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r317896 - stable/11/lib/libc/gen

2017-05-07 Thread Konstantin Belousov
Author: kib
Date: Sun May  7 07:54:21 2017
New Revision: 317896
URL: https://svnweb.freebsd.org/changeset/base/317896

Log:
  MFC r317610:
  Restructure normal (non-error) control flow in sem_close().

Modified:
  stable/11/lib/libc/gen/sem_new.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/lib/libc/gen/sem_new.c
==
--- stable/11/lib/libc/gen/sem_new.cSun May  7 07:51:36 2017
(r317895)
+++ stable/11/lib/libc/gen/sem_new.cSun May  7 07:54:21 2017
(r317896)
@@ -41,6 +41,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -260,6 +261,7 @@ int
 _sem_close(sem_t *sem)
 {
struct sem_nameinfo *ni;
+   bool last;
 
if (sem_check_validity(sem) != 0)
return (-1);
@@ -274,21 +276,17 @@ _sem_close(sem_t *sem)
_pthread_mutex_lock(_llock);
LIST_FOREACH(ni, _list, next) {
if (sem == ni->sem) {
-   if (--ni->open_count > 0) {
-   _pthread_mutex_unlock(_llock);
-   return (0);
+   last = --ni->open_count == 0;
+   if (last)
+   LIST_REMOVE(ni, next);
+   _pthread_mutex_unlock(_llock);
+   if (last) {
+   munmap(sem, sizeof(*sem));
+   free(ni);
}
-   break;
+   return (0);
}
}
-
-   if (ni != NULL) {
-   LIST_REMOVE(ni, next);
-   _pthread_mutex_unlock(_llock);
-   munmap(sem, sizeof(*sem));
-   free(ni);
-   return (0);
-   }
_pthread_mutex_unlock(_llock);
errno = EINVAL;
return (-1);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r317895 - stable/11/lib/libc/gen

2017-05-07 Thread Konstantin Belousov
Author: kib
Date: Sun May  7 07:51:36 2017
New Revision: 317895
URL: https://svnweb.freebsd.org/changeset/base/317895

Log:
  MFC r317606:
  Style.

Modified:
  stable/11/lib/libc/gen/sem_new.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/lib/libc/gen/sem_new.c
==
--- stable/11/lib/libc/gen/sem_new.cSun May  7 01:31:42 2017
(r317894)
+++ stable/11/lib/libc/gen/sem_new.cSun May  7 07:51:36 2017
(r317895)
@@ -77,24 +77,26 @@ struct sem_nameinfo {
 
 static pthread_once_t once = PTHREAD_ONCE_INIT;
 static pthread_mutex_t sem_llock;
-static LIST_HEAD(,sem_nameinfo) sem_list = LIST_HEAD_INITIALIZER(sem_list);
+static LIST_HEAD(, sem_nameinfo) sem_list = LIST_HEAD_INITIALIZER(sem_list);
 
 static void
-sem_prefork()
+sem_prefork(void)
 {

_pthread_mutex_lock(_llock);
 }
 
 static void
-sem_postfork()
+sem_postfork(void)
 {
+
_pthread_mutex_unlock(_llock);
 }
 
 static void
-sem_child_postfork()
+sem_child_postfork(void)
 {
+
_pthread_mutex_unlock(_llock);
 }
 
@@ -116,10 +118,8 @@ sem_check_validity(sem_t *sem)
 
if (sem->_magic == SEM_MAGIC)
return (0);
-   else {
-   errno = EINVAL;
-   return (-1);
-   }
+   errno = EINVAL;
+   return (-1);
 }
 
 int
@@ -142,13 +142,16 @@ sem_t *
 _sem_open(const char *name, int flags, ...)
 {
char path[PATH_MAX];
-
struct stat sb;
va_list ap;
-   struct sem_nameinfo *ni = NULL;
-   sem_t *sem = NULL;
-   int fd = -1, mode, len, errsave;
-   int value = 0;
+   struct sem_nameinfo *ni;
+   sem_t *sem, tmp;
+   int errsave, fd, len, mode, value;
+
+   ni = NULL;
+   sem = NULL;
+   fd = -1;
+   value = 0;
 
if (name[0] != '/') {
errno = EINVAL;
@@ -213,8 +216,6 @@ _sem_open(const char *name, int flags, .
goto error;
}
if (sb.st_size < sizeof(sem_t)) {
-   sem_t tmp;
-
tmp._magic = SEM_MAGIC;
tmp._kern._count = value;
tmp._kern._flags = USYNC_PROCESS_SHARED | SEM_NAMED;
@@ -222,8 +223,8 @@ _sem_open(const char *name, int flags, .
goto error;
}
flock(fd, LOCK_UN);
-   sem = (sem_t *)mmap(NULL, sizeof(sem_t), PROT_READ|PROT_WRITE,
-   MAP_SHARED|MAP_NOSYNC, fd, 0);
+   sem = mmap(NULL, sizeof(sem_t), PROT_READ | PROT_WRITE,
+   MAP_SHARED | MAP_NOSYNC, fd, 0);
if (sem == MAP_FAILED) {
sem = NULL;
if (errno == ENOMEM)
@@ -277,12 +278,11 @@ _sem_close(sem_t *sem)
_pthread_mutex_unlock(_llock);
return (0);
}
-   else
-   break;
+   break;
}
}
 
-   if (ni) {
+   if (ni != NULL) {
LIST_REMOVE(ni, next);
_pthread_mutex_unlock(_llock);
munmap(sem, sizeof(*sem));
@@ -342,7 +342,8 @@ _sem_getvalue(sem_t * __restrict sem, in
 static __inline int
 usem_wake(struct _usem2 *sem)
 {
-   return _umtx_op(sem, UMTX_OP_SEM2_WAKE, 0, NULL, NULL);
+
+   return (_umtx_op(sem, UMTX_OP_SEM2_WAKE, 0, NULL, NULL));
 }
 
 static __inline int
@@ -436,6 +437,7 @@ int
 _sem_timedwait(sem_t * __restrict sem,
const struct timespec * __restrict abstime)
 {
+
return (_sem_clockwait_np(sem, CLOCK_REALTIME, TIMER_ABSTIME, abstime,
NULL));
 };
@@ -443,7 +445,8 @@ _sem_timedwait(sem_t * __restrict sem,
 int
 _sem_wait(sem_t *sem)
 {
-   return _sem_timedwait(sem, NULL);
+
+   return (_sem_timedwait(sem, NULL));
 }
 
 /*
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"