svn commit: r270193 - in vendor-sys/illumos/dist/uts/common: dtrace fs os sys

2014-08-20 Thread Xin LI
Author: delphij
Date: Wed Aug 20 06:15:53 2014
New Revision: 270193
URL: http://svnweb.freebsd.org/changeset/base/270193

Log:
  5042 stop using deprecated atomic functions
  Reviewed by: Dan McDonald dan...@omniti.com
  Approved by: Robert Mustacchi r...@joyent.com
  Author:   Josef 'Jeff' Sipek josef.si...@nexenta.com
  
  illumos/illumos-gate@75d94465dbafa487b716482dc36d5150a4ec9853

Modified:
  vendor-sys/illumos/dist/uts/common/dtrace/systrace.c
  vendor-sys/illumos/dist/uts/common/fs/vnode.c
  vendor-sys/illumos/dist/uts/common/os/fm.c
  vendor-sys/illumos/dist/uts/common/sys/bitmap.h
  vendor-sys/illumos/dist/uts/common/sys/cpuvar.h

Modified: vendor-sys/illumos/dist/uts/common/dtrace/systrace.c
==
--- vendor-sys/illumos/dist/uts/common/dtrace/systrace.cWed Aug 20 
01:32:04 2014(r270192)
+++ vendor-sys/illumos/dist/uts/common/dtrace/systrace.cWed Aug 20 
06:15:53 2014(r270193)
@@ -164,11 +164,11 @@ systrace_enable(void *arg, dtrace_id_t i
return (0);
}
 
-   (void) casptr(sysent[sysnum].sy_callc,
+   (void) atomic_cas_ptr(sysent[sysnum].sy_callc,
(void *)systrace_sysent[sysnum].stsy_underlying,
(void *)dtrace_systrace_syscall);
 #ifdef _SYSCALL32_IMPL
-   (void) casptr(sysent32[sysnum].sy_callc,
+   (void) atomic_cas_ptr(sysent32[sysnum].sy_callc,
(void *)systrace_sysent32[sysnum].stsy_underlying,
(void *)dtrace_systrace_syscall32);
 #endif
@@ -184,12 +184,12 @@ systrace_disable(void *arg, dtrace_id_t 
systrace_sysent[sysnum].stsy_return == DTRACE_IDNONE);
 
if (disable) {
-   (void) casptr(sysent[sysnum].sy_callc,
+   (void) atomic_cas_ptr(sysent[sysnum].sy_callc,
(void *)dtrace_systrace_syscall,
(void *)systrace_sysent[sysnum].stsy_underlying);
 
 #ifdef _SYSCALL32_IMPL
-   (void) casptr(sysent32[sysnum].sy_callc,
+   (void) atomic_cas_ptr(sysent32[sysnum].sy_callc,
(void *)dtrace_systrace_syscall32,
(void *)systrace_sysent32[sysnum].stsy_underlying);
 #endif

Modified: vendor-sys/illumos/dist/uts/common/fs/vnode.c
==
--- vendor-sys/illumos/dist/uts/common/fs/vnode.c   Wed Aug 20 01:32:04 
2014(r270192)
+++ vendor-sys/illumos/dist/uts/common/fs/vnode.c   Wed Aug 20 06:15:53 
2014(r270193)
@@ -2837,11 +2837,12 @@ vn_setops(vnode_t *vp, vnodeops_t *vnode
op = vp-v_op;
membar_consumer();
/*
-* If vp-v_femhead == NULL, then we'll call casptr() to do the
-* compare-and-swap on vp-v_op.  If either fails, then FEM is
+* If vp-v_femhead == NULL, then we'll call atomic_cas_ptr() to do
+* the compare-and-swap on vp-v_op.  If either fails, then FEM is
 * in effect on the vnode and we need to have FEM deal with it.
 */
-   if (vp-v_femhead != NULL || casptr(vp-v_op, op, vnodeops) != op) {
+   if (vp-v_femhead != NULL || atomic_cas_ptr(vp-v_op, op, vnodeops) !=
+   op) {
fem_setvnops(vp, vnodeops);
}
 }

Modified: vendor-sys/illumos/dist/uts/common/os/fm.c
==
--- vendor-sys/illumos/dist/uts/common/os/fm.c  Wed Aug 20 01:32:04 2014
(r270192)
+++ vendor-sys/illumos/dist/uts/common/os/fm.c  Wed Aug 20 06:15:53 2014
(r270193)
@@ -374,7 +374,7 @@ fm_panic(const char *format, ...)
 {
va_list ap;
 
-   (void) casptr((void *)fm_panicstr, NULL, (void *)format);
+   (void) atomic_cas_ptr((void *)fm_panicstr, NULL, (void *)format);
 #if defined(__i386) || defined(__amd64)
fastreboot_disable_highpil();
 #endif /* __i386 || __amd64 */

Modified: vendor-sys/illumos/dist/uts/common/sys/bitmap.h
==
--- vendor-sys/illumos/dist/uts/common/sys/bitmap.h Wed Aug 20 01:32:04 
2014(r270192)
+++ vendor-sys/illumos/dist/uts/common/sys/bitmap.h Wed Aug 20 06:15:53 
2014(r270193)
@@ -171,9 +171,9 @@ extern int  odd_parity(ulong_t);
  * to 0 otherwise.
  */
 #defineBT_ATOMIC_SET(bitmap, bitindex) \
-   { atomic_or_long((BT_WIM(bitmap, bitindex)), BT_BIW(bitindex)); }
+   { atomic_or_ulong((BT_WIM(bitmap, bitindex)), BT_BIW(bitindex)); }
 #defineBT_ATOMIC_CLEAR(bitmap, bitindex) \
-   { atomic_and_long((BT_WIM(bitmap, bitindex)), ~BT_BIW(bitindex)); }
+   { atomic_and_ulong((BT_WIM(bitmap, bitindex)), ~BT_BIW(bitindex)); }
 
 #defineBT_ATOMIC_SET_EXCL(bitmap, bitindex, result) \
{ result = atomic_set_long_excl((BT_WIM(bitmap, bitindex)),\

Modified: vendor-sys/illumos/dist/uts/common/sys/cpuvar.h

svn commit: r270194 - in vendor-sys/illumos/dist/common/atomic: amd64 i386 sparc

2014-08-20 Thread Xin LI
Author: delphij
Date: Wed Aug 20 06:20:06 2014
New Revision: 270194
URL: http://svnweb.freebsd.org/changeset/base/270194

Log:
  5043 remove deprecated atomic functions' prototypes
  Reviewed by: Garrett D'Amore garr...@damore.org
  Approved by: Robert Mustacchi r...@joyent.com
  Author: Josef 'Jeff' Sipek josef.si...@nexenta.com
  
  illumos/illumos-gate@6ed9368a130d7c9a82e574da808d34034da33748

Modified:
  vendor-sys/illumos/dist/common/atomic/amd64/atomic.s
  vendor-sys/illumos/dist/common/atomic/i386/atomic.s
  vendor-sys/illumos/dist/common/atomic/sparc/atomic.s

Modified: vendor-sys/illumos/dist/common/atomic/amd64/atomic.s
==
--- vendor-sys/illumos/dist/common/atomic/amd64/atomic.sWed Aug 20 
06:15:53 2014(r270193)
+++ vendor-sys/illumos/dist/common/atomic/amd64/atomic.sWed Aug 20 
06:20:06 2014(r270194)
@@ -29,7 +29,8 @@
 
 #if defined(_KERNEL)
/*
-* Legacy kernel interfaces; they will go away (eventually).
+* Legacy kernel interfaces; they will go away the moment our closed
+* bins no longer require them.
 */
ANSI_PRAGMA_WEAK2(cas8,atomic_cas_8,function)
ANSI_PRAGMA_WEAK2(cas32,atomic_cas_32,function)

Modified: vendor-sys/illumos/dist/common/atomic/i386/atomic.s
==
--- vendor-sys/illumos/dist/common/atomic/i386/atomic.s Wed Aug 20 06:15:53 
2014(r270193)
+++ vendor-sys/illumos/dist/common/atomic/i386/atomic.s Wed Aug 20 06:20:06 
2014(r270194)
@@ -30,7 +30,8 @@
 
 #if defined(_KERNEL)
/*
-* Legacy kernel interfaces; they will go away (eventually).
+* Legacy kernel interfaces; they will go away the moment our closed
+* bins no longer require them.
 */
ANSI_PRAGMA_WEAK2(cas8,atomic_cas_8,function)
ANSI_PRAGMA_WEAK2(cas32,atomic_cas_32,function)

Modified: vendor-sys/illumos/dist/common/atomic/sparc/atomic.s
==
--- vendor-sys/illumos/dist/common/atomic/sparc/atomic.sWed Aug 20 
06:15:53 2014(r270193)
+++ vendor-sys/illumos/dist/common/atomic/sparc/atomic.sWed Aug 20 
06:20:06 2014(r270194)
@@ -30,7 +30,8 @@
 
 #if defined(_KERNEL)
/*
-* Legacy kernel interfaces; they will go away (eventually).
+* Legacy kernel interfaces; they will go away the moment our closed
+* bins no longer require them.
 */
ANSI_PRAGMA_WEAK2(cas8,atomic_cas_8,function)
ANSI_PRAGMA_WEAK2(cas32,atomic_cas_32,function)
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r270195 - in vendor-sys/illumos/dist/uts: common/dtrace common/fs common/fs/zfs common/fs/zfs/sys common/os sparc/dtrace

2014-08-20 Thread Xin LI
Author: delphij
Date: Wed Aug 20 06:22:59 2014
New Revision: 270195
URL: http://svnweb.freebsd.org/changeset/base/270195

Log:
  5045 use atomic_{inc,dec}_* instead of atomic_add_*
  Reviewed by: Matthew Ahrens mahr...@delphix.com
  Reviewed by: Garrett D'Amore garr...@damore.org
  Approved by: Robert Mustacchi r...@joyent.com
  Author: Josef 'Jeff' Sipek josef.si...@nexenta.com
  
  illumos/illumos-gate@1a5e258f5471356ca102c7176637cdce45bac147

Modified:
  vendor-sys/illumos/dist/uts/common/dtrace/fasttrap.c
  vendor-sys/illumos/dist/uts/common/dtrace/profile.c
  vendor-sys/illumos/dist/uts/common/fs/vnode.c
  vendor-sys/illumos/dist/uts/common/fs/zfs/dbuf.c
  vendor-sys/illumos/dist/uts/common/fs/zfs/spa.c
  vendor-sys/illumos/dist/uts/common/fs/zfs/sys/refcount.h
  vendor-sys/illumos/dist/uts/common/fs/zfs/vdev_cache.c
  vendor-sys/illumos/dist/uts/common/fs/zfs/vdev_label.c
  vendor-sys/illumos/dist/uts/common/fs/zfs/zfs_vfsops.c
  vendor-sys/illumos/dist/uts/common/fs/zfs/zio_inject.c
  vendor-sys/illumos/dist/uts/common/os/fm.c
  vendor-sys/illumos/dist/uts/sparc/dtrace/fasttrap_isa.c

Modified: vendor-sys/illumos/dist/uts/common/dtrace/fasttrap.c
==
--- vendor-sys/illumos/dist/uts/common/dtrace/fasttrap.cWed Aug 20 
06:20:06 2014(r270194)
+++ vendor-sys/illumos/dist/uts/common/dtrace/fasttrap.cWed Aug 20 
06:22:59 2014(r270195)
@@ -1182,7 +1182,7 @@ fasttrap_proc_lookup(pid_t pid)
mutex_enter(fprc-ftpc_mtx);
mutex_exit(bucket-ftb_mtx);
fprc-ftpc_rcount++;
-   atomic_add_64(fprc-ftpc_acount, 1);
+   atomic_inc_64(fprc-ftpc_acount);
ASSERT(fprc-ftpc_acount = fprc-ftpc_rcount);
mutex_exit(fprc-ftpc_mtx);
 
@@ -1212,7 +1212,7 @@ fasttrap_proc_lookup(pid_t pid)
mutex_enter(fprc-ftpc_mtx);
mutex_exit(bucket-ftb_mtx);
fprc-ftpc_rcount++;
-   atomic_add_64(fprc-ftpc_acount, 1);
+   atomic_inc_64(fprc-ftpc_acount);
ASSERT(fprc-ftpc_acount = fprc-ftpc_rcount);
mutex_exit(fprc-ftpc_mtx);
 
@@ -1424,7 +1424,7 @@ fasttrap_provider_free(fasttrap_provider
 * count of active providers on the associated process structure.
 */
if (!provider-ftp_retired) {
-   atomic_add_64(provider-ftp_proc-ftpc_acount, -1);
+   atomic_dec_64(provider-ftp_proc-ftpc_acount);
ASSERT(provider-ftp_proc-ftpc_acount 
provider-ftp_proc-ftpc_rcount);
}
@@ -1499,7 +1499,7 @@ fasttrap_provider_retire(pid_t pid, cons
 * bucket lock therefore protects the integrity of the provider hash
 * table.
 */
-   atomic_add_64(fp-ftp_proc-ftpc_acount, -1);
+   atomic_dec_64(fp-ftp_proc-ftpc_acount);
ASSERT(fp-ftp_proc-ftpc_acount  fp-ftp_proc-ftpc_rcount);
 
fp-ftp_retired = 1;
@@ -1595,10 +1595,10 @@ fasttrap_add_probe(fasttrap_probe_spec_t
pdata-ftps_mod, pdata-ftps_func, name_str) != 0)
continue;
 
-   atomic_add_32(fasttrap_total, 1);
+   atomic_inc_32(fasttrap_total);
 
if (fasttrap_total  fasttrap_max) {
-   atomic_add_32(fasttrap_total, -1);
+   atomic_dec_32(fasttrap_total);
goto no_mem;
}
 

Modified: vendor-sys/illumos/dist/uts/common/dtrace/profile.c
==
--- vendor-sys/illumos/dist/uts/common/dtrace/profile.c Wed Aug 20 06:20:06 
2014(r270194)
+++ vendor-sys/illumos/dist/uts/common/dtrace/profile.c Wed Aug 20 06:22:59 
2014(r270195)
@@ -171,9 +171,9 @@ profile_create(hrtime_t interval, const 
if (dtrace_probe_lookup(profile_id, NULL, NULL, name) != 0)
return;
 
-   atomic_add_32(profile_total, 1);
+   atomic_inc_32(profile_total);
if (profile_total  profile_max) {
-   atomic_add_32(profile_total, -1);
+   atomic_dec_32(profile_total);
return;
}
 
@@ -328,7 +328,7 @@ profile_destroy(void *arg, dtrace_id_t i
kmem_free(prof, sizeof (profile_probe_t));
 
ASSERT(profile_total = 1);
-   atomic_add_32(profile_total, -1);
+   atomic_dec_32(profile_total);
 }
 
 /*ARGSUSED*/

Modified: vendor-sys/illumos/dist/uts/common/fs/vnode.c
==
--- vendor-sys/illumos/dist/uts/common/fs/vnode.c   Wed Aug 20 06:20:06 
2014(r270194)
+++ vendor-sys/illumos/dist/uts/common/fs/vnode.c   Wed 

svn commit: r270196 - vendor-sys/illumos/dist/uts/common/fs/zfs

2014-08-20 Thread Xin LI
Author: delphij
Date: Wed Aug 20 06:25:43 2014
New Revision: 270196
URL: http://svnweb.freebsd.org/changeset/base/270196

Log:
  5047 don't use atomic_*_nv if you discard the return value
  Reviewed by: Garrett D'Amore garr...@damore.org
  Reviewed by: Jason King jason.brian.k...@gmail.com
  Reviewed by: Matthew Ahrens mahr...@delphix.com
  Approved by: Robert Mustacchi r...@joyent.com
  Author: Josef 'Jeff' Sipek josef.si...@nexenta.com
  
  illumos/illumos-gate@640c1670a105457bb0040e8e11037b53ab6ebcfa

Modified:
  vendor-sys/illumos/dist/uts/common/fs/zfs/dbuf.c
  vendor-sys/illumos/dist/uts/common/fs/zfs/dmu.c

Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/dbuf.c
==
--- vendor-sys/illumos/dist/uts/common/fs/zfs/dbuf.cWed Aug 20 06:22:59 
2014(r270195)
+++ vendor-sys/illumos/dist/uts/common/fs/zfs/dbuf.cWed Aug 20 06:25:43 
2014(r270196)
@@ -1605,7 +1605,7 @@ dbuf_clear(dmu_buf_impl_t *db)
dndb = dn-dn_dbuf;
if (db-db_blkid != DMU_BONUS_BLKID  MUTEX_HELD(dn-dn_dbufs_mtx)) {
avl_remove(dn-dn_dbufs, db);
-   (void) atomic_dec_32_nv(dn-dn_dbufs_count);
+   atomic_dec_32(dn-dn_dbufs_count);
membar_producer();
DB_DNODE_EXIT(db);
/*
@@ -1781,7 +1781,7 @@ dbuf_create(dnode_t *dn, uint8_t level, 
ASSERT(dn-dn_object == DMU_META_DNODE_OBJECT ||
refcount_count(dn-dn_holds)  0);
(void) refcount_add(dn-dn_holds, db);
-   (void) atomic_inc_32_nv(dn-dn_dbufs_count);
+   atomic_inc_32(dn-dn_dbufs_count);
 
dprintf_dbuf(db, db=%p\n, db);
 
@@ -1827,7 +1827,7 @@ dbuf_destroy(dmu_buf_impl_t *db)
dn = DB_DNODE(db);
mutex_enter(dn-dn_dbufs_mtx);
avl_remove(dn-dn_dbufs, db);
-   (void) atomic_dec_32_nv(dn-dn_dbufs_count);
+   atomic_dec_32(dn-dn_dbufs_count);
mutex_exit(dn-dn_dbufs_mtx);
DB_DNODE_EXIT(db);
/*
@@ -2111,7 +2111,7 @@ dbuf_rele_and_unlock(dmu_buf_impl_t *db,
 * until the move completes.
 */
DB_DNODE_ENTER(db);
-   (void) atomic_dec_32_nv(DB_DNODE(db)-dn_dbufs_count);
+   atomic_dec_32(DB_DNODE(db)-dn_dbufs_count);
DB_DNODE_EXIT(db);
/*
 * The bonus buffer's dnode hold is no longer discounted

Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/dmu.c
==
--- vendor-sys/illumos/dist/uts/common/fs/zfs/dmu.c Wed Aug 20 06:22:59 
2014(r270195)
+++ vendor-sys/illumos/dist/uts/common/fs/zfs/dmu.c Wed Aug 20 06:25:43 
2014(r270196)
@@ -284,7 +284,7 @@ dmu_bonus_hold(objset_t *os, uint64_t ob
/* as long as the bonus buf is held, the dnode will be held */
if (refcount_add(db-db_holds, tag) == 1) {
VERIFY(dnode_add_ref(dn, db));
-   (void) atomic_inc_32_nv(dn-dn_dbufs_count);
+   atomic_inc_32(dn-dn_dbufs_count);
}
 
/*
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r270197 - vendor-sys/illumos/dist/uts/common/sys vendor/illumos/dist/head

2014-08-20 Thread Xin LI
Author: delphij
Date: Wed Aug 20 06:29:42 2014
New Revision: 270197
URL: http://svnweb.freebsd.org/changeset/base/270197

Log:
  5066 remove support for non-ANSI compilation
  5068 Remove SCCSID() macro from macros.h
  Reviewed by: Keith Wesolowski keith.wesolow...@joyent.com
  Reviewed by: Josef 'Jeff' Sipek jef...@josefsipek.net
  Approved by: Robert Mustacchi r...@joyent.com
  Author: Garrett D'Amore garr...@damore.org
  
  illumos/illumos-gate@ba3594ba9b5dd4c846c472a8d657edcb7c8109ac

Modified:
  vendor-sys/illumos/dist/uts/common/sys/acl.h
  vendor-sys/illumos/dist/uts/common/sys/debug.h
  vendor-sys/illumos/dist/uts/common/sys/feature_tests.h
  vendor-sys/illumos/dist/uts/common/sys/processor.h

Changes in other areas also in this revision:
Modified:
  vendor/illumos/dist/head/libintl.h
  vendor/illumos/dist/head/nlist.h
  vendor/illumos/dist/head/synch.h
  vendor/illumos/dist/head/thread.h

Modified: vendor-sys/illumos/dist/uts/common/sys/acl.h
==
--- vendor-sys/illumos/dist/uts/common/sys/acl.hWed Aug 20 06:25:43 
2014(r270196)
+++ vendor-sys/illumos/dist/uts/common/sys/acl.hWed Aug 20 06:29:42 
2014(r270197)
@@ -19,6 +19,8 @@
  * CDDL HEADER END
  */
 /*
+ * Copyright 2014 Garrett D'Amore garr...@damore.org
+ *
  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
@@ -287,13 +289,8 @@ extern int cmp2acls(void *, void *);
 
 #endif /* !defined(_KERNEL) */
 
-#if defined(__STDC__)
 extern int acl(const char *path, int cmd, int cnt, void *buf);
 extern int facl(int fd, int cmd, int cnt, void *buf);
-#else  /* !__STDC__ */
-extern int acl();
-extern int facl();
-#endif /* defined(__STDC__) */
 
 #ifdef __cplusplus
 }

Modified: vendor-sys/illumos/dist/uts/common/sys/debug.h
==
--- vendor-sys/illumos/dist/uts/common/sys/debug.h  Wed Aug 20 06:25:43 
2014(r270196)
+++ vendor-sys/illumos/dist/uts/common/sys/debug.h  Wed Aug 20 06:29:42 
2014(r270197)
@@ -19,6 +19,8 @@
  * CDDL HEADER END
  */
 /*
+ * Copyright 2014 Garrett D'Amore garr...@damore.org
+ *
  * Copyright 2010 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
@@ -48,7 +50,6 @@ extern C {
  * ASSERT and is evaluated on both debug and non-debug kernels.
  */
 
-#if defined(__STDC__)
 extern int assfail(const char *, const char *, int);
 #defineVERIFY(EX) ((void)((EX) || assfail(#EX, __FILE__, __LINE__)))
 #if DEBUG
@@ -56,15 +57,6 @@ extern int assfail(const char *, const c
 #else
 #defineASSERT(x)  ((void)0)
 #endif
-#else  /* defined(__STDC__) */
-extern int assfail();
-#defineVERIFY(EX) ((void)((EX) || assfail(EX, __FILE__, __LINE__)))
-#if DEBUG
-#defineASSERT(EX) ((void)((EX) || assfail(EX, __FILE__, __LINE__)))
-#else
-#defineASSERT(x)  ((void)0)
-#endif
-#endif /* defined(__STDC__) */
 
 /*
  * Assertion variants sensitive to the compilation data model

Modified: vendor-sys/illumos/dist/uts/common/sys/feature_tests.h
==
--- vendor-sys/illumos/dist/uts/common/sys/feature_tests.h  Wed Aug 20 
06:25:43 2014(r270196)
+++ vendor-sys/illumos/dist/uts/common/sys/feature_tests.h  Wed Aug 20 
06:29:42 2014(r270197)
@@ -20,6 +20,8 @@
  */
 
 /*
+ * Copyright 2013 Garrett D'Amore garr...@damore.org
+ *
  * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
@@ -43,15 +45,16 @@ extern C {
  * 199309L POSIX.1b-1993 compilation (Real Time)
  * 199506L POSIX.1c-1995 compilation (POSIX Threads)
  * 200112L POSIX.1-2001 compilation (Austin Group Revision)
+ * 200809L POSIX.1-2008 compilation
  */
 #if defined(_POSIX_SOURCE)  !defined(_POSIX_C_SOURCE)
 #define_POSIX_C_SOURCE 1
 #endif
 
 /*
- * The feature test macros __XOPEN_OR_POSIX, _STRICT_STDC, and _STDC_C99
- * are Sun implementation specific macros created in order to compress
- * common standards specified feature test macros for easier reading.
+ * The feature test macros __XOPEN_OR_POSIX, _STRICT_STDC, _STRICT_SYMBOLS,
+ * and _STDC_C99 are Sun implementation specific macros created in order to
+ * compress common standards specified feature test macros for easier reading.
  * These macros should not be used by the application developer as
  * unexpected results may occur. Instead, the user should reference
  * standards(5) for correct usage of the standards feature test macros.
@@ -77,6 +80,10 @@ extern C {
  *  the C standard. A value of 199901L indicates a
  *  compiler that complies with ISO/IEC 9899:1999, other-
  *  wise known as the C99 standard.
+ *
+ * _STRICT_SYMBOLS Used 

svn commit: r270197 - vendor-sys/illumos/dist/uts/common/sys vendor/illumos/dist/head

2014-08-20 Thread Xin LI
Author: delphij
Date: Wed Aug 20 06:29:42 2014
New Revision: 270197
URL: http://svnweb.freebsd.org/changeset/base/270197

Log:
  5066 remove support for non-ANSI compilation
  5068 Remove SCCSID() macro from macros.h
  Reviewed by: Keith Wesolowski keith.wesolow...@joyent.com
  Reviewed by: Josef 'Jeff' Sipek jef...@josefsipek.net
  Approved by: Robert Mustacchi r...@joyent.com
  Author: Garrett D'Amore garr...@damore.org
  
  illumos/illumos-gate@ba3594ba9b5dd4c846c472a8d657edcb7c8109ac

Modified:
  vendor/illumos/dist/head/libintl.h
  vendor/illumos/dist/head/nlist.h
  vendor/illumos/dist/head/synch.h
  vendor/illumos/dist/head/thread.h

Changes in other areas also in this revision:
Modified:
  vendor-sys/illumos/dist/uts/common/sys/acl.h
  vendor-sys/illumos/dist/uts/common/sys/debug.h
  vendor-sys/illumos/dist/uts/common/sys/feature_tests.h
  vendor-sys/illumos/dist/uts/common/sys/processor.h

Modified: vendor/illumos/dist/head/libintl.h
==
--- vendor/illumos/dist/head/libintl.h  Wed Aug 20 06:25:43 2014
(r270196)
+++ vendor/illumos/dist/head/libintl.h  Wed Aug 20 06:29:42 2014
(r270197)
@@ -19,6 +19,8 @@
  * CDDL HEADER END
  */
 /*
+ * Copyright 2014 Garrett D'Amore garr...@damore.org
+ *
  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
@@ -27,8 +29,6 @@
 #ifndef_LIBINTL_H
 #define_LIBINTL_H
 
-#pragma ident  %Z%%M% %I% %E% SMI
-
 #include sys/isa_defs.h
 
 #ifdef __cplusplus
@@ -64,7 +64,6 @@ typedef long  wchar_t;
 #define__GNU_GETTEXT_SUPPORTED_REVISION(m) \
m) == 0) || ((m) == 1)) ? 1 : -1)
 
-#ifdef __STDC__
 extern char *dcgettext(const char *, const char *, const int);
 extern char *dgettext(const char *, const char *);
 extern char *gettext(const char *);
@@ -91,33 +90,6 @@ extern wchar_t *wddelim(wchar_t, wchar_t
 extern wchar_t mcfiller(void);
 extern int mcwrap(void);
 
-#else
-extern char *dcgettext();
-extern char *dgettext();
-extern char *gettext();
-extern char *textdomain();
-extern char *bindtextdomain();
-
-/*
- * LI18NUX 2000 Globalization Specification Version 1.0
- * with Amendment 2
- */
-extern char *dcngettext();
-extern char *dngettext();
-extern char *ngettext();
-extern char *bind_textdomain_codeset();
-
-/* Word handling functions --- requires dynamic linking */
-/* Warning: these are experimental and subject to change. */
-extern int wdinit();
-extern int wdchkind();
-extern int wdbindf();
-extern wchar_t *wddelim();
-extern wchar_t mcfiller();
-extern int mcwrap();
-
-#endif
-
 #ifdef __cplusplus
 }
 #endif

Modified: vendor/illumos/dist/head/nlist.h
==
--- vendor/illumos/dist/head/nlist.hWed Aug 20 06:25:43 2014
(r270196)
+++ vendor/illumos/dist/head/nlist.hWed Aug 20 06:29:42 2014
(r270197)
@@ -19,6 +19,9 @@
  *
  * CDDL HEADER END
  */
+/*
+ * Copyright 2014 Garrett D'Amore garr...@damore.org
+ */
 /* Copyright (c) 1988 ATT */
 /*   All Rights Reserved   */
 
@@ -26,8 +29,6 @@
 #ifndef _NLIST_H
 #define_NLIST_H
 
-#pragma ident  %Z%%M% %I% %E% SMI/* SVr4.0 1.8.2.4 */
-
 #ifdef __cplusplus
 extern C {
 #endif
@@ -41,11 +42,7 @@ struct nlist {
charn_numaux;   /* number of aux. entries */
 };
 
-#if defined(__STDC__)
 extern int nlist(const char *, struct nlist *);
-#else  /* __STDC__ */
-extern int nlist();
-#endif  /* __STDC__ */
 
 #ifdef __cplusplus
 }

Modified: vendor/illumos/dist/head/synch.h
==
--- vendor/illumos/dist/head/synch.hWed Aug 20 06:25:43 2014
(r270196)
+++ vendor/illumos/dist/head/synch.hWed Aug 20 06:29:42 2014
(r270197)
@@ -20,6 +20,7 @@
  */
 
 /*
+ * Copyright 2014 Garrett D'Amore garr...@damore.org
  * Copyright (c) 1992, 2010, Oracle and/or its affiliates. All rights reserved.
  */
 
@@ -86,7 +87,6 @@ typedef struct _rwlock {
cond_t  writercv;   /* used only to indicate ownership */
 } rwlock_t;
 
-#ifdef __STDC__
 int_lwp_mutex_lock(lwp_mutex_t *);
 int_lwp_mutex_unlock(lwp_mutex_t *);
 int_lwp_mutex_trylock(lwp_mutex_t *);
@@ -127,50 +127,6 @@ intsema_reltimedwait(sema_t *, const ti
 intsema_post(sema_t *);
 intsema_trywait(sema_t *);
 
-#else  /* __STDC__ */
-
-int_lwp_mutex_lock();
-int_lwp_mutex_unlock();
-int_lwp_mutex_trylock();
-int_lwp_cond_wait();
-int_lwp_cond_timedwait();
-int_lwp_cond_reltimedwait();
-int_lwp_cond_signal();
-int_lwp_cond_broadcast();
-int_lwp_sema_init();
-int_lwp_sema_wait();
-int_lwp_sema_trywait();
-int_lwp_sema_post();
-intcond_init();
-intcond_destroy();
-intcond_wait();
-intcond_timedwait();
-intcond_reltimedwait();
-intcond_signal();
-int

svn commit: r270198 - in vendor-sys/illumos/dist/uts/common/fs/zfs: . sys

2014-08-20 Thread Xin LI
Author: delphij
Date: Wed Aug 20 06:34:24 2014
New Revision: 270198
URL: http://svnweb.freebsd.org/changeset/base/270198

Log:
  5095 panic when adding a duplicate dbuf to dn_dbufs
  Reviewed by: Adam Leventhal adam.levent...@delphix.com
  Reviewed by: George Wilson george.wil...@delphix.com
  Reviewed by: Mattew Ahrens mahr...@delphix.com
  Reviewed by: Dan Kimmel dan.kim...@delphix.com
  Reviewed by: Dan McDonald dan...@omniti.com
  Reviewed by: Josef Sipek jef...@josefsipek.net
  Approved by: Robert Mustacchi r...@joyent.com
  Author: Alex Reece a...@delphix.com
  
  illumos/illumos-gate@86bb58aec7165f8a0303564575c65e5a2ad58bf1

Modified:
  vendor-sys/illumos/dist/uts/common/fs/zfs/dbuf.c
  vendor-sys/illumos/dist/uts/common/fs/zfs/dnode.c
  vendor-sys/illumos/dist/uts/common/fs/zfs/sys/dbuf.h
  vendor-sys/illumos/dist/uts/common/fs/zfs/sys/dnode.h

Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/dbuf.c
==
--- vendor-sys/illumos/dist/uts/common/fs/zfs/dbuf.cWed Aug 20 06:29:42 
2014(r270197)
+++ vendor-sys/illumos/dist/uts/common/fs/zfs/dbuf.cWed Aug 20 06:34:24 
2014(r270198)
@@ -70,8 +70,6 @@ dbuf_cons(void *vdb, void *unused, int k
cv_init(db-db_changed, NULL, CV_DEFAULT, NULL);
refcount_create(db-db_holds);
 
-   db-db_creation = gethrtime();
-
return (0);
 }
 
@@ -819,7 +817,7 @@ dbuf_free_range(dnode_t *dn, uint64_t st
 
db_search.db_level = 0;
db_search.db_blkid = start_blkid;
-   db_search.db_creation = 0;
+   db_search.db_state = DB_SEARCH;
 
mutex_enter(dn-dn_dbufs_mtx);
if (start_blkid = dn-dn_unlisted_l0_blkid) {

Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/dnode.c
==
--- vendor-sys/illumos/dist/uts/common/fs/zfs/dnode.c   Wed Aug 20 06:29:42 
2014(r270197)
+++ vendor-sys/illumos/dist/uts/common/fs/zfs/dnode.c   Wed Aug 20 06:34:24 
2014(r270198)
@@ -67,33 +67,35 @@ dbuf_compare(const void *x1, const void 
 
if (d1-db_level  d2-db_level) {
return (-1);
-   } else if (d1-db_level  d2-db_level) {
+   }
+   if (d1-db_level  d2-db_level) {
return (1);
}
 
if (d1-db_blkid  d2-db_blkid) {
return (-1);
-   } else if (d1-db_blkid  d2-db_blkid) {
+   }
+   if (d1-db_blkid  d2-db_blkid) {
return (1);
}
 
-   /*
-* If a dbuf is being evicted while dn_dbufs_mutex is not held, we set
-* the db_state to DB_EVICTING but do not remove it from dn_dbufs. If
-* another thread creates a dbuf of the same blkid before the dbuf is
-* removed from dn_dbufs, we can reach a state where there are two
-* dbufs of the same blkid and level in db_dbufs. To maintain the avl
-* invariant that there cannot be duplicate items, we distinguish
-* between these two dbufs based on the time they were created.
-*/
-   if (d1-db_creation  d2-db_creation) {
+   if (d1-db_state  d2-db_state) {
return (-1);
-   } else if (d1-db_creation  d2-db_creation) {
+   }
+   if (d1-db_state  d2-db_state) {
return (1);
-   } else {
-   ASSERT3P(d1, ==, d2);
-   return (0);
}
+
+   ASSERT3S(d1-db_state, !=, DB_SEARCH);
+   ASSERT3S(d2-db_state, !=, DB_SEARCH);
+
+   if ((uintptr_t)d1  (uintptr_t)d2) {
+   return (-1);
+   }
+   if ((uintptr_t)d1  (uintptr_t)d2) {
+   return (1);
+   }
+   return (0);
 }
 
 /* ARGSUSED */

Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/sys/dbuf.h
==
--- vendor-sys/illumos/dist/uts/common/fs/zfs/sys/dbuf.hWed Aug 20 
06:29:42 2014(r270197)
+++ vendor-sys/illumos/dist/uts/common/fs/zfs/sys/dbuf.hWed Aug 20 
06:34:24 2014(r270198)
@@ -66,8 +66,13 @@ extern C {
  * ||
  * ||
  * + NOFILL ---+
+ *
+ * DB_SEARCH is an invalid state for a dbuf. It is used by dbuf_free_range
+ * to find all dbufs in a range of a dnode and must be less than any other
+ * dbuf_states_t (see comment on dn_dbufs in dnode.h).
  */
 typedef enum dbuf_states {
+   DB_SEARCH = -1,
DB_UNCACHED,
DB_FILL,
DB_NOFILL,
@@ -213,9 +218,6 @@ typedef struct dmu_buf_impl {
/* pointer to most recent dirty record for this buffer */
dbuf_dirty_record_t *db_last_dirty;
 
-   /* Creation time of dbuf (see comment in dbuf_compare). */
-   hrtime_t db_creation;
-
/*
 * Our link on the owner dnodes's dn_dbufs list.
 * Protected by its dn_dbufs_mtx.

Modified: 

svn commit: r270199 - head/tools/tools/vt/keymaps

2014-08-20 Thread Stefan Esser
Author: se
Date: Wed Aug 20 07:46:28 2014
New Revision: 270199
URL: http://svnweb.freebsd.org/changeset/base/270199

Log:
  Fix further conversion errors found while testing the converted keymaps.
  
  MFC after:3 days

Modified:
  head/tools/tools/vt/keymaps/convert-keymap.pl
  head/tools/tools/vt/keymaps/convert-keymaps.pl

Modified: head/tools/tools/vt/keymaps/convert-keymap.pl
==
--- head/tools/tools/vt/keymaps/convert-keymap.pl   Wed Aug 20 06:34:24 
2014(r270198)
+++ head/tools/tools/vt/keymaps/convert-keymap.pl   Wed Aug 20 07:46:28 
2014(r270199)
@@ -35,33 +35,50 @@ sub local_to_UCS_code
 return prettyprint_token(ord(Encode::decode(UTF-8, 
local_to_UCS_string($char;
 }
 
+sub malformed_to_UCS_code
+{
+my ($char) = @_;
+
+return prettyprint_token(ord(Encode::decode(UTF-8, $char)));
+}
 
 sub convert_token
 {
 my ($C) = @_;
 
 return $1
-if $C =~ m/^([a-z][a-z0-9]*)$/; # key token
+if $C =~ m/^([a-z][a-z0-9]*)$/;# key token
 return local_to_UCS_code(chr($1))
-if $C =~ m/^(\d+)$/;# decimal number
+if $C =~ m/^(\d+)$/;   # decimal number
 return local_to_UCS_code(chr(hex($1)))
-if $C =~ m/^0x([0-9a-f]+)$/i;   # hex number
+if $C =~ m/^0x([0-9a-f]+)$/i;  # hex number
 return local_to_UCS_code(chr(ord($1)))
-if $C =~ m/^'(.)'$/;# character
-return ?$C?;# uncovered case
+if $C =~ m/^'(.)'$/;   # character
+return malformed_to_UCS_code($1)
+if $C =~ m/^'(.+)'$/;  # character
+return ?$C?;   # uncovered case
 }
 
 sub tokenize { # split on white space and parentheses (but not within token)
 my ($line) = @_;
 
-$line =~ s/' '/ _spc_ /g; # prevent splitting of ' '
+#print  $line;
 $line =~ s/'\('/ _lpar_ /g; # prevent splitting of '('
 $line =~ s/'\)'/ _rpar_ /g; # prevent splitting of ')'
+$line =~ s/'''/'_squote_'/g; # remove quoted single quotes from matches 
below
 $line =~ s/([()])/ $1 /g; # insert blanks around remaining parentheses
+my $matches;
+do {
+   $matches = ($line =~ s/^([^']*)'([^']+)'/$1_squoteL_$2_squoteR_/g);
+#  print - $line $matches: ('$1','$2')\n;
+} while $matches;
+$line =~ s/_squoteL_ _squoteR_/ _spc_ /g; # prevent splitting of ' '
 my @KEYTOKEN = split ( , $line);
+grep(s/_squote[LR]?_/'/g, @KEYTOKEN);
 grep(s/_spc_/' '/, @KEYTOKEN);
 grep(s/_lpar_/'('/, @KEYTOKEN);
 grep(s/_rpar_/')'/, @KEYTOKEN);
+#printf  $line%s\n, join('|', @KEYTOKEN);
 return @KEYTOKEN;
 }
 
@@ -85,7 +102,7 @@ while (FH) {
} elsif ($C eq () {
printf %17s, ( ; # paren continues accent definition
} else {
-   print UNKNOWN DEFINITION: $_;
+   print Unknown input line format: $_;
}
$at_bol = 0;
} else {

Modified: head/tools/tools/vt/keymaps/convert-keymaps.pl
==
--- head/tools/tools/vt/keymaps/convert-keymaps.pl  Wed Aug 20 06:34:24 
2014(r270198)
+++ head/tools/tools/vt/keymaps/convert-keymaps.pl  Wed Aug 20 07:46:28 
2014(r270199)
@@ -94,6 +94,6 @@ foreach $kbdfile (glob($dir_keymaps_sys
print $kbdfile not found\n;
}
 } else {
-   print Unknown input file: $basename\n;
+   print Ignore '$basename': No encoding defined in KBDFILES.map\n;
 }
 }
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r270200 - head/share/vt/keymaps

2014-08-20 Thread Stefan Esser
Author: se
Date: Wed Aug 20 07:48:09 2014
New Revision: 270200
URL: http://svnweb.freebsd.org/changeset/base/270200

Log:
  Fix conversion errors leading to malformed keymap files.
  
  MFC after:3 days

Modified:
  head/share/vt/keymaps/cz.kbd
  head/share/vt/keymaps/fr.dvorak.acc.kbd
  head/share/vt/keymaps/nordic.asus-eee.kbd
  head/share/vt/keymaps/pl.dvorak.kbd

Modified: head/share/vt/keymaps/cz.kbd
==
--- head/share/vt/keymaps/cz.kbdWed Aug 20 07:46:28 2014
(r270199)
+++ head/share/vt/keymaps/cz.kbdWed Aug 20 07:48:09 2014
(r270200)
@@ -262,7 +262,7 @@
( 'i'0xed) ( 'n'0x0144  ) ( 'o'0xf3) ( 'u'  
  0xfa)
( 'y'0xfd)
 
-  dcir '^' ( ?'^? ' '?^'?  ) ( 'A'0xc2) ( 'I'0xce) 
( 'O'0xd4)
+  dcir '^' ( '^''^' ) ( 'A'0xc2) ( 'I'0xce) ( 'O'  
  0xd4)
( 'a'0xe2) ( 'i'0xee) ( 'o'0xf4)
 
   dbre 0x02d8  ( 0x02d8 0x02d8  ) ( 'A'0x0102  ) ( 'a'0x0103  )

Modified: head/share/vt/keymaps/fr.dvorak.acc.kbd
==
--- head/share/vt/keymaps/fr.dvorak.acc.kbd Wed Aug 20 07:46:28 2014
(r270199)
+++ head/share/vt/keymaps/fr.dvorak.acc.kbd Wed Aug 20 07:48:09 2014
(r270200)
@@ -1,7 +1,7 @@
 # A Dvorak keyboard for French
 #
 # This is a Dvorak-like layout for French
-# according to Francis Leboutte on
+# according to Francis Leboutte on 
 # http://www.algo.be/ergo/dvorak-fr.html
 #
 #   -Frédéric Praca frederic.pr...@freebsd-fr.org
@@ -14,58 +14,58 @@
 # --
   000   nopnopnopnopnopnopnopnop O
   001   escescescescescescdebug  esc O
-  002  '=''1'nopnopnopnopnopnop C
-  003  '/''2'nopnopnopnopnopnop C
-  004  '-''3'nopnopnopnopnopnop C
-  005  'è''4'nopnopnopnopnopnop C
-  006  '\''5'nopnopnopnopnopnop C
-  007  dcir   '6'nopnopnopnopnopnop C
-  008  '(''7'nopnopnopnopnopnop C
-  009  dgra   '8'nopnopnopnopnopnop C
-  010  ')''9'nopnopnopnopnopnop C
-  011  '''0'nopnopnopnopnopnop C
-  012  '[''+'nopnopnopnopnopnop C
-  013  ']''%'nopnopnopnopnopnop C
+  002   '=''1'nopnopnopnopnopnop C
+  003   '/''2'nopnopnopnopnopnop C
+  004   '-''3'nopnopnopnopnopnop C
+  005   0xe8   '4'nopnopnopnopnopnop C
+  006   '\''5'nopnopnopnopnopnop C
+  007   dcir   '6'nopnopnopnopnopnop C
+  008   '(''7'nopnopnopnopnopnop C
+  009   dgra   '8'nopnopnopnopnopnop C
+  010   ')''9'nopnopnopnopnopnop C
+  011   '''0'nopnopnopnopnopnop C
+  012   '[''+'nopnopnopnopnopnop C
+  013   ']''%'nopnopnopnopnopnop C
   014   bs bs deldelbs bs deldel O
   015   ht btab   nopnopht btab   nopnop O
-  016  ':''?'nopnopnopnopnopnop O
-  017  '''''nopnopnopnopnopnop C
-  018  'é'''nopnopnopnopnopnop C
-  019  'g''G'nopnopnopnopnopnop C
-  020  '.''!'nopnopnopnopnopnop O
-  021  'h''H'nopnopnopnopnopnop C
-  022  'v''V'nopnopnopnopnopnop C
-  023  'c''C'nopnopnopnopnopnop C
-  024  'm''M'nopnopnopnopnopnop C
-  025  'k''K'nopnopnopnopnopnop C
-  026  'z''Z'nopnopnopnopnopnop C
-  027  ddia   ''nopnopnopnopnopnop O
+  016   ':''?'nopnopnopnopnopnop O
+  017   '''''nopnopnopnopnopnop C
+  018   0xe9   ''nopnopnopnopnopnop C
+  019   'g''G'nopnopnopnopnopnop C
+  020   '.''!'nopnopnopnopnopnop O
+  021   'h''H'nopnopnopnopnopnop C
+  022   'v''V'nopnopnopnopnopnop C
+  023   'c''C'

svn commit: r270201 - in head/sys: powerpc/include sys

2014-08-20 Thread Konstantin Belousov
Author: kib
Date: Wed Aug 20 08:02:38 2014
New Revision: 270201
URL: http://svnweb.freebsd.org/changeset/base/270201

Log:
  Add arch-specific macro SFBUF_PHYS_DMAP(), which should translate the
  physical address of the page to direct map address, in case
  SFBUF_OPTIONAL_DIRECT_MAP returns true.  The case of PowerPC AIM
  64bit, where the page physical address is identical to the direct map
  address, is accidental.
  
  Reviewed by:  alc
  Sponsored by: The FreeBSD Foundation

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

Modified: head/sys/powerpc/include/vmparam.h
==
--- head/sys/powerpc/include/vmparam.h  Wed Aug 20 07:48:09 2014
(r270200)
+++ head/sys/powerpc/include/vmparam.h  Wed Aug 20 08:02:38 2014
(r270201)
@@ -210,5 +210,6 @@ struct pmap_physseg {
 #defineSFBUF
 #defineSFBUF_NOMD
 #defineSFBUF_OPTIONAL_DIRECT_MAP   hw_direct_map
+#defineSFBUF_PHYS_DMAP(x)  (x)
  
 #endif /* _MACHINE_VMPARAM_H_ */

Modified: head/sys/sys/sf_buf.h
==
--- head/sys/sys/sf_buf.h   Wed Aug 20 07:48:09 2014(r270200)
+++ head/sys/sys/sf_buf.h   Wed Aug 20 08:02:38 2014(r270201)
@@ -113,7 +113,7 @@ sf_buf_kva(struct sf_buf *sf)
 {
 #ifdef SFBUF_OPTIONAL_DIRECT_MAP
if (SFBUF_OPTIONAL_DIRECT_MAP)
-   return (VM_PAGE_TO_PHYS((vm_page_t)sf));
+   return (SFBUF_PHYS_DMAP(VM_PAGE_TO_PHYS((vm_page_t)sf)));
 #endif
 
 return (sf-kva);
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r270202 - head/sys/amd64/include

2014-08-20 Thread Konstantin Belousov
Author: kib
Date: Wed Aug 20 08:07:08 2014
New Revision: 270202
URL: http://svnweb.freebsd.org/changeset/base/270202

Log:
  Increase max number of physical segments on amd64 to 63.
  
  Eventually, the vmd_segs of the struct vm_domain should become bitset
  instead of long, to allow arbitrary compile-time selected maximum.
  
  Reviewed by:  alc
  Sponsored by: The FreeBSD Foundation
  MFC after:1 week

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

Modified: head/sys/amd64/include/vmparam.h
==
--- head/sys/amd64/include/vmparam.hWed Aug 20 08:02:38 2014
(r270201)
+++ head/sys/amd64/include/vmparam.hWed Aug 20 08:07:08 2014
(r270202)
@@ -87,7 +87,7 @@
  * largest physical address that is accessible by ISA DMA is split
  * into two PHYSSEG entries. 
  */
-#defineVM_PHYSSEG_MAX  31
+#defineVM_PHYSSEG_MAX  63
 
 /*
  * Create three free page pools: VM_FREEPOOL_DEFAULT is the default pool
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


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

2014-08-20 Thread Konstantin Belousov
Author: kib
Date: Wed Aug 20 08:13:03 2014
New Revision: 270203
URL: http://svnweb.freebsd.org/changeset/base/270203

Log:
  Correct the test for condition to suspend UFS filesystem during
  unmount.  There is no need to suspend read-only filesystem, while we
  need suspension on modificable mount point.
  
  Reported by:  rwatson
  Tested by:pho
  Sponsored by: The FreeBSD Foundation
  MFC after:1 week

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

Modified: head/sys/ufs/ffs/ffs_vfsops.c
==
--- head/sys/ufs/ffs/ffs_vfsops.c   Wed Aug 20 08:07:08 2014
(r270202)
+++ head/sys/ufs/ffs/ffs_vfsops.c   Wed Aug 20 08:13:03 2014
(r270203)
@@ -1213,7 +1213,7 @@ ffs_unmount(mp, mntflags)
susp = 0;
if (mntflags  MNT_FORCE) {
flags |= FORCECLOSE;
-   susp = fs-fs_ronly != 0;
+   susp = fs-fs_ronly == 0;
}
 #ifdef UFS_EXTATTR
if ((error = ufs_extattr_stop(mp, td))) {
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r270204 - head/sys/ufs/ufs

2014-08-20 Thread Konstantin Belousov
Author: kib
Date: Wed Aug 20 08:15:23 2014
New Revision: 270204
URL: http://svnweb.freebsd.org/changeset/base/270204

Log:
  Do not busy the UFS mount point inside VOP_RENAME().  The
  kern_renameat() already starts write on the mp, which prevents
  parallel unmount from proceed.  Busying mp after vn_start_write()
  deadlocks the unmount.
  
  Reported and tested by:   pho
  Sponsored by: The FreeBSD Foundation
  MFC after:1 week

Modified:
  head/sys/ufs/ufs/ufs_vnops.c

Modified: head/sys/ufs/ufs/ufs_vnops.c
==
--- head/sys/ufs/ufs/ufs_vnops.cWed Aug 20 08:13:03 2014
(r270203)
+++ head/sys/ufs/ufs/ufs_vnops.cWed Aug 20 08:15:23 2014
(r270204)
@@ -1141,11 +1141,6 @@ ufs_rename(ap)
mp = NULL;
goto releout;
}
-   error = vfs_busy(mp, 0);
-   if (error) {
-   mp = NULL;
-   goto releout;
-   }
 relock:
/* 
 * We need to acquire 2 to 4 locks depending on whether tvp is NULL
@@ -1545,8 +1540,6 @@ unlockout:
if (error == 0  tdp-i_flag  IN_NEEDSYNC)
error = VOP_FSYNC(tdvp, MNT_WAIT, td);
vput(tdvp);
-   if (mp)
-   vfs_unbusy(mp);
return (error);
 
 bad:
@@ -1564,8 +1557,6 @@ releout:
vrele(tdvp);
if (tvp)
vrele(tvp);
-   if (mp)
-   vfs_unbusy(mp);
 
return (error);
 }
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r270205 - in stable/10/sys: kern vm

2014-08-20 Thread Konstantin Belousov
Author: kib
Date: Wed Aug 20 08:24:37 2014
New Revision: 270205
URL: http://svnweb.freebsd.org/changeset/base/270205

Log:
  MFC r269907:
  Fix leaks of unqueued unwired pages.

Modified:
  stable/10/sys/kern/kern_exec.c
  stable/10/sys/kern/uipc_shm.c
  stable/10/sys/vm/vm_glue.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/kern/kern_exec.c
==
--- stable/10/sys/kern/kern_exec.c  Wed Aug 20 08:15:23 2014
(r270204)
+++ stable/10/sys/kern/kern_exec.c  Wed Aug 20 08:24:37 2014
(r270205)
@@ -996,6 +996,7 @@ exec_map_first_page(imgp)
vm_page_xunbusy(ma[0]);
vm_page_lock(ma[0]);
vm_page_hold(ma[0]);
+   vm_page_activate(ma[0]);
vm_page_unlock(ma[0]);
VM_OBJECT_WUNLOCK(object);
 

Modified: stable/10/sys/kern/uipc_shm.c
==
--- stable/10/sys/kern/uipc_shm.c   Wed Aug 20 08:15:23 2014
(r270204)
+++ stable/10/sys/kern/uipc_shm.c   Wed Aug 20 08:24:37 2014
(r270205)
@@ -197,6 +197,12 @@ uiomove_object_page(vm_object_t obj, siz
vm_page_xunbusy(m);
vm_page_lock(m);
vm_page_hold(m);
+   if (m-queue == PQ_NONE) {
+   vm_page_deactivate(m);
+   } else {
+   /* Requeue to maintain LRU ordering. */
+   vm_page_requeue(m);
+   }
vm_page_unlock(m);
VM_OBJECT_WUNLOCK(obj);
error = uiomove_fromphys(m, offset, tlen, uio);
@@ -208,12 +214,6 @@ uiomove_object_page(vm_object_t obj, siz
}
vm_page_lock(m);
vm_page_unhold(m);
-   if (m-queue == PQ_NONE) {
-   vm_page_deactivate(m);
-   } else {
-   /* Requeue to maintain LRU ordering. */
-   vm_page_requeue(m);
-   }
vm_page_unlock(m);
 
return (error);

Modified: stable/10/sys/vm/vm_glue.c
==
--- stable/10/sys/vm/vm_glue.c  Wed Aug 20 08:15:23 2014(r270204)
+++ stable/10/sys/vm/vm_glue.c  Wed Aug 20 08:24:37 2014(r270205)
@@ -251,6 +251,7 @@ vm_imgact_hold_page(vm_object_t object, 
vm_page_xunbusy(m);
vm_page_lock(m);
vm_page_hold(m);
+   vm_page_activate(m);
vm_page_unlock(m);
 out:
VM_OBJECT_WUNLOCK(object);
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


Re: svn commit: r270201 - in head/sys: powerpc/include sys

2014-08-20 Thread Konstantin Belousov
On Wed, Aug 20, 2014 at 08:02:38AM +, Konstantin Belousov wrote:
 Author: kib
 Date: Wed Aug 20 08:02:38 2014
 New Revision: 270201
 URL: http://svnweb.freebsd.org/changeset/base/270201
 
 Log:
   Add arch-specific macro SFBUF_PHYS_DMAP(), which should translate the
   physical address of the page to direct map address, in case
   SFBUF_OPTIONAL_DIRECT_MAP returns true.  The case of PowerPC AIM
   64bit, where the page physical address is identical to the direct map
   address, is accidental.
Real use of this interposer is for sparc64 machines which can use direct
map due to usable cache implementation.

Could someone with the machine identified as SPARC64V test the following
patch ?  Just booting multiuser should be enough.

diff --git a/sys/sparc64/include/vmparam.h b/sys/sparc64/include/vmparam.h
index 8e7d76c..c2f30c3 100644
--- a/sys/sparc64/include/vmparam.h
+++ b/sys/sparc64/include/vmparam.h
@@ -241,5 +241,8 @@ extern vm_offset_t vm_max_kernel_address;
 
 #defineSFBUF
 #defineSFBUF_MAP
+#defineSFBUF_OPTIONAL_DIRECT_MAP   dcache_color_ignore
+#include machine/tlb.h
+#defineSFBUF_PHYS_DMAP(x)  TLB_PHYS_TO_DIRECT(x)
 
 #endif /* !_MACHINE_VMPARAM_H_ */


pgpvQrlyzvQ0A.pgp
Description: PGP signature


svn commit: r270206 - head/sys/net80211

2014-08-20 Thread Adrian Chadd
Author: adrian
Date: Wed Aug 20 09:10:03 2014
New Revision: 270206
URL: http://svnweb.freebsd.org/changeset/base/270206

Log:
  After much toying around with this AMRR initial rate stuff,
  I've decided that for 11n rates it's best to start (very) low and work
  our way up.
  
  So, from now on, the initial rate for AMRR 11n is MCS4.
  It doesn't try MCS12 or MCS20 - at low signal strengths those don't
  work very well at all.
  
  AMRR will step the rate control up over time if things work out better.
  
  Tested:
  
  * Intel 5100
  * Intel 5300 (using local diffs to test out 3x3 stream support)

Modified:
  head/sys/net80211/ieee80211_amrr.c

Modified: head/sys/net80211/ieee80211_amrr.c
==
--- head/sys/net80211/ieee80211_amrr.c  Wed Aug 20 08:24:37 2014
(r270205)
+++ head/sys/net80211/ieee80211_amrr.c  Wed Aug 20 09:10:03 2014
(r270206)
@@ -195,12 +195,13 @@ amrr_node_init(struct ieee80211_node *ni
rate = IEEE80211_RATE_VAL;
 
/* pick initial rate from the rateset - HT or otherwise */
+   /* Pick something low that's likely to succeed */
for (amn-amn_rix = rs-rs_nrates - 1; amn-amn_rix  0;
amn-amn_rix--) {
/* legacy - anything  36mbit, stop searching */
-   /* 11n - stop at MCS4 / MCS12 / MCS28 */
+   /* 11n - stop at MCS4 */
if (amrr_node_is_11n(ni)) {
-   if ((rs-rs_rates[amn-amn_rix]  0x7)  4)
+   if ((rs-rs_rates[amn-amn_rix]  0x1f)  4)
break;
} else if ((rs-rs_rates[amn-amn_rix]  IEEE80211_RATE_VAL) = 
72)
break;
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r270207 - head/sys/fs/autofs

2014-08-20 Thread Edward Tomasz Napierala
Author: trasz
Date: Wed Aug 20 13:46:51 2014
New Revision: 270207
URL: http://svnweb.freebsd.org/changeset/base/270207

Log:
  Rework .. lookup; previous one failed to properly busy the mountpoint.
  
  Reviewed by:  kib@
  MFC after:2 weeks
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/fs/autofs/autofs_vnops.c

Modified: head/sys/fs/autofs/autofs_vnops.c
==
--- head/sys/fs/autofs/autofs_vnops.c   Wed Aug 20 09:10:03 2014
(r270206)
+++ head/sys/fs/autofs/autofs_vnops.c   Wed Aug 20 13:46:51 2014
(r270207)
@@ -198,6 +198,15 @@ mounted:
 }
 
 static int
+autofs_vget_callback(struct mount *mp, void *arg, int lkflags __unused,
+struct vnode **vpp)
+{
+
+
+   return (autofs_node_vn(arg, mp, vpp));
+}
+
+static int
 autofs_lookup(struct vop_lookup_args *ap)
 {
struct vnode *dvp, *newvp, **vpp;
@@ -217,24 +226,19 @@ autofs_lookup(struct vop_lookup_args *ap
if (cnp-cn_flags  ISDOTDOT) {
KASSERT(anp-an_parent != NULL, (NULL parent));
/*
-* Note that in this case, dvp is the child vnode, and we are
-* looking up the parent vnode - exactly reverse from normal
-* operation.  To preserve lock order, we unlock the child
-* (dvp), obtain the lock on parent (*vpp) in autofs_node_vn(),
-* then relock the child.  We use vhold()/vdrop() to prevent
-* dvp from being freed in the meantime.
+* Note that in this case, dvp is the child vnode, and we
+* are looking up the parent vnode - exactly reverse from
+* normal operation.  Unlocking dvp requires some rather
+* tricky unlock/relock dance to prevent mp from being freed;
+* use vn_vget_ino_gen() which takes care of all that.
 */
-   lock_flags = VOP_ISLOCKED(dvp);
-   vhold(dvp);
-   VOP_UNLOCK(dvp, 0);
-   error = autofs_node_vn(anp-an_parent, mp, vpp);
+   error = vn_vget_ino_gen(dvp, autofs_vget_callback,
+   anp-an_parent, 0, vpp);
if (error != 0) {
-   AUTOFS_WARN(autofs_node_vn() failed with error %d,
+   AUTOFS_WARN(vn_vget_ino_gen() failed with error %d,
error);
+   return (error);
}
-   vn_lock(dvp, lock_flags | LK_RETRY);
-   vdrop(dvp);
-
return (error);
}
 
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r270209 - head/sbin/mount

2014-08-20 Thread Edward Tomasz Napierala
Author: trasz
Date: Wed Aug 20 13:52:47 2014
New Revision: 270209
URL: http://svnweb.freebsd.org/changeset/base/270209

Log:
  Add description for the automounted mount flag.
  
  Reviewed by:  emaste@
  MFC after:2 weeks
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sbin/mount/mount.8

Modified: head/sbin/mount/mount.8
==
--- head/sbin/mount/mount.8 Wed Aug 20 13:48:58 2014(r270208)
+++ head/sbin/mount/mount.8 Wed Aug 20 13:52:47 2014(r270209)
@@ -28,7 +28,7 @@
 .\ @(#)mount.88.8 (Berkeley) 6/16/94
 .\ $FreeBSD$
 .\
-.Dd June 6, 2011
+.Dd August 20, 2014
 .Dt MOUNT 8
 .Os
 .Sh NAME
@@ -150,6 +150,11 @@ For this reason, the
 .Cm async
 flag should be used sparingly, and only when some data recovery
 mechanism is present.
+.It Cm automounted
+This flag indicates that the file system was mounted by
+.Xr automountd 8 .
+Automounted file systems are automatically unmounted by
+.Xr autounmountd 8 .
 .It Cm current
 When used with the
 .Fl u
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r270210 - head/usr.sbin/autofs

2014-08-20 Thread Edward Tomasz Napierala
Author: trasz
Date: Wed Aug 20 13:54:27 2014
New Revision: 270210
URL: http://svnweb.freebsd.org/changeset/base/270210

Log:
  Remove useless - and buggy, it resulted in spurious warnings in logs - code.
  
  MFC after:2 weeks
  Sponsored by: The FreeBSD Foundation

Modified:
  head/usr.sbin/autofs/autounmountd.c

Modified: head/usr.sbin/autofs/autounmountd.c
==
--- head/usr.sbin/autofs/autounmountd.c Wed Aug 20 13:52:47 2014
(r270209)
+++ head/usr.sbin/autofs/autounmountd.c Wed Aug 20 13:54:27 2014
(r270210)
@@ -182,7 +182,6 @@ expire_automounted(double expiration_tim
time_t now;
double mounted_for, mounted_max = 0;
int error;
-   bool unmounted = false;
 
now = time(NULL);
 
@@ -211,20 +210,9 @@ expire_automounted(double expiration_tim
if (error != 0) {
if (mounted_for  mounted_max)
mounted_max = mounted_for;
-   } else {
-   unmounted = true;
}
}
 
-   if (unmounted) {
-   /*
-* Successful unmount of a filesystem could unbusy its parent
-* filesystem that can now be unmounted.
-*/
-   log_debugx(filesystem got unmounted; go around);
-   return (expire_automounted(expiration_time));
-   }
-
return (mounted_max);
 }
 
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


Re: svn commit: r265003 - head/secure/usr.sbin/sshd

2014-08-20 Thread Roger Pau Monné
On 27/04/14 07:28, Konstantin Belousov wrote:
 Author: kib
 Date: Sun Apr 27 05:28:14 2014
 New Revision: 265003
 URL: http://svnweb.freebsd.org/changeset/base/265003
 
 Log:
   Fix order of libthr and libc in the global dso list for sshd, by
   explicitely linking main binary with -lpthread.  Before, libthr
   appeared in the list due to dependency of one of the kerberos libs.
   Due to the change in ld(1) behaviour of not copying NEEDED entries
   from direct dependencies into the link results, the order becomes
   reversed.
   
   The libthr must appear before libc to properly interpose libc symbols
   and provide working rtld locks implementation.  The symptom was sshd
   hanging on rtld bind lock during nested symbol binding from a signal
   handler.
   
   Approved by:des (openssh maintainer)
   Sponsored by:   The FreeBSD Foundation
   MFC after:  1 week
 
 Modified:
   head/secure/usr.sbin/sshd/Makefile
 
 Modified: head/secure/usr.sbin/sshd/Makefile
 ==
 --- head/secure/usr.sbin/sshd/MakefileSun Apr 27 05:19:01 2014
 (r265002)
 +++ head/secure/usr.sbin/sshd/MakefileSun Apr 27 05:28:14 2014
 (r265003)
 @@ -57,6 +57,16 @@ CFLAGS+= -DNONE_CIPHER_ENABLED
  DPADD+= ${LIBCRYPT} ${LIBCRYPTO} ${LIBZ}
  LDADD+= -lcrypt -lcrypto -lz
  
 +# Fix the order of NEEDED entries for libthr and libc. The libthr
 +# needs to interpose libc symbols, leaving the libthr loading as
 +# dependency of krb causes reversed order and broken interposing. Put
 +# the threading library last on the linker command line, just before
 +# the -lc added by a compiler driver.
 +.if ${MK_KERBEROS_SUPPORT} != no
 +DPADD+= ${LIBPTHREAD}
 +LDADD+= -lpthread
 +.endif
 +
  .if defined(LOCALBASE)
  CFLAGS+= -DXAUTH_PATH=\${LOCALBASE}/bin/xauth\
  .endif

Hello,

This change makes the following simple test program fail on the second 
assert. The problem is that sa_handler == SIG_DFL, and sa_flags == 
SA_SIGINFO, which according to the sigaction(9) man page is not 
possible. With this change reverted the test is successful.

---
#include signal.h
#include string.h
#include assert.h

int main(int argn, char **argv)
{
struct sigaction new, old;
int rc;

memset(new, 0, sizeof(new));
memset(old, 0, sizeof(old));

sigemptyset(new.sa_mask);
new.sa_handler = SIG_DFL;
new.sa_flags = 0;

rc = sigaction(SIGCHLD, new, old);
assert(rc == 0);
assert((old.sa_handler == SIG_DFL || old.sa_handler == SIG_IGN) 
!(old.sa_flags  SA_SIGINFO));

return (0);
}


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


svn commit: r270211 - vendor/resolver/dist/lib/libc/nameser

2014-08-20 Thread Pedro F. Giffuni
Author: pfg
Date: Wed Aug 20 14:53:36 2014
New Revision: 270211
URL: http://svnweb.freebsd.org/changeset/base/270211

Log:
  Add missing break.
  
  CID:  603368

Modified:
  vendor/resolver/dist/lib/libc/nameser/ns_print.c

Modified: vendor/resolver/dist/lib/libc/nameser/ns_print.c
==
--- vendor/resolver/dist/lib/libc/nameser/ns_print.cWed Aug 20 13:54:27 
2014(r270210)
+++ vendor/resolver/dist/lib/libc/nameser/ns_print.cWed Aug 20 14:53:36 
2014(r270211)
@@ -900,6 +900,7 @@ ns_sprintrrf(const u_char *msg, size_t m
if (len  15)
T(addstr( ), 2, buf, buflen));
}
+   break;
}
 
case ns_t_ipseckey: {
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r270213 - stable/9/cddl/contrib/opensolaris/lib/libdtrace/common

2014-08-20 Thread Mark Johnston
Author: markj
Date: Wed Aug 20 14:57:21 2014
New Revision: 270213
URL: http://svnweb.freebsd.org/changeset/base/270213

Log:
  MFC r269524:
  Preserve the errno value of an ioctl before calling free(3). Previously,
  errno was very occasionally being clobbered, resulting in a bogus error from
  dt_consume() and thus an error from dtrace(1).

Modified:
  stable/9/cddl/contrib/opensolaris/lib/libdtrace/common/dt_consume.c
  stable/9/cddl/contrib/opensolaris/lib/libdtrace/common/dt_map.c
  stable/9/cddl/contrib/opensolaris/lib/libdtrace/common/dt_work.c
Directory Properties:
  stable/9/cddl/contrib/opensolaris/   (props changed)
  stable/9/cddl/contrib/opensolaris/lib/libdtrace/common/   (props changed)

Modified: stable/9/cddl/contrib/opensolaris/lib/libdtrace/common/dt_consume.c
==
--- stable/9/cddl/contrib/opensolaris/lib/libdtrace/common/dt_consume.c Wed Aug 
20 14:57:20 2014(r270212)
+++ stable/9/cddl/contrib/opensolaris/lib/libdtrace/common/dt_consume.c Wed Aug 
20 14:57:21 2014(r270213)
@@ -2555,7 +2555,7 @@ dt_get_buf(dtrace_hdl_t *dtp, int cpu, d
 {
dtrace_optval_t size;
dtrace_bufdesc_t *buf = dt_zalloc(dtp, sizeof (*buf));
-   int error;
+   int error, rval;
 
if (buf == NULL)
return (-1);
@@ -2574,7 +2574,6 @@ dt_get_buf(dtrace_hdl_t *dtp, int cpu, d
 #else
if (dt_ioctl(dtp, DTRACEIOC_BUFSNAP, buf) == -1) {
 #endif
-   dt_put_buf(dtp, buf);
/*
 * If we failed with ENOENT, it may be because the
 * CPU was unconfigured -- this is okay.  Any other
@@ -2582,10 +2581,12 @@ dt_get_buf(dtrace_hdl_t *dtp, int cpu, d
 */
if (errno == ENOENT) {
*bufp = NULL;
-   return (0);
-   }
+   rval = 0;
+   } else
+   rval = dt_set_errno(dtp, errno);
 
-   return (dt_set_errno(dtp, errno));
+   dt_put_buf(dtp, buf);
+   return (rval);
}
 
error = dt_unring_buf(dtp, buf);

Modified: stable/9/cddl/contrib/opensolaris/lib/libdtrace/common/dt_map.c
==
--- stable/9/cddl/contrib/opensolaris/lib/libdtrace/common/dt_map.c Wed Aug 
20 14:57:20 2014(r270212)
+++ stable/9/cddl/contrib/opensolaris/lib/libdtrace/common/dt_map.c Wed Aug 
20 14:57:21 2014(r270213)
@@ -39,7 +39,7 @@
 static int
 dt_strdata_add(dtrace_hdl_t *dtp, dtrace_recdesc_t *rec, void ***data, int 
*max)
 {
-   int maxformat;
+   int maxformat, rval;
dtrace_fmtdesc_t fmt;
void *result;
 
@@ -63,8 +63,9 @@ dt_strdata_add(dtrace_hdl_t *dtp, dtrace
return (dt_set_errno(dtp, EDT_NOMEM));
 
if (dt_ioctl(dtp, DTRACEIOC_FORMAT, fmt) == -1) {
+   rval = dt_set_errno(dtp, errno);
free(fmt.dtfd_string);
-   return (dt_set_errno(dtp, errno));
+   return (rval);
}
 
while (rec-dtrd_format  (maxformat = *max)) {

Modified: stable/9/cddl/contrib/opensolaris/lib/libdtrace/common/dt_work.c
==
--- stable/9/cddl/contrib/opensolaris/lib/libdtrace/common/dt_work.cWed Aug 
20 14:57:20 2014(r270212)
+++ stable/9/cddl/contrib/opensolaris/lib/libdtrace/common/dt_work.cWed Aug 
20 14:57:21 2014(r270213)
@@ -184,7 +184,7 @@ dtrace_go(dtrace_hdl_t *dtp)
 {
dtrace_enable_io_t args;
void *dof;
-   int err;
+   int error, r;
 
if (dtp-dt_active)
return (dt_set_errno(dtp, EINVAL));
@@ -206,11 +206,12 @@ dtrace_go(dtrace_hdl_t *dtp)
 
args.dof = dof;
args.n_matched = 0;
-   err = dt_ioctl(dtp, DTRACEIOC_ENABLE, args);
+   r = dt_ioctl(dtp, DTRACEIOC_ENABLE, args);
+   error = errno;
dtrace_dof_destroy(dtp, dof);
 
-   if (err == -1  (errno != ENOTTY || dtp-dt_vector == NULL))
-   return (dt_set_errno(dtp, errno));
+   if (r == -1  (error != ENOTTY || dtp-dt_vector == NULL))
+   return (dt_set_errno(dtp, error));
 
if (dt_ioctl(dtp, DTRACEIOC_GO, dtp-dt_beganon) == -1) {
if (errno == EACCES)
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r270215 - head/lib/libc/nameser

2014-08-20 Thread Pedro F. Giffuni
Author: pfg
Date: Wed Aug 20 14:58:25 2014
New Revision: 270215
URL: http://svnweb.freebsd.org/changeset/base/270215

Log:
  Add missing break.
  
  CID:  603368

Modified:
  head/lib/libc/nameser/ns_print.c

Modified: head/lib/libc/nameser/ns_print.c
==
--- head/lib/libc/nameser/ns_print.cWed Aug 20 14:57:55 2014
(r270214)
+++ head/lib/libc/nameser/ns_print.cWed Aug 20 14:58:25 2014
(r270215)
@@ -911,6 +911,7 @@ ns_sprintrrf(const u_char *msg, size_t m
if (len  15)
T(addstr( ), 2, buf, buflen));
}
+   break;
}
 
case ns_t_ipseckey: {
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r270212 - in head/sys: dev/pci ofed/include/linux

2014-08-20 Thread Roger Pau Monné
Author: royger
Date: Wed Aug 20 14:57:20 2014
New Revision: 270212
URL: http://svnweb.freebsd.org/changeset/base/270212

Log:
  pci: make MSI(-X) enable and disable methods of the PCI bus
  
  Make the functions pci_disable_msi, pci_enable_msi and pci_enable_msix
  methods of the newbus PCI bus. This code should not include any
  functional change.
  
  Sponsored by: Citrix Systems RD
  Reviewed by: imp, jhb
  Differential Revision: https://reviews.freebsd.org/D354
  
  dev/pci/pci.c:
   - Convert the mentioned functions to newbus methods.
   - Fix the callers of the converted functions.
  
  sys/dev/pci/pci_private.h:
  dev/pci/pci_if.m:
   - Declare the new methods.
  
  dev/pci/pcivar.h:
   - Add helpers to call the newbus methods.
  
  ofed/include/linux/pci.h:
   - Add define to prevent the ofed version of pci_enable_msix from
 clashing with the FreeBSD native version.

Modified:
  head/sys/dev/pci/pci.c
  head/sys/dev/pci/pci_if.m
  head/sys/dev/pci/pci_private.h
  head/sys/dev/pci/pcivar.h
  head/sys/ofed/include/linux/pci.h

Modified: head/sys/dev/pci/pci.c
==
--- head/sys/dev/pci/pci.c  Wed Aug 20 14:53:36 2014(r270211)
+++ head/sys/dev/pci/pci.c  Wed Aug 20 14:57:20 2014(r270212)
@@ -110,11 +110,6 @@ static int pci_write_vpd_reg(device_t p
int reg, uint32_t data);
 #endif
 static voidpci_read_vpd(device_t pcib, pcicfgregs *cfg);
-static voidpci_disable_msi(device_t dev);
-static voidpci_enable_msi(device_t dev, uint64_t address,
-   uint16_t data);
-static voidpci_enable_msix(device_t dev, u_int index,
-   uint64_t address, uint32_t data);
 static voidpci_mask_msix(device_t dev, u_int index);
 static voidpci_unmask_msix(device_t dev, u_int index);
 static int pci_msi_blacklisted(void);
@@ -180,6 +175,9 @@ static device_method_t pci_methods[] = {
DEVMETHOD(pci_find_htcap,   pci_find_htcap_method),
DEVMETHOD(pci_alloc_msi,pci_alloc_msi_method),
DEVMETHOD(pci_alloc_msix,   pci_alloc_msix_method),
+   DEVMETHOD(pci_enable_msi,   pci_enable_msi_method),
+   DEVMETHOD(pci_enable_msix,  pci_enable_msix_method),
+   DEVMETHOD(pci_disable_msi,  pci_disable_msi_method),
DEVMETHOD(pci_remap_msix,   pci_remap_msix_method),
DEVMETHOD(pci_release_msi,  pci_release_msi_method),
DEVMETHOD(pci_msi_count,pci_msi_count_method),
@@ -1343,9 +1341,10 @@ pci_find_extcap_method(device_t dev, dev
  * Support for MSI-X message interrupts.
  */
 void
-pci_enable_msix(device_t dev, u_int index, uint64_t address, uint32_t data)
+pci_enable_msix_method(device_t dev, device_t child, u_int index,
+uint64_t address, uint32_t data)
 {
-   struct pci_devinfo *dinfo = device_get_ivars(dev);
+   struct pci_devinfo *dinfo = device_get_ivars(child);
struct pcicfg_msix *msix = dinfo-cfg.msix;
uint32_t offset;
 
@@ -1356,7 +1355,7 @@ pci_enable_msix(device_t dev, u_int inde
bus_write_4(msix-msix_table_res, offset + 8, data);
 
/* Enable MSI - HT mapping. */
-   pci_ht_map_msi(dev, address);
+   pci_ht_map_msi(child, address);
 }
 
 void
@@ -1868,45 +1867,46 @@ pci_set_max_read_req(device_t dev, int s
  * Support for MSI message signalled interrupts.
  */
 void
-pci_enable_msi(device_t dev, uint64_t address, uint16_t data)
+pci_enable_msi_method(device_t dev, device_t child, uint64_t address,
+uint16_t data)
 {
-   struct pci_devinfo *dinfo = device_get_ivars(dev);
+   struct pci_devinfo *dinfo = device_get_ivars(child);
struct pcicfg_msi *msi = dinfo-cfg.msi;
 
/* Write data and address values. */
-   pci_write_config(dev, msi-msi_location + PCIR_MSI_ADDR,
+   pci_write_config(child, msi-msi_location + PCIR_MSI_ADDR,
address  0x, 4);
if (msi-msi_ctrl  PCIM_MSICTRL_64BIT) {
-   pci_write_config(dev, msi-msi_location + PCIR_MSI_ADDR_HIGH,
+   pci_write_config(child, msi-msi_location + PCIR_MSI_ADDR_HIGH,
address  32, 4);
-   pci_write_config(dev, msi-msi_location + PCIR_MSI_DATA_64BIT,
+   pci_write_config(child, msi-msi_location + PCIR_MSI_DATA_64BIT,
data, 2);
} else
-   pci_write_config(dev, msi-msi_location + PCIR_MSI_DATA, data,
+   pci_write_config(child, msi-msi_location + PCIR_MSI_DATA, data,
2);
 
/* Enable MSI in the control register. */
msi-msi_ctrl |= PCIM_MSICTRL_MSI_ENABLE;
-   pci_write_config(dev, msi-msi_location + PCIR_MSI_CTRL, msi-msi_ctrl,
-   2);
+   pci_write_config(child, msi-msi_location + PCIR_MSI_CTRL,
+   msi-msi_ctrl, 2);
 
/* Enable MSI - HT 

svn commit: r270214 - stable/10/cddl/contrib/opensolaris/lib/libdtrace/common

2014-08-20 Thread Mark Johnston
Author: markj
Date: Wed Aug 20 14:57:55 2014
New Revision: 270214
URL: http://svnweb.freebsd.org/changeset/base/270214

Log:
  MFC r269524:
  Preserve the errno value of an ioctl before calling free(3). Previously,
  errno was very occasionally being clobbered, resulting in a bogus error from
  dt_consume() and thus an error from dtrace(1).

Modified:
  stable/10/cddl/contrib/opensolaris/lib/libdtrace/common/dt_consume.c
  stable/10/cddl/contrib/opensolaris/lib/libdtrace/common/dt_map.c
  stable/10/cddl/contrib/opensolaris/lib/libdtrace/common/dt_work.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/cddl/contrib/opensolaris/lib/libdtrace/common/dt_consume.c
==
--- stable/10/cddl/contrib/opensolaris/lib/libdtrace/common/dt_consume.c
Wed Aug 20 14:57:21 2014(r270213)
+++ stable/10/cddl/contrib/opensolaris/lib/libdtrace/common/dt_consume.c
Wed Aug 20 14:57:55 2014(r270214)
@@ -2944,7 +2944,7 @@ dt_get_buf(dtrace_hdl_t *dtp, int cpu, d
 {
dtrace_optval_t size;
dtrace_bufdesc_t *buf = dt_zalloc(dtp, sizeof (*buf));
-   int error;
+   int error, rval;
 
if (buf == NULL)
return (-1);
@@ -2963,7 +2963,6 @@ dt_get_buf(dtrace_hdl_t *dtp, int cpu, d
 #else
if (dt_ioctl(dtp, DTRACEIOC_BUFSNAP, buf) == -1) {
 #endif
-   dt_put_buf(dtp, buf);
/*
 * If we failed with ENOENT, it may be because the
 * CPU was unconfigured -- this is okay.  Any other
@@ -2971,10 +2970,12 @@ dt_get_buf(dtrace_hdl_t *dtp, int cpu, d
 */
if (errno == ENOENT) {
*bufp = NULL;
-   return (0);
-   }
+   rval = 0;
+   } else
+   rval = dt_set_errno(dtp, errno);
 
-   return (dt_set_errno(dtp, errno));
+   dt_put_buf(dtp, buf);
+   return (rval);
}
 
error = dt_unring_buf(dtp, buf);

Modified: stable/10/cddl/contrib/opensolaris/lib/libdtrace/common/dt_map.c
==
--- stable/10/cddl/contrib/opensolaris/lib/libdtrace/common/dt_map.cWed Aug 
20 14:57:21 2014(r270213)
+++ stable/10/cddl/contrib/opensolaris/lib/libdtrace/common/dt_map.cWed Aug 
20 14:57:55 2014(r270214)
@@ -39,7 +39,7 @@
 static int
 dt_strdata_add(dtrace_hdl_t *dtp, dtrace_recdesc_t *rec, void ***data, int 
*max)
 {
-   int maxformat;
+   int maxformat, rval;
dtrace_fmtdesc_t fmt;
void *result;
 
@@ -63,8 +63,9 @@ dt_strdata_add(dtrace_hdl_t *dtp, dtrace
return (dt_set_errno(dtp, EDT_NOMEM));
 
if (dt_ioctl(dtp, DTRACEIOC_FORMAT, fmt) == -1) {
+   rval = dt_set_errno(dtp, errno);
free(fmt.dtfd_string);
-   return (dt_set_errno(dtp, errno));
+   return (rval);
}
 
while (rec-dtrd_format  (maxformat = *max)) {

Modified: stable/10/cddl/contrib/opensolaris/lib/libdtrace/common/dt_work.c
==
--- stable/10/cddl/contrib/opensolaris/lib/libdtrace/common/dt_work.c   Wed Aug 
20 14:57:21 2014(r270213)
+++ stable/10/cddl/contrib/opensolaris/lib/libdtrace/common/dt_work.c   Wed Aug 
20 14:57:55 2014(r270214)
@@ -184,7 +184,7 @@ dtrace_go(dtrace_hdl_t *dtp)
 {
dtrace_enable_io_t args;
void *dof;
-   int err;
+   int error, r;
 
if (dtp-dt_active)
return (dt_set_errno(dtp, EINVAL));
@@ -206,11 +206,12 @@ dtrace_go(dtrace_hdl_t *dtp)
 
args.dof = dof;
args.n_matched = 0;
-   err = dt_ioctl(dtp, DTRACEIOC_ENABLE, args);
+   r = dt_ioctl(dtp, DTRACEIOC_ENABLE, args);
+   error = errno;
dtrace_dof_destroy(dtp, dof);
 
-   if (err == -1  (errno != ENOTTY || dtp-dt_vector == NULL))
-   return (dt_set_errno(dtp, errno));
+   if (r == -1  (error != ENOTTY || dtp-dt_vector == NULL))
+   return (dt_set_errno(dtp, error));
 
if (dt_ioctl(dtp, DTRACEIOC_GO, dtp-dt_beganon) == -1) {
if (errno == EACCES)
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


Re: svn commit: r265003 - head/secure/usr.sbin/sshd

2014-08-20 Thread Konstantin Belousov
On Wed, Aug 20, 2014 at 04:41:05PM +0200, Roger Pau Monn?? wrote:
 On 27/04/14 07:28, Konstantin Belousov wrote:
  Author: kib
  Date: Sun Apr 27 05:28:14 2014
  New Revision: 265003
  URL: http://svnweb.freebsd.org/changeset/base/265003
  
  Log:
Fix order of libthr and libc in the global dso list for sshd, by
explicitely linking main binary with -lpthread.  Before, libthr
appeared in the list due to dependency of one of the kerberos libs.
Due to the change in ld(1) behaviour of not copying NEEDED entries
from direct dependencies into the link results, the order becomes
reversed.

The libthr must appear before libc to properly interpose libc symbols
and provide working rtld locks implementation.  The symptom was sshd
hanging on rtld bind lock during nested symbol binding from a signal
handler.

Approved by:  des (openssh maintainer)
Sponsored by: The FreeBSD Foundation
MFC after:1 week
  
  Modified:
head/secure/usr.sbin/sshd/Makefile
  
  Modified: head/secure/usr.sbin/sshd/Makefile
  ==
  --- head/secure/usr.sbin/sshd/Makefile  Sun Apr 27 05:19:01 2014
  (r265002)
  +++ head/secure/usr.sbin/sshd/Makefile  Sun Apr 27 05:28:14 2014
  (r265003)
  @@ -57,6 +57,16 @@ CFLAGS+= -DNONE_CIPHER_ENABLED
   DPADD+= ${LIBCRYPT} ${LIBCRYPTO} ${LIBZ}
   LDADD+= -lcrypt -lcrypto -lz
   
  +# Fix the order of NEEDED entries for libthr and libc. The libthr
  +# needs to interpose libc symbols, leaving the libthr loading as
  +# dependency of krb causes reversed order and broken interposing. Put
  +# the threading library last on the linker command line, just before
  +# the -lc added by a compiler driver.
  +.if ${MK_KERBEROS_SUPPORT} != no
  +DPADD+= ${LIBPTHREAD}
  +LDADD+= -lpthread
  +.endif
  +
   .if defined(LOCALBASE)
   CFLAGS+= -DXAUTH_PATH=\${LOCALBASE}/bin/xauth\
   .endif
 
 Hello,
 
 This change makes the following simple test program fail on the second 
 assert. The problem is that sa_handler == SIG_DFL, and sa_flags == 
 SA_SIGINFO, which according to the sigaction(9) man page is not 
 possible. With this change reverted the test is successful.
I do not quite follow.

What are the relations between sshd and your test program ?
Should the test be run somehow specially ?

 
 ---
 #include signal.h
 #include string.h
 #include assert.h
 
 int main(int argn, char **argv)
 {
 struct sigaction new, old;
 int rc;
 
 memset(new, 0, sizeof(new));
 memset(old, 0, sizeof(old));
 
 sigemptyset(new.sa_mask);
 new.sa_handler = SIG_DFL;
 new.sa_flags = 0;
 
 rc = sigaction(SIGCHLD, new, old);
 assert(rc == 0);
 assert((old.sa_handler == SIG_DFL || old.sa_handler == SIG_IGN) 
 !(old.sa_flags  SA_SIGINFO));
 
 return (0);
 }
 


pgpv1KXQIdCjW.pgp
Description: PGP signature


Re: svn commit: r265003 - head/secure/usr.sbin/sshd

2014-08-20 Thread Roger Pau Monné
On 20/08/14 17:13, Konstantin Belousov wrote:
 On Wed, Aug 20, 2014 at 04:41:05PM +0200, Roger Pau Monn?? wrote:
 On 27/04/14 07:28, Konstantin Belousov wrote:
 Author: kib
 Date: Sun Apr 27 05:28:14 2014
 New Revision: 265003
 URL: http://svnweb.freebsd.org/changeset/base/265003

 Log:
   Fix order of libthr and libc in the global dso list for sshd, by
   explicitely linking main binary with -lpthread.  Before, libthr
   appeared in the list due to dependency of one of the kerberos libs.
   Due to the change in ld(1) behaviour of not copying NEEDED entries
   from direct dependencies into the link results, the order becomes
   reversed.
   
   The libthr must appear before libc to properly interpose libc symbols
   and provide working rtld locks implementation.  The symptom was sshd
   hanging on rtld bind lock during nested symbol binding from a signal
   handler.
   
   Approved by:  des (openssh maintainer)
   Sponsored by: The FreeBSD Foundation
   MFC after:1 week

 Modified:
   head/secure/usr.sbin/sshd/Makefile

 Modified: head/secure/usr.sbin/sshd/Makefile
 ==
 --- head/secure/usr.sbin/sshd/Makefile  Sun Apr 27 05:19:01 2014
 (r265002)
 +++ head/secure/usr.sbin/sshd/Makefile  Sun Apr 27 05:28:14 2014
 (r265003)
 @@ -57,6 +57,16 @@ CFLAGS+= -DNONE_CIPHER_ENABLED
  DPADD+= ${LIBCRYPT} ${LIBCRYPTO} ${LIBZ}
  LDADD+= -lcrypt -lcrypto -lz
  
 +# Fix the order of NEEDED entries for libthr and libc. The libthr
 +# needs to interpose libc symbols, leaving the libthr loading as
 +# dependency of krb causes reversed order and broken interposing. Put
 +# the threading library last on the linker command line, just before
 +# the -lc added by a compiler driver.
 +.if ${MK_KERBEROS_SUPPORT} != no
 +DPADD+= ${LIBPTHREAD}
 +LDADD+= -lpthread
 +.endif
 +
  .if defined(LOCALBASE)
  CFLAGS+= -DXAUTH_PATH=\${LOCALBASE}/bin/xauth\
  .endif

 Hello,

 This change makes the following simple test program fail on the second 
 assert. The problem is that sa_handler == SIG_DFL, and sa_flags == 
 SA_SIGINFO, which according to the sigaction(9) man page is not 
 possible. With this change reverted the test is successful.
 I do not quite follow.
 
 What are the relations between sshd and your test program ?
 Should the test be run somehow specially ?

No, and frankly that's what I don't understand. I compile this simple
test with `cc -o test test.c`. It fails with this commit applied, and
succeeds without it.

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


Re: svn commit: r265003 - head/secure/usr.sbin/sshd

2014-08-20 Thread Bryan Drewery
On 8/20/2014 10:19 AM, Roger Pau Monné wrote:
 On 20/08/14 17:13, Konstantin Belousov wrote:
 On Wed, Aug 20, 2014 at 04:41:05PM +0200, Roger Pau Monn?? wrote:
 On 27/04/14 07:28, Konstantin Belousov wrote:
 Author: kib
 Date: Sun Apr 27 05:28:14 2014
 New Revision: 265003
 URL: http://svnweb.freebsd.org/changeset/base/265003

 Log:
   Fix order of libthr and libc in the global dso list for sshd, by
   explicitely linking main binary with -lpthread.  Before, libthr
   appeared in the list due to dependency of one of the kerberos libs.
   Due to the change in ld(1) behaviour of not copying NEEDED entries
   from direct dependencies into the link results, the order becomes
   reversed.
   
   The libthr must appear before libc to properly interpose libc symbols
   and provide working rtld locks implementation.  The symptom was sshd
   hanging on rtld bind lock during nested symbol binding from a signal
   handler.
   
   Approved by: des (openssh maintainer)
   Sponsored by:The FreeBSD Foundation
   MFC after:   1 week

 Modified:
   head/secure/usr.sbin/sshd/Makefile

 Modified: head/secure/usr.sbin/sshd/Makefile
 ==
 --- head/secure/usr.sbin/sshd/Makefile Sun Apr 27 05:19:01 2014
 (r265002)
 +++ head/secure/usr.sbin/sshd/Makefile Sun Apr 27 05:28:14 2014
 (r265003)
 @@ -57,6 +57,16 @@ CFLAGS+= -DNONE_CIPHER_ENABLED
  DPADD+= ${LIBCRYPT} ${LIBCRYPTO} ${LIBZ}
  LDADD+= -lcrypt -lcrypto -lz
  
 +# Fix the order of NEEDED entries for libthr and libc. The libthr
 +# needs to interpose libc symbols, leaving the libthr loading as
 +# dependency of krb causes reversed order and broken interposing. Put
 +# the threading library last on the linker command line, just before
 +# the -lc added by a compiler driver.
 +.if ${MK_KERBEROS_SUPPORT} != no
 +DPADD+= ${LIBPTHREAD}
 +LDADD+= -lpthread
 +.endif
 +
  .if defined(LOCALBASE)
  CFLAGS+= -DXAUTH_PATH=\${LOCALBASE}/bin/xauth\
  .endif

 Hello,

 This change makes the following simple test program fail on the second 
 assert. The problem is that sa_handler == SIG_DFL, and sa_flags == 
 SA_SIGINFO, which according to the sigaction(9) man page is not 
 possible. With this change reverted the test is successful.
 I do not quite follow.

 What are the relations between sshd and your test program ?
 Should the test be run somehow specially ?
 
 No, and frankly that's what I don't understand. I compile this simple
 test with `cc -o test test.c`. It fails with this commit applied, and
 succeeds without it.
 
 Roger.
 

Does it fail if you do not connect with ssh?

-- 
Regards,
Bryan Drewery



signature.asc
Description: OpenPGP digital signature


Re: svn commit: r265003 - head/secure/usr.sbin/sshd

2014-08-20 Thread Roger Pau Monné
On 20/08/14 17:28, Bryan Drewery wrote:
 On 8/20/2014 10:19 AM, Roger Pau Monné wrote:
 On 20/08/14 17:13, Konstantin Belousov wrote:
 On Wed, Aug 20, 2014 at 04:41:05PM +0200, Roger Pau Monn?? wrote:
 On 27/04/14 07:28, Konstantin Belousov wrote:
 Author: kib
 Date: Sun Apr 27 05:28:14 2014
 New Revision: 265003
 URL: http://svnweb.freebsd.org/changeset/base/265003

 Log:
   Fix order of libthr and libc in the global dso list for sshd, by
   explicitely linking main binary with -lpthread.  Before, libthr
   appeared in the list due to dependency of one of the kerberos libs.
   Due to the change in ld(1) behaviour of not copying NEEDED entries
   from direct dependencies into the link results, the order becomes
   reversed.
   
   The libthr must appear before libc to properly interpose libc symbols
   and provide working rtld locks implementation.  The symptom was sshd
   hanging on rtld bind lock during nested symbol binding from a signal
   handler.
   
   Approved by:des (openssh maintainer)
   Sponsored by:   The FreeBSD Foundation
   MFC after:  1 week

 Modified:
   head/secure/usr.sbin/sshd/Makefile

 Modified: head/secure/usr.sbin/sshd/Makefile
 ==
 --- head/secure/usr.sbin/sshd/MakefileSun Apr 27 05:19:01 2014
 (r265002)
 +++ head/secure/usr.sbin/sshd/MakefileSun Apr 27 05:28:14 2014
 (r265003)
 @@ -57,6 +57,16 @@ CFLAGS+= -DNONE_CIPHER_ENABLED
  DPADD+= ${LIBCRYPT} ${LIBCRYPTO} ${LIBZ}
  LDADD+= -lcrypt -lcrypto -lz
  
 +# Fix the order of NEEDED entries for libthr and libc. The libthr
 +# needs to interpose libc symbols, leaving the libthr loading as
 +# dependency of krb causes reversed order and broken interposing. Put
 +# the threading library last on the linker command line, just before
 +# the -lc added by a compiler driver.
 +.if ${MK_KERBEROS_SUPPORT} != no
 +DPADD+= ${LIBPTHREAD}
 +LDADD+= -lpthread
 +.endif
 +
  .if defined(LOCALBASE)
  CFLAGS+= -DXAUTH_PATH=\${LOCALBASE}/bin/xauth\
  .endif

 Hello,

 This change makes the following simple test program fail on the second 
 assert. The problem is that sa_handler == SIG_DFL, and sa_flags == 
 SA_SIGINFO, which according to the sigaction(9) man page is not 
 possible. With this change reverted the test is successful.
 I do not quite follow.

 What are the relations between sshd and your test program ?
 Should the test be run somehow specially ?

 No, and frankly that's what I don't understand. I compile this simple
 test with `cc -o test test.c`. It fails with this commit applied, and
 succeeds without it.

 Roger.

 
 Does it fail if you do not connect with ssh?

Right, it works fine from the serial console, fails when executed from ssh.

Roger.

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


svn commit: r270216 - head/gnu/lib/libgcc

2014-08-20 Thread Garrett Cooper
Author: ngie
Date: Wed Aug 20 15:43:26 2014
New Revision: 270216
URL: http://svnweb.freebsd.org/changeset/base/270216

Log:
  Add ${LIBC} to DPADD to fix make checkdpadd
  
  Phabric: D632
  Approved by: jmmv (mentor)
  MFC after: 2 weeks

Modified:
  head/gnu/lib/libgcc/Makefile

Modified: head/gnu/lib/libgcc/Makefile
==
--- head/gnu/lib/libgcc/MakefileWed Aug 20 14:58:25 2014
(r270215)
+++ head/gnu/lib/libgcc/MakefileWed Aug 20 15:43:26 2014
(r270216)
@@ -28,6 +28,7 @@ CFLAGS+=  -DIN_GCC -DIN_LIBGCC2 -D__GCC_F
-I${.CURDIR}/../../usr.bin/cc/cc_tools
 
 LDFLAGS+=  -nodefaultlibs
+DPADD+=${LIBC}
 LDADD+=-lc
 
 OBJS=  # added to below in various ways depending on TARGET_CPUARCH
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r270221 - head/sys/security/audit

2014-08-20 Thread Davide Italiano
Author: davide
Date: Wed Aug 20 16:04:30 2014
New Revision: 270221
URL: http://svnweb.freebsd.org/changeset/base/270221

Log:
  Replace dev_clone with cdevpriv(9) KPI in audit_pipe code.
  This is (yet another) step towards the removal of device
  cloning from our kernel.
  
  CR:   https://reviews.freebsd.org/D441
  Reviewed by:  kib, rwatson
  Tested by:pho

Modified:
  head/sys/security/audit/audit_pipe.c

Modified: head/sys/security/audit/audit_pipe.c
==
--- head/sys/security/audit/audit_pipe.cWed Aug 20 15:57:52 2014
(r270220)
+++ head/sys/security/audit/audit_pipe.cWed Aug 20 16:04:30 2014
(r270221)
@@ -112,7 +112,6 @@ struct audit_pipe_preselect {
 #defineAUDIT_PIPE_ASYNC0x0001
 #defineAUDIT_PIPE_NBIO 0x0002
 struct audit_pipe {
-   int  ap_open;   /* Device open? */
u_intap_flags;
 
struct selinfo   ap_selinfo;
@@ -205,6 +204,7 @@ static struct rwlock audit_pipe_lock;
 
 #defineAUDIT_PIPE_LIST_LOCK_INIT() rw_init(audit_pipe_lock, \
audit_pipe_list_lock)
+#defineAUDIT_PIPE_LIST_LOCK_DESTROY()  rw_destroy(audit_pipe_lock)
 #defineAUDIT_PIPE_LIST_RLOCK() rw_rlock(audit_pipe_lock)
 #defineAUDIT_PIPE_LIST_RUNLOCK()   rw_runlock(audit_pipe_lock)
 #defineAUDIT_PIPE_LIST_WLOCK() rw_wlock(audit_pipe_lock)
@@ -213,11 +213,11 @@ static struct rwlock   audit_pipe_lock;
 #defineAUDIT_PIPE_LIST_WUNLOCK()   rw_wunlock(audit_pipe_lock)
 
 /*
- * Cloning related variables and constants.
+ * Audit pipe device.
  */
-#defineAUDIT_PIPE_NAME auditpipe
-static eventhandler_tag audit_pipe_eh_tag;
-static struct clonedevs*audit_pipe_clones;
+static struct cdev *audit_pipe_dev;
+
+#define AUDIT_PIPE_NAMEauditpipe
 
 /*
  * Special device methods and definition.
@@ -231,7 +231,6 @@ static d_kqfilter_t audit_pipe_kqfilter;
 
 static struct cdevsw   audit_pipe_cdevsw = {
.d_version =D_VERSION,
-   .d_flags =  D_NEEDMINOR,
.d_open =   audit_pipe_open,
.d_close =  audit_pipe_close,
.d_read =   audit_pipe_read,
@@ -572,8 +571,6 @@ audit_pipe_alloc(void)
 {
struct audit_pipe *ap;
 
-   AUDIT_PIPE_LIST_WLOCK_ASSERT();
-
ap = malloc(sizeof(*ap), M_AUDIT_PIPE, M_NOWAIT | M_ZERO);
if (ap == NULL)
return (NULL);
@@ -599,9 +596,11 @@ audit_pipe_alloc(void)
/*
 * Add to global list and update global statistics.
 */
+   AUDIT_PIPE_LIST_WLOCK();
TAILQ_INSERT_HEAD(audit_pipe_list, ap, ap_list);
audit_pipe_count++;
audit_pipe_ever++;
+   AUDIT_PIPE_LIST_WUNLOCK();
 
return (ap);
 }
@@ -653,28 +652,16 @@ audit_pipe_free(struct audit_pipe *ap)
audit_pipe_count--;
 }
 
-/*
- * Audit pipe clone routine -- provide specific requested audit pipe, or a
- * fresh one if a specific one is not requested.
- */
 static void
-audit_pipe_clone(void *arg, struct ucred *cred, char *name, int namelen,
-struct cdev **dev)
+audit_pipe_dtor(void *arg)
 {
-   int i, u;
-
-   if (*dev != NULL)
-   return;
-
-   if (strcmp(name, AUDIT_PIPE_NAME) == 0)
-   u = -1;
-   else if (dev_stdclone(name, NULL, AUDIT_PIPE_NAME, u) != 1)
-   return;
+   struct audit_pipe *ap;
 
-   i = clone_create(audit_pipe_clones, audit_pipe_cdevsw, u, dev, 0);
-   if (i)
-   *dev = make_dev_credf(MAKEDEV_REF, audit_pipe_cdevsw, u, cred,
-   UID_ROOT, GID_WHEEL, 0600, %s%d, AUDIT_PIPE_NAME, u);
+   ap = arg;
+   AUDIT_PIPE_LIST_WLOCK();
+   AUDIT_PIPE_LOCK(ap);
+   audit_pipe_free(ap);
+   AUDIT_PIPE_LIST_WUNLOCK();
 }
 
 /*
@@ -686,24 +673,19 @@ static int
 audit_pipe_open(struct cdev *dev, int oflags, int devtype, struct thread *td)
 {
struct audit_pipe *ap;
+   int error;
 
-   AUDIT_PIPE_LIST_WLOCK();
-   ap = dev-si_drv1;
+   ap = audit_pipe_alloc();
if (ap == NULL) {
-   ap = audit_pipe_alloc();
-   if (ap == NULL) {
-   AUDIT_PIPE_LIST_WUNLOCK();
-   return (ENOMEM);
-   }
-   dev-si_drv1 = ap;
-   } else {
-   KASSERT(ap-ap_open, (audit_pipe_open: ap  !ap_open));
-   AUDIT_PIPE_LIST_WUNLOCK();
-   return (EBUSY);
+   return (ENOMEM);
}
-   ap-ap_open = 1;/* No lock required yet. */
-   AUDIT_PIPE_LIST_WUNLOCK();
fsetown(td-td_proc-p_pid, ap-ap_sigio);
+   error = devfs_set_cdevpriv(ap, audit_pipe_dtor);
+   if (error != 0) {
+   

svn commit: r270222 - head/sys/sys

2014-08-20 Thread John Baldwin
Author: jhb
Date: Wed Aug 20 16:05:15 2014
New Revision: 270222
URL: http://svnweb.freebsd.org/changeset/base/270222

Log:
  Bump the default size of cpuset_t masks in userland from 128 bits to 256.
  
  This should not be an ABI change since the various public APIs that use
  cpusets all include an explicit size parameter in addition to the cpuset
  parameter.
  
  MFC after:1 week

Modified:
  head/sys/sys/_cpuset.h

Modified: head/sys/sys/_cpuset.h
==
--- head/sys/sys/_cpuset.h  Wed Aug 20 16:04:30 2014(r270221)
+++ head/sys/sys/_cpuset.h  Wed Aug 20 16:05:15 2014(r270222)
@@ -38,7 +38,7 @@
 #defineCPU_SETSIZE MAXCPU
 #endif
 
-#defineCPU_MAXSIZE 128
+#defineCPU_MAXSIZE 256
 
 #ifndefCPU_SETSIZE
 #defineCPU_SETSIZE CPU_MAXSIZE
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r270223 - head/sys/amd64/include

2014-08-20 Thread John Baldwin
Author: jhb
Date: Wed Aug 20 16:06:24 2014
New Revision: 270223
URL: http://svnweb.freebsd.org/changeset/base/270223

Log:
  Bump MAXCPU on amd64 from 64 to 256.  In practice APIC only permits 255
  CPUs (IDs 0 through 254).  Getting above that limit requires x2APIC.
  
  MFC after:1 month

Modified:
  head/sys/amd64/include/param.h

Modified: head/sys/amd64/include/param.h
==
--- head/sys/amd64/include/param.h  Wed Aug 20 16:05:15 2014
(r270222)
+++ head/sys/amd64/include/param.h  Wed Aug 20 16:06:24 2014
(r270223)
@@ -65,7 +65,7 @@
 
 #if defined(SMP) || defined(KLD_MODULE)
 #ifndef MAXCPU
-#define MAXCPU 64
+#define MAXCPU 256
 #endif
 #else
 #define MAXCPU 1
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r270224 - in head/sys: amd64/conf dev/si i386/conf

2014-08-20 Thread John Baldwin
Author: jhb
Date: Wed Aug 20 16:07:17 2014
New Revision: 270224
URL: http://svnweb.freebsd.org/changeset/base/270224

Log:
  Fix build of si(4) and enable it in LINT on amd64 and i386.

Modified:
  head/sys/amd64/conf/NOTES
  head/sys/dev/si/si.c
  head/sys/i386/conf/NOTES

Modified: head/sys/amd64/conf/NOTES
==
--- head/sys/amd64/conf/NOTES   Wed Aug 20 16:06:24 2014(r270223)
+++ head/sys/amd64/conf/NOTES   Wed Aug 20 16:07:17 2014(r270224)
@@ -521,7 +521,7 @@ hint.pbio.0.port=0x360
 device smbios
 device vpd
 device asmc
-#devicesi
+device si
 device tpm
 device padlock_rng # VIA Padlock RNG
 device rdrand_rng  # Intel Bull Mountain RNG

Modified: head/sys/dev/si/si.c
==
--- head/sys/dev/si/si.cWed Aug 20 16:06:24 2014(r270223)
+++ head/sys/dev/si/si.cWed Aug 20 16:07:17 2014(r270224)
@@ -36,9 +36,9 @@
 __FBSDID($FreeBSD$);
 
 #ifndef lint
-static const char si_copyright1[] =  @(#) Copyright (C) Specialix 
International, 1990,1992,1998,
- si_copyright2[] =  @(#) Copyright (C) Andy Rutter 1993,
- si_copyright3[] =  @(#) Copyright (C) Peter Wemm 2000;
+__IDSTRING(si_copyright1, @(#) Copyright (C) Specialix International, 
1990,1992,1998);
+__IDSTRING(si_copyright2, @(#) Copyright (C) Andy Rutter 1993);
+__IDSTRING(si_copyright3, @(#) Copyright (C) Peter Wemm 2000);
 #endif /* not lint */
 
 #include opt_compat.h

Modified: head/sys/i386/conf/NOTES
==
--- head/sys/i386/conf/NOTESWed Aug 20 16:06:24 2014(r270223)
+++ head/sys/i386/conf/NOTESWed Aug 20 16:07:17 2014(r270224)
@@ -871,7 +871,7 @@ device  spic
 hint.spic.0.at=isa
 hint.spic.0.port=0x10a0
 device asmc
-#devicesi
+device si
 device tpm
 device padlock_rng # VIA Padlock RNG
 device rdrand_rng  # Intel Bull Mountain RNG
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r270225 - head/sys/cam/scsi

2014-08-20 Thread John Baldwin
Author: jhb
Date: Wed Aug 20 16:07:56 2014
New Revision: 270225
URL: http://svnweb.freebsd.org/changeset/base/270225

Log:
  Unexpand TAILQ_FOREACH().

Modified:
  head/sys/cam/scsi/scsi_low.c

Modified: head/sys/cam/scsi/scsi_low.c
==
--- head/sys/cam/scsi/scsi_low.cWed Aug 20 16:07:17 2014
(r270224)
+++ head/sys/cam/scsi/scsi_low.cWed Aug 20 16:07:56 2014
(r270225)
@@ -326,15 +326,13 @@ scsi_low_find_ccb(slp, target, lun, osde
if ((cb = slp-sl_Qnexus) != NULL  cb-osdep == osdep)
return cb;
 
-   for (cb = TAILQ_FIRST(slp-sl_start); cb != NULL;
-cb = TAILQ_NEXT(cb, ccb_chain))
+   TAILQ_FOREACH(cb, slp-sl_start, ccb_chain)
{
if (cb-osdep == osdep)
return cb;
}
 
-   for (cb = TAILQ_FIRST(li-li_discq); cb != NULL;
-cb = TAILQ_NEXT(cb, ccb_chain))
+   TAILQ_FOREACH(cb, li-li_discq, ccb_chain)
{
if (cb-osdep == osdep)
return cb;
@@ -4184,8 +4182,7 @@ scsi_low_info(slp, ti, s)
printf( SCSI_LOW_INFO(0x%lx): %s\n, (u_long) slp-sl_Tnexus, s);
if (ti == NULL)
{
-   for (ti = TAILQ_FIRST(slp-sl_titab); ti != NULL;
-ti = TAILQ_NEXT(ti, ti_chain))
+   TAILQ_FOREACH(ti, slp-sl_titab, ti_chain)
{
scsi_low_print(slp, ti);
}
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r270226 - in head/sys/modules: . si wds wl

2014-08-20 Thread John Baldwin
Author: jhb
Date: Wed Aug 20 16:09:05 2014
New Revision: 270226
URL: http://svnweb.freebsd.org/changeset/base/270226

Log:
  Add kernel modules for si(4), wds(4), and wl(4).

Added:
  head/sys/modules/si/
  head/sys/modules/si/Makefile   (contents, props changed)
  head/sys/modules/wds/
  head/sys/modules/wds/Makefile   (contents, props changed)
  head/sys/modules/wl/
  head/sys/modules/wl/Makefile   (contents, props changed)
Modified:
  head/sys/modules/Makefile

Modified: head/sys/modules/Makefile
==
--- head/sys/modules/Makefile   Wed Aug 20 16:07:56 2014(r270225)
+++ head/sys/modules/Makefile   Wed Aug 20 16:09:05 2014(r270226)
@@ -310,6 +310,7 @@ SUBDIR= \
${_sf} \
${_sfxge} \
sge \
+   ${_si} \
siba_bwn \
siftr \
siis \
@@ -364,7 +365,9 @@ SUBDIR= \
${_vxge} \
wb \
${_wbwd} \
+   ${_wds} \
${_wi} \
+   ${_wl} \
wlan \
wlan_acl \
wlan_amrr \
@@ -547,6 +550,7 @@ _rdma=  rdma
 _safe= safe
 _sbni= sbni
 _scsi_low= scsi_low
+_si=   si
 _smbfs=smbfs
 _sound=sound
 _speaker=  speaker
@@ -557,6 +561,7 @@ _streams=   streams
 _svr4= svr4
 _vxge= vxge
 _wbwd= wbwd
+_wds=  wds
 _wi=   wi
 _xe=   xe
 .if ${MK_ZFS} != no || defined(ALL_MODULES)
@@ -625,6 +630,7 @@ _nvram= nvram
 _nxge= nxge
 _tpm=  tpm
 _viawd=viawd
+_wl=   wl
 _wpi=  wpi
 .if ${MK_SOURCELESS_UCODE} != no
 _wpifw=wpifw
@@ -757,6 +763,7 @@ _s3=s3
 _safe= safe
 _scsi_low= scsi_low
 _sfxge=sfxge
+_si=   si
 _smbfs=smbfs
 _sound=sound
 _speaker=  speaker

Added: head/sys/modules/si/Makefile
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/modules/si/MakefileWed Aug 20 16:09:05 2014
(r270226)
@@ -0,0 +1,10 @@
+# $FreeBSD$
+
+.PATH: ${.CURDIR}/../../dev/si
+
+KMOD=  si
+SRCS=  si.c si2_z280.c si3_t225.c si_eisa.c si_isa.c si_pci.c
+SRCS+= bus_if.h device_if.h eisa_if.h isa_if.h pci_if.h
+SRCS+= opt_compat.h opt_debug_si.h opt_eisa.h
+
+.include bsd.kmod.mk

Added: head/sys/modules/wds/Makefile
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/modules/wds/Makefile   Wed Aug 20 16:09:05 2014
(r270226)
@@ -0,0 +1,10 @@
+# $FreeBSD$
+
+.PATH: ${.CURDIR}/../../dev/wds
+
+KMOD=  wds
+SRCS=  wd7000.c
+SRCS+= bus_if.h device_if.h isa_if.h
+SRCS+= opt_cam.h
+
+.include bsd.kmod.mk

Added: head/sys/modules/wl/Makefile
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/modules/wl/MakefileWed Aug 20 16:09:05 2014
(r270226)
@@ -0,0 +1,10 @@
+# $FreeBSD$
+
+.PATH: ${.CURDIR}/../../dev/wl
+
+KMOD=  if_wl
+SRCS=  if_wl.c
+SRCS+= bus_if.h device_if.h isa_if.h
+SRCS+= opt_inet.h opt_wavelan.h
+
+.include bsd.kmod.mk
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r270227 - head/sys/sys

2014-08-20 Thread Davide Italiano
Author: davide
Date: Wed Aug 20 16:32:02 2014
New Revision: 270227
URL: http://svnweb.freebsd.org/changeset/base/270227

Log:
  Make Bruce happy removing the LL abomination from time.h
  It's not necessary in all the three instances because
  they already have the correct type on all the supported
  arches.
  
  Requested by: bde

Modified:
  head/sys/sys/time.h

Modified: head/sys/sys/time.h
==
--- head/sys/sys/time.h Wed Aug 20 16:09:05 2014(r270226)
+++ head/sys/sys/time.h Wed Aug 20 16:32:02 2014(r270227)
@@ -129,7 +129,7 @@ bintime_shift(struct bintime *_bt, int _
 #defineSBT_1MS (SBT_1S / 1000)
 #defineSBT_1US (SBT_1S / 100)
 #defineSBT_1NS (SBT_1S / 10)
-#defineSBT_MAX 0x7fffLL
+#defineSBT_MAX 0x7fff
 
 static __inline int
 sbintime_getsec(sbintime_t _sbt)
@@ -184,7 +184,7 @@ timespec2bintime(const struct timespec *
 
_bt-sec = _ts-tv_sec;
/* 18446744073 = int(2^64 / 10) */
-   _bt-frac = _ts-tv_nsec * (uint64_t)18446744073LL;
+   _bt-frac = _ts-tv_nsec * (uint64_t)18446744073;
 }
 
 static __inline void
@@ -201,7 +201,7 @@ timeval2bintime(const struct timeval *_t
 
_bt-sec = _tv-tv_sec;
/* 18446744073709 = int(2^64 / 100) */
-   _bt-frac = _tv-tv_usec * (uint64_t)18446744073709LL;
+   _bt-frac = _tv-tv_usec * (uint64_t)18446744073709;
 }
 
 static __inline struct timespec
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r270229 - head/share/vt/keymaps

2014-08-20 Thread Stefan Esser
Author: se
Date: Wed Aug 20 17:00:47 2014
New Revision: 270229
URL: http://svnweb.freebsd.org/changeset/base/270229

Log:
  Another rpund of fixes, after checking keymaps for plausibility and with
  several updates to the converter tools. There is now support for hybrid
  source keymaps, which e.g. use ISO8859-1 (not -15) but still provide an
  Euro key (on the E key). ISO8859-1 currency symbols on other keys are
  still converted to that character, not the Euro sign. A similar hack was
  applied to the Japanese keyboards to add the Yen key, that could not be
  expressed in SYSCONS.
  
  Several modifications have been applied after the conversion (removal of
  unused accents tables, some reformatting, exchange of a few key symbols).
  
  The German keymap (de.kbd) is now using deadkeys only for those keys,
  that behave that way under Windows. There are now .acc and .noacc
  variants, which use deadkeys vs. nodeadkeys for all accent keys.
  
  I'm still in the process of comparing keymaps that existed in different
  encodings in SYSCONS. These are generally translated slightly differently,
  either because of mistakes, or because of different preferences, or due
  to limitations of the respective encoding.
  
  MFC after:3 days

Added:
  head/share/vt/keymaps/centraleuropean.qwerty.kbd
 - copied, changed from r270200, head/share/vt/keymaps/centraleuropean.kbd
  head/share/vt/keymaps/de.noacc.kbd
 - copied, changed from r270210, head/share/vt/keymaps/de.kbd
Replaced:
  head/share/vt/keymaps/de.kbd
 - copied, changed from r270200, head/share/vt/keymaps/de.acc.kbd
Modified:
  head/share/vt/keymaps/INDEX.keymaps
  head/share/vt/keymaps/Makefile
  head/share/vt/keymaps/am.kbd
  head/share/vt/keymaps/be.acc.kbd
  head/share/vt/keymaps/ca-fr.kbd
  head/share/vt/keymaps/centraleuropean.kbd
  head/share/vt/keymaps/ch-fr.acc.kbd
  head/share/vt/keymaps/ch-fr.kbd
  head/share/vt/keymaps/de.acc.kbd
  head/share/vt/keymaps/dk.acc.kbd
  head/share/vt/keymaps/dk.kbd
  head/share/vt/keymaps/dk.macbook.kbd
  head/share/vt/keymaps/es.dvorak.kbd
  head/share/vt/keymaps/fi.kbd
  head/share/vt/keymaps/fr.acc.kbd
  head/share/vt/keymaps/fr.dvorak.acc.kbd
  head/share/vt/keymaps/fr.dvorak.kbd
  head/share/vt/keymaps/fr.macbook.kbd
  head/share/vt/keymaps/is.kbd
  head/share/vt/keymaps/it.kbd
  head/share/vt/keymaps/jp.pc98.iso.kbd
  head/share/vt/keymaps/jp.pc98.kbd
  head/share/vt/keymaps/no.dvorak.kbd
  head/share/vt/keymaps/no.kbd
  head/share/vt/keymaps/nordic.asus-eee.kbd
  head/share/vt/keymaps/se.kbd
  head/share/vt/keymaps/uk.capsctrl.kbd
  head/share/vt/keymaps/uk.kbd
  head/share/vt/keymaps/us.acc.kbd

Modified: head/share/vt/keymaps/INDEX.keymaps
==
--- head/share/vt/keymaps/INDEX.keymaps Wed Aug 20 16:59:33 2014
(r270228)
+++ head/share/vt/keymaps/INDEX.keymaps Wed Aug 20 17:00:47 2014
(r270229)
@@ -77,6 +77,11 @@ centraleuropean.kbd:de:Zentral Europäis
 centraleuropean.kbd:fr:Centre européen
 centraleuropean.kbd:es:Centroeuropeo
 
+centraleuropean.qwerty.kbd:en:Central European (QWERTY)
+centraleuropean.qwerty.kbd:de:Zentral Europäisch (QWERTY)
+centraleuropean.qwerty.kbd:fr:Centre européen (QWERTY)
+centraleuropean.qwerty.kbd:es:Centroeuropeo (QWERTY)
+
 colemak.kbd:en:Colemak ergonomic alternative
 
 cz.kbd:en:Czech (QWERTZ, accent keys)
@@ -89,6 +94,11 @@ cz.kbd.from-ce:de:Tschechisch
 cz.kbd.from-ce:fr:Tchèque
 cz.kbd.from-ce:es:Checo
 
+cz.qwerty.kbd.from-ce:en:Czech (QWERTY)
+cz.qwerty.kbd.from-ce:de:Tschechisch (QWERTY)
+cz.qwerty.kbd.from-ce:fr:Tchèquey (QWERTY)
+cz.qwerty.kbd.from-ce:es:Checo (QWERTY)
+
 dk.kbd:en:Danish
 dk.kbd:da:Dansk
 dk.kbd:de:Dänisch
@@ -208,6 +218,13 @@ de.acc.kbd:pt:Alemão (com acentos)
 de.acc.kbd:es:Alemán (con acentos)
 de.acc.kbd:uk:Німецька (accent keys)
 
+de.noacc.kbd:en:German (no accent keys)
+de.noacc.kbd:de:Deutsch (ohne Akzente)
+de.noacc.kbd:fr:Allemand (sans accents)
+de.noacc.kbd:pt:Alemão (no accent keys)
+de.noacc.kbd:es:Alemán (no accent keys)
+de.noacc.kbd:uk:Німецька (no accent keys)
+
 de.kbd.from-cp850:en:German
 de.kbd.from-cp850:de:Deutsch
 de.kbd.from-cp850:fr:Allemand
@@ -501,18 +518,6 @@ uk.capsctrl.kbd:de:Vereinigtes Königrei
 #uk.iso-ctrl.kbd:pt:Reino Unido (caps lock acts as Left Ctrl)
 #uk.iso-ctrl.kbd:es:Brit�nico (caps lock acts as Left Ctrl)
 
-uk.kbd.from-cp850:en:United Kingdom
-uk.kbd.from-cp850:de:Vereinigtes Königreich
-uk.kbd.from-cp850:fr:Royaume Uni
-uk.kbd.from-cp850:pt:Reino Unido
-uk.kbd.from-cp850:es:Británico
-
-uk.capsctrl.kbd.from-cp850:en:United Kingdom (Caps Lock acts as Left Ctrl)
-uk.kbd.from-cp850:de:Vereinigtes Königreich (Caps Lock als linke Strg)
-#uk.cp850.kbd:fr:Royaume Uni (caps lock acts as Left Ctrl)
-#uk.cp850.kbd:pt:Reino Unido (caps lock acts as Left Ctrl)
-#uk.cp850.kbd:es:Brit�nico (caps lock acts as Left Ctrl)
-
 uk.dvorak.kbd:en:United Kingdom Dvorak
 uk.dvorak.kbd:de:Vereinigtes Königreich Dvorak
 

svn commit: r270230 - head/sys/arm/ti

2014-08-20 Thread Luiz Otavio O Souza
Author: loos
Date: Wed Aug 20 17:02:37 2014
New Revision: 270230
URL: http://svnweb.freebsd.org/changeset/base/270230

Log:
  Rewrite of ti_i2c based on gonzo's patch, fix the following bugs/problems:
  
. interrupt storm detected on intr70:; throttling interrupt source;
  
. Added access serialization on iicbus_transfer(), previously there was
  no such protection and a new transfer could easily confuse the
  controller;
  
. Add error checkings (i.e. stop the transfer when a error is detected
  and do _not_ overwrite the previous error);
  
. On command done interrupt do not assume that the transfer was finished
  sucessfully as we will receive the command done interrupt even after
  errors;
  
. Simplify the FIFO handling;
  
. Reset the FIFO between the transfers as the FIFO may contain data from
  the last (failed) transfer;
  
. Fix the iicbus speed for AM335x, which in turn will make better use of
  the I2C noise filter (set to one internal clock cycle);
  
. Move the read and write handler to ithread instead of notifying the
  requesting thread with wakeup(9);
  
. Fix the comments based on OMAP4 TRM.
  
  The above changes allows me to read the EDID from my HDMI monitor on BBB
  with gonzo's patches to support TDA19988 (which does 128 bytes reads) and
  repeatedly scan the iicbus (with a modified i2c(8)) without lock up the bus.
  
  Phabric:  D465

Modified:
  head/sys/arm/ti/ti_i2c.c
  head/sys/arm/ti/ti_i2c.h

Modified: head/sys/arm/ti/ti_i2c.c
==
--- head/sys/arm/ti/ti_i2c.cWed Aug 20 17:00:47 2014(r270229)
+++ head/sys/arm/ti/ti_i2c.cWed Aug 20 17:02:37 2014(r270230)
@@ -1,6 +1,6 @@
 /*-
- * Copyright (c) 2011
- * Ben Gray ben.r.g...@gmail.com.
+ * Copyright (c) 2011 Ben Gray ben.r.g...@gmail.com.
+ * Copyright (c) 2014 Luiz Otavio O Souza l...@freebsd.org.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -58,9 +58,9 @@ __FBSDID($FreeBSD$);
 #include sys/module.h
 #include sys/mutex.h
 #include sys/rman.h
+#include sys/sysctl.h
 #include machine/bus.h
 
-#include dev/fdt/fdt_common.h
 #include dev/ofw/openfirm.h
 #include dev/ofw/ofw_bus.h
 #include dev/ofw/ofw_bus_subr.h
@@ -90,8 +90,13 @@ struct ti_i2c_softc
 
struct mtx  sc_mtx;
 
-   volatile uint16_t   sc_stat_flags;  /* contains the status flags 
last IRQ */
+   struct iic_msg* sc_buffer;
+   int sc_bus_inuse;
+   int sc_buffer_pos;
+   int sc_error;
+   int sc_fifo_trsh;
 
+   uint16_tsc_con_reg;
uint16_tsc_rev;
 };
 
@@ -106,63 +111,54 @@ struct ti_i2c_clock_config
uint8_t hssclh; /* High Speed mode SCL high time */
 };
 
+#if defined(SOC_OMAP3)
+#error Unsupported SoC
+#endif
+
 #if defined(SOC_OMAP4)
 static struct ti_i2c_clock_config ti_omap4_i2c_clock_configs[] = {
-   { IIC_SLOW,  10, 23,  13,  15, 0,  0},
-   { IIC_FAST,  40,  9,   5,   7, 0,  0},
-   { IIC_FASTEST,  331,  1, 113, 115, 7, 10},
+   { IIC_UNKNOWN,   10, 23, 13, 15,  0, 0},
+   { IIC_SLOW,  10, 23, 13, 15,  0, 0},
+   { IIC_FAST,  40,  9,  5,  7,  0, 0},
+   { IIC_FASTEST,  100,  5,  3,  4,  0, 0},
+   /* { IIC_FASTEST, 320,  1, 113, 115, 7, 10}, - HS mode */
{ -1, 0 }
 };
 #endif
 
 #if defined(SOC_TI_AM335X)
+/*
+ * AM335X doesn't support HS mode.  For 100kHz I2C clock set the internal
+ * clock to 12Mhz, for 400kHz I2C clock set the internal clock to 24Mhz.
+ */
 static struct ti_i2c_clock_config ti_am335x_i2c_clock_configs[] = {
-   { IIC_SLOW,  10,  3,  53,  55, 0,  0},
-   { IIC_FAST,  40,  3,   8,  10, 0,  0},
-   { IIC_FASTEST,   40,  3,   8,  10, 0,  0}, /* This might be higher 
*/
+   { IIC_UNKNOWN,   10, 7, 59, 61, 0, 0},
+   { IIC_SLOW,  10, 7, 59, 61, 0, 0},
+   { IIC_FAST,  40, 3, 23, 25, 0, 0},
+   { IIC_FASTEST,   40, 3, 23, 25, 0, 0},
{ -1, 0 }
 };
 #endif
 
-
-#define TI_I2C_REV1  0x003C  /* OMAP3 */
-#define TI_I2C_REV2  0x000A  /* OMAP4 */
-
 /**
  * Locking macros used throughout the driver
  */
-#define TI_I2C_LOCK(_sc) mtx_lock((_sc)-sc_mtx)
-#defineTI_I2C_UNLOCK(_sc)   mtx_unlock((_sc)-sc_mtx)
-#define TI_I2C_LOCK_INIT(_sc) \
-   mtx_init(_sc-sc_mtx, device_get_nameunit(_sc-sc_dev), \
-ti_i2c, MTX_DEF)
-#define TI_I2C_LOCK_DESTROY(_sc)  mtx_destroy(_sc-sc_mtx);
-#define TI_I2C_ASSERT_LOCKED(_sc) mtx_assert(_sc-sc_mtx, MA_OWNED);
-#define TI_I2C_ASSERT_UNLOCKED(_sc)   mtx_assert(_sc-sc_mtx, MA_NOTOWNED);
+#defineTI_I2C_LOCK(_sc)mtx_lock((_sc)-sc_mtx)
+#define

svn commit: r270231 - head/sbin/devd/tests

2014-08-20 Thread Alan Somers
Author: asomers
Date: Wed Aug 20 17:04:49 2014
New Revision: 270231
URL: http://svnweb.freebsd.org/changeset/base/270231

Log:
  Misc fixes suggested by Coverity.
  
  sbin/devd/tests/client_test.c
* In the event that popen fails, don't dereference its return value.
* Fix array overwrite in the stream and seqpacket tests.
* Close sockets at the end of successful ATF tests.
  
  Reported by:  Coverity scan
  CID:  1232019, 1232020, 1232029, 1232030
  MFC after:1 week
  Sponsored by: Spectra Logic

Modified:
  head/sbin/devd/tests/client_test.c

Modified: head/sbin/devd/tests/client_test.c
==
--- head/sbin/devd/tests/client_test.c  Wed Aug 20 17:02:37 2014
(r270230)
+++ head/sbin/devd/tests/client_test.c  Wed Aug 20 17:04:49 2014
(r270231)
@@ -58,6 +58,7 @@ create_two_events(void)
 
snprintf(destroy_cmd, nitems(destroy_cmd), mdconfig -d -u %s, mdname);
destroy_stdout = popen(destroy_cmd, r);
+   ATF_REQUIRE(destroy_stdout != NULL);
/* We expect no output */
ATF_REQUIRE_EQ(0, pclose(destroy_stdout));
 }
@@ -105,7 +106,8 @@ ATF_TC_BODY(seqpacket, tc)
ssize_t len;
char event[1024];
 
-   len = recv(s, event, sizeof(event), MSG_WAITALL);
+   /* Read 1 less than sizeof(event) to allow space for NULL */
+   len = recv(s, event, sizeof(event) - 1, MSG_WAITALL);
ATF_REQUIRE(len != -1);
/* NULL terminate the result */
event[len] = '\0';
@@ -118,6 +120,8 @@ ATF_TC_BODY(seqpacket, tc)
if (cmp == 0)
got_destroy_event = true;
}
+
+   close(s);
 }
 
 /*
@@ -160,7 +164,8 @@ ATF_TC_BODY(stream, tc)
ssize_t newlen;
char *create_pos, *destroy_pos;
 
-   newlen = read(s, event[len], sizeof(event) - len);
+   /* Read 1 less than sizeof(event) to allow space for NULL */
+   newlen = read(s, event[len], sizeof(event) - len - 1);
ATF_REQUIRE(newlen != -1);
len += newlen;
/* NULL terminate the result */
@@ -174,8 +179,9 @@ ATF_TC_BODY(stream, tc)
destroy_pos = strstr(event, destroy_pat);
if (destroy_pos != NULL)
got_destroy_event = true;
-
}
+
+   close(s);
 }
 
 /*
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r270232 - head/tools/tools/vt/keymaps

2014-08-20 Thread Stefan Esser
Author: se
Date: Wed Aug 20 17:07:41 2014
New Revision: 270232
URL: http://svnweb.freebsd.org/changeset/base/270232

Log:
  The conversion tools have been further improved and some erroneous
  conversions have been detected and fixed.
  
  It is now possible to add options after the encoding in the parameter
  list for convert-keymap.pl. This is currently used to selectively
  enable interpretation of the ISO8859-1 currency symbol as the Euro
  sign found in ISO5589-15, or to add a Yen symbol in place of '\' for
  specific Japanese keyboards. The option are appended to the parameter
  list, as in e.g. convert-keymap.pl german.iso.kbd ISO5589-1 EURO.
  
  The options are appended to the encoding in the form +EURO or +YEN
  in KBDFILES.map, to keep the meaning of the columns intact.
  
  MFC after:3 days

Modified:
  head/tools/tools/vt/keymaps/KBDFILES.map
  head/tools/tools/vt/keymaps/convert-keymap.pl
  head/tools/tools/vt/keymaps/convert-keymaps.pl

Modified: head/tools/tools/vt/keymaps/KBDFILES.map
==
--- head/tools/tools/vt/keymaps/KBDFILES.mapWed Aug 20 17:04:49 2014
(r270231)
+++ head/tools/tools/vt/keymaps/KBDFILES.mapWed Aug 20 17:07:41 2014
(r270232)
@@ -1,7 +1,15 @@
 # $FreeBSD$
-
-ISO8859-15 be.iso.kbd  be.kbd
-ISO8859-15 be.iso.acc.kbd  be.acc.kbd
+#
+# The Files are converted by convert-keymaps.pl from the given encoding to 
UCS.
+#
+# An additional +EURO causes the translation of the generic currency symbol 
to 
+# an Euro symbol, even if the source locale does not support an Euro symbol.
+# This conversion is only performed for the E key (not e.g. on Shift-4, 
which 
+# still generates the currency symbol).
+#
+# Encoding  syscons file name   newcons (vt) file name
+ISO8859-1+EURO be.iso.kbd  be.kbd
+ISO8859-1+EURO be.iso.acc.kbd  be.acc.kbd
 
 ISO8859-5  bg.bds.ctrlcaps.kbd bg.bds.kbd
 ISO8859-5  bg.phonetic.ctrlcaps.kbdbg.bds.ctrlcaps.kbd
@@ -14,15 +22,15 @@ CP850   br275.cp850.kbd 
br.noacc.kbd
 #CP1251by.cp1251.kbd   by.kbd.from-cp1251  
(result identical to CP1251)
 ISO8859-5  by.iso5.kbd by.kbd
 
-ISO8859-2  ce.iso2.kbd centraleuropean.kbd
+ISO8859-2  ce.iso2.kbd centraleuropean.qwerty.kbd
 
 ISO8859-1  colemak.iso15.acc.kbd   colemak.kbd
 
 ISO8859-2  cs.latin2.qwertz.kbdcz.kbd
-ISO8859-2  cz.iso2.kbd cz.kbd.from-ce
+ISO8859-2  cz.iso2.kbd cz.qwerty.kbd.from-ce
 
-ISO8859-15 danish.iso.kbd  dk.kbd
-ISO8859-15 danish.iso.acc.kbd  dk.acc.kbd
+ISO8859-1+EURO danish.iso.kbd  dk.kbd
+ISO8859-1+EURO danish.iso.acc.kbd  dk.acc.kbd
 CP865  danish.cp865.kbddk.kbd.from-cp865
 ISO8859-1  danish.iso.macbook.kbd  dk.macbook.kbd
 
@@ -36,19 +44,19 @@ ISO8859-1   estonian.iso.kbdee.kbd.from-
 ISO8859-15 estonian.iso15.kbd  ee.kbd
 CP850  estonian.cp850.kbd  ee.kbd.from-cp850
 
-ISO8859-15 finnish.iso.kbd fi.kbd
+ISO8859-1+EURO finnish.iso.kbd fi.kbd
 CP850  finnish.cp850.kbd   fi.kbd.from-cp850
 
-ISO8859-15 fr.iso.kbd  fr.kbd
-ISO8859-15 fr.iso.acc.kbd  fr.acc.kbd
-ISO8859-15 fr.macbook.acc.kbd  fr.macbook.kbd
-ISO8859-1  fr.dvorak.kbd   fr.dvorak.kbd
-ISO8859-15 fr.dvorak.acc.kbd   fr.dvorak.acc.kbd
+ISO8859-1+EURO fr.iso.kbd  fr.kbd
+ISO8859-1+EURO fr.iso.acc.kbd  fr.acc.kbd
+ISO8859-1+EURO fr.macbook.acc.kbd  fr.macbook.kbd
+ISO8859-1+EURO fr.dvorak.kbd   fr.dvorak.kbd
+ISO8859-1  fr.dvorak.acc.kbd   fr.dvorak.acc.kbd
 
-ISO8859-15 fr_CA.iso.acc.kbd   ca-fr.kbd
+ISO8859-1+EURO fr_CA.iso.acc.kbd   ca-fr.kbd
 
-ISO8859-15 german.iso.kbd  de.kbd
-ISO8859-15 german.iso.acc.kbd  de.acc.kbd
+ISO8859-1+EURO german.iso.kbd  de.noacc.kbd
+ISO8859-1+EURO german.iso.acc.kbd  de.acc.kbd
 CP850  german.cp850.kbdde.kbd.from-cp850
 
 ISO8859-7  gr.elot.acc.kbd gr.elot.acc.kbd
@@ -66,12 +74,12 @@ ARMSCII-8   hy.armscii-8.kbdam.kbd
 ISO8859-1  icelandic.iso.kbd   is.kbd
 ISO8859-1  icelandic.iso.acc.kbd   is.acc.kbd
 
-ISO8859-15 it.iso.kbd  it.kbd
+ISO8859-1+EURO it.iso.kbd  it.kbd
 
-ISO8859-1  jp.106.kbd  jp.kbd
-ISO8859-1  jp.106x.kbd   

svn commit: r270228 - head/tests/sys/kern

2014-08-20 Thread Alan Somers
Author: asomers
Date: Wed Aug 20 16:59:33 2014
New Revision: 270228
URL: http://svnweb.freebsd.org/changeset/base/270228

Log:
  Numerous small fixes, mostly suggested by Coverity.
  
  tests/sys/kern/unix_seqpacket_test.c
* Remove a duplicate error check in mk_pair_of_sockets
* Always close sockets in the success path of ATF test cases.  Don't
  bother with the error paths, because those are mostly assertions
  anyway.  Most of these socket leaks were reported by Coverity.
  All of them are harmless, because each ATF test case runs in its
  own process.
* Fix the len argument to send in shutdown_send and
  shutdown_send_sigpipe.  The old version was using sizeof a pointer
  instead of sizeof the char array.  Reported by Coverity.
* Change a few ATF_CHECK to ATF_REQUIRE if the test can't reasonably
  continue past a failure.
  
  Reported by:  Coverity Scan
  CID:  1229995, 1229991, 1229988, 1229994, 1229989, 1229992
  CID:  1229993, 1229990, 1229984, 1229967, 1230005, 1229977
  CID:  1229966, 1230004, 1229976
  MFC after:1 week
  Sponsored by: Spectra Logic

Modified:
  head/tests/sys/kern/unix_seqpacket_test.c

Modified: head/tests/sys/kern/unix_seqpacket_test.c
==
--- head/tests/sys/kern/unix_seqpacket_test.c   Wed Aug 20 16:32:02 2014
(r270227)
+++ head/tests/sys/kern/unix_seqpacket_test.c   Wed Aug 20 16:59:33 2014
(r270228)
@@ -91,7 +91,6 @@ mk_pair_of_sockets(int *sv)
err = bind(s, (struct sockaddr *)sun, sizeof(sun));
err = listen(s, -1);
ATF_CHECK_EQ(0, err);
-   ATF_CHECK_EQ(0, err);
 
/* Create the other socket */
s2 = socket(PF_LOCAL, SOCK_SEQPACKET, 0);
@@ -111,6 +110,9 @@ mk_pair_of_sockets(int *sv)
 
sv[0] = s1;
sv[1] = s2;
+
+   close(s);
+
return (path);
 }
 
@@ -148,8 +150,11 @@ test_eagain(size_t sndbufsize, size_t rc
for(i=0; i  numpkts; i++) {
ssize = send(sv[0], sndbuf, pktsize, MSG_EOR);
if (ssize == -1) {
-   if (errno == EAGAIN)
+   if (errno == EAGAIN) {
+   close(sv[0]);
+   close(sv[1]);
atf_tc_pass();
+   }
else {
perror(send);
atf_tc_fail(send returned  0 but not EAGAIN);
@@ -199,6 +204,8 @@ test_sendrecv_symmetric_buffers(size_t b
}
ATF_CHECK_EQ_MSG(pktsize, rsize, expected %zd=send(...) but got %zd,
pktsize, rsize);
+   close(sv[0]);
+   close(sv[1]);
 }
 
 static void
@@ -274,6 +281,8 @@ test_pipe_simulator(size_t sndbufsize, s
}
}
}
+   close(sv[0]);
+   close(sv[1]);
 }
 
 typedef struct {
@@ -372,6 +381,8 @@ test_pipe(size_t sndbufsize, size_t rcvb
/* Join the children */
ATF_REQUIRE_EQ(0, pthread_join(writer, NULL));
ATF_REQUIRE_EQ(0, pthread_join(reader, NULL));
+   close(sv[0]);
+   close(sv[1]);
 }
 
 
@@ -387,6 +398,7 @@ ATF_TC_BODY(create_socket, tc)
 
s = socket(PF_LOCAL, SOCK_SEQPACKET, 0);
ATF_CHECK(s = 0);
+   close(s);
 }
 
 /* Create SEQPACKET sockets using socketpair(2) */
@@ -401,6 +413,8 @@ ATF_TC_BODY(create_socketpair, tc)
ATF_CHECK(sv[0] = 0);
ATF_CHECK(sv[1] = 0);
ATF_CHECK(sv[0] != sv[1]);
+   close(sv[0]);
+   close(sv[1]);
 }
 
 /* Call listen(2) without first calling bind(2).  It should fail */
@@ -414,6 +428,7 @@ ATF_TC_BODY(listen_unbound, tc)
r = listen(s, -1);
/* expect listen to fail since we haven't called bind(2) */
ATF_CHECK(r != 0);
+   close(s);
 }
 
 /* Bind the socket to a file */
@@ -434,6 +449,7 @@ ATF_TC_BODY(bind, tc)
strlcpy(sun.sun_path, path, sizeof(sun.sun_path));
r = bind(s, (struct sockaddr *)sun, sizeof(sun));
ATF_CHECK_EQ(0, r);
+   close(s);
 }
 
 /* listen(2) a socket that is already bound(2) should succeed */
@@ -456,6 +472,7 @@ ATF_TC_BODY(listen_bound, tc)
l = listen(s, -1);
ATF_CHECK_EQ(0, r);
ATF_CHECK_EQ(0, l);
+   close(s);
 }
 
 /* connect(2) can make a connection */
@@ -487,6 +504,8 @@ ATF_TC_BODY(connect, tc)
perror(connect);
atf_tc_fail(connect(2) failed);
}
+   close(s);
+   close(s2);
 }
 
 /* accept(2) can receive a connection */
@@ -496,6 +515,8 @@ ATF_TC_BODY(accept, tc)
int sv[2];
 
mk_pair_of_sockets(sv);
+   close(sv[0]);
+   close(sv[1]);
 }
 
 
@@ -511,6 +532,7 @@ ATF_TC_BODY(fcntl_nonblock, tc)
perror(fcntl);
atf_tc_fail(fcntl failed);
}
+   close(s);
 }
 
 /* Resize the send and 

svn commit: r270233 - stable/10/sys/kern

2014-08-20 Thread Davide Italiano
Author: davide
Date: Wed Aug 20 17:26:05 2014
New Revision: 270233
URL: http://svnweb.freebsd.org/changeset/base/270233

Log:
  MFC r269502:
  Fix an overflow in getsockopt(). optval isn't big enough to hold
  sbintime_t.
  Re-introduce r255030 behaviour capping socket timeouts to INT_32
  if they're too large.

Modified:
  stable/10/sys/kern/uipc_socket.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/kern/uipc_socket.c
==
--- stable/10/sys/kern/uipc_socket.cWed Aug 20 17:07:41 2014
(r270232)
+++ stable/10/sys/kern/uipc_socket.cWed Aug 20 17:26:05 2014
(r270233)
@@ -2548,8 +2548,10 @@ sosetopt(struct socket *so, struct socko
error = EDOM;
goto bad;
}
-   val = tvtosbt(tv);
-
+   if (tv.tv_sec  INT32_MAX)
+   val = SBT_MAX;
+   else
+   val = tvtosbt(tv);
switch (sopt-sopt_name) {
case SO_SNDTIMEO:
so-so_snd.sb_timeo = val;
@@ -2699,10 +2701,8 @@ integer:
 
case SO_SNDTIMEO:
case SO_RCVTIMEO:
-   optval = (sopt-sopt_name == SO_SNDTIMEO ?
- so-so_snd.sb_timeo : so-so_rcv.sb_timeo);
-
-   tv = sbttotv(optval);
+   tv = sbttotv(sopt-sopt_name == SO_SNDTIMEO ?
+   so-so_snd.sb_timeo : so-so_rcv.sb_timeo);
 #ifdef COMPAT_FREEBSD32
if (SV_CURPROC_FLAG(SV_ILP32)) {
struct timeval32 tv32;
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


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

2014-08-20 Thread Hiroki Sato
Author: hrs
Date: Wed Aug 20 17:27:15 2014
New Revision: 270234
URL: http://svnweb.freebsd.org/changeset/base/270234

Log:
  Recover sin6_scope_id of gateway addresses in riprecv() by using the if_index
  where a RIP packet was received.  This fixes a bug which prevented gateway
  addresses in fe80::/64 from being added.

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

Modified: head/usr.sbin/route6d/route6d.c
==
--- head/usr.sbin/route6d/route6d.c Wed Aug 20 17:26:05 2014
(r270233)
+++ head/usr.sbin/route6d/route6d.c Wed Aug 20 17:27:15 2014
(r270234)
@@ -2835,6 +2835,8 @@ addroute(struct riprt *rrt,
sin6-sin6_len = sizeof(struct sockaddr_in6);
sin6-sin6_family = AF_INET6;
sin6-sin6_addr = *gw;
+   if (IN6_IS_ADDR_LINKLOCAL(sin6-sin6_addr))
+   sin6-sin6_scope_id = ifcp-ifc_index;
sin6 = (struct sockaddr_in6 *)((char *)sin6 + ROUNDUP(sin6-sin6_len));
/* Netmask */
sin6-sin6_len = sizeof(struct sockaddr_in6);
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


Re: svn commit: r270227 - head/sys/sys

2014-08-20 Thread Davide Italiano
On Wed, Aug 20, 2014 at 9:32 AM, Davide Italiano dav...@freebsd.org wrote:
 Author: davide
 Date: Wed Aug 20 16:32:02 2014
 New Revision: 270227
 URL: http://svnweb.freebsd.org/changeset/base/270227

 Log:
   Make Bruce happy removing the LL abomination from time.h
   It's not necessary in all the three instances because
   they already have the correct type on all the supported
   arches.

   Requested by: bde


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


svn commit: r270235 - stable/10/sys/dev/e1000

2014-08-20 Thread Luigi Rizzo
Author: luigi
Date: Wed Aug 20 17:33:32 2014
New Revision: 270235
URL: http://svnweb.freebsd.org/changeset/base/270235

Log:
  MFC 259907 (dates back to december)
  use the correct netmap - nic slot mapping on the transmit ring for 'lem'.
  This bug would manifest only in netmap mode and on packets transmitted after
  a NIC reset while netmap mode is active.

Modified:
  stable/10/sys/dev/e1000/if_lem.c

Modified: stable/10/sys/dev/e1000/if_lem.c
==
--- stable/10/sys/dev/e1000/if_lem.cWed Aug 20 17:27:15 2014
(r270234)
+++ stable/10/sys/dev/e1000/if_lem.cWed Aug 20 17:33:32 2014
(r270235)
@@ -2678,7 +2678,7 @@ lem_setup_transmit_structures(struct ada
void *addr;
 
addr = PNMB(slot + si, paddr);
-   adapter-tx_desc_base[si].buffer_addr = htole64(paddr);
+   adapter-tx_desc_base[i].buffer_addr = htole64(paddr);
/* reload the map for netmap mode */
netmap_load_map(adapter-txtag, tx_buffer-map, addr);
}
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r270236 - stable/10/sys/dev/gpio

2014-08-20 Thread Luiz Otavio O Souza
Author: loos
Date: Wed Aug 20 17:39:53 2014
New Revision: 270236
URL: http://svnweb.freebsd.org/changeset/base/270236

Log:
  MFC r266922:
  
Add a bounds verification to the SCL and SDA pin values.
  
At attach, print the SCL and SDA pin numbers.
  
Remove a stray blank line.
  
Remove the GPIOBUS locking from gpioiic_reset(), it is already called with
this lock held.  This fixes a crash when you try to scan the iicbus with
i2c(8).

Modified:
  stable/10/sys/dev/gpio/gpioiic.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/gpio/gpioiic.c
==
--- stable/10/sys/dev/gpio/gpioiic.cWed Aug 20 17:33:32 2014
(r270235)
+++ stable/10/sys/dev/gpio/gpioiic.cWed Aug 20 17:39:53 2014
(r270236)
@@ -46,6 +46,8 @@ __FBSDID($FreeBSD$);
 #include dev/fdt/fdt_common.h
 #endif
 
+#include dev/gpio/gpiobusvar.h
+
 #include dev/iicbus/iiconf.h
 #include dev/iicbus/iicbus.h
 
@@ -74,7 +76,6 @@ static int gpioiic_getsda(device_t);
 static int gpioiic_getscl(device_t);
 static int gpioiic_reset(device_t, u_char, u_char, u_char *);
 
-
 static int
 gpioiic_probe(device_t dev)
 {
@@ -91,13 +92,15 @@ gpioiic_probe(device_t dev)
 static int
 gpioiic_attach(device_t dev)
 {
-   struct gpioiic_softc*sc = device_get_softc(dev);
device_tbitbang;
 #ifdef FDT
phandle_t   node;
pcell_t pin;
 #endif
+   struct gpiobus_ivar *devi;
+   struct gpioiic_softc*sc;
 
+   sc = device_get_softc(dev);
sc-sc_dev = dev;
sc-sc_busdev = device_get_parent(dev);
if (resource_int_value(device_get_name(dev),
@@ -116,6 +119,15 @@ gpioiic_attach(device_t dev)
sc-sda_pin = (int)pin;
 #endif
 
+   if (sc-scl_pin  0 || sc-scl_pin  1)
+   sc-scl_pin = SCL_PIN_DEFAULT;
+   if (sc-sda_pin  0 || sc-sda_pin  1)
+   sc-sda_pin = SDA_PIN_DEFAULT;
+
+   devi = GPIOBUS_IVAR(dev);
+   device_printf(dev, SCL pin: %d, SDA pin: %d\n,
+   devi-pins[sc-scl_pin], devi-pins[sc-sda_pin]);
+
/* add generic bit-banging code */
bitbang = device_add_child(dev, iicbb, -1);
device_probe_and_attach(bitbang);
@@ -221,16 +233,11 @@ gpioiic_getsda(device_t dev)
 static int
 gpioiic_reset(device_t dev, u_char speed, u_char addr, u_char *oldaddr)
 {
-   struct gpioiic_softc*sc = device_get_softc(dev);
-
-   GPIOBUS_LOCK_BUS(sc-sc_busdev);
-   GPIOBUS_ACQUIRE_BUS(sc-sc_busdev, sc-sc_dev);
+   struct gpioiic_softc*sc;
 
+   sc = device_get_softc(dev);
gpioiic_reset_bus(sc-sc_dev);
 
-   GPIOBUS_RELEASE_BUS(sc-sc_busdev, sc-sc_dev);
-   GPIOBUS_UNLOCK_BUS(sc-sc_busdev);
-
return (IIC_ENOADDR);
 }
 
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r270237 - stable/10/sys/arm/ti/am335x

2014-08-20 Thread Luiz Otavio O Souza
Author: loos
Date: Wed Aug 20 17:57:23 2014
New Revision: 270237
URL: http://svnweb.freebsd.org/changeset/base/270237

Log:
  MFC r266937:
  
Export two new settings for the AM335x PWM, the clock prescaler (clkdiv)
and the actual PWM frequency.
  
Enforce the maximum value for the period sysctl.
  
The frequency systcl now allows the direct setting of the PWM frequency
(it will try to find the better clkdiv and period for a given frequency,
i.e. the ones that will give the better PWM resolution).
  
This allows the use lower frequencies on the PWM.  Without changing the
clock prescaler the minimum PWM frequency was 1.52kHz.
  
PWM frequencies checked with an osciloscope.
  
PWM output tested with some R/C servos at 50Hz.

Modified:
  stable/10/sys/arm/ti/am335x/am335x_pwm.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/arm/ti/am335x/am335x_pwm.c
==
--- stable/10/sys/arm/ti/am335x/am335x_pwm.cWed Aug 20 17:39:53 2014
(r270236)
+++ stable/10/sys/arm/ti/am335x/am335x_pwm.cWed Aug 20 17:57:23 2014
(r270237)
@@ -29,10 +29,11 @@ __FBSDID($FreeBSD$);
 
 #include sys/param.h
 #include sys/systm.h
-#include sys/kernel.h
-#include sys/module.h
 #include sys/bus.h
+#include sys/kernel.h
+#include sys/limits.h
 #include sys/lock.h
+#include sys/module.h
 #include sys/mutex.h
 #include sys/resource.h
 #include sys/rman.h
@@ -53,12 +54,13 @@ __FBSDID($FreeBSD$);
 
 /* In ticks */
 #defineDEFAULT_PWM_PERIOD  1000
+#definePWM_CLOCK   1UL
 
 #definePWM_LOCK(_sc)   mtx_lock((_sc)-sc_mtx)
 #definePWM_UNLOCK(_sc) mtx_unlock((_sc)-sc_mtx)
 #definePWM_LOCK_INIT(_sc)  mtx_init((_sc)-sc_mtx, \
 device_get_nameunit(_sc-sc_dev), am335x_pwm softc, MTX_DEF)
-#definePWM_LOCK_DESTROY(_sc)   mtx_destroy((_sc)-sc_mtx);
+#definePWM_LOCK_DESTROY(_sc)   mtx_destroy((_sc)-sc_mtx)
 
 static struct resource_spec am335x_pwm_mem_spec[] = {
{ SYS_RES_MEMORY, 0, RF_ACTIVE }, /* PWMSS */
@@ -170,6 +172,8 @@ static struct resource_spec am335x_pwm_m
 static device_probe_t am335x_pwm_probe;
 static device_attach_t am335x_pwm_attach;
 static device_detach_t am335x_pwm_detach;
+
+static int am335x_pwm_clkdiv[8] = { 1, 2, 4, 8, 16, 32, 64, 128 };
 
 struct am335x_pwm_softc {
device_tsc_dev;
@@ -177,6 +181,10 @@ struct am335x_pwm_softc {
struct resource *sc_mem_res[4];
int sc_id;
/* sysctl for configuration */
+   int sc_pwm_clkdiv;
+   int sc_pwm_freq;
+   struct sysctl_oid   *sc_clkdiv_oid;
+   struct sysctl_oid   *sc_freq_oid;
struct sysctl_oid   *sc_period_oid;
struct sysctl_oid   *sc_chanA_oid;
struct sysctl_oid   *sc_chanB_oid;
@@ -241,6 +249,98 @@ am335x_pwm_config_ecas(int unit, int per
return (0);
 }
 
+static void
+am335x_pwm_freq(struct am335x_pwm_softc *sc)
+{
+   int clkdiv;
+
+   clkdiv = am335x_pwm_clkdiv[sc-sc_pwm_clkdiv];
+   sc-sc_pwm_freq = PWM_CLOCK / (1 * clkdiv) / sc-sc_pwm_period;
+}
+
+static int
+am335x_pwm_sysctl_freq(SYSCTL_HANDLER_ARGS)
+{
+   int clkdiv, error, freq, i, period;
+   struct am335x_pwm_softc *sc;
+   uint32_t reg;
+
+   sc = (struct am335x_pwm_softc *)arg1;
+
+   PWM_LOCK(sc);
+   freq = sc-sc_pwm_freq;
+   PWM_UNLOCK(sc);
+
+   error = sysctl_handle_int(oidp, freq, sizeof(freq), req);
+   if (error != 0 || req-newptr == NULL)
+   return (error);
+
+   if (freq  PWM_CLOCK)
+   freq = PWM_CLOCK;
+
+   PWM_LOCK(sc);
+   if (freq != sc-sc_pwm_freq) {
+   for (i = nitems(am335x_pwm_clkdiv) - 1; i = 0; i--) {
+   clkdiv = am335x_pwm_clkdiv[i];
+   period = PWM_CLOCK / clkdiv / freq;
+   if (period  USHRT_MAX)
+   break;
+   sc-sc_pwm_clkdiv = i;
+   sc-sc_pwm_period = period;
+   }
+   /* Reset the duty cycle settings. */
+   sc-sc_pwm_dutyA = 0;
+   sc-sc_pwm_dutyB = 0;
+   EPWM_WRITE2(sc, EPWM_CMPA, sc-sc_pwm_dutyA);
+   EPWM_WRITE2(sc, EPWM_CMPB, sc-sc_pwm_dutyB);
+   /* Update the clkdiv settings. */
+   reg = EPWM_READ2(sc, EPWM_TBCTL);
+   reg = ~TBCTL_CLKDIV_MASK;
+   reg |= TBCTL_CLKDIV(sc-sc_pwm_clkdiv);
+   EPWM_WRITE2(sc, EPWM_TBCTL, reg);
+   /* Update the period settings. */
+   EPWM_WRITE2(sc, EPWM_TBPRD, sc-sc_pwm_period - 1);
+   am335x_pwm_freq(sc);
+   }
+   PWM_UNLOCK(sc);
+
+   return (0);
+}
+
+static int

svn commit: r270238 - in stable/10: share/man/man4/man4.arm sys/arm/ti

2014-08-20 Thread Luiz Otavio O Souza
Author: loos
Date: Wed Aug 20 18:10:12 2014
New Revision: 270238
URL: http://svnweb.freebsd.org/changeset/base/270238

Log:
  MFC r266960:
  
Configure the analog input 7 which, on BBB, is connected to the 3V3B rail
through a voltage divisor (R163 and R164 on page 4 of BBB schematic).
  
Add a note about this on ti_adc(4) man page.  The ti_adc(4) man page will
first appear on 10.1-RELEASE.
  
Suggested by: Sulev-Madis Silber (ketas)
Manual page reviewed by:  brueffer (D127)

Modified:
  stable/10/share/man/man4/man4.arm/ti_adc.4
  stable/10/sys/arm/ti/ti_adc.c
  stable/10/sys/arm/ti/ti_adcreg.h
  stable/10/sys/arm/ti/ti_adcvar.h
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/share/man/man4/man4.arm/ti_adc.4
==
--- stable/10/share/man/man4/man4.arm/ti_adc.4  Wed Aug 20 17:57:23 2014
(r270237)
+++ stable/10/share/man/man4/man4.arm/ti_adc.4  Wed Aug 20 18:10:12 2014
(r270238)
@@ -24,7 +24,7 @@
 .\
 .\ $FreeBSD$
 .\
-.Dd March 21, 2014
+.Dd June 1, 2014
 .Dt TI_ADC 4
 .Os
 .Sh NAME
@@ -78,8 +78,17 @@ dev.ti_adc.0.ain.6.enable: 1
 dev.ti_adc.0.ain.6.open_delay: 0
 dev.ti_adc.0.ain.6.samples_avg: 4
 dev.ti_adc.0.ain.6.input: 2308
+dev.ti_adc.0.ain.7.enable: 1
+dev.ti_adc.0.ain.7.open_delay: 0
+dev.ti_adc.0.ain.7.samples_avg: 0
+dev.ti_adc.0.ain.7.input: 3812
 .Ed
 .Pp
+On Beaglebone-black the analog input 7 is connected to the 3V3B rail through
+a voltage divisor (2:1).
+The 3V3B voltage rail comes from the TL5209 LDO regulator which is limited
+to 500mA maximum.
+.Pp
 Global settings:
 .Bl -tag -width .Va dev.ti_adc.0.clockdiv
 .It Va dev.ti_adc.0.clockdiv
@@ -112,8 +121,8 @@ It is made of a 12 bit value (0 ~ 4095).
 The
 .Nm
 driver first appeared in
-.Fx 11.0 .
+.Fx 10.1 .
 .Sh AUTHORS
 .An -nosplit
 The driver and this manual page was written by
-.An Luiz Otavio O Souza Aq l...@freebsd.org
+.An Luiz Otavio O Souza Aq l...@freebsd.org .

Modified: stable/10/sys/arm/ti/ti_adc.c
==
--- stable/10/sys/arm/ti/ti_adc.c   Wed Aug 20 17:57:23 2014
(r270237)
+++ stable/10/sys/arm/ti/ti_adc.c   Wed Aug 20 18:10:12 2014
(r270238)
@@ -50,7 +50,7 @@ __FBSDID($FreeBSD$);
 #include arm/ti/ti_adcreg.h
 #include arm/ti/ti_adcvar.h
 
-/* Define our 7 steps, one for each input channel. */
+/* Define our 8 steps, one for each input channel. */
 static struct ti_adc_input ti_adc_inputs[TI_ADC_NPINS] = {
{ .stepconfig = ADC_STEPCFG1, .stepdelay = ADC_STEPDLY1 },
{ .stepconfig = ADC_STEPCFG2, .stepdelay = ADC_STEPDLY2 },
@@ -59,6 +59,7 @@ static struct ti_adc_input ti_adc_inputs
{ .stepconfig = ADC_STEPCFG5, .stepdelay = ADC_STEPDLY5 },
{ .stepconfig = ADC_STEPCFG6, .stepdelay = ADC_STEPDLY6 },
{ .stepconfig = ADC_STEPCFG7, .stepdelay = ADC_STEPDLY7 },
+   { .stepconfig = ADC_STEPCFG8, .stepdelay = ADC_STEPDLY8 },
 };
 
 static int ti_adc_samples[5] = { 0, 2, 4, 8, 16 };

Modified: stable/10/sys/arm/ti/ti_adcreg.h
==
--- stable/10/sys/arm/ti/ti_adcreg.hWed Aug 20 17:57:23 2014
(r270237)
+++ stable/10/sys/arm/ti/ti_adcreg.hWed Aug 20 18:10:12 2014
(r270238)
@@ -81,6 +81,8 @@
 #defineADC_STEPDLY60x090
 #defineADC_STEPCFG70x094
 #defineADC_STEPDLY70x098
+#defineADC_STEPCFG80x09c
+#defineADC_STEPDLY80x0a0
 #defineADC_STEP_DIFF_CNTRL (1  25)
 #defineADC_STEP_RFM_MSK0x0180
 #defineADC_STEP_RFM_SHIFT  23

Modified: stable/10/sys/arm/ti/ti_adcvar.h
==
--- stable/10/sys/arm/ti/ti_adcvar.hWed Aug 20 17:57:23 2014
(r270237)
+++ stable/10/sys/arm/ti/ti_adcvar.hWed Aug 20 18:10:12 2014
(r270238)
@@ -29,7 +29,7 @@
 #ifndef _TI_ADCVAR_H_
 #define _TI_ADCVAR_H_
 
-#defineTI_ADC_NPINS7
+#defineTI_ADC_NPINS8
 
 #defineADC_READ4(_sc, reg) bus_read_4((_sc)-sc_mem_res, reg)
 #defineADC_WRITE4(_sc, reg, value) \
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


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

2014-08-20 Thread Xin LI
Author: delphij
Date: Wed Aug 20 18:29:18 2014
New Revision: 270239
URL: http://svnweb.freebsd.org/changeset/base/270239

Log:
  MFV r270193:
  
  Illumos issues:
  5042 stop using deprecated atomic functions
  
  MFC after:2 weeks

Modified:
  head/sys/cddl/contrib/opensolaris/uts/common/dtrace/systrace.c
  head/sys/cddl/contrib/opensolaris/uts/common/os/fm.c
  head/sys/cddl/contrib/opensolaris/uts/common/sys/bitmap.h
  head/sys/cddl/contrib/opensolaris/uts/common/sys/cpuvar.h
Directory Properties:
  head/sys/cddl/contrib/opensolaris/   (props changed)

Modified: head/sys/cddl/contrib/opensolaris/uts/common/dtrace/systrace.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/dtrace/systrace.c  Wed Aug 
20 18:10:12 2014(r270238)
+++ head/sys/cddl/contrib/opensolaris/uts/common/dtrace/systrace.c  Wed Aug 
20 18:29:18 2014(r270239)
@@ -165,11 +165,11 @@ systrace_enable(void *arg, dtrace_id_t i
return;
}
 
-   (void) casptr(sysent[sysnum].sy_callc,
+   (void) atomic_cas_ptr(sysent[sysnum].sy_callc,
(void *)systrace_sysent[sysnum].stsy_underlying,
(void *)dtrace_systrace_syscall);
 #ifdef _SYSCALL32_IMPL
-   (void) casptr(sysent32[sysnum].sy_callc,
+   (void) atomic_cas_ptr(sysent32[sysnum].sy_callc,
(void *)systrace_sysent32[sysnum].stsy_underlying,
(void *)dtrace_systrace_syscall32);
 #endif
@@ -184,12 +184,12 @@ systrace_disable(void *arg, dtrace_id_t 
systrace_sysent[sysnum].stsy_return == DTRACE_IDNONE);
 
if (disable) {
-   (void) casptr(sysent[sysnum].sy_callc,
+   (void) atomic_cas_ptr(sysent[sysnum].sy_callc,
(void *)dtrace_systrace_syscall,
(void *)systrace_sysent[sysnum].stsy_underlying);
 
 #ifdef _SYSCALL32_IMPL
-   (void) casptr(sysent32[sysnum].sy_callc,
+   (void) atomic_cas_ptr(sysent32[sysnum].sy_callc,
(void *)dtrace_systrace_syscall32,
(void *)systrace_sysent32[sysnum].stsy_underlying);
 #endif

Modified: head/sys/cddl/contrib/opensolaris/uts/common/os/fm.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/os/fm.cWed Aug 20 
18:10:12 2014(r270238)
+++ head/sys/cddl/contrib/opensolaris/uts/common/os/fm.cWed Aug 20 
18:29:18 2014(r270239)
@@ -379,7 +379,7 @@ fm_panic(const char *format, ...)
 {
va_list ap;
 
-   (void) casptr((void *)fm_panicstr, NULL, (void *)format);
+   (void) atomic_cas_ptr((void *)fm_panicstr, NULL, (void *)format);
 #if defined(__i386) || defined(__amd64)
fastreboot_disable_highpil();
 #endif /* __i386 || __amd64 */

Modified: head/sys/cddl/contrib/opensolaris/uts/common/sys/bitmap.h
==
--- head/sys/cddl/contrib/opensolaris/uts/common/sys/bitmap.h   Wed Aug 20 
18:10:12 2014(r270238)
+++ head/sys/cddl/contrib/opensolaris/uts/common/sys/bitmap.h   Wed Aug 20 
18:29:18 2014(r270239)
@@ -171,9 +171,9 @@ extern int  odd_parity(ulong_t);
  * to 0 otherwise.
  */
 #defineBT_ATOMIC_SET(bitmap, bitindex) \
-   { atomic_or_long((BT_WIM(bitmap, bitindex)), BT_BIW(bitindex)); }
+   { atomic_or_ulong((BT_WIM(bitmap, bitindex)), BT_BIW(bitindex)); }
 #defineBT_ATOMIC_CLEAR(bitmap, bitindex) \
-   { atomic_and_long((BT_WIM(bitmap, bitindex)), ~BT_BIW(bitindex)); }
+   { atomic_and_ulong((BT_WIM(bitmap, bitindex)), ~BT_BIW(bitindex)); }
 
 #defineBT_ATOMIC_SET_EXCL(bitmap, bitindex, result) \
{ result = atomic_set_long_excl((BT_WIM(bitmap, bitindex)),\

Modified: head/sys/cddl/contrib/opensolaris/uts/common/sys/cpuvar.h
==
--- head/sys/cddl/contrib/opensolaris/uts/common/sys/cpuvar.h   Wed Aug 20 
18:10:12 2014(r270238)
+++ head/sys/cddl/contrib/opensolaris/uts/common/sys/cpuvar.h   Wed Aug 20 
18:29:18 2014(r270239)
@@ -524,8 +524,8 @@ typedef ulong_t cpuset_t;   /* a set of CP
largest = (uint_t)(highbit(set) - 1);   \
 }
 
-#defineCPUSET_ATOMIC_DEL(set, cpu) atomic_and_long((set), 
~CPUSET(cpu))
-#defineCPUSET_ATOMIC_ADD(set, cpu) atomic_or_long((set), 
CPUSET(cpu))
+#defineCPUSET_ATOMIC_DEL(set, cpu) atomic_and_ulong((set), 
~CPUSET(cpu))
+#defineCPUSET_ATOMIC_ADD(set, cpu) atomic_or_ulong((set), 
CPUSET(cpu))
 
 #defineCPUSET_ATOMIC_XADD(set, cpu, result) \
{ result = atomic_set_long_excl((set), (cpu)); }
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to 

svn commit: r270240 - stable/10/sys/sys

2014-08-20 Thread Davide Italiano
Author: davide
Date: Wed Aug 20 18:40:29 2014
New Revision: 270240
URL: http://svnweb.freebsd.org/changeset/base/270240

Log:
  Complete MFC of r270233, also unbreak the build.
  
  Reported by:  grehan

Modified:
  stable/10/sys/sys/time.h

Modified: stable/10/sys/sys/time.h
==
--- stable/10/sys/sys/time.hWed Aug 20 18:29:18 2014(r270239)
+++ stable/10/sys/sys/time.hWed Aug 20 18:40:29 2014(r270240)
@@ -129,6 +129,7 @@ bintime_shift(struct bintime *_bt, int _
 #defineSBT_1MS (SBT_1S / 1000)
 #defineSBT_1US (SBT_1S / 100)
 #defineSBT_1NS (SBT_1S / 10)
+#defineSBT_MAX 0x7fff
 
 static __inline int
 sbintime_getsec(sbintime_t _sbt)
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r270241 - in stable/10/sys: arm/ti dev/iicbus

2014-08-20 Thread Luiz Otavio O Souza
Author: loos
Date: Wed Aug 20 19:12:19 2014
New Revision: 270241
URL: http://svnweb.freebsd.org/changeset/base/270241

Log:
  MFC r266923:
  
Ignore IIC_ENOADDR from iicbus_reset() as it only means we have a
master-only controller.
  
This fixes the iic bus scan with i2c(8) (on supported controllers).
  
Tested with gpioiic(4).
  
  MFC r267009:
  
Remove the unnecessary i2c slave address assignment.
  
The ti_i2c controller only works in the master mode and the i2c address
passed on iicbus_reset() is used to set the controller slave address when
operating as an i2c slave (which isn't currently supported).
  
When talking to a slave, the slave address is correctly provided to
ti_i2c_tranfer().

Modified:
  stable/10/sys/arm/ti/ti_i2c.c
  stable/10/sys/dev/iicbus/iic.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/arm/ti/ti_i2c.c
==
--- stable/10/sys/arm/ti/ti_i2c.c   Wed Aug 20 18:40:29 2014
(r270240)
+++ stable/10/sys/arm/ti/ti_i2c.c   Wed Aug 20 19:12:19 2014
(r270241)
@@ -91,7 +91,6 @@ struct ti_i2c_softc
 
volatile uint16_t   sc_stat_flags;  /* contains the status flags 
last IRQ */
 
-   uint16_tsc_i2c_addr;
uint16_tsc_rev;
 };
 
@@ -294,10 +293,6 @@ ti_i2c_reset(device_t dev, u_char speed,
 
TI_I2C_LOCK(sc);
 
-   if (oldaddr)
-   *oldaddr = sc-sc_i2c_addr;
-   sc-sc_i2c_addr = addr;
-
/* First disable the controller while changing the clocks */
con_reg = ti_i2c_read_reg(sc, I2C_REG_CON);
ti_i2c_write_reg(sc, I2C_REG_CON, 0x);
@@ -309,9 +304,6 @@ ti_i2c_reset(device_t dev, u_char speed,
ti_i2c_write_reg(sc, I2C_REG_SCLL, clkcfg-scll | (clkcfg-hsscll8));
ti_i2c_write_reg(sc, I2C_REG_SCLH, clkcfg-sclh | (clkcfg-hssclh8));
 
-   /* Set the remote slave address */
-   ti_i2c_write_reg(sc, I2C_REG_SA, addr);
-
/* Check if we are dealing with high speed mode */
if ((clkcfg-hsscll + clkcfg-hssclh)  0)
con_reg  = I2C_CON_OPMODE_HS;
@@ -323,7 +315,7 @@ ti_i2c_reset(device_t dev, u_char speed,
 
TI_I2C_UNLOCK(sc);
 
-   return 0;
+   return (IIC_ENOADDR);
 }
 
 /**

Modified: stable/10/sys/dev/iicbus/iic.c
==
--- stable/10/sys/dev/iicbus/iic.c  Wed Aug 20 18:40:29 2014
(r270240)
+++ stable/10/sys/dev/iicbus/iic.c  Wed Aug 20 19:12:19 2014
(r270241)
@@ -322,6 +322,12 @@ iicioctl(struct cdev *dev, u_long cmd, c
 
case I2CRSTCARD:
error = iicbus_reset(parent, IIC_UNKNOWN, 0, NULL);
+   /*
+* Ignore IIC_ENOADDR as it only means we have a master-only
+* controller.
+*/
+   if (error == IIC_ENOADDR)
+   error = 0;
break;
 
case I2CWRITE:
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r270242 - in stable/10: etc/mtree sbin/devd sbin/devd/tests

2014-08-20 Thread Alan Somers
Author: asomers
Date: Wed Aug 20 19:30:58 2014
New Revision: 270242
URL: http://svnweb.freebsd.org/changeset/base/270242

Log:
  MFC devd-related changes
  
  r270004
  Convert devd's client socket to type SOCK_SEQPACKET.
  
This change consists of two merges from projects/zfsd/head along with the
addition of an ATF test case for the new functionality.
  
sbin/devd/tests/Makefile
sbin/devd/tests/client_test.c
  Add ATF test cases for reading events from both devd socket types.
  
r266519:
sbin/devd/devd.8
sbin/devd/devd.cc
  Create a new socket, of type SOCK_SEQPACKET, for communicating with
  clients. SOCK_SEQPACKET sockets preserve record boundaries,
  simplying code in the client. The old SOCK_STREAM socket is retained
  for backwards-compatibility with existing clients.
  
r269993:
sbin/devd/devd.8
  Fix grammar bug.
  
  r270019 (from bz)
  Remove bogus ; at the end of the if condition in order to unbreak gcc builds
after r270004.
  
MFC after:4 days
X-MFX with:   r270004

Added:
  stable/10/sbin/devd/tests/
 - copied from r270004, head/sbin/devd/tests/
Modified:
  stable/10/etc/mtree/BSD.tests.dist
  stable/10/sbin/devd/Makefile
  stable/10/sbin/devd/devd.8
  stable/10/sbin/devd/devd.cc
  stable/10/sbin/devd/tests/client_test.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/etc/mtree/BSD.tests.dist
==
--- stable/10/etc/mtree/BSD.tests.dist  Wed Aug 20 19:12:19 2014
(r270241)
+++ stable/10/etc/mtree/BSD.tests.dist  Wed Aug 20 19:30:58 2014
(r270242)
@@ -95,6 +95,8 @@
 sbin
 dhclient
 ..
+devd
+..
 growfs
 ..
 mdconfig

Modified: stable/10/sbin/devd/Makefile
==
--- stable/10/sbin/devd/MakefileWed Aug 20 19:12:19 2014
(r270241)
+++ stable/10/sbin/devd/MakefileWed Aug 20 19:30:58 2014
(r270242)
@@ -1,5 +1,7 @@
 # $FreeBSD$
 
+.include bsd.own.mk
+
 PROG_CXX=devd
 SRCS=  devd.cc token.l parse.y y.tab.h
 MAN=   devd.8 devd.conf.5
@@ -16,4 +18,8 @@ CFLAGS+=-I. -I${.CURDIR}
 
 CLEANFILES= y.output
 
+.if ${MK_TESTS} != no
+SUBDIR+=tests
+.endif
+
 .include bsd.prog.mk

Modified: stable/10/sbin/devd/devd.8
==
--- stable/10/sbin/devd/devd.8  Wed Aug 20 19:12:19 2014(r270241)
+++ stable/10/sbin/devd/devd.8  Wed Aug 20 19:30:58 2014(r270242)
@@ -25,7 +25,7 @@
 .\
 .\ $FreeBSD$
 .\
-.Dd January 30, 2013
+.Dd August 14, 2014
 .Dt DEVD 8
 .Os
 .Sh NAME
@@ -55,9 +55,7 @@ If option
 .Fl f
 is specified more than once, the last file specified is used.
 .It Fl l Ar num
-Limit concurrent
-.Pa /var/run/devd.pipe
-connections to
+Limit concurrent socket connections to
 .Ar num .
 The default connection limit is 10.
 .It Fl n
@@ -130,22 +128,27 @@ wish to hook into the
 system without modifying the user's other
 config files.
 .Pp
-All messages that
+Since
+.Xr devctl 4
+allows only one active reader,
 .Nm
-receives are forwarded to the
+multiplexes it, forwarding all events to any number of connected clients.
+Clients connect by opening the SOCK_SEQPACKET
 .Ux
 domain socket at
-.Pa /var/run/devd.pipe .
+.Pa /var/run/devd.seqpacket.pipe .
 .Sh FILES
-.Bl -tag -width .Pa /var/run/devd.pipe -compact
+.Bl -tag -width .Pa /var/run/devd.seqpacket.pipe -compact
 .It Pa /etc/devd.conf
 The default
 .Nm
 configuration file.
-.It Pa /var/run/devd.pipe
+.It Pa /var/run/devd.seqpacket.pipe
 The socket used by
 .Nm
 to communicate with its clients.
+.It Pa /var/run/devd.pipe
+A deprecated socket retained for use with old clients.
 .El
 .Sh SEE ALSO
 .Xr devctl 4 ,

Modified: stable/10/sbin/devd/devd.cc
==
--- stable/10/sbin/devd/devd.cc Wed Aug 20 19:12:19 2014(r270241)
+++ stable/10/sbin/devd/devd.cc Wed Aug 20 19:30:58 2014(r270242)
@@ -100,7 +100,8 @@ __FBSDID($FreeBSD$);
 #include devd.h  /* C compatible definitions */
 #include devd.hh /* C++ class definitions */
 
-#define PIPE /var/run/devd.pipe
+#define STREAMPIPE /var/run/devd.pipe
+#define SEQPACKETPIPE /var/run/devd.seqpacket.pipe
 #define CF /etc/devd.conf
 #define SYSCTL hw.bus.devctl_queue
 
@@ -119,6 +120,11 @@ __FBSDID($FreeBSD$);
 
 using namespace std;
 
+typedef struct client {
+   int fd;
+   int socktype;
+} client_t;
+
 extern FILE *yyin;
 extern int lineno;
 
@@ -822,12 +828,12 @@ process_event(char *buffer)
 }
 
 int
-create_socket(const char *name)
+create_socket(const char *name, int socktype)
 {
int fd, slen;
struct sockaddr_un sun;
 
-   if ((fd = socket(PF_LOCAL, SOCK_STREAM, 0))  0)
+   if ((fd = 

svn commit: r270243 - in stable/10: share/man/man4 sys/arm/broadcom/bcm2835 sys/arm/ti sys/boot/fdt/dts/arm

2014-08-20 Thread Luiz Otavio O Souza
Author: loos
Date: Wed Aug 20 19:37:05 2014
New Revision: 270243
URL: http://svnweb.freebsd.org/changeset/base/270243

Log:
  MFC r267021:
  
FreeBSD, historically, has always used 8-bit addresses for i2c devices
(7-bit device address  1), always leaving the room for the read/write
bit.
  
This commit convert ti_i2c and revert r259127 on bcm2835_bsc to make them
compatible with 8-bit addresses.  Previous to this commit an i2c device
would have different addresses depending on the controller it was attached
to (by example, when compared to any iicbb(4) based i2c controller), which
was a pretty annoying behavior.
  
Also, update the PMIC i2c address on beaglebone* DTS files to match the
new address scheme.
  
Now the userland utilities need to do the correct slave address shifting
(but it is going to work with any i2c controller on the system).
  
Discussed with: ian
  
  MFC r267834:
  
Clarify the expected usage of I2C 7-bit slave addresses on ioctl(2)
interface.
  
While here add the cross reference to iic(4) on iicbus(4).
  
CR: D210
Suggested by:   jmg

Modified:
  stable/10/share/man/man4/iic.4
  stable/10/share/man/man4/iicbus.4
  stable/10/sys/arm/broadcom/bcm2835/bcm2835_bsc.c
  stable/10/sys/arm/ti/ti_i2c.c
  stable/10/sys/boot/fdt/dts/arm/beaglebone-black.dts
  stable/10/sys/boot/fdt/dts/arm/beaglebone.dts
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/share/man/man4/iic.4
==
--- stable/10/share/man/man4/iic.4  Wed Aug 20 19:30:58 2014
(r270242)
+++ stable/10/share/man/man4/iic.4  Wed Aug 20 19:37:05 2014
(r270243)
@@ -25,7 +25,7 @@
 .\
 .\ $FreeBSD$
 .\
-.Dd September 6, 2006
+.Dd June 24, 2014
 .Dt IIC 4
 .Os
 .Sh NAME
@@ -51,12 +51,20 @@ following ioctls:
 Sends the start condition to the slave specified by the
 .Va slave
 element to the bus.
+The
+.Va slave
+element consists of a 7-bit address and a read/write bit
+(i.e., 7-bit address  1 | r/w).
+If the read/write bit is set a read operation is initiated, if the read/write
+bit is cleared a write operation is initiated.
 All other elements are ignored.
 .It Dv I2CRPTSTART
 .Pq Vt struct iiccmd
 Sends the repeated start condition to the slave specified by the
 .Va slave
 element to the bus.
+The slave address should be specified as in
+.Dv I2CSTART .
 All other elements are ignored.
 .It Dv I2CSTOP
 No argument is passed.
@@ -115,10 +123,15 @@ is set in
 Otherwise the transfer is a write transfer.
 The
 .Va slave
-element specifies the 7-bit address for the transfer.
+element specifies the 7-bit address with the read/write bit for the transfer.
+The read/write bit will be handled by the iicbus stack based on the specified
+transfer operation.
 The
 .Va len
-element is the length of the data.
+element is the number of
+.Pq Vt struct iic_msg
+messages encoded on
+.Pq Vt struct iic_rdwr_data .
 The
 .Va buf
 element is a buffer for that data.

Modified: stable/10/share/man/man4/iicbus.4
==
--- stable/10/share/man/man4/iicbus.4   Wed Aug 20 19:30:58 2014
(r270242)
+++ stable/10/share/man/man4/iicbus.4   Wed Aug 20 19:37:05 2014
(r270243)
@@ -24,7 +24,7 @@
 .\
 .\ $FreeBSD$
 .\
-.Dd August 6, 1998
+.Dd June 24, 2014
 .Dt IICBUS 4
 .Os
 .Sh NAME
@@ -104,6 +104,7 @@ Some I2C interfaces are available:
 .It Sy bktr Ta Brooktree848 video chipset, hardware and software master-only 
interface
 .El
 .Sh SEE ALSO
+.Xr iic 4 ,
 .Xr iicbb 4 ,
 .Xr lpbb 4 ,
 .Xr pcf 4

Modified: stable/10/sys/arm/broadcom/bcm2835/bcm2835_bsc.c
==
--- stable/10/sys/arm/broadcom/bcm2835/bcm2835_bsc.cWed Aug 20 19:30:58 
2014(r270242)
+++ stable/10/sys/arm/broadcom/bcm2835/bcm2835_bsc.cWed Aug 20 19:37:05 
2014(r270243)
@@ -407,7 +407,7 @@ bcm_bsc_transfer(device_t dev, struct ii
for (i = 0; i  nmsgs; i++) {
 
/* Write the slave address. */
-   BCM_BSC_WRITE(sc, BCM_BSC_SLAVE, msgs[i].slave);
+   BCM_BSC_WRITE(sc, BCM_BSC_SLAVE, msgs[i].slave  1);
 
/* Write the data length. */
BCM_BSC_WRITE(sc, BCM_BSC_DLEN, msgs[i].len);

Modified: stable/10/sys/arm/ti/ti_i2c.c
==
--- stable/10/sys/arm/ti/ti_i2c.c   Wed Aug 20 19:30:58 2014
(r270242)
+++ stable/10/sys/arm/ti/ti_i2c.c   Wed Aug 20 19:37:05 2014
(r270243)
@@ -747,7 +747,7 @@ ti_i2c_transfer(device_t dev, struct iic
}
 
/* set the slave address */
-   ti_i2c_write_reg(sc, I2C_REG_SA, msgs[i].slave);
+   ti_i2c_write_reg(sc, I2C_REG_SA, msgs[i].slave  1);
 
/* perform the read or 

svn commit: r270244 - in stable/10: bin/sh/tests/builtins tools/build/mk

2014-08-20 Thread Jilles Tjoelker
Author: jilles
Date: Wed Aug 20 19:39:07 2014
New Revision: 270244
URL: http://svnweb.freebsd.org/changeset/base/270244

Log:
  MFC r268429: Don't install locale1.0 if MK_NLS == no.
  
  The test locale1.0 depends on locale support; it is meaningless without a
  working LC_MESSAGES.
  
  I added an OptionalObsoleteFiles.inc entry.
  
  PR:   181151
  Submitted by: Garrett Cooper (original version)
  Sponsored by: EMC / Isilon Storage Division

Modified:
  stable/10/bin/sh/tests/builtins/Makefile
  stable/10/tools/build/mk/OptionalObsoleteFiles.inc
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/bin/sh/tests/builtins/Makefile
==
--- stable/10/bin/sh/tests/builtins/MakefileWed Aug 20 19:37:05 2014
(r270243)
+++ stable/10/bin/sh/tests/builtins/MakefileWed Aug 20 19:39:07 2014
(r270244)
@@ -92,7 +92,9 @@ FILES+=   local1.0
 FILES+=local2.0
 FILES+=local3.0
 FILES+=local4.0
+.if ${MK_NLS} != no
 FILES+=locale1.0
+.endif
 FILES+=printf1.0
 FILES+=printf2.0
 FILES+=printf3.0

Modified: stable/10/tools/build/mk/OptionalObsoleteFiles.inc
==
--- stable/10/tools/build/mk/OptionalObsoleteFiles.inc  Wed Aug 20 19:37:05 
2014(r270243)
+++ stable/10/tools/build/mk/OptionalObsoleteFiles.inc  Wed Aug 20 19:39:07 
2014(r270244)
@@ -3336,9 +3336,10 @@ OLD_FILES+=var/yp/Makefile
 OLD_FILES+=var/yp/Makefile.dist
 .endif
 
-#.if ${MK_NLS} == no
+.if ${MK_NLS} == no
+OLD_FILES+=usr/tests/bin/sh/builtins/locale1.0
 # to be filled in
-#.endif
+.endif
 
 .if ${MK_NTP} == no
 OLD_FILES+=etc/ntp.conf
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


Re: svn commit: r270227 - head/sys/sys

2014-08-20 Thread Xin Li
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA512

On 08/20/14 09:32, Davide Italiano wrote:
 Author: davide Date: Wed Aug 20 16:32:02 2014 New Revision: 270227 
 URL: http://svnweb.freebsd.org/changeset/base/270227
 
 Log: Make Bruce happy removing the LL abomination from time.h 
 It's not necessary in all the three instances because they already
 have the correct type on all the supported arches.

I'm not yet 100% sure (still building with some of my changes) but
this looks like the change that broke powerpc build, I saw:

In file included from
/tank/delphij/head/cddl/usr.sbin/lockstat/../../../sys/cddl/compat/opensolaris/sys/time.h:32,
 from
/tank/delphij/head/cddl/usr.sbin/lockstat/../../../sys/sys/stat.h:99,
 from
/tank/delphij/head/cddl/usr.sbin/lockstat/../../../sys/cddl/compat/opensolaris/sys/stat.h:33,
 from
/tank/delphij/head/cddl/usr.sbin/lockstat/../../../cddl/contrib/opensolaris/cmd/lockstat/lockstat.c:41:
/tank/delphij/head/cddl/usr.sbin/lockstat/../../../sys/sys/time.h: In
function 'timespec2bintime':
/tank/delphij/head/cddl/usr.sbin/lockstat/../../../sys/sys/time.h:187:
warning: integer constant is too large for 'long' type
/tank/delphij/head/cddl/usr.sbin/lockstat/../../../sys/sys/time.h: In
function 'timeval2bintime':
/tank/delphij/head/cddl/usr.sbin/lockstat/../../../sys/sys/time.h:204:
warning: integer constant is too large for 'long' type
*** [lockstat.o] Error code 1


 Requested by: bde
 
 Modified: head/sys/sys/time.h
 
 Modified: head/sys/sys/time.h 
 ==

 
- --- head/sys/sys/time.h   Wed Aug 20 16:09:05 2014(r270226)
 +++ head/sys/sys/time.h   Wed Aug 20 16:32:02 2014(r270227) @@
 -129,7 +129,7 @@ bintime_shift(struct bintime *_bt, int _ #define
 SBT_1MS   (SBT_1S / 1000) #define SBT_1US (SBT_1S / 100) #define
 SBT_1NS   (SBT_1S / 10) -#define  SBT_MAX
 0x7fffLL +#define SBT_MAX 0x7fff
 
 static __inline int sbintime_getsec(sbintime_t _sbt) @@ -184,7
 +184,7 @@ timespec2bintime(const struct timespec *
 
 _bt-sec = _ts-tv_sec; /* 18446744073 = int(2^64 / 10) */ 
 - _bt-frac = _ts-tv_nsec * (uint64_t)18446744073LL; +   _bt-frac =
 _ts-tv_nsec * (uint64_t)18446744073; }
 
 static __inline void @@ -201,7 +201,7 @@ timeval2bintime(const
 struct timeval *_t
 
 _bt-sec = _tv-tv_sec; /* 18446744073709 = int(2^64 / 100) */ 
 - _bt-frac = _tv-tv_usec * (uint64_t)18446744073709LL; +
 _bt-frac = _tv-tv_usec * (uint64_t)18446744073709; }
 
 static __inline struct timespec
 


- -- 
Xin LI delp...@delphij.nethttps://www.delphij.net/
FreeBSD - The Power to Serve!   Live free or die
-BEGIN PGP SIGNATURE-
Version: GnuPG v2.0

iQIcBAEBCgAGBQJT9PoeAAoJEJW2GBstM+nsvAsP/3asjb/pBnK4jXnouHSSHmzf
Hww9RbqtRrLVGmxl0utcI4yhs/5yvlm2wqGyhfqS4EY8dHEXE0N+gtHTXcZsrCSM
g/3kJLGNj8oA6poNWXiNWo4fIVEmsOgwy/K2ef5EDs8moq19dP7/3x7ixjpEMIIz
80Yq9Zts1hNLICKlv2gKCONpGo5MyThquJytadXsRKz+McZnzR3XaXnHEIl5DB9+
OgZrKuYX4aGdWguppciS53IUvdn43jF5NZw+JFsf6SwXX5I7p4DjM1JE0R6wssKr
jeuelME0xmki462VBlOBj+ul/JHEbF6aF8Nkp4VVf0oN527rRguJ1Qu7a2r/xbO1
Vcc28rO8o+oxbYotnCItlKtj2tXBivalc+gcHV+ySdVL/mIDAcPw0UVqYWIQAQul
QHRW+zwnnVH5DRoHn0IBpDs1jlvu45xubc0iVpZPWHbE3FFt8HMcrqMQc+7ppSAn
HJSQv4kxEhvR/jHzu3dY6cnziWsz5TZT4V4HfE9ut7QZELA5f95DR5HqT82dOf0x
4Wrc9uJT2yJayvK5E40/tuXMhipv+OOm/Gjs1gF/BHULHjMEc1LRRirwY0DAewwd
8p/cTmKNXpyTxi24kAvJ2mWKNdv4ncrjWIgLDJLZfMruA4SbaD3TCZEs0evmE1lH
gbdwjyzcWuwHUMh+1TfG
=1yEW
-END PGP SIGNATURE-
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


Re: svn commit: r270177 - in stable/8: tools/regression/usr.sbin/etcupdate usr.sbin usr.sbin/etcupdate

2014-08-20 Thread Peter Wemm
On 8/19/14 10:54 AM, John Baldwin wrote:
 Author: jhb
 Date: Tue Aug 19 17:54:15 2014
 New Revision: 270177
 URL: http://svnweb.freebsd.org/changeset/base/270177
 
 Log:
   MFC 238423,238426,238428,258063,258064,258066,258097,258185,259134:
   The etcupdate utility is a tool for managing updates to files that are
   not updated as part of `make installworld' such as files in /etc.  It
   manages updates by doing a three-way merge of changes made to these files
   against the local versions.  It is also designed to minimize the amount
   of user intervention with the goal of simplifying upgrades for clusters
   of machines.
   
   Requested by:   peter

Much appreciated, thanks!

We're making a serious effort at streamlining the cluster refresh process
and etcupdate seems to fit the bill nicely for upgrading src-less systems.
 We have freebsd/8.x machines in the mix so this eliminates a whole bunch
of script exceptions.

etcupdate is so much nicer than mergemaster when dealing with *many*
systems.  To paraphrase twitter:
mergemaster: i enter i enter i enter ... i enter i enter OH CRAP!

-- 
Peter Wemm - pe...@wemm.org; pe...@freebsd.org; pe...@yahoo-inc.com; KI6FJV



signature.asc
Description: OpenPGP digital signature


Re: svn commit: r270227 - head/sys/sys

2014-08-20 Thread Davide Italiano
On Wed, Aug 20, 2014 at 12:42 PM, Xin Li delp...@delphij.net wrote:
 -BEGIN PGP SIGNED MESSAGE-
 Hash: SHA512

 On 08/20/14 09:32, Davide Italiano wrote:
 Author: davide Date: Wed Aug 20 16:32:02 2014 New Revision: 270227
 URL: http://svnweb.freebsd.org/changeset/base/270227

 Log: Make Bruce happy removing the LL abomination from time.h
 It's not necessary in all the three instances because they already
 have the correct type on all the supported arches.

 I'm not yet 100% sure (still building with some of my changes) but
 this looks like the change that broke powerpc build, I saw:


No problem to (at least partly) revert this if it causes problem. Let me know.

-- 
Davide

There are no solved problems; there are only problems that are more
or less solved -- Henri Poincare
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r270245 - stable/9/lib/libc/gen

2014-08-20 Thread Jilles Tjoelker
Author: jilles
Date: Wed Aug 20 20:12:05 2014
New Revision: 270245
URL: http://svnweb.freebsd.org/changeset/base/270245

Log:
  MFC r262872: fts: Don't abort if an empty pathname is given.
  
  Make fts_open(3) treat an empty pathname like any other pathname that cannot
  be lstatted because of [ENOENT].
  
  It is rather confusing if  rm -rf file1  file2  does not remove file1 and
  file2.
  
  PR:   187264

Modified:
  stable/9/lib/libc/gen/fts.c
Directory Properties:
  stable/9/lib/libc/   (props changed)

Modified: stable/9/lib/libc/gen/fts.c
==
--- stable/9/lib/libc/gen/fts.c Wed Aug 20 19:39:07 2014(r270244)
+++ stable/9/lib/libc/gen/fts.c Wed Aug 20 20:12:05 2014(r270245)
@@ -160,11 +160,7 @@ fts_open(argv, options, compar)
 
/* Allocate/initialize root(s). */
for (root = NULL, nitems = 0; *argv != NULL; ++argv, ++nitems) {
-   /* Don't allow zero-length paths. */
-   if ((len = strlen(*argv)) == 0) {
-   errno = ENOENT;
-   goto mem3;
-   }
+   len = strlen(*argv);
 
p = fts_alloc(sp, *argv, len);
p-fts_level = FTS_ROOTLEVEL;
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r270246 - head/bin/sh

2014-08-20 Thread Jilles Tjoelker
Author: jilles
Date: Wed Aug 20 20:15:43 2014
New Revision: 270246
URL: http://svnweb.freebsd.org/changeset/base/270246

Log:
  sh: Remove two redundant (uintmax_t) casts.
  
  Submitted by: jmallett

Modified:
  head/bin/sh/arith_yacc.c

Modified: head/bin/sh/arith_yacc.c
==
--- head/bin/sh/arith_yacc.cWed Aug 20 20:12:05 2014(r270245)
+++ head/bin/sh/arith_yacc.cWed Aug 20 20:15:43 2014(r270246)
@@ -139,10 +139,9 @@ static arith_t do_binop(int op, arith_t 
case ARITH_SUB:
return (uintmax_t)a - (uintmax_t)b;
case ARITH_LSHIFT:
-   return (uintmax_t)a 
-   ((uintmax_t)b  (sizeof(uintmax_t) * CHAR_BIT - 1));
+   return (uintmax_t)a  (b  (sizeof(uintmax_t) * CHAR_BIT - 1));
case ARITH_RSHIFT:
-   return a  ((uintmax_t)b  (sizeof(uintmax_t) * CHAR_BIT - 1));
+   return a  (b  (sizeof(uintmax_t) * CHAR_BIT - 1));
case ARITH_LT:
return a  b;
case ARITH_LE:
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


Re: svn commit: r270227 - head/sys/sys

2014-08-20 Thread Bruce Evans

On Wed, 20 Aug 2014, Xin Li wrote:


-BEGIN PGP SIGNED MESSAGE-
Hash: SHA512

On 08/20/14 09:32, Davide Italiano wrote:

Author: davide Date: Wed Aug 20 16:32:02 2014 New Revision: 270227
URL: http://svnweb.freebsd.org/changeset/base/270227

Log: Make Bruce happy removing the LL abomination from time.h
It's not necessary in all the three instances because they already
have the correct type on all the supported arches.


I'm not yet 100% sure (still building with some of my changes) but
this looks like the change that broke powerpc build, I saw:


That is a compiler bug, or excessive compiler flags to force the compiler
to be broken.  I thought that such compilers and/or flags went away.
However, apparently 15 years of C99 and 25 years of gnu89 is not enough
for them to go away.  We used to almost-intentionally ask for the warning
and not ask for pure gnu89 using some flag like -std=c89.  Otherwise, old
compilers default to gnu89 and support constants whos natural type is
long long.


In file included from
/tank/delphij/head/cddl/usr.sbin/lockstat/../../../sys/cddl/compat/opensolaris/sys/time.h:32,
from
/tank/delphij/head/cddl/usr.sbin/lockstat/../../../sys/sys/stat.h:99,
from
/tank/delphij/head/cddl/usr.sbin/lockstat/../../../sys/cddl/compat/opensolaris/sys/stat.h:33,
from
/tank/delphij/head/cddl/usr.sbin/lockstat/../../../cddl/contrib/opensolaris/cmd/lockstat/lockstat.c:41:
/tank/delphij/head/cddl/usr.sbin/lockstat/../../../sys/sys/time.h: In
function 'timespec2bintime':
/tank/delphij/head/cddl/usr.sbin/lockstat/../../../sys/sys/time.h:187:
warning: integer constant is too large for 'long' type
/tank/delphij/head/cddl/usr.sbin/lockstat/../../../sys/sys/time.h: In
function 'timeval2bintime':
/tank/delphij/head/cddl/usr.sbin/lockstat/../../../sys/sys/time.h:204:
warning: integer constant is too large for 'long' type
*** [lockstat.o] Error code 1


Requested by:   bde

Modified: head/sys/sys/time.h

Modified: head/sys/sys/time.h
==

- --- head/sys/sys/time.h   Wed Aug 20 16:09:05 2014(r270226)

+++ head/sys/sys/time.h Wed Aug 20 16:32:02 2014(r270227) @@
-129,7 +129,7 @@ bintime_shift(struct bintime *_bt, int _ #define
SBT_1MS (SBT_1S / 1000) #define SBT_1US (SBT_1S / 100) #define
SBT_1NS (SBT_1S / 10) -#define  SBT_MAX
0x7fffLL +#define   SBT_MAX 0x7fff


This is the part touched by davide recently.


static __inline int sbintime_getsec(sbintime_t _sbt) @@ -184,7
+184,7 @@ timespec2bintime(const struct timespec *

_bt-sec = _ts-tv_sec; /* 18446744073 = int(2^64 / 10) */
-   _bt-frac = _ts-tv_nsec * (uint64_t)18446744073LL; + _bt-frac =
_ts-tv_nsec * (uint64_t)18446744073; }

static __inline void @@ -201,7 +201,7 @@ timeval2bintime(const
struct timeval *_t

_bt-sec = _tv-tv_sec; /* 18446744073709 = int(2^64 / 100) */
-   _bt-frac = _tv-tv_usec * (uint64_t)18446744073709LL; +
_bt-frac = _tv-tv_usec * (uint64_t)18446744073709; }

static __inline struct timespec


Older parts used the uint64_t casts to get the correct type, but also
used the long long abomination to avoid the warning, since this used
to be necessary for gcc on i386.

It is actually -std=c99 or clang that is needed to avoid the warning.

The default for gcc is to warn, and even -std=gnu89 doesn't prevent
the warning.  This is bogus since old gcc and gnu89 support long
long and don't warn about other uses of it.

clang is more seriously broken in the other direction: it doesn't warn
about either the constants too large for long or for use of long
long even with -std=c89.  It takes -std=c89 -pedantic to get a warning
about use of long long, and this is not enough for a warning about
large constants (e.g., in 'long long x = 111;').  clang
does give a more useful conversion warning which such a constant
is assigned to a type too small to represent it.

-std=c99 is standard in kern.pre.mk but not so standard for applications.
The default for applications is -std=gnu99 but there is support for
overriding this.  So another bug bites.  I consider the functions with
the LL's in them as namespace pollution for applications.  I think
they are meant to be used by applications, but they are undocumented.
So it was not enough to check that this change doesn't break kernels.

The SBT macros are also undocumented namespace pollution for applications
(everything is under __BSD_VISIBLE, but that is the default), but since
they are macros they don't cause problems unless they are used or have
a conflicting name.  Inline functions give much more pollution than
macros since they are always parsed and they may depend on other headers.

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

svn commit: r270247 - in head/sys/cddl/contrib/opensolaris/uts: common/dtrace common/fs/zfs common/fs/zfs/sys common/os sparc/dtrace

2014-08-20 Thread Xin LI
Author: delphij
Date: Wed Aug 20 21:44:48 2014
New Revision: 270247
URL: http://svnweb.freebsd.org/changeset/base/270247

Log:
  MFC r270195:
  
  Illumos issue:
  5045 use atomic_{inc,dec}_* instead of atomic_add_*
  
  MFC after:2 weeks

Modified:
  head/sys/cddl/contrib/opensolaris/uts/common/dtrace/fasttrap.c
  head/sys/cddl/contrib/opensolaris/uts/common/dtrace/profile.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/refcount.h
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_cache.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_label.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio_inject.c
  head/sys/cddl/contrib/opensolaris/uts/common/os/fm.c
  head/sys/cddl/contrib/opensolaris/uts/sparc/dtrace/fasttrap_isa.c
Directory Properties:
  head/sys/cddl/contrib/opensolaris/   (props changed)

Modified: head/sys/cddl/contrib/opensolaris/uts/common/dtrace/fasttrap.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/dtrace/fasttrap.c  Wed Aug 
20 20:15:43 2014(r270246)
+++ head/sys/cddl/contrib/opensolaris/uts/common/dtrace/fasttrap.c  Wed Aug 
20 21:44:48 2014(r270247)
@@ -1467,7 +1467,7 @@ fasttrap_proc_lookup(pid_t pid)
mutex_enter(fprc-ftpc_mtx);
mutex_exit(bucket-ftb_mtx);
fprc-ftpc_rcount++;
-   atomic_add_64(fprc-ftpc_acount, 1);
+   atomic_inc_64(fprc-ftpc_acount);
ASSERT(fprc-ftpc_acount = fprc-ftpc_rcount);
mutex_exit(fprc-ftpc_mtx);
 
@@ -1501,7 +1501,7 @@ fasttrap_proc_lookup(pid_t pid)
mutex_enter(fprc-ftpc_mtx);
mutex_exit(bucket-ftb_mtx);
fprc-ftpc_rcount++;
-   atomic_add_64(fprc-ftpc_acount, 1);
+   atomic_inc_64(fprc-ftpc_acount);
ASSERT(fprc-ftpc_acount = fprc-ftpc_rcount);
mutex_exit(fprc-ftpc_mtx);
 
@@ -1738,7 +1738,7 @@ fasttrap_provider_free(fasttrap_provider
 * count of active providers on the associated process structure.
 */
if (!provider-ftp_retired) {
-   atomic_add_64(provider-ftp_proc-ftpc_acount, -1);
+   atomic_dec_64(provider-ftp_proc-ftpc_acount);
ASSERT(provider-ftp_proc-ftpc_acount 
provider-ftp_proc-ftpc_rcount);
}
@@ -1814,7 +1814,7 @@ fasttrap_provider_retire(pid_t pid, cons
 * bucket lock therefore protects the integrity of the provider hash
 * table.
 */
-   atomic_add_64(fp-ftp_proc-ftpc_acount, -1);
+   atomic_dec_64(fp-ftp_proc-ftpc_acount);
ASSERT(fp-ftp_proc-ftpc_acount  fp-ftp_proc-ftpc_rcount);
 
fp-ftp_retired = 1;
@@ -1910,10 +1910,10 @@ fasttrap_add_probe(fasttrap_probe_spec_t
pdata-ftps_mod, pdata-ftps_func, name_str) != 0)
continue;
 
-   atomic_add_32(fasttrap_total, 1);
+   atomic_inc_32(fasttrap_total);
 
if (fasttrap_total  fasttrap_max) {
-   atomic_add_32(fasttrap_total, -1);
+   atomic_dec_32(fasttrap_total);
goto no_mem;
}
 

Modified: head/sys/cddl/contrib/opensolaris/uts/common/dtrace/profile.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/dtrace/profile.c   Wed Aug 
20 20:15:43 2014(r270246)
+++ head/sys/cddl/contrib/opensolaris/uts/common/dtrace/profile.c   Wed Aug 
20 21:44:48 2014(r270247)
@@ -169,9 +169,9 @@ profile_create(hrtime_t interval, const 
if (dtrace_probe_lookup(profile_id, NULL, NULL, name) != 0)
return;
 
-   atomic_add_32(profile_total, 1);
+   atomic_inc_32(profile_total);
if (profile_total  profile_max) {
-   atomic_add_32(profile_total, -1);
+   atomic_dec_32(profile_total);
return;
}
 
@@ -326,7 +326,7 @@ profile_destroy(void *arg, dtrace_id_t i
kmem_free(prof, sizeof (profile_probe_t));
 
ASSERT(profile_total = 1);
-   atomic_add_32(profile_total, -1);
+   atomic_dec_32(profile_total);
 }
 
 /*ARGSUSED*/

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c  Wed Aug 20 
20:15:43 2014(r270246)
+++ 

svn commit: r270248 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs

2014-08-20 Thread Xin LI
Author: delphij
Date: Wed Aug 20 22:39:26 2014
New Revision: 270248
URL: http://svnweb.freebsd.org/changeset/base/270248

Log:
  MFV r270196:
  
  Illumos issue:
  5047 don't use atomic_*_nv if you discard the return value
  
  MFC after:2 weeks

Modified:
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c
Directory Properties:
  head/sys/cddl/contrib/opensolaris/   (props changed)

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c  Wed Aug 20 
21:44:48 2014(r270247)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c  Wed Aug 20 
22:39:26 2014(r270248)
@@ -1609,7 +1609,7 @@ dbuf_clear(dmu_buf_impl_t *db)
dndb = dn-dn_dbuf;
if (db-db_blkid != DMU_BONUS_BLKID  MUTEX_HELD(dn-dn_dbufs_mtx)) {
avl_remove(dn-dn_dbufs, db);
-   (void) atomic_dec_32_nv(dn-dn_dbufs_count);
+   atomic_dec_32(dn-dn_dbufs_count);
membar_producer();
DB_DNODE_EXIT(db);
/*
@@ -1785,7 +1785,7 @@ dbuf_create(dnode_t *dn, uint8_t level, 
ASSERT(dn-dn_object == DMU_META_DNODE_OBJECT ||
refcount_count(dn-dn_holds)  0);
(void) refcount_add(dn-dn_holds, db);
-   (void) atomic_inc_32_nv(dn-dn_dbufs_count);
+   atomic_inc_32(dn-dn_dbufs_count);
 
dprintf_dbuf(db, db=%p\n, db);
 
@@ -1831,7 +1831,7 @@ dbuf_destroy(dmu_buf_impl_t *db)
dn = DB_DNODE(db);
mutex_enter(dn-dn_dbufs_mtx);
avl_remove(dn-dn_dbufs, db);
-   (void) atomic_dec_32_nv(dn-dn_dbufs_count);
+   atomic_dec_32(dn-dn_dbufs_count);
mutex_exit(dn-dn_dbufs_mtx);
DB_DNODE_EXIT(db);
/*
@@ -2115,7 +2115,7 @@ dbuf_rele_and_unlock(dmu_buf_impl_t *db,
 * until the move completes.
 */
DB_DNODE_ENTER(db);
-   (void) atomic_dec_32_nv(DB_DNODE(db)-dn_dbufs_count);
+   atomic_dec_32(DB_DNODE(db)-dn_dbufs_count);
DB_DNODE_EXIT(db);
/*
 * The bonus buffer's dnode hold is no longer discounted

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c   Wed Aug 20 
21:44:48 2014(r270247)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c   Wed Aug 20 
22:39:26 2014(r270248)
@@ -287,7 +287,7 @@ dmu_bonus_hold(objset_t *os, uint64_t ob
/* as long as the bonus buf is held, the dnode will be held */
if (refcount_add(db-db_holds, tag) == 1) {
VERIFY(dnode_add_ref(dn, db));
-   (void) atomic_inc_32_nv(dn-dn_dbufs_count);
+   atomic_inc_32(dn-dn_dbufs_count);
}
 
/*
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r270249 - head/sys/cam/ata

2014-08-20 Thread Warner Losh
Author: imp
Date: Wed Aug 20 22:58:12 2014
New Revision: 270249
URL: http://svnweb.freebsd.org/changeset/base/270249

Log:
  Turns out that IDENTIFY DEVICE and IDENTIFY PACKET DEVICE return data
  that's only mostly similar. Specifically word 78 bits are defined for
  IDENTIFY DEVICE as
5 Supports Hardware Feature Control
  while a IDENTIFY PACKET DEVICE defines them as
5 Asynchronous notification supported
  Therefore, only pay attention to bit 5 when we're talking to ATAPI
  devices (we don't use the hardware feature control at this time).
  Ignore it for ATA devices. Remove kludge that papered over this issue
  for Samsung SATA SSDs, since Micron drives also have the bit set and
  the error was caused by this bad interpretation of the spec (which is
  quite easy to do, since bits aren't normally overlapping like this).

Modified:
  head/sys/cam/ata/ata_xpt.c

Modified: head/sys/cam/ata/ata_xpt.c
==
--- head/sys/cam/ata/ata_xpt.c  Wed Aug 20 22:39:26 2014(r270248)
+++ head/sys/cam/ata/ata_xpt.c  Wed Aug 20 22:58:12 2014(r270249)
@@ -458,12 +458,18 @@ negotiate:
0, 0x02);
break;
case PROBE_SETAN:
-   /* Remember what transport thinks about AEN. */
-   if (softc-caps  CTS_SATA_CAPS_H_AN)
+   /* 
+* Only ATAPI defines this bit to mean AEN, but remember
+* what transport thinks about AEN.
+*/
+   if ((softc-caps  CTS_SATA_CAPS_H_AN)  
+   periph-path-device-protocol == PROTO_ATAPI)
path-device-inq_flags |= SID_AEN;
else
path-device-inq_flags = ~SID_AEN;
xpt_async(AC_GETDEV_CHANGED, path, NULL);
+   if (periph-path-device-protocol != PROTO_ATAPI)
+   break;
cam_fill_ataio(ataio,
1,
probedone,
@@ -750,14 +756,6 @@ out:
goto noerror;
 
/*
-* Some Samsung SSDs report supported Asynchronous Notification,
-* but return ABORT on attempt to enable it.
-*/
-   } else if (softc-action == PROBE_SETAN 
-   status == CAM_ATA_STATUS_ERROR) {
-   goto noerror;
-
-   /*
 * SES and SAF-TE SEPs have different IDENTIFY commands,
 * but SATA specification doesn't tell how to identify them.
 * Until better way found, just try another if first fail.
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r270250 - stable/10/sys/dev/mps

2014-08-20 Thread Stephen McConnell
Author: slm
Date: Wed Aug 20 23:09:27 2014
New Revision: 270250
URL: http://svnweb.freebsd.org/changeset/base/270250

Log:
  MFC r269314 and r269316
  
  r269314:
  Bring in LSI's phase16 - phase18 changes
  * Implements Start Stop Unit for SATA direct-attach devices in IR mode to 
avoid
data corruption.
  * Use CAM_DEV_NOT_THERE instead of CAM_SEL_TIMEOUT and CAM_TID_INVALID
  
  r269316:
  Bring in LSI's phase19 changes
  * Removed unused mpssas_discovery_timeout function.
  * Don't alter mapping boundaries if not raid firmware.
  * Check free_busaddr instead of post_busaddr (diff minimisation really)
  
  Approved by:  ken (co-mentor) and smh

Modified:
  stable/10/sys/dev/mps/mps.c
  stable/10/sys/dev/mps/mps_mapping.c
  stable/10/sys/dev/mps/mps_sas.c
  stable/10/sys/dev/mps/mps_sas.h
  stable/10/sys/dev/mps/mps_sas_lsi.c
  stable/10/sys/dev/mps/mpsvar.h
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/mps/mps.c
==
--- stable/10/sys/dev/mps/mps.c Wed Aug 20 22:58:12 2014(r270249)
+++ stable/10/sys/dev/mps/mps.c Wed Aug 20 23:09:27 2014(r270250)
@@ -140,6 +140,7 @@ mps_diag_reset(struct mps_softc *sc,int 
 {
uint32_t reg;
int i, error, tries = 0;
+   uint8_t first_wait_done = FALSE;
 
mps_dprint(sc, MPS_TRACE, %s\n, __func__);
 
@@ -182,15 +183,32 @@ mps_diag_reset(struct mps_softc *sc,int 
 
/* Wait up to 300 seconds in 50ms intervals */
error = ETIMEDOUT;
-   for (i = 0; i  6; i++) {
-   /* wait 50 msec */
-   if (mtx_owned(sc-mps_mtx)  sleep_flag == CAN_SLEEP)
-   msleep(sc-msleep_fake_chan, sc-mps_mtx, 0,
-   mpsdiag, hz/20);
-   else if (sleep_flag == CAN_SLEEP)
-   pause(mpsdiag, hz/20);
-   else
-   DELAY(50 * 1000);
+   for (i = 0; i  6000; i++) {
+   /*
+* Wait 50 msec. If this is the first time through, wait 256
+* msec to satisfy Diag Reset timing requirements.
+*/
+   if (first_wait_done) {
+   if (mtx_owned(sc-mps_mtx)  sleep_flag == CAN_SLEEP)
+   msleep(sc-msleep_fake_chan, sc-mps_mtx, 0,
+   mpsdiag, hz/20);
+   else if (sleep_flag == CAN_SLEEP)
+   pause(mpsdiag, hz/20);
+   else
+   DELAY(50 * 1000);
+   } else {
+   DELAY(256 * 1000);
+   first_wait_done = TRUE;
+   }
+   /*
+* Check for the RESET_ADAPTER bit to be cleared first, then
+* wait for the RESET state to be cleared, which takes a little
+* longer.
+*/
+   reg = mps_regread(sc, MPI2_HOST_DIAGNOSTIC_OFFSET);
+   if (reg  MPI2_DIAG_RESET_ADAPTER) {
+   continue;
+   }
reg = mps_regread(sc, MPI2_DOORBELL_OFFSET);
if ((reg  MPI2_IOC_STATE_MASK) != MPI2_IOC_STATE_RESET) {
error = 0;
@@ -236,7 +254,7 @@ mps_transition_ready(struct mps_softc *s
sleep_flags = (sc-mps_flags  MPS_FLAGS_ATTACH_DONE)
? CAN_SLEEP:NO_SLEEP;
error = 0;
-   while (tries++  5) {
+   while (tries++  1200) {
reg = mps_regread(sc, MPI2_DOORBELL_OFFSET);
mps_dprint(sc, MPS_INIT, Doorbell= 0x%x\n, reg);
 
@@ -592,7 +610,7 @@ mps_iocfacts_free(struct mps_softc *sc)
 
mps_dprint(sc, MPS_TRACE, %s\n, __func__);
 
-   if (sc-post_busaddr != 0)
+   if (sc-free_busaddr != 0)
bus_dmamap_unload(sc-queues_dmat, sc-queues_map);
if (sc-free_queue != NULL)
bus_dmamem_free(sc-queues_dmat, sc-free_queue,
@@ -656,6 +674,9 @@ int
 mps_reinit(struct mps_softc *sc)
 {
int error;
+   struct mpssas_softc *sassc;
+
+   sassc = sc-sassc;
 
MPS_FUNCTRACE(sc);
 
@@ -736,6 +757,8 @@ mps_reinit(struct mps_softc *sc)
mps_dprint(sc, MPS_INFO, %s finished sc %p post %u free %u\n, 
__func__, sc, sc-replypostindex, sc-replyfreeindex);
 
+   mpssas_release_simq_reinit(sassc);
+
return 0;
 }
 
@@ -2510,6 +2533,7 @@ int
 mps_request_polled(struct mps_softc *sc, struct mps_command *cm)
 {
int error, timeout = 0, rc;
+   struct timeval cur_time, start_time;
 
error = 0;
 
@@ -2517,22 +2541,33 @@ mps_request_polled(struct mps_softc *sc,
cm-cm_complete = NULL;
mps_map_command(sc, cm);
 
+   getmicrotime(start_time);
while ((cm-cm_flags  MPS_CM_FLAGS_COMPLETE) == 0) {
mps_intr_locked(sc);
 
-   DELAY(50 * 1000);
-   

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

2014-08-20 Thread Gavin Atkinson
Author: gavin
Date: Wed Aug 20 23:29:34 2014
New Revision: 270251
URL: http://svnweb.freebsd.org/changeset/base/270251

Log:
  Fix return type of callout_init_rm() and add return type to
  callout_deactivate().
  
  PR:   192520
  Submitted by: yaneurabeya gmail com
  MFC after:3 days

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

Modified: head/share/man/man9/timeout.9
==
--- head/share/man/man9/timeout.9   Wed Aug 20 23:09:27 2014
(r270250)
+++ head/share/man/man9/timeout.9   Wed Aug 20 23:29:34 2014
(r270251)
@@ -29,7 +29,7 @@
 .\
 .\ $FreeBSD$
 .\
-.Dd July 17, 2014
+.Dd August 21, 2014
 .Dt TIMEOUT 9
 .Os
 .Sh NAME
@@ -74,7 +74,7 @@ struct callout_handle handle = CALLOUT_H
 .Fn callout_init struct callout *c int mpsafe
 .Ft void
 .Fn callout_init_mtx struct callout *c struct mtx *mtx int flags
-.Fn void
+.Ft void
 .Fn callout_init_rm struct callout *c struct rmlock *rm int flags
 .Ft void
 .Fn callout_init_rw struct callout *c struct rwlock *rw int flags
@@ -103,6 +103,7 @@ struct callout_handle handle = CALLOUT_H
 .Fn callout_pending struct callout *c
 .Ft int
 .Fn callout_active struct callout *c
+.Ft void
 .Fn callout_deactivate struct callout *c
 .Sh DESCRIPTION
 The function
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r270252 - in stable/10: sys/conf sys/dev/e1000 sys/dev/ixgbe sys/dev/netmap tools/tools/netmap

2014-08-20 Thread Luigi Rizzo
Author: luigi
Date: Wed Aug 20 23:34:36 2014
New Revision: 270252
URL: http://svnweb.freebsd.org/changeset/base/270252

Log:
  MFC 270063: update of netmap code
  (vtnet and cxgbe not merged yet because we need some other mfc first)

Added:
  stable/10/sys/dev/netmap/if_vtnet_netmap.h   (contents, props changed)
  stable/10/sys/dev/netmap/netmap_monitor.c   (contents, props changed)
Modified:
  stable/10/sys/conf/files
  stable/10/sys/dev/e1000/if_em.c
  stable/10/sys/dev/e1000/if_igb.c
  stable/10/sys/dev/e1000/if_lem.c
  stable/10/sys/dev/ixgbe/ixgbe.c
  stable/10/sys/dev/netmap/if_em_netmap.h
  stable/10/sys/dev/netmap/if_igb_netmap.h
  stable/10/sys/dev/netmap/if_lem_netmap.h
  stable/10/sys/dev/netmap/if_re_netmap.h
  stable/10/sys/dev/netmap/ixgbe_netmap.h
  stable/10/sys/dev/netmap/netmap.c
  stable/10/sys/dev/netmap/netmap_freebsd.c
  stable/10/sys/dev/netmap/netmap_generic.c
  stable/10/sys/dev/netmap/netmap_kern.h
  stable/10/sys/dev/netmap/netmap_mbq.h
  stable/10/sys/dev/netmap/netmap_mem2.c
  stable/10/sys/dev/netmap/netmap_mem2.h
  stable/10/sys/dev/netmap/netmap_offloadings.c
  stable/10/sys/dev/netmap/netmap_pipe.c
  stable/10/sys/dev/netmap/netmap_vale.c
  stable/10/tools/tools/netmap/pkt-gen.c
  stable/10/tools/tools/netmap/vale-ctl.c

Modified: stable/10/sys/conf/files
==
--- stable/10/sys/conf/filesWed Aug 20 23:29:34 2014(r270251)
+++ stable/10/sys/conf/filesWed Aug 20 23:34:36 2014(r270252)
@@ -1933,6 +1933,7 @@ dev/netmap/netmap_freebsd.c   optional net
 dev/netmap/netmap_generic.coptional netmap
 dev/netmap/netmap_mbq.coptional netmap
 dev/netmap/netmap_mem2.c   optional netmap
+dev/netmap/netmap_monitor.coptional netmap
 dev/netmap/netmap_offloadings.coptional netmap
 dev/netmap/netmap_pipe.c   optional netmap
 dev/netmap/netmap_vale.c   optional netmap

Modified: stable/10/sys/dev/e1000/if_em.c
==
--- stable/10/sys/dev/e1000/if_em.c Wed Aug 20 23:29:34 2014
(r270251)
+++ stable/10/sys/dev/e1000/if_em.c Wed Aug 20 23:34:36 2014
(r270252)
@@ -3389,10 +3389,10 @@ em_setup_transmit_ring(struct tx_ring *t
uint64_t paddr;
void *addr;
 
-   addr = PNMB(slot + si, paddr);
+   addr = PNMB(na, slot + si, paddr);
txr-tx_base[i].buffer_addr = htole64(paddr);
/* reload the map for netmap mode */
-   netmap_load_map(txr-txtag, txbuf-map, addr);
+   netmap_load_map(na, txr-txtag, txbuf-map, addr);
}
 #endif /* DEV_NETMAP */
 
@@ -4131,8 +4131,8 @@ em_setup_receive_ring(struct rx_ring *rx
uint64_t paddr;
void *addr;
 
-   addr = PNMB(slot + si, paddr);
-   netmap_load_map(rxr-rxtag, rxbuf-map, addr);
+   addr = PNMB(na, slot + si, paddr);
+   netmap_load_map(na, rxr-rxtag, rxbuf-map, addr);
/* Update descriptor */
rxr-rx_base[j].buffer_addr = htole64(paddr);
continue;

Modified: stable/10/sys/dev/e1000/if_igb.c
==
--- stable/10/sys/dev/e1000/if_igb.cWed Aug 20 23:29:34 2014
(r270251)
+++ stable/10/sys/dev/e1000/if_igb.cWed Aug 20 23:34:36 2014
(r270252)
@@ -3531,7 +3531,7 @@ igb_setup_transmit_ring(struct tx_ring *
if (slot) {
int si = netmap_idx_n2k(na-tx_rings[txr-me], i);
/* no need to set the address */
-   netmap_load_map(txr-txtag, txbuf-map, NMB(slot + si));
+   netmap_load_map(na, txr-txtag, txbuf-map, NMB(na, 
slot + si));
}
 #endif /* DEV_NETMAP */
/* clear the watch index */
@@ -4335,8 +4335,8 @@ igb_setup_receive_ring(struct rx_ring *r
uint64_t paddr;
void *addr;
 
-   addr = PNMB(slot + sj, paddr);
-   netmap_load_map(rxr-ptag, rxbuf-pmap, addr);
+   addr = PNMB(na, slot + sj, paddr);
+   netmap_load_map(na, rxr-ptag, rxbuf-pmap, addr);
/* Update descriptor */
rxr-rx_base[j].read.pkt_addr = htole64(paddr);
continue;

Modified: stable/10/sys/dev/e1000/if_lem.c
==
--- stable/10/sys/dev/e1000/if_lem.cWed Aug 20 23:29:34 2014
(r270251)
+++ stable/10/sys/dev/e1000/if_lem.cWed Aug 20 23:34:36 2014
(r270252)
@@ -32,6 +32,15 @@
 

Re: svn commit: r270252 - in stable/10: sys/conf sys/dev/e1000 sys/dev/ixgbe sys/dev/netmap tools/tools/netmap

2014-08-20 Thread Navdeep Parhar

On 08/20/14 16:34, Luigi Rizzo wrote:

Author: luigi
Date: Wed Aug 20 23:34:36 2014
New Revision: 270252
URL: http://svnweb.freebsd.org/changeset/base/270252

Log:
   MFC 270063: update of netmap code
   (vtnet and cxgbe not merged yet because we need some other mfc first)


I'll take care of the cxgbe bits.  There's a mega MFC coming soon..

Regards,
Navdeep

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


svn commit: r270253 - head/sys/dev/netmap

2014-08-20 Thread Navdeep Parhar
Author: np
Date: Wed Aug 20 23:37:44 2014
New Revision: 270253
URL: http://svnweb.freebsd.org/changeset/base/270253

Log:
  Change netmap's global lock to sx instead of a mutex.
  
  Reviewed by:  luigi@
  MFC after:1 day

Modified:
  head/sys/dev/netmap/netmap_kern.h

Modified: head/sys/dev/netmap/netmap_kern.h
==
--- head/sys/dev/netmap/netmap_kern.h   Wed Aug 20 23:34:36 2014
(r270252)
+++ head/sys/dev/netmap/netmap_kern.h   Wed Aug 20 23:37:44 2014
(r270253)
@@ -44,13 +44,13 @@
 #define unlikely(x)__builtin_expect((long)!!(x), 0L)
 
 #defineNM_LOCK_T   struct mtx
-#defineNMG_LOCK_T  struct mtx
-#define NMG_LOCK_INIT()mtx_init(netmap_global_lock, \
-   netmap global lock, NULL, MTX_DEF)
-#define NMG_LOCK_DESTROY() mtx_destroy(netmap_global_lock)
-#define NMG_LOCK() mtx_lock(netmap_global_lock)
-#define NMG_UNLOCK()   mtx_unlock(netmap_global_lock)
-#define NMG_LOCK_ASSERT()  mtx_assert(netmap_global_lock, MA_OWNED)
+#defineNMG_LOCK_T  struct sx
+#define NMG_LOCK_INIT()sx_init(netmap_global_lock, \
+   netmap global lock)
+#define NMG_LOCK_DESTROY() sx_destroy(netmap_global_lock)
+#define NMG_LOCK() sx_xlock(netmap_global_lock)
+#define NMG_UNLOCK()   sx_xunlock(netmap_global_lock)
+#define NMG_LOCK_ASSERT()  sx_assert(netmap_global_lock, SA_XLOCKED)
 
 #defineNM_SELINFO_Tstruct selinfo
 #defineMBUF_LEN(m) ((m)-m_pkthdr.len)
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


Re: svn commit: r270252 - in stable/10: sys/conf sys/dev/e1000 sys/dev/ixgbe sys/dev/netmap tools/tools/netmap

2014-08-20 Thread Bryan Venteicher
On Wed, Aug 20, 2014 at 6:36 PM, Navdeep Parhar n...@freebsd.org wrote:

 On 08/20/14 16:34, Luigi Rizzo wrote:

 Author: luigi
 Date: Wed Aug 20 23:34:36 2014
 New Revision: 270252
 URL: http://svnweb.freebsd.org/changeset/base/270252

 Log:
MFC 270063: update of netmap code
(vtnet and cxgbe not merged yet because we need some other mfc first)


 I'll take care of the cxgbe bits.  There's a mega MFC coming soon..


vtnet is on my todo list in the next day. I think there is two commits.


 Regards,
 Navdeep



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


svn commit: r270254 - head/sys/dev/ep

2014-08-20 Thread Adrian Chadd
Author: adrian
Date: Thu Aug 21 00:57:32 2014
New Revision: 270254
URL: http://svnweb.freebsd.org/changeset/base/270254

Log:
  Add missing locking.
  
  Whilst here, assert that the lock is held when calling epstop().
  
  Tested:
  
  ep0: 3com Megahertz 574B

Modified:
  head/sys/dev/ep/if_ep.c

Modified: head/sys/dev/ep/if_ep.c
==
--- head/sys/dev/ep/if_ep.c Wed Aug 20 23:37:44 2014(r270253)
+++ head/sys/dev/ep/if_ep.c Thu Aug 21 00:57:32 2014(r270254)
@@ -343,7 +343,9 @@ ep_attach(struct ep_softc *sc)
EP_FSET(sc, F_RX_FIRST);
sc-top = sc-mcur = 0;
 
+   EP_LOCK(sc);
epstop(sc);
+   EP_UNLOCK(sc);
 
return (0);
 }
@@ -1000,6 +1002,9 @@ epwatchdog(struct ep_softc *sc)
 static void
 epstop(struct ep_softc *sc)
 {
+
+   EP_ASSERT_LOCKED(sc);
+
CSR_WRITE_2(sc, EP_COMMAND, RX_DISABLE);
CSR_WRITE_2(sc, EP_COMMAND, RX_DISCARD_TOP_PACK);
EP_BUSY_WAIT(sc);
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r270255 - stable/10/usr.sbin/mountd

2014-08-20 Thread Rick Macklem
Author: rmacklem
Date: Thu Aug 21 01:07:27 2014
New Revision: 270255
URL: http://svnweb.freebsd.org/changeset/base/270255

Log:
  MFC: r270005
  Try to clarify how file systems are exported for NFSv4.
  This is a content change.

Modified:
  stable/10/usr.sbin/mountd/exports.5
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/usr.sbin/mountd/exports.5
==
--- stable/10/usr.sbin/mountd/exports.5 Thu Aug 21 00:57:32 2014
(r270254)
+++ stable/10/usr.sbin/mountd/exports.5 Thu Aug 21 01:07:27 2014
(r270255)
@@ -28,7 +28,7 @@
 .\ @(#)exports.5  8.3 (Berkeley) 3/29/95
 .\ $FreeBSD$
 .\
-.Dd December 23, 2012
+.Dd August 14, 2014
 .Dt EXPORTS 5
 .Os
 .Sh NAME
@@ -91,10 +91,10 @@ option is used on
 Because NFSv4 does not use the mount protocol,
 the
 .Dq administrative controls
-are not applied.
-Thus, all the above export line(s) should be considered to have the
+are not applied and all directories within this server
+file system are mountable via NFSv4 even if the
 .Fl alldirs
-flag, even if the line is specified without it.
+flag has not been specified.
 The third form has the string ``V4:'' followed by a single absolute path
 name, to specify the NFSv4 tree root.
 This line does not export any file system, but simply marks where the root
@@ -310,7 +310,8 @@ interface.
 For the third form which specifies the NFSv4 tree root, the directory path
 specifies the location within the server's file system tree which is the
 root of the NFSv4 tree.
-All entries of this form must specify the same directory path.
+There can only be one NFSv4 root directory per server.
+As such, all entries of this form must specify the same directory path.
 For file systems other than ZFS,
 this location can be any directory and does not
 need to be within an exported file system. If it is not in an exported
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


Re: svn commit: r270254 - head/sys/dev/ep

2014-08-20 Thread Adrian Chadd
Also, I have no plans to MFC this, but it likely should be.

So if you're .. bored, please feel free to MFC this as appropriate.


-a


On 20 August 2014 17:57, Adrian Chadd adr...@freebsd.org wrote:
 Author: adrian
 Date: Thu Aug 21 00:57:32 2014
 New Revision: 270254
 URL: http://svnweb.freebsd.org/changeset/base/270254

 Log:
   Add missing locking.

   Whilst here, assert that the lock is held when calling epstop().

   Tested:

   ep0: 3com Megahertz 574B

 Modified:
   head/sys/dev/ep/if_ep.c

 Modified: head/sys/dev/ep/if_ep.c
 ==
 --- head/sys/dev/ep/if_ep.c Wed Aug 20 23:37:44 2014(r270253)
 +++ head/sys/dev/ep/if_ep.c Thu Aug 21 00:57:32 2014(r270254)
 @@ -343,7 +343,9 @@ ep_attach(struct ep_softc *sc)
 EP_FSET(sc, F_RX_FIRST);
 sc-top = sc-mcur = 0;

 +   EP_LOCK(sc);
 epstop(sc);
 +   EP_UNLOCK(sc);

 return (0);
  }
 @@ -1000,6 +1002,9 @@ epwatchdog(struct ep_softc *sc)
  static void
  epstop(struct ep_softc *sc)
  {
 +
 +   EP_ASSERT_LOCKED(sc);
 +
 CSR_WRITE_2(sc, EP_COMMAND, RX_DISABLE);
 CSR_WRITE_2(sc, EP_COMMAND, RX_DISCARD_TOP_PACK);
 EP_BUSY_WAIT(sc);

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


svn commit: r270256 - in head: bin/ed libexec/rtld-elf usr.bin/mail

2014-08-20 Thread Pedro F. Giffuni
Author: pfg
Date: Thu Aug 21 02:40:33 2014
New Revision: 270256
URL: http://svnweb.freebsd.org/changeset/base/270256

Log:
  Always check the limits of array index variables before using them.
  
  Obtained from:DragonFlyBSD
  MFC after:1 week

Modified:
  head/bin/ed/cbc.c
  head/libexec/rtld-elf/libmap.c
  head/usr.bin/mail/edit.c

Modified: head/bin/ed/cbc.c
==
--- head/bin/ed/cbc.c   Thu Aug 21 01:07:27 2014(r270255)
+++ head/bin/ed/cbc.c   Thu Aug 21 02:40:33 2014(r270256)
@@ -237,7 +237,7 @@ expand_des_key(char *obuf, char *kbuf)
/*
 * now translate it, bombing on any illegal hex digit
 */
-   for (i = 0; kbuf[i]  i  16; i++)
+   for (i = 0; i  16  kbuf[i]; i++)
if ((nbuf[i] = hex_to_binary((int) kbuf[i], 16)) == -1)
des_error(bad hex digit in key);
while (i  16)

Modified: head/libexec/rtld-elf/libmap.c
==
--- head/libexec/rtld-elf/libmap.c  Thu Aug 21 01:07:27 2014
(r270255)
+++ head/libexec/rtld-elf/libmap.c  Thu Aug 21 02:40:33 2014
(r270256)
@@ -216,14 +216,14 @@ lmc_parse(char *lm_p, size_t lm_len)
p = NULL;
while (cnt  lm_len) {
i = 0;
-   while (lm_p[cnt] != '\n'  cnt  lm_len 
+   while (cnt  lm_len  lm_p[cnt] != '\n' 
i  sizeof(line) - 1) {
line[i] = lm_p[cnt];
cnt++;
i++;
}
line[i] = '\0';
-   while (lm_p[cnt] != '\n'  cnt  lm_len)
+   while (cnt  lm_len  lm_p[cnt] != '\n')
cnt++;
/* skip over nl */
cnt++;

Modified: head/usr.bin/mail/edit.c
==
--- head/usr.bin/mail/edit.cThu Aug 21 01:07:27 2014(r270255)
+++ head/usr.bin/mail/edit.cThu Aug 21 02:40:33 2014(r270256)
@@ -81,7 +81,7 @@ edit1(int *msgvec, int type)
/*
 * Deal with each message to be edited . . .
 */
-   for (i = 0; msgvec[i]  i  msgCount; i++) {
+   for (i = 0; i  msgCount  msgvec[i]; i++) {
sig_t sigint;
 
if (i  0) {
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


Re: svn commit: r270229 - head/share/vt/keymaps

2014-08-20 Thread TAKAHASHI Yoshihiro
In article 201408201700.s7kh0lrh005...@svn.freebsd.org
Stefan Esser s...@freebsd.org writes:

 Log:
   Another rpund of fixes, after checking keymaps for plausibility and with
   several updates to the converter tools. There is now support for hybrid
   source keymaps, which e.g. use ISO8859-1 (not -15) but still provide an
   Euro key (on the E key). ISO8859-1 currency symbols on other keys are
   still converted to that character, not the Euro sign. A similar hack was
   applied to the Japanese keyboards to add the Yen key, that could not be
   expressed in SYSCONS.

PC98 keyboards don't have a backslash key, so we use the Yen key
instead.  Please back it out of pc98 part.

---
TAKAHASHI Yoshihiro n...@freebsd.org
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


Re: svn commit: r270227 - head/sys/sys

2014-08-20 Thread Bruce Evans

On Thu, 21 Aug 2014, Bruce Evans wrote:


On Wed, 20 Aug 2014, Xin Li wrote:


-BEGIN PGP SIGNED MESSAGE-
Hash: SHA512

On 08/20/14 09:32, Davide Italiano wrote:

Author: davide Date: Wed Aug 20 16:32:02 2014 New Revision: 270227
URL: http://svnweb.freebsd.org/changeset/base/270227

Log: Make Bruce happy removing the LL abomination from time.h
It's not necessary in all the three instances because they already
have the correct type on all the supported arches.


I'm not yet 100% sure (still building with some of my changes) but
this looks like the change that broke powerpc build, I saw:


That is a compiler bug, or excessive compiler flags to force the compiler
to be broken.  I thought that such compilers and/or flags went away.


[It is actually -std=c99 or clang that is needed to avoid the warning.]


+184,7 @@ timespec2bintime(const struct timespec *

_bt-sec = _ts-tv_sec; /* 18446744073 = int(2^64 / 10) */
-   _bt-frac = _ts-tv_nsec * (uint64_t)18446744073LL; + _bt-frac =
_ts-tv_nsec * (uint64_t)18446744073; }
...

Older parts used the uint64_t casts to get the correct type, but also
used the long long abomination to avoid the warning, since this used
to be necessary for gcc on i386.


I also wished for the correct fix of spelling the magic decimal numbers
non-magically and without a comment as is already done for some numbers
elsewhere in the file.  The magic 1844mumble is 2**64 obfuscated by spelling
it in decimal.  I can only remember what 2**N is in decimal up to N = 16
and calculate it easily up to N = 20.  2**64 is best written as
(uint65_t)1  64, but since most arches don't have uint65_t you can only
write 2**63 using as (uint64_t)1  63 this method.  Dividing by 2 is
easy and gives small or recognizable decimal constants:

/* No comment: */
_bt-frac = _ts-tv_nsec * (((uint64_t)1  63) / 5);

Strictly portable code also needs an L suffix on the 5, since
ints might be 16 bits and then 5 would be too large for an int
constant and compilers might gratuitously warn about this.  FreeBSD
doesn't need this since it only supports 32-bit ints.

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


svn commit: r270257 - stable/10/usr.bin/ssh-copy-id

2014-08-20 Thread Eitan Adler
Author: eadler
Date: Thu Aug 21 04:26:16 2014
New Revision: 270257
URL: http://svnweb.freebsd.org/changeset/base/270257

Log:
  MFC r265256:
Syntax fix

Modified:
  stable/10/usr.bin/ssh-copy-id/ssh-copy-id.sh
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/usr.bin/ssh-copy-id/ssh-copy-id.sh
==
--- stable/10/usr.bin/ssh-copy-id/ssh-copy-id.shThu Aug 21 02:40:33 
2014(r270256)
+++ stable/10/usr.bin/ssh-copy-id/ssh-copy-id.shThu Aug 21 04:26:16 
2014(r270257)
@@ -45,7 +45,7 @@ sendkey() {
if ! grep -sqwF $key $keyfile; then \
printf $alg $key $comment\n  $keyfile ; \
fi ; \
-   done \
+   done ; \
if [ -x /sbin/restorecon ]; then \
/sbin/restorecon -F $HOME/.ssh/ $keyfile /dev/null 
21 || true ; \
fi
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r270258 - in stable/10: sbin/umount usr.bin/showmount

2014-08-20 Thread Peter Wemm
Author: peter
Date: Thu Aug 21 04:31:48 2014
New Revision: 270258
URL: http://svnweb.freebsd.org/changeset/base/270258

Log:
  MFC r270062: switch rpc mount protocol for showmount and umount from
  mountv1 to mountv3 - it breaks by default on the new netapp release with
  the legacy protocols removed.

Modified:
  stable/10/sbin/umount/umount.c
  stable/10/usr.bin/showmount/showmount.8
  stable/10/usr.bin/showmount/showmount.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sbin/umount/umount.c
==
--- stable/10/sbin/umount/umount.c  Thu Aug 21 04:26:16 2014
(r270257)
+++ stable/10/sbin/umount/umount.c  Thu Aug 21 04:31:48 2014
(r270258)
@@ -394,7 +394,7 @@ umountfs(struct statfs *sfs)
 * has been unmounted.
 */
if (ai != NULL  !(fflag  MNT_FORCE)  do_rpc) {
-   clp = clnt_create(hostp, MOUNTPROG, MOUNTVERS, udp);
+   clp = clnt_create(hostp, MOUNTPROG, MOUNTVERS3, udp);
if (clp  == NULL) {
warnx(%s: %s, hostp,
clnt_spcreateerror(MOUNTPROG));

Modified: stable/10/usr.bin/showmount/showmount.8
==
--- stable/10/usr.bin/showmount/showmount.8 Thu Aug 21 04:26:16 2014
(r270257)
+++ stable/10/usr.bin/showmount/showmount.8 Thu Aug 21 04:31:48 2014
(r270258)
@@ -31,7 +31,7 @@
 .\ @(#)showmount.88.3 (Berkeley) 3/29/95
 .\ $FreeBSD$
 .\
-.Dd March 29, 1995
+.Dd August 16, 2014
 .Dt SHOWMOUNT 8
 .Os
 .Sh NAME
@@ -41,6 +41,7 @@
 .Nm
 .Op Fl a | d
 .Op Fl e
+.Op Fl 1
 .Op Fl 3
 .Op Ar host
 .Sh DESCRIPTION
@@ -76,10 +77,10 @@ List directory paths of mount points ins
 Show the
 .Ar host Ns 's
 exports list.
+.It Fl 1
+Use mount protocol Version 1, compatible with legacy servers.
 .It Fl 3
-Use mount protocol Version 3, compatible with
-.Tn NFS
-Version 3.
+Ignored for backwards compatibility.
 .El
 .Sh SEE ALSO
 .Xr mount 8 ,

Modified: stable/10/usr.bin/showmount/showmount.c
==
--- stable/10/usr.bin/showmount/showmount.c Thu Aug 21 04:26:16 2014
(r270257)
+++ stable/10/usr.bin/showmount/showmount.c Thu Aug 21 04:31:48 2014
(r270258)
@@ -110,11 +110,11 @@ main(int argc, char **argv)
 {
register struct exportslist *exp;
register struct grouplist *grp;
-   register int rpcs = 0, mntvers = 1;
+   register int rpcs = 0, mntvers = 3;
const char *host;
int ch, estat;
 
-   while ((ch = getopt(argc, argv, ade3)) != -1)
+   while ((ch = getopt(argc, argv, ade13)) != -1)
switch (ch) {
case 'a':
if (type == 0) {
@@ -133,6 +133,9 @@ main(int argc, char **argv)
case 'e':
rpcs |= DOEXPORTS;
break;
+   case '1':
+   mntvers = 1;
+   break;
case '3':
mntvers = 3;
break;
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


Re: svn commit: r254627 - in head: bin/chflags bin/ls lib/libc/gen lib/libc/sys sys/cddl/contrib/opensolaris/uts/common/fs/zfs sys/fs/msdosfs sys/fs/smbfs sys/sys sys/ufs/ufs

2014-08-20 Thread Bruce Evans

[My mail connection wasn't working back in June when I wrote this.  This
is the first of many replies to try to prevent breakage of mv.

I have now checked what happens for simple tests on ref11.  Details in
later replies.]

On Sat, 28 Jun 2014, Bruce Evans wrote:


On Fri, 27 Jun 2014, Kenneth D. Merry wrote:


On Fri, Jun 27, 2014 at 12:48:29 -0700, Xin LI wrote:

Hi,

Craig have hit an interesting issue today, where he tried to 'mv' a file
from ZFS dataset to a NFS mount, 'mv' bails out because chflags failed.

I think it's probably sensible to have mv ignoring UF_ARCHIVE, and set the
flag on the target unconditionally?  i.e.:

Index: mv.c
===
--- mv.c (revision 267940)
+++ mv.c (working copy)
@@ -337,8 +337,8 @@
  * on a file that we copied, i.e., that we didn't create.)
  */
  errno = 0;
- if (fchflags(to_fd, sbp-st_flags))
- if (errno != EOPNOTSUPP || sbp-st_flags != 0)
+ if (fchflags(to_fd, sbp-st_flags | UF_ARCHIVE))
+ if (errno != EOPNOTSUPP || (sbp-st_flags  ~UF_ARCHIVE) != 0)
  warn(%s: set flags (was: 0%07o), to, sbp-st_flags);

  tval[0].tv_sec = sbp-st_atime;


Yes, that sounds like a good way to do it.


No, this is very broken.

Ignoring the error is bad enough.  POSIX requires duplicating all of
the attributes and certain error handling when they cannot be
duplicated.  File flags aren't a POSIX attribute, but not duplicating
or handling errors differently for them them breaks the spirit of the
POSIX spec.

Forcing the archive flag to be set on the copy is worse.  It is broken
especially broken  if the source and target both support the archive flag,
since it then fails to preserve the flag when it is clear on the source.

The old code was bad too.  I think it usually gives the POSIX behaviour,
but it only applies to the unusual case where only a few regular files
are moved, and its checking if the preservation worked can be done
better by stat()ing the result and comparing with the original.  The
usual case (by number of files moved, if not by mv instances), is for
moving whole directory heirarchies.  The above code is not used in that
case.  cp -pR is used.  cp -pR is more buggy than the above in general,
but for the chflags() its error handling is less fancy and thus stricter
than the above, so tends to produce thousands or warnings instead of only
1.  More and different details in another reply.

I sent the following mail to ken about this (mostly for cp -p instead of
mv) in April, but received no reply:

old Copying files on freefall now causes annoying warnings.  This is because
old zfs supports UF_ARCHIVE but nfs doesn't:
old old % Script started on Sat Apr  5 05:10:55 2014
old % pts/29:bde@freefall:~/zmsun cp -p $l/msun/Makefile .
old % cp: chflags: ./Makefile: Operation not supported
old % pts/29:bde@freefall:~/zmsun echo $?
old % 1
old % pts/29:bde@freefall:~/zmsun ls -lo $l/msun/Makefile Makefile
old % -rw-r--r--  1 root  wheel  uarch 8610 Mar  2 11:00 
/usr/src/lib/msun/Makefile

old % -rw-r--r--  1 bde   devel  - 8610 Mar  2 11:00 Makefile
old % pts/29:bde@freefall:~/zmsun exit
old % old % Script done on Sat Apr  5 05:11:28 2014
old old cp works, but this is hard to determine since the exit status is 1. 
Oops,

old that means that cp doesn't work.  It also cannot copy the more important
old uid and gid, but it doesn't warn about this or change the exit status to
old 1 for this.  Not warning is a historical hack to keep cp usable.  Not
old indicating the error in any other way is not good, but is also 
historical.
old This is only done when chown() returns EPERM.  For chflags() on nfs, 
we're

old getting EOPNOTSUPPORT for the whole syscall.

So cp -pR is completely broken for use by mv for the uid and gid, but works
almost as correctly as possibly for file flags.  POSIX has relaxed
requirements for cp relative to mv, since cp without -p is not required
to preserve any attributes, and cp with -p can't be expected to preserve
all the attributes in many cases, unlike the usual case for mv where it
is not across a file system.

old The support is useless in practice, at least on freefall, because zfs
old always sets UF_ARCHIVE and nothing ever clears it.  zfs sets it even
old for directories and symlinks.
old old Also, sys/stat.h still has SF_ARCHIVED:
old old % #define	UF_ARCHIVE	0x0800	/* file needs to be 
archived */

old % #define   SF_ARCHIVED 0x0001  /* file is archived */
old old It's not clear what SF_ARCHIVED means, especially since no file 
system

old supports it.  The only references to it are:
old old % ./fs/tmpfs/tmpfs_subr.c:	if ((flags  ~(SF_APPEND | 
SF_ARCHIVED | SF_IMMUTABLE | SF_NOUNLINK |
old % ./ufs/ufs/ufs_vnops.c:		if ((vap-va_flags  ~(SF_APPEND | 
SF_ARCHIVED | SF_IMMUTABLE |
old old So applications can set this flag for ffs and tmpfs, but since the 
fs never

old changes it, it is almost useless.  Perhaps we left it for compatibility
old in ffs.  tmpfs doesn't have 

Re: svn commit: r267977 - head/bin/mv

2014-08-20 Thread Bruce Evans

[My mail connection wasn't working back in June when I wrote this.  This
is the first of many replies to try to prevent breakage of mv.

I have now checked what happens for simple tests on ref11.  Details in
later replies.]

On Sat, 28 Jun 2014, Bruce Evans wrote:


On Sat, 28 Jun 2014, Jilles Tjoelker wrote:


On Fri, Jun 27, 2014 at 07:57:54PM +, Xin LI wrote:

Author: delphij



Log:
  Always set UF_ARCHIVE on target (because they are by definition new 
files
  and should be archived) and ignore error when we can't set it (e.g. 
NFS).



  Reviewed by:  ken
  MFC after:2 weeks



Modified:
  head/bin/mv/mv.c



Modified: head/bin/mv/mv.c
==
--- head/bin/mv/mv.cFri Jun 27 19:50:30 2014(r267976)
+++ head/bin/mv/mv.cFri Jun 27 19:57:54 2014(r267977)
@@ -337,8 +337,8 @@ err:if (unlink(to))
 * on a file that we copied, i.e., that we didn't create.)
 */
errno = 0;
-   if (fchflags(to_fd, sbp-st_flags))
-   if (errno != EOPNOTSUPP || sbp-st_flags != 0)
+   if (fchflags(to_fd, sbp-st_flags | UF_ARCHIVE))
+		if (errno != EOPNOTSUPP || ((sbp-st_flags  ~UF_ARCHIVE) != 
0))
 			warn(%s: set flags (was: 0%07o), to, 
sbp-st_flags);


tval[0].tv_sec = sbp-st_atime;


The part ignoring failures to set UF_ARCHIVE is OK.


No, it is not OK.  The error was only a warning, and that is the best
possible.


Now I'm not sure about this.  The same warning for the usual case where
cp -pR is used becomes fatal for mv:

@ pts/9:bde@freefall:~ cd /tmp
@ pts/9:bde@freefall:/tmp mkdir bde
@ pts/9:bde@freefall:/tmp mv bde ~/z
@ mv: rename bde to /home/bde/z: Not a directory
@ pts/9:bde@freefall:/tmp mv bde ~/z1
@ mv: chflags: /home/bde/z1: Operation not supported
@ mv: /bin/cp bde /home/bde/z1: terminated with 1 (non-zero) status

After cp exits with nonzero status, mv cannot remove the source
directory and a mess results.

It is more reasonable for cp -p to ignore this error, but it is mv
that doesn't allow the error to affect its exit status.  POSIX has
detailed rules for mv, and IIRC not so detailed rules for cp -p.
POSIX doesn't allow implementing mv across file systems using cp -pR
like the FreeBSD implementation does, except possibly if cp -pR follows
exactly the same rules as mv and rules followed don't conflict with
the POSIX rules.


However, it seems
inconsistent to set UF_ARCHIVE on a cross-filesystem mv of a single
file, but not on a cross-filesystem mv of a directory tree


It is also inconsistent with within-filesystem mv's in both cases.


or a file
newly created via shell output redirection.


The file system should set it in that case, if the file system actually
supports UF_ARCHIVE.


If UF_ARCHIVE is supposed to be set automatically, I think this should
be done in the kernel, like msdosfs already does.


zfs sets it too.  That's where the problematic UF_ARCHIVE settings
come from.  The problem was just less visible for msdsofs since it
is less used for critical file systems.

It used to be an even larger problem for msdosfs.  msdosfs's archive
flag was mapped to SF_ARCHIVE instead of to UF_ARCHIVE.  So for mv
or cp -p from msdsofs to msdosfs (or a similar file system), you
could get an EPERM error.  The above hack only checks for
EOPNOTSUPP, so it made no difference.

When the target file system actually supports UF_ARCHIVE, the target
file already has UF_ARCHIVE set because the file is new.  Then the
chflags() is needed mainly to unset UF_ARCHIVE when the source file
doesn't have it set.  The change does the opposite.

The cp -pR case (for mv across file systems and cp itself) never even
had the EOPNOTSUPP hack (except possibly in recent versions which I
can't check now), so it tends to spew errors.  Old versions of cp -p
did the following:

@   /*
@* Changing the ownership probably won't succeed, unless we're root
@* or POSIX_CHOWN_RESTRICTED is not set.  Set uid/gid before setting
@* the mode; current BSD behavior is to remove all setuid bits on
@* chown.  If chown fails, lose setuid/setgid bits.
@*/
@   if (!gotstat || fs-st_uid != ts.st_uid || fs-st_gid != ts.st_gid)

This avoids most chown()s by not attempting any.  Good.

@   if (fdval ? fchown(fd, fs-st_uid, fs-st_gid) :
@   (islink ? lchown(to.p_path, fs-st_uid, fs-st_gid) :
@   chown(to.p_path, fs-st_uid, fs-st_gid))) {

Here it would be better to stat() the file again and mostly not use the
syscall result.  syscalls that can set multiple attributes should allow
setting subsets and require checking to see which ones were set.
tcsettattr() is such a syscall.  It has the very bad error handling of
returning success if at least 1 attribute was set.  That is bad because
it is fail-unsafe for sloppy callers, and its success is guaranteed
since there are always attributes which can be set to an 

Re: svn commit: r268129 - head/bin/mv

2014-08-20 Thread Bruce Evans

[My mail connection wasn't working back in June when I wrote this.  This
is the last of many old replies to try to prevent breakage of mv.  The
second of the old replies was labeled as the first again.  This reply
adds new details]

On Wed, 2 Jul 2014, Bruce Evans wrote:


On Tue, 1 Jul 2014, Xin LI wrote:


Log:
 Check if fchflags() is needed by fstat'ing before and check
 the results.

 Reviewed by:   jilles
 X-MFC-With:r267977


This keeps getting worse.  It now does extra work (with style bugs)
to check one of the broken cases and try harder to keep it broken.


Modified: head/bin/mv/mv.c
==
--- head/bin/mv/mv.cTue Jul  1 22:42:53 2014(r268128)
+++ head/bin/mv/mv.cTue Jul  1 22:46:39 2014(r268129)
@@ -278,6 +278,7 @@ fastcopy(const char *from, const char *t
static char *bp = NULL;
mode_t oldmode;
int nread, from_fd, to_fd;
+   struct stat tsb;


Style bug.



if ((from_fd = open(from, O_RDONLY, 0))  0) {
warn(fastcopy: open() failed (from): %s, from);
@@ -336,10 +337,18 @@ err:  if (unlink(to))
 * if the server supports flags and we were trying to *remove* flags
 * on a file that we copied, i.e., that we didn't create.)
 */


The code keeps rotting further away from the comment.  The last sentence
in it is about being wrong when the server (really, any target file
system) sets flags that aren't set in the source file.  We now do extra
work to try harder to break this for the UF_ARCHIVE flag.


-   errno = 0;
-   if (fchflags(to_fd, sbp-st_flags | UF_ARCHIVE))
-		if (errno != EOPNOTSUPP || ((sbp-st_flags  ~UF_ARCHIVE) != 
0))
-			warn(%s: set flags (was: 0%07o), to, 
sbp-st_flags);

+   if (fstat(to_fd, tsb) == 0) {
+   if ((sbp-st_flags   ~UF_ARCHIVE) !=
+   (tsb.st_flags  ~UF_ARCHIVE)) {


This sometimes (when the other flags are identical) skips fchflags()
to explicitly break clearing of UF_ARCHIVE on the target file when it
is set in the target but not in the source.  In this case, the
fchflags() to clear it should work so there was no bug until recently.
It also skips fchflags() in some cases where UF_ARCHIVE is set in the
source but not in the target.  This case was previously broken a little
differently.  The previous brokenness is retained in the fchlags()
error handling for the case where fchflags() is called in an attempt
to change other flags.

The above is a verbose way of writing the flags test.  Tests for
equality of a subset of flags are best written using the xor operator:

if ((sbp-st_flags ^ tsb.st_flags)  ~UF_ARCHIVE) {

or in KNF verboseness:

if (((sbp-st_flags ^ tsb.st_flags)  ~UF_ARCHIVE) != 0) {


+   if (fchflags(to_fd,
+   sbp-st_flags | (tsb.st_flags  UF_ARCHIVE)))


This retains the brokenness of forcing the UF_ARCHIVE on in the target
to ensure breaking it in the case that it is off in the source.  This
is is really silly now.  We only reach here if the flags other than
UF_ARCHIVE differ.  The target UF_ARCHIVE is now not clobbered in the
usual case where all the flags except possibly UF_ARCHIVE are clear
in both the source and the target, but it is also not cleared when it
should be in this case.  It is now forcibly set in other cases, to
retain the brokenness when it should be cleared.


+   if (errno != EOPNOTSUPP ||
+   ((sbp-st_flags  ~UF_ARCHIVE) != 0))
+   warn(%s: set flags (was: 0%07o),
+   to, sbp-st_flags);


This error handling to break the warning is much the same as before,
but sillier.  Now we only get here if there are flags other than
UF_ARCHIVE to change.  If errno == EOPNOTSUPP, then the whole syscall
failed so it was impossible to change the other flags.  So errno ==
EOPNOTSUPP implies an error that it just as fatal as errno !=
EOPNOTSUPP, and any flags test after it is redundant or broken.  The
correct redundant test is that the flags are the same, but we already
know that they differ and fchflags() has the bug of changing some but
failing.  The current broken test is that all the source flags except
UF_ARCHIVE are the same.  These tests only give different results if
the target has some flag other than UF_ARCHIVE set, since even an
unsupported chflags() should result in mostly-zero flags.  There are
currently no such flags, but mv shouldn't depend on this.


+   }
+   } else
+   warn(%s: cannot stat, to);


The error handling for fstat() is laborious and silly.  We just opened
the file, so fstat() can't fail.  If it somehow fails, then the following
close() of the file should also fail and generate a fatal error.



tval[0].tv_sec = sbp-st_atime;
tval[1].tv_sec =