Re: svn commit: r216101 - head/sys/netinet

2010-12-02 Thread Bruce Evans

On Thu, 2 Dec 2010, Lawrence Stewart wrote:


On 12/02/10 14:45, Bruce Evans wrote:

On Thu, 2 Dec 2010, Lawrence Stewart wrote:


Log:
 Pass NULL instead of 0 for the th pointer value. NULL != 0 on all
platforms.

...
The last case is essentially what applies in function calls.  Now the
conversion of either NULL or 0 or any other null pointer constant to a
null pointer is done according to the prototype.  The results are not
necessarily the same like I said above, but they compare the same.
Thus spelling the null pointer constant as 0 made no difference to
the higher-level results on any platform (unless you do something like
memcmp of null pointers, and use an exotic platform where null pointers
have different representations).  It was just a style bug.


hmm, thanks for the informative response. I'm not sure where I got it in
my head that NULL != 0 on all platforms, but you've now corrected that
bit of misunderstanding. For the record, the now known to be bogus
commit log was my own creation based on my (mis)understanding and did
not come from David.

When it comes time to MFC, should I use the bogus log message or correct
it to something like:

"Fix a minor style nit by passing NULL instead of 0 for the th pointer
value."


Thanks.

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


Re: svn commit: r209110 - in head/lib/msun: . src

2010-12-02 Thread Kostik Belousov
On Wed, Dec 01, 2010 at 11:57:28PM -0500, David Schultz wrote:
> On Tue, Jun 15, 2010, David Schultz wrote:
> > On Tue, Jun 15, 2010, Kostik Belousov wrote:
> > > On Sat, Jun 12, 2010 at 05:32:05PM +, David Schultz wrote:
> > > > Author: das
> > > > Date: Sat Jun 12 17:32:05 2010
> > > > New Revision: 209110
> > > > URL: http://svn.freebsd.org/changeset/base/209110
> > > > 
> > > > Log:
> > > >   Introduce __isnanf() as an alias for isnanf(), and make the isnan()
> > > >   macro expand to __isnanf() instead of isnanf() for float arguments.
> > > >   This change is needed because isnanf() isn't declared in strict POSIX
> > > >   or C99 mode.
> > > >   
> > > >   Compatibility note: Apps using isnan(float) that are compiled after
> > > >   this change won't link against an older libm.
> > > >   
> > > >   Reported by:  Florian Forster 
> > > 
> > > May be, it makes sense to remove the default version for the isnan symbol 
> > > ?
> > 
> > Wouldn't this mean apps that use isnanf() directly will no longer
> > compile?  isnanf() is a historical BSD interface, and although
> > it's been deprecated for many years, it's still declared (if
> > __BSD_VISIBLE).
> > 
> > Oops, to complicate matters further, I just noticed that we
> > already have isnanf and __isnanf symbols in libc, so maybe the new
> > symbol isn't needed.  (isnan() and isnanf() are in libc because
> > that's where they were historically.)  The second version in
> > libm looks like a mistake (wrong scope of the #if 0 in s_isnan.c.)
> > Perhaps we could just remove the duplicate symbols from libm.
> 
> Any thoughts on removing the isnanf and __isnanf symbols from
> libm?  Both symbols are already in libc for historical reasons, so
> the duplication isn't needed.
> 
> Although we've had the duplicate isnanf symbol in libm for several
> releases, I don't believe removing it will cause problems; apps
> will just pick up the libc version.  __isnanf is only present in
> libm in 9-CURRENT (due to the commit referenced above).  Because
> of symbol version differences, however, removing it will affect
> apps that were linked under 9-CURRENT AND rely on isnanf AND link
> against libm before libc.  On my system, libwebkit is the only
> affected binary I could find.

Both libc and libm export FBSD_1.X versions. For isnanf, both
libc and libm export isn...@fbsd_1.0, this means that isnanf can
be removed from libm (we do not believe that some binary or library
links against libm but not libc).

For __isnanf, libc exports __isn...@fbsd_1.0, and libm exports
__isn...@fbsd_1.2. I suspect that we could export both
__isn...@fbsd_1.0 and __isn...@fbsd_1.2 from libc.

Then, isnanf and __isnanf may be removed from libm.


pgptqYFPCDtZo.pgp
Description: PGP signature


Re: svn commit: r216113 - head/gnu/usr.bin/cc

2010-12-02 Thread Bjoern A. Zeeb

On Thu, 2 Dec 2010, Nathan Whitehorn wrote:


Author: nwhitehorn
Date: Thu Dec  2 04:58:07 2010
New Revision: 216113
URL: http://svn.freebsd.org/changeset/base/216113

Log:
 The driver-XXX.c files used for host CPU detection with -march=native
 should not be compiled in the cross-tools case (where -march=native makes
 no sense). This fixes cross-building x86 toolchains on non-x86 systems.


I think it's wrong.  And it seems people running into the case now
cross compiling i386 on amd64 not picking up driver-i386.c anymore and
thus missing host_detect_local_cpu.
It could be this is related to a fix I had started to do for the
cross-gcc port:
http://people.freebsd.org/~bz/20101202-01-ports-devel-cross-gcc-za.diff
(the port still dies later on, thus not submitted yet).
but given that it was fine before, yu are simply removing the extra
file from compilation in that case now as I understand.


Modified:
 head/gnu/usr.bin/cc/Makefile.fe

Modified: head/gnu/usr.bin/cc/Makefile.fe
==
--- head/gnu/usr.bin/cc/Makefile.fe Thu Dec  2 04:28:01 2010
(r216112)
+++ head/gnu/usr.bin/cc/Makefile.fe Thu Dec  2 04:58:07 2010
(r216113)
@@ -19,7 +19,8 @@ CFLAGS+= ${DRIVER_DEFINES}

SRCS=   gcc.c opts-common.c options.c intl.c prefix.c version.c

-.if exists(${GCCDIR}/config/${GCC_CPU}/driver-${GCC_CPU}.c)
+.if ${TARGET_ARCH} == ${MACHINE_ARCH} && \
+   exists(${GCCDIR}/config/${GCC_CPU}/driver-${GCC_CPU}.c)
SRCS+=  driver-${GCC_CPU}.c
.endif




--
Bjoern A. Zeeb  Welcome a new stage of life.
 Going to jail sucks --  All my daemons like it!
  http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/jails.html
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r216119 - head

2010-12-02 Thread Ulrich Spoerlein
Author: uqs
Date: Thu Dec  2 10:46:05 2010
New Revision: 216119
URL: http://svn.freebsd.org/changeset/base/216119

Log:
  Remove more duplicates.
  
  Just so that I can lookup the command for the next time:
  
  for t in `make -V TARGETS universe`; do
__MAKE_CONF=/dev/null make -f Makefile.inc1 -m $PWD/share/mk TARGET=$t \
-V OLD_FILES -V OLD_LIBS -V OLD_DIRS delete-old | \
xargs -n1|sort|uniq -c|egrep -v "^ *1 ";
  done

Modified:
  head/ObsoleteFiles.inc

Modified: head/ObsoleteFiles.inc
==
--- head/ObsoleteFiles.inc  Thu Dec  2 10:39:44 2010(r216118)
+++ head/ObsoleteFiles.inc  Thu Dec  2 10:46:05 2010(r216119)
@@ -1158,12 +1158,6 @@ OLD_FILES+=usr/include/machine/i4b_rbch_
 OLD_FILES+=usr/include/machine/i4b_tel_ioctl.h
 OLD_FILES+=usr/include/machine/i4b_trace.h
 .endif
-# 20070704: I4B 'modules' temporary disconnected (removed 20080525)
-.if ${TARGET_ARCH} == "i386"
-OLD_FILES+=usr/share/man/man4/i4bing.4.gz
-OLD_FILES+=usr/share/man/man4/i4bipr.4.gz
-OLD_FILES+=usr/share/man/man4/i4bisppp.4.gz
-.endif
 # 20070703: pf 4.1 import
 OLD_FILES+=usr/libexec/ftp-proxy
 # 20070701: KAME IPSec removal
@@ -1342,12 +1336,8 @@ OLD_LIBS+=usr/lib/libusbhid.so.2
 OLD_LIBS+=usr/lib/libvgl.so.4
 OLD_LIBS+=usr/lib/libwrap.so.4
 OLD_LIBS+=usr/lib/libypclnt.so.2
-OLD_LIBS+=usr/lib/snmp_atm.so.3
 OLD_LIBS+=usr/lib/snmp_bridge.so.3
 OLD_LIBS+=usr/lib/snmp_hostres.so.3
-OLD_LIBS+=usr/lib/snmp_mibII.so.3
-OLD_LIBS+=usr/lib/snmp_netgraph.so.3
-OLD_LIBS+=usr/lib/snmp_pf.so.3
 .if ${TARGET_ARCH} == "amd64"
 OLD_LIBS+=usr/lib32/libatm.so.4
 OLD_LIBS+=usr/lib32/libbegemot.so.2
@@ -4551,7 +4541,6 @@ OLD_FILES+=usr/games/worm
 OLD_FILES+=usr/games/worms
 OLD_FILES+=usr/games/wump
 OLD_FILES+=sbin/mount_reiserfs
-OLD_FILES+=usr/include/c++/3.4/ext/demangle.h
 OLD_FILES+=usr/include/cam/cam_extend.h
 OLD_FILES+=usr/include/dev/wi/wi_hostap.h
 OLD_FILES+=usr/include/disktab.h
@@ -4814,7 +4803,6 @@ OLD_FILES+=usr/include/posix4/posix4.h
 OLD_FILES+=usr/include/posix4/sched.h
 OLD_FILES+=usr/include/posix4/semaphore.h
 OLD_DIRS+=usr/include/posix4
-OLD_FILES+=usr/include/rune.h
 OLD_FILES+=usr/include/security/_pam_compat.h
 OLD_FILES+=usr/include/security/_pam_macros.h
 OLD_FILES+=usr/include/security/_pam_types.h
@@ -4960,37 +4948,14 @@ OLD_FILES+=usr/share/doc/ntp/release.htm
 OLD_FILES+=usr/share/doc/ntp/tickadj.htm
 OLD_FILES+=usr/share/doc/papers/nqnfs.ascii.gz
 OLD_FILES+=usr/share/doc/papers/px.ascii.gz
-OLD_FILES+=usr/share/man/man3/mbrune.3.gz
-OLD_FILES+=usr/share/man/man3/rune.3.gz
-OLD_FILES+=usr/share/man/man3/mac_is_present_np.3.gz
-OLD_FILES+=usr/share/man/man3/fpsetsticky.3.gz
-OLD_FILES+=usr/share/man/man3/gss_krb5_copy_ccache.3.gz
-OLD_FILES+=usr/share/man/man3/gss_krb5_compat_des3_mic.3.gz
-OLD_FILES+=usr/share/man/man3/exp10f.3.gz
 OLD_FILES+=usr/share/man/man3/exp10.3.gz
-OLD_FILES+=usr/share/man/man3/mbrrune.3.gz
-OLD_FILES+=usr/share/man/man3/mbmb.3.gz
-OLD_FILES+=usr/share/man/man3/sputrune.3.gz
-OLD_FILES+=usr/share/man/man3/sgetrune.3.gz
-OLD_FILES+=usr/share/man/man3/setrunelocale.3.gz
-OLD_FILES+=usr/share/man/man3/setinvalidrune.3.gz
-OLD_FILES+=usr/share/man/man3/mbrune.3.gz
-OLD_FILES+=usr/share/man/man3/rune.3.gz
-OLD_FILES+=usr/share/man/man3/mac_is_present_np.3.gz
+OLD_FILES+=usr/share/man/man3/exp10f.3.gz
 OLD_FILES+=usr/share/man/man3/fpsetsticky.3.gz
-OLD_FILES+=usr/share/man/man3/gss_krb5_copy_ccache.3.gz
 OLD_FILES+=usr/share/man/man3/gss_krb5_compat_des3_mic.3.gz
-OLD_FILES+=usr/share/man/man3/exp10f.3.gz
-OLD_FILES+=usr/share/man/man3/exp10.3.gz
-OLD_FILES+=usr/share/man/man3/mbrrune.3.gz
+OLD_FILES+=usr/share/man/man3/gss_krb5_copy_ccache.3.gz
+OLD_FILES+=usr/share/man/man3/mac_is_present_np.3.gz
 OLD_FILES+=usr/share/man/man3/mbmb.3.gz
-OLD_FILES+=usr/share/man/man3/sputrune.3.gz
-OLD_FILES+=usr/share/man/man3/sgetrune.3.gz
 OLD_FILES+=usr/share/man/man3/setrunelocale.3.gz
-OLD_FILES+=usr/share/man/man3/setinvalidrune.3.gz
-OLD_FILES+=usr/share/man/man3/fungetrune.3.gz
-OLD_FILES+=usr/share/man/man3/fputrune.3.gz
-OLD_FILES+=usr/share/man/man3/fgetrune.3.gz
 OLD_FILES+=usr/share/man/man5/usbd.conf.5.gz
 .if ${TARGET_ARCH} != "i386" && ${TARGET_ARCH} != "amd64"
 OLD_FILES+=usr/share/man/man8/boot_i386.8.gz
@@ -5088,11 +5053,7 @@ OLD_LIBS+=lib/libgpib.so.1
 # 20060413: libpcap.so.4 moved to /lib/
 OLD_LIBS+=usr/lib/libpcap.so.4
 # 20060412: libpthread.so.2 moved to /lib/
-.if ${TARGET_ARCH} != "sparc64"
 OLD_LIBS+=usr/lib/libpthread.so.2
-.else
-OLD_LIBS+=usr/lib/libthr.so.2
-.endif
 # 20060127: revert libdisk to static-only
 OLD_LIBS+=usr/lib/libdisk.so.3
 # 20051027: libc_r discontinued (removed 20101113)
@@ -5211,8 +5172,6 @@ OLD_LIBS+=usr/lib/snmp_atm.so.3
 OLD_LIBS+=usr/lib/snmp_mibII.so.3
 OLD_LIBS+=usr/lib/snmp_netgraph.so.3
 OLD_LIBS+=usr/lib/snmp_pf.so.3
-# 20050603: network related ABI change on 64bit systems
-OLD_LIBS+=usr/lib/libpcap.so.3
 # 200505XX: ?
 OLD_LIBS+=usr/li

svn commit: r216120 - head/sys/fs/procfs

2010-12-02 Thread Konstantin Belousov
Author: kib
Date: Thu Dec  2 12:44:51 2010
New Revision: 216120
URL: http://svn.freebsd.org/changeset/base/216120

Log:
  For non-stopped threads, td_frame pointer is undefined.  As a
  consequence, fill_regs() and fill_fpregs() access random data, usually
  on the thread kernel stack. Most often the td_frame points to the
  previous frame saved by last kernel entry sequence, but this is not
  guaranteed.
  
  For /proc//{regs,fpregs} read access, require the thread to be in
  stopped state. Otherwise, return EBUSY as is done for write case.
  
  Reported and tested by:   pho
  Approved by:  des (procfs maintainer)
  MFC after:1 week

Modified:
  head/sys/fs/procfs/procfs_fpregs.c
  head/sys/fs/procfs/procfs_regs.c

Modified: head/sys/fs/procfs/procfs_fpregs.c
==
--- head/sys/fs/procfs/procfs_fpregs.c  Thu Dec  2 10:46:05 2010
(r216119)
+++ head/sys/fs/procfs/procfs_fpregs.c  Thu Dec  2 12:44:51 2010
(r216120)
@@ -97,6 +97,10 @@ procfs_doprocfpregs(PFS_FILL_ARGS)
PROC_UNLOCK(p);
return (EPERM);
}
+   if (!P_SHOULDSTOP(p)) {
+   PROC_UNLOCK(p);
+   return (EBUSY);
+   }
 
/* XXXKSE: */
td2 = FIRST_THREAD_IN_PROC(p);

Modified: head/sys/fs/procfs/procfs_regs.c
==
--- head/sys/fs/procfs/procfs_regs.cThu Dec  2 10:46:05 2010
(r216119)
+++ head/sys/fs/procfs/procfs_regs.cThu Dec  2 12:44:51 2010
(r216120)
@@ -97,6 +97,10 @@ procfs_doprocregs(PFS_FILL_ARGS)
PROC_UNLOCK(p);
return (EPERM);
}
+   if (!P_SHOULDSTOP(p)) {
+   PROC_UNLOCK(p);
+   return (EBUSY);
+   }
 
/* XXXKSE: */
td2 = FIRST_THREAD_IN_PROC(p);
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r216121 - head/lib/libc/stdio

2010-12-02 Thread Gavin Atkinson
Author: gavin
Date: Thu Dec  2 13:40:21 2010
New Revision: 216121
URL: http://svn.freebsd.org/changeset/base/216121

Log:
  Remove two unused variables, left over from the refactoring in r180104.
  
  PR:   bin/152551
  Submitted by: Henning Petersen 
  MFC after:2 weeks

Modified:
  head/lib/libc/stdio/printf-pos.c

Modified: head/lib/libc/stdio/printf-pos.c
==
--- head/lib/libc/stdio/printf-pos.cThu Dec  2 12:44:51 2010
(r216120)
+++ head/lib/libc/stdio/printf-pos.cThu Dec  2 13:40:21 2010
(r216121)
@@ -248,7 +248,6 @@ __find_arguments (const char *fmt0, va_l
int n;  /* handy integer (short term usage) */
int error;
int flags;  /* flags as above */
-   int width;  /* width from format (%8d), or 0 */
struct typetable types; /* table of types */
 
fmt = (char *)fmt0;
@@ -266,7 +265,6 @@ __find_arguments (const char *fmt0, va_l
fmt++;  /* skip over '%' */
 
flags = 0;
-   width = 0;
 
 rflag: ch = *fmt++;
 reswitch:  switch (ch) {
@@ -304,7 +302,6 @@ reswitch:   switch (ch) {
types.nextarg = n;
goto rflag;
}
-   width = n;
goto reswitch;
 #ifndef NO_FLOATING_POINT
case 'L':
@@ -439,7 +436,6 @@ __find_warguments (const wchar_t *fmt0, 
int n;  /* handy integer (short term usage) */
int error;
int flags;  /* flags as above */
-   int width;  /* width from format (%8d), or 0 */
struct typetable types; /* table of types */
 
fmt = (wchar_t *)fmt0;
@@ -457,7 +453,6 @@ __find_warguments (const wchar_t *fmt0, 
fmt++;  /* skip over '%' */
 
flags = 0;
-   width = 0;
 
 rflag: ch = *fmt++;
 reswitch:  switch (ch) {
@@ -495,7 +490,6 @@ reswitch:   switch (ch) {
types.nextarg = n;
goto rflag;
}
-   width = n;
goto reswitch;
 #ifndef NO_FLOATING_POINT
case 'L':
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r216119 - head

2010-12-02 Thread Alexander Leidinger
Quoting Ulrich Spoerlein  (from Thu, 2 Dec 2010  
10:46:05 + (UTC)):



Author: uqs
Date: Thu Dec  2 10:46:05 2010
New Revision: 216119
URL: http://svn.freebsd.org/changeset/base/216119

Log:
  Remove more duplicates.

  Just so that I can lookup the command for the next time:


Can you please add it to OldFiles.inc instead, with a comment what it does?


  for t in `make -V TARGETS universe`; do
__MAKE_CONF=/dev/null make -f Makefile.inc1 -m $PWD/share/mk TARGET=$t \
-V OLD_FILES -V OLD_LIBS -V OLD_DIRS delete-old | \
xargs -n1|sort|uniq -c|egrep -v "^ *1 ";
  done


While it does not matter for "-V OLD*", the spirit of the command is  
more like the check-old target (which is including shared libs) than  
the delete-old target (which does not delete shared libs but only  
static libs). Using check-old would also remove the (wrong, but not  
far fetched) fear of actually deleting something with this command.


Bye,
Alexander.

--
Each kiss is as the first.
-- Miramanee, Kirk's wife, "The Paradise Syndrome",
   stardate 4842.6

http://www.Leidinger.netAlexander @ Leidinger.net: PGP ID = B0063FE7
http://www.FreeBSD.org   netchild @ FreeBSD.org  : PGP ID = 72077137
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r216122 - head/sys/powerpc/include

2010-12-02 Thread Nathan Whitehorn
Author: nwhitehorn
Date: Thu Dec  2 15:10:27 2010
New Revision: 216122
URL: http://svn.freebsd.org/changeset/base/216122

Log:
  Define bswap macros for constants to allow the compiler to pre-compute
  byte-swapped versions of compile-time constants. This allows use of
  bswap() and htole*() in initializers, which is required to cross-build
  btxld.
  
  Obtained from:sparc64

Modified:
  head/sys/powerpc/include/endian.h

Modified: head/sys/powerpc/include/endian.h
==
--- head/sys/powerpc/include/endian.h   Thu Dec  2 13:40:21 2010
(r216121)
+++ head/sys/powerpc/include/endian.h   Thu Dec  2 15:10:27 2010
(r216122)
@@ -27,7 +27,6 @@
  * SUCH DAMAGE.
  *
  * @(#)endian.h8.1 (Berkeley) 6/10/93
- * $NetBSD: endian.h,v 1.7 1999/08/21 05:53:51 simonb Exp $
  * $FreeBSD$
  */
 
@@ -79,17 +78,36 @@
 #defineBYTE_ORDER  _BYTE_ORDER
 #endif
 
-#ifdef __CC_SUPPORTS___INLINE
+#if defined(__GNUCLIKE_BUILTIN_CONSTANT_P)
+#define__is_constant(x)__builtin_constant_p(x)
+#else
+#define__is_constant(x)0
+#endif
+
+#define__bswap16_const(x)  __uint16_t)(x) >> 8) & 0xff) |  
\
+   (((__uint16_t)(x) << 8) & 0xff00))
+#define__bswap32_const(x)  __uint32_t)(x) >> 24) & 0xff) | 
\
+   (((__uint32_t)(x) >> 8) & 0xff00) | \
+   (((__uint32_t)(x)<< 8) & 0xff) |\
+   (((__uint32_t)(x) << 24) & 0xff00))
+#define__bswap64_const(x)  __uint64_t)(x) >> 56) & 0xff) | 
\
+   (((__uint64_t)(x) >> 40) & 0xff00) |\
+   (((__uint64_t)(x) >> 24) & 0xff) |  \
+   (((__uint64_t)(x) >> 8) & 0xff00) | \
+   (((__uint64_t)(x) << 8) & ((__uint64_t)0xff << 32)) |   \
+   (((__uint64_t)(x) << 24) & ((__uint64_t)0xff << 40)) |  \
+   (((__uint64_t)(x) << 40) & ((__uint64_t)0xff << 48)) |  \
+   (((__uint64_t)(x) << 56) & ((__uint64_t)0xff << 56)))
 
 static __inline __uint16_t
-__bswap16(__uint16_t _x)
+__bswap16_var(__uint16_t _x)
 {
 
return ((_x >> 8) | ((_x << 8) & 0xff00));
 }
 
 static __inline __uint32_t
-__bswap32(__uint32_t _x)
+__bswap32_var(__uint32_t _x)
 {
 
return ((_x >> 24) | ((_x >> 8) & 0xff00) | ((_x << 8) & 0xff) |
@@ -97,7 +115,7 @@ __bswap32(__uint32_t _x)
 }
 
 static __inline __uint64_t
-__bswap64(__uint64_t _x)
+__bswap64_var(__uint64_t _x)
 {
 
return ((_x >> 56) | ((_x >> 40) & 0xff00) | ((_x >> 24) & 0xff) |
@@ -106,20 +124,16 @@ __bswap64(__uint64_t _x)
((_x << 40) & ((__uint64_t)0xff << 48)) | ((_x << 56)));
 }
 
+#define__bswap16(x)(__is_constant(x) ? __bswap16_const(x) : \
+   __bswap16_var(x))
+#define__bswap32(x)(__is_constant(x) ? __bswap32_const(x) : \
+   __bswap32_var(x))
+#define__bswap64(x)(__is_constant(x) ? __bswap64_const(x) : \
+   __bswap64_var(x))
+
 #define__htonl(x)  ((__uint32_t)(x))
 #define__htons(x)  ((__uint16_t)(x))
 #define__ntohl(x)  ((__uint32_t)(x))
 #define__ntohs(x)  ((__uint16_t)(x))
 
-#else /* !__CC_SUPPORTS___INLINE */
-
-/*
- * No optimizations are available for this compiler.  Fall back to
- * non-optimized functions by defining the constant usually used to prevent
- * redefinition.
- */
-#define_BYTEORDER_FUNC_DEFINED
-
-#endif /* __CC_SUPPORTS___INLINE */
-
 #endif /* !_MACHINE_ENDIAN_H_ */
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r216016 - head/sys/sparc64/include

2010-12-02 Thread Marius Strobl
On Wed, Dec 01, 2010 at 12:19:17PM -0600, Alan Cox wrote:
> Marius Strobl wrote:
> >On Mon, Nov 29, 2010 at 08:23:08PM +0100, Marius Strobl wrote:
> >  
> >>On Tue, Nov 30, 2010 at 12:31:31AM +0600, Max Khon wrote:
> >>
> >>>Marius,
> >>>
> >>>On Mon, Nov 29, 2010 at 1:45 AM, Marius Strobl 
> >>>wrote:
> >>>
> >>>On Sun, Nov 28, 2010 at 07:26:20PM +, Max Khon wrote:
> >>>  
> >Author: fjoe
> >Date: Sun Nov 28 19:26:20 2010
> >New Revision: 216016
> >URL: http://svn.freebsd.org/changeset/base/216016
> >
> >Log:
> >  Define VM_KMEM_SIZE_MAX on sparc64. Otherwise kernel built with
> >  DEBUG_MEMGUARD panics early in kmeminit() with the message
> >  "kmem_suballoc: bad status return of 1" because of zero "size" 
> >  argument
> >  passed to kmem_suballoc() due to "vm_kmem_size_max" being zero.
> >
> >  The problem also exists on ia64.
> >
> >Modified:
> >  head/sys/sparc64/include/vmparam.h
> >
> >Modified: head/sys/sparc64/include/vmparam.h
> >
> >  
> ==
> 
> >--- head/sys/sparc64/include/vmparam.hSun Nov 28 18:59:52 2010
> >  
>  (r216015)
> 
> >+++ head/sys/sparc64/include/vmparam.hSun Nov 28 19:26:20 2010
> >  
>  (r216016)
> 
> >@@ -237,6 +237,14 @@
> > #endif
> >
> > /*
> >+ * Ceiling on amount of kmem_map kva space.
> >+ */
> >+#ifndef VM_KMEM_SIZE_MAX
> >+#define  VM_KMEM_SIZE_MAX((VM_MAX_KERNEL_ADDRESS - \
> >+VM_MIN_KERNEL_ADDRESS + 1) * 3 / 5)
> >+#endif
> >+
> >+/*
> >  * Initial pagein size of beginning of executable file.
> >  */
> > #ifndef  VM_INITIAL_PAGEIN
> >  
> How was that value determined?
> 
> 
> >>>I've just copied it from amd64 to be non-zero for now. Do you have a 
> >>>better
> >>>idea of what it should look like?
> >>>
> >>>  
> >>Well, on sparc64 VM_MAX_KERNEL_ADDRESS already is dynamically adjusted
> >>to the maximum appropriate for the specific CPU during the early cycles
> >>of the kernel so I'd think one could just use VM_MAX_KERNEL_ADDRESS -
> >>VM_MIN_KERNEL_ADDRESS for VM_KMEM_SIZE_MAX there, I'm not sure what
> >>the intention of the ceiling provided by that macro actually is though
> >>In any case, the commit message of r180210 which changed the amd64
> >>version to the current one talks about limiting the kmem map to 3.6GB
> >>and while it also fails to explain where that value comes from it
> >>looks rather amd64 specific and the formula used by the macro will
> >>result in a different ceiling on sparc64 and thus inappropriate. I've
> >>CC'ed alc@ who hopefully can shed some light on this.
> >>Apart from this the actual bug here seems to be that memguard_fudge()
> >>can't deal with a km_max being zero or that zero is passed to it as
> >>kmeminit() allows for VM_KMEM_SIZE_MAX not being defined.
> >>
> >>
> >
> >Oops, forgot to actually CC a...@.
> >  
> 
> There's nothing particularly amd64-specific about the definition.  In 
> general, if you allow the kmem_map, which is basically the kernel's 
> heap, to consume the entire kernel address space as you propose, then 
> you're leaving no room for the buffer cache, thread stacks, pipes, and a 
> few other things.  Since the cap on the kmem_map size as defined by 
> r180210 is a fraction of the overall kernel address space size, it 
> scales automatically with the kernel address space size and should be a 
> reasonable cap definition for most architectures.
> 
> In the specific case of sparc64, I think it's fair to say that the 
> kernel virtual address is sufficiently large and the amount of physical 
> memory in any of the supported machines is small enough in comparison 
> that it hasn't mattered that a kmem_map cap doesn't exist, because most 
> of the aforementioned structures are scaled based on the amount of 
> physical memory.  In fact, it probably won't matter any time soon.
> 
> All of that said, I would suggest fixing memguard_fudge() and reverting 
> r216016 and the follow up change.  All I think that is required to fix 
> memguard_fudge() is
> 
> Index: vm/memguard.c
> ===
> --- vm/memguard.c   (revision 216070)
> +++ vm/memguard.c   (working copy)
> @@ -186,7 +186,7 @@ memguard_fudge(unsigned long km_size, unsigned lon
>memguard_mapsize = round_page(memguard_mapsize);
>if (memguard_mapsize / (2 * PAGE_SIZE) > mem_pgs)
>memguard_mapsize = mem_pgs * 2 * PAGE_SIZE;
> -   if (km_size + memguard_mapsize > km_max)
> +   if (km_max > 0 && km_size + memguard_mapsize > km_max)
>return (km_max);
>return (km_size + memguard_mapsize);
> }
> 

Thanks but unfortunately this variant then still pani

Re: svn commit: r216016 - head/sys/sparc64/include

2010-12-02 Thread Alan Cox

Marius Strobl wrote:

On Wed, Dec 01, 2010 at 12:19:17PM -0600, Alan Cox wrote:
  

Marius Strobl wrote:


On Mon, Nov 29, 2010 at 08:23:08PM +0100, Marius Strobl wrote:
 
  

On Tue, Nov 30, 2010 at 12:31:31AM +0600, Max Khon wrote:
   


Marius,

On Mon, Nov 29, 2010 at 1:45 AM, Marius Strobl 
wrote:


On Sun, Nov 28, 2010 at 07:26:20PM +, Max Khon wrote:
 
  

Author: fjoe
Date: Sun Nov 28 19:26:20 2010
New Revision: 216016
URL: http://svn.freebsd.org/changeset/base/216016

Log:
 Define VM_KMEM_SIZE_MAX on sparc64. Otherwise kernel built with
 DEBUG_MEMGUARD panics early in kmeminit() with the message
 "kmem_suballoc: bad status return of 1" because of zero "size" 
 argument

 passed to kmem_suballoc() due to "vm_kmem_size_max" being zero.

 The problem also exists on ia64.

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

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

 
  

==
   


--- head/sys/sparc64/include/vmparam.hSun Nov 28 18:59:52 2010
 
  

(r216015)
   


+++ head/sys/sparc64/include/vmparam.hSun Nov 28 19:26:20 2010
 
  

(r216016)
   


@@ -237,6 +237,14 @@
#endif

/*
+ * Ceiling on amount of kmem_map kva space.
+ */
+#ifndef VM_KMEM_SIZE_MAX
+#define  VM_KMEM_SIZE_MAX((VM_MAX_KERNEL_ADDRESS - \
+VM_MIN_KERNEL_ADDRESS + 1) * 3 / 5)
+#endif
+
+/*
 * Initial pagein size of beginning of executable file.
 */
#ifndef  VM_INITIAL_PAGEIN
 
  

How was that value determined?

   

I've just copied it from amd64 to be non-zero for now. Do you have a 
better

idea of what it should look like?

 
  

Well, on sparc64 VM_MAX_KERNEL_ADDRESS already is dynamically adjusted
to the maximum appropriate for the specific CPU during the early cycles
of the kernel so I'd think one could just use VM_MAX_KERNEL_ADDRESS -
VM_MIN_KERNEL_ADDRESS for VM_KMEM_SIZE_MAX there, I'm not sure what
the intention of the ceiling provided by that macro actually is though
In any case, the commit message of r180210 which changed the amd64
version to the current one talks about limiting the kmem map to 3.6GB
and while it also fails to explain where that value comes from it
looks rather amd64 specific and the formula used by the macro will
result in a different ceiling on sparc64 and thus inappropriate. I've
CC'ed alc@ who hopefully can shed some light on this.
Apart from this the actual bug here seems to be that memguard_fudge()
can't deal with a km_max being zero or that zero is passed to it as
kmeminit() allows for VM_KMEM_SIZE_MAX not being defined.

   


Oops, forgot to actually CC a...@.
 
  
There's nothing particularly amd64-specific about the definition.  In 
general, if you allow the kmem_map, which is basically the kernel's 
heap, to consume the entire kernel address space as you propose, then 
you're leaving no room for the buffer cache, thread stacks, pipes, and a 
few other things.  Since the cap on the kmem_map size as defined by 
r180210 is a fraction of the overall kernel address space size, it 
scales automatically with the kernel address space size and should be a 
reasonable cap definition for most architectures.


In the specific case of sparc64, I think it's fair to say that the 
kernel virtual address is sufficiently large and the amount of physical 
memory in any of the supported machines is small enough in comparison 
that it hasn't mattered that a kmem_map cap doesn't exist, because most 
of the aforementioned structures are scaled based on the amount of 
physical memory.  In fact, it probably won't matter any time soon.


All of that said, I would suggest fixing memguard_fudge() and reverting 
r216016 and the follow up change.  All I think that is required to fix 
memguard_fudge() is


Index: vm/memguard.c
===
--- vm/memguard.c   (revision 216070)
+++ vm/memguard.c   (working copy)
@@ -186,7 +186,7 @@ memguard_fudge(unsigned long km_size, unsigned lon
   memguard_mapsize = round_page(memguard_mapsize);
   if (memguard_mapsize / (2 * PAGE_SIZE) > mem_pgs)
   memguard_mapsize = mem_pgs * 2 * PAGE_SIZE;
-   if (km_size + memguard_mapsize > km_max)
+   if (km_max > 0 && km_size + memguard_mapsize > km_max)
   return (km_max);
   return (km_size + memguard_mapsize);
}




Thanks but unfortunately this variant then still panics in kmem_suballoc()
when called by memguard_init():
KDB: debugger backends: ddb
KDB: current backend: ddb
Copyright (c) 1992-2010 The FreeBSD Project.
Copyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994
The Regents of the University of California. All rights reserved.
FreeBSD is a registered trademark of The FreeBSD Foundation.

svn commit: r216127 - head/gnu/usr.bin/cc

2010-12-02 Thread Nathan Whitehorn
Author: nwhitehorn
Date: Thu Dec  2 17:36:47 2010
New Revision: 216127
URL: http://svn.freebsd.org/changeset/base/216127

Log:
  Unbreak amd64<->i386 cross builds.

Modified:
  head/gnu/usr.bin/cc/Makefile.fe

Modified: head/gnu/usr.bin/cc/Makefile.fe
==
--- head/gnu/usr.bin/cc/Makefile.fe Thu Dec  2 16:46:28 2010
(r216126)
+++ head/gnu/usr.bin/cc/Makefile.fe Thu Dec  2 17:36:47 2010
(r216127)
@@ -19,8 +19,9 @@ CFLAGS+= ${DRIVER_DEFINES}
 
 SRCS=  gcc.c opts-common.c options.c intl.c prefix.c version.c
 
-.if ${TARGET_ARCH} == ${MACHINE_ARCH} && \
-   exists(${GCCDIR}/config/${GCC_CPU}/driver-${GCC_CPU}.c)
+# Include -march=native support for native-ish compilers only
+.if (${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH} == "amd64") && \
+${GCC_CPU} == "i386"
 SRCS+=  driver-${GCC_CPU}.c
 .endif
 
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r216128 - in head/sys: fs/procfs kern vm

2010-12-02 Thread Edward Tomasz Napierala
Author: trasz
Date: Thu Dec  2 17:37:16 2010
New Revision: 216128
URL: http://svn.freebsd.org/changeset/base/216128

Log:
  Replace pointer to "struct uidinfo" with pointer to "struct ucred"
  in "struct vm_object".  This is required to make it possible to account
  for per-jail swap usage.
  
  Reviewed by:  kib@
  Tested by:pho@
  Sponsored by: FreeBSD Foundation

Modified:
  head/sys/fs/procfs/procfs_map.c
  head/sys/kern/uipc_shm.c
  head/sys/vm/default_pager.c
  head/sys/vm/swap_pager.c
  head/sys/vm/vm.h
  head/sys/vm/vm_fault.c
  head/sys/vm/vm_map.c
  head/sys/vm/vm_map.h
  head/sys/vm/vm_object.c
  head/sys/vm/vm_object.h

Modified: head/sys/fs/procfs/procfs_map.c
==
--- head/sys/fs/procfs/procfs_map.c Thu Dec  2 17:36:47 2010
(r216127)
+++ head/sys/fs/procfs/procfs_map.c Thu Dec  2 17:37:16 2010
(r216128)
@@ -83,7 +83,7 @@ procfs_doprocmap(PFS_FILL_ARGS)
vm_map_entry_t entry, tmp_entry;
struct vnode *vp;
char *fullpath, *freepath;
-   struct uidinfo *uip;
+   struct ucred *cred;
int error, vfslocked;
unsigned int last_timestamp;
 #ifdef COMPAT_FREEBSD32
@@ -136,7 +136,7 @@ procfs_doprocmap(PFS_FILL_ARGS)
if (obj->shadow_count == 1)
privateresident = obj->resident_page_count;
}
-   uip = (entry->uip) ? entry->uip : (obj ? obj->uip : NULL);
+   cred = (entry->cred) ? entry->cred : (obj ? obj->cred : NULL);
 
resident = 0;
addr = entry->start;
@@ -221,7 +221,7 @@ procfs_doprocmap(PFS_FILL_ARGS)
(e_eflags & MAP_ENTRY_COW)?"COW":"NCOW",
(e_eflags & MAP_ENTRY_NEEDS_COPY)?"NC":"NNC",
type, fullpath,
-   uip ? "CH":"NCH", uip ? uip->ui_uid : -1);
+   cred ? "CH":"NCH", cred ? cred->cr_ruid : -1);
 
if (freepath != NULL)
free(freepath, M_TEMP);

Modified: head/sys/kern/uipc_shm.c
==
--- head/sys/kern/uipc_shm.cThu Dec  2 17:36:47 2010(r216127)
+++ head/sys/kern/uipc_shm.cThu Dec  2 17:37:16 2010(r216128)
@@ -271,7 +271,7 @@ shm_dotruncate(struct shmfd *shmfd, off_
swap_pager_freespace(object, nobjsize, delta);
 
/* Free the swap accounted for shm */
-   swap_release_by_uid(delta, object->uip);
+   swap_release_by_cred(delta, object->cred);
object->charge -= delta;
 
/*
@@ -314,7 +314,7 @@ shm_dotruncate(struct shmfd *shmfd, off_
 
/* Attempt to reserve the swap */
delta = ptoa(nobjsize - object->size);
-   if (!swap_reserve_by_uid(delta, object->uip)) {
+   if (!swap_reserve_by_cred(delta, object->cred)) {
VM_OBJECT_UNLOCK(object);
return (ENOMEM);
}

Modified: head/sys/vm/default_pager.c
==
--- head/sys/vm/default_pager.c Thu Dec  2 17:36:47 2010(r216127)
+++ head/sys/vm/default_pager.c Thu Dec  2 17:37:16 2010(r216128)
@@ -80,21 +80,19 @@ default_pager_alloc(void *handle, vm_oof
 vm_ooffset_t offset, struct ucred *cred)
 {
vm_object_t object;
-   struct uidinfo *uip;
 
if (handle != NULL)
panic("default_pager_alloc: handle specified");
if (cred != NULL) {
-   uip = cred->cr_ruidinfo;
-   if (!swap_reserve_by_uid(size, uip))
+   if (!swap_reserve_by_cred(size, cred))
return (NULL);
-   uihold(uip);
+   crhold(cred);
}
object = vm_object_allocate(OBJT_DEFAULT,
OFF_TO_IDX(round_page(offset + size)));
if (cred != NULL) {
VM_OBJECT_LOCK(object);
-   object->uip = uip;
+   object->cred = cred;
object->charge = size;
VM_OBJECT_UNLOCK(object);
}

Modified: head/sys/vm/swap_pager.c
==
--- head/sys/vm/swap_pager.cThu Dec  2 17:36:47 2010(r216127)
+++ head/sys/vm/swap_pager.cThu Dec  2 17:37:16 2010(r216128)
@@ -174,16 +174,19 @@ int
 swap_reserve(vm_ooffset_t incr)
 {
 
-   return (swap_reserve_by_uid(incr, curthread->td_ucred->cr_ruidinfo));
+   return (swap_reserve_by_cred(incr, curthread->td_ucred));
 }
 
 int
-swap_reserve_by_uid(vm_ooffset_t incr, struct uidinfo *uip)
+swap_reserve_by_cred(vm_ooffset_t incr, struct ucred *cred)
 {
vm_ooffset_t r, s;
int res, error;
static int curfail;
static struct timev

svn commit: r216130 - head/usr.bin/kdump

2010-12-02 Thread Xin LI
Author: delphij
Date: Thu Dec  2 18:24:22 2010
New Revision: 216130
URL: http://svn.freebsd.org/changeset/base/216130

Log:
  Decode IPC_CREAT and IPC_EXCL for semget(2).
  
  PR:   bin/152781
  Submitted by: Anton Yuzhaninov 
  MFC after:2 weeks

Modified:
  head/usr.bin/kdump/mksubr

Modified: head/usr.bin/kdump/mksubr
==
--- head/usr.bin/kdump/mksubr   Thu Dec  2 18:01:18 2010(r216129)
+++ head/usr.bin/kdump/mksubr   Thu Dec  2 18:24:22 2010(r216130)
@@ -254,6 +254,8 @@ shmctlname (int cmd) {
 void
 semgetname (int flag) {
int or = 0;
+   if_print_or(flag, IPC_CREAT, or);
+   if_print_or(flag, IPC_EXCL, or);
if_print_or(flag, SEM_R, or);
if_print_or(flag, SEM_A, or);
if_print_or(flag, (SEM_R>>3), or);
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"



svn commit: r216131 - head/share/man/man4

2010-12-02 Thread Pyun YongHyeon
Author: yongari
Date: Thu Dec  2 18:37:34 2010
New Revision: 216131
URL: http://svn.freebsd.org/changeset/base/216131

Log:
  Document loader tunable hw.re.prefer_iomap.

Modified:
  head/share/man/man4/re.4

Modified: head/share/man/man4/re.4
==
--- head/share/man/man4/re.4Thu Dec  2 18:24:22 2010(r216130)
+++ head/share/man/man4/re.4Thu Dec  2 18:37:34 2010(r216131)
@@ -30,7 +30,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd October 27, 2010
+.Dd December 2, 2010
 .Dt RE 4
 .Os
 .Sh NAME
@@ -178,6 +178,11 @@ prompt before booting the kernel or stor
 .It Va hw.re.msi_disable
 This tunable disables MSI support on the Ethernet hardware.
 The default value is 0.
+.It Va hw.re.prefer_iomap
+This tunable controls which register mapping should be used on the
+specified device.
+A non-zero value enables I/O space register mapping.
+The default value is 0 to use memory space register mapping.
 .El
 .Sh DIAGNOSTICS
 .Bl -diag
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r209110 - in head/lib/msun: . src

2010-12-02 Thread David Schultz
On Wed, Dec 01, 2010, Garrett Cooper wrote:
> >> Any thoughts on removing the isnanf and __isnanf symbols from
> >> libm?  Both symbols are already in libc for historical reasons, so
> >> the duplication isn't needed.
> >>
> >> Although we've had the duplicate isnanf symbol in libm for several
> >> releases, I don't believe removing it will cause problems; apps
> >> will just pick up the libc version.  __isnanf is only present in
> >> libm in 9-CURRENT (due to the commit referenced above).  Because
> >> of symbol version differences, however, removing it will affect
> >> apps that were linked under 9-CURRENT AND rely on isnanf AND link
> >> against libm before libc.  On my system, libwebkit is the only
> >> affected binary I could find.
> >
> >    Yeah... it's going to be broken according to the manpage (manpage
> > explicitly calls out -lm and math.h) and POSIX (POSIX only calls out
> > math.h) as math.h lives in lib/msun for C apps:
> >
> > $ find /usr/src/ -name math.h
> > /usr/src/contrib/libstdc++/include/tr1/math.h
> > /usr/src/contrib/libstdc++/include/c_compatibility/math.h
> > /usr/src/lib/msun/src/math.h
> >
> >    So unless math.h is going to move to libc, I'd leave it alone if I
> > was making the final call.

A few math library functions are in libc because they've always
been there historically, and it seems impractical to change that.
In a few cases, they're in libc because other parts of libc (e.g.,
printf) require their functionality anyway.  libm also depends on
libc, so the fact that a few things are in libc instead of libm
isn't a problem.

> Arg -- please ignore this email. I did another search and you said
> isnanf, not isnan. It's not mentioned anywhere in POSIX land or in any
> of our manpages.
> Sorry bout that,
> -Garrett

In C99, isnan() is actually a type-generic macro, and in FreeBSD,
it expands to __isnanf() when the argument is a float.
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r209110 - in head/lib/msun: . src

2010-12-02 Thread David Schultz
On Thu, Dec 02, 2010, Kostik Belousov wrote:
> For __isnanf, libc exports __isn...@fbsd_1.0, and libm exports
> __isn...@fbsd_1.2. I suspect that we could export both
> __isn...@fbsd_1.0 and __isn...@fbsd_1.2 from libc.

I like the idea of adding an __isn...@fbsd_1.2 alias to libc for
the benefit of people running -CURRENT.
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r216132 - head/sys/geom/part

2010-12-02 Thread Ivan Voras
Author: ivoras
Date: Thu Dec  2 19:47:27 2010
New Revision: 216132
URL: http://svn.freebsd.org/changeset/base/216132

Log:
  Add a note about the magic number 20. Actually, 22.75 entries fit in
  a 512 byte sector but when choosing magic numbers, 20 looks nicer.
  
  Discussed with:   marcel

Modified:
  head/sys/geom/part/g_part_bsd.c

Modified: head/sys/geom/part/g_part_bsd.c
==
--- head/sys/geom/part/g_part_bsd.c Thu Dec  2 18:37:34 2010
(r216131)
+++ head/sys/geom/part/g_part_bsd.c Thu Dec  2 19:47:27 2010
(r216132)
@@ -99,7 +99,7 @@ static struct g_part_scheme g_part_bsd_s
sizeof(struct g_part_bsd_table),
.gps_entrysz = sizeof(struct g_part_bsd_entry),
.gps_minent = 8,
-   .gps_maxent = 20,
+   .gps_maxent = 20,   /* Only 22 entries fit in 512 byte sectors */
.gps_bootcodesz = BBSIZE,
 };
 G_PART_SCHEME_DECLARE(g_part_bsd);
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r216091 - head/sys/dev/usb

2010-12-02 Thread Weongyo Jeong
On Wed, Dec 01, 2010 at 06:58:18PM -0500, Jung-uk Kim wrote:
> On Tuesday 30 November 2010 10:51 pm, Weongyo Jeong wrote:
> > Author: weongyo
> > Date: Wed Dec  1 03:51:06 2010
> > New Revision: 216091
> > URL: http://svn.freebsd.org/changeset/base/216091
> >
> > Log:
> >   Explicitly UP and DOWN the usbus interfaces (IFT_USB) when it's
> > attached or detached.  Normally it should be changed through user
> > land ioctl(2) system calls but it looks there's no apps for USB and
> > no need.
> >
> >   With this patch, libpcap would detect the usbus interfaces
> > correctly and tcpdump(1) could dump the USB packets into PCAP
> > format with -w option. However it couldn't print the output to
> > console because there's no printer-routine at tcpdump(1).
> 
> I have written a very hackish USB packet printer for tcpdump based on 
> Linux version.
> 
> http://people.freebsd.org/~jkim/tcpdump-usb.diff

Looks good to me.

> Note we can only print headers as Linux version does.
> 
> Are you planning on adopting DLT_USB_LINUX or DLT_USB_LINUX_MMAPPED or 
> applying for our own DLT, BTW?

Frankly speaking, not sure yet.  As you know, DLT_USB_LINUX and
DLT_USB_LINUX_MMAPPED types are very specific only for Linux and each
types has different structure size (48 bytes and 64 bytes).  IMHO linux
thought their own format only instead of thinking/defining a generic
format.

I think we have some cases we could select as follows:

  1) Define a generic USB packet header form and make a consensus with
 linux guys then uses DLT_USB type.
  2) Define DLT_USB_BSD and write our own code.
  3) Changes `struct usbpf_pkthdr' to be compatible with linux format
 though it's expected to have some wasted variables (e.g. time
 stamp).

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


Re: svn commit: r216119 - head

2010-12-02 Thread Ulrich Spoerlein
On Thu, 02.12.2010 at 15:45:22 +0100, Alexander Leidinger wrote:
> Quoting Ulrich Spoerlein  (from Thu, 2 Dec 2010  
> 10:46:05 + (UTC)):
> 
> > Author: uqs
> > Date: Thu Dec  2 10:46:05 2010
> > New Revision: 216119
> > URL: http://svn.freebsd.org/changeset/base/216119
> >
> > Log:
> >   Remove more duplicates.
> >
> >   Just so that I can lookup the command for the next time:
> 
> Can you please add it to OldFiles.inc instead, with a comment what it does?
> 
> >   for t in `make -V TARGETS universe`; do
> > __MAKE_CONF=/dev/null make -f Makefile.inc1 -m $PWD/share/mk TARGET=$t \
> > -V OLD_FILES -V OLD_LIBS -V OLD_DIRS delete-old | \
> > xargs -n1|sort|uniq -c|egrep -v "^ *1 ";
> >   done
> 
> While it does not matter for "-V OLD*", the spirit of the command is  
> more like the check-old target (which is including shared libs) than  
> the delete-old target (which does not delete shared libs but only  
> static libs). Using check-old would also remove the (wrong, but not  
> far fetched) fear of actually deleting something with this command.

Something that bugs me more, is all the TARGET_ARCH conditionals in that
file, that serve practically no purpose. If a file only existed on i386,
and it has been removed on i386, there's no point in wrapping this under
TARGET_ARCH=i386. The wrapping of all lib32 files for amd64 is a great
example :/

The wrapping is only ever required, if some file has been removed from a
set of arches, but must be retained on others.

Anyway, please see attached.

Uli
commit 2c5b79ffde80760690baee61d30b0f533e511ca3
Author: Ulrich Spörlein 
Date:   Thu Dec 2 21:23:58 2010 +0100

Document two more ways to find duplicates in the obsolete file list.

Remove the only duplicate found by the optional files check. Fix typos,
while here.

Suggested by:	netchild

diff --git a/ObsoleteFiles.inc b/ObsoleteFiles.inc
index 0756547..e406532 100644
--- a/ObsoleteFiles.inc
+++ b/ObsoleteFiles.inc
@@ -22,16 +22,31 @@
 # grep '+=' /usr/src/tools/build/mk/OptionalObsoleteFiles.inc | sort -u) | \
 # sort | uniq -d
 #
+# To find regular duplicates not dependant on optional components, you can
+# also use something that will not give you false positives, e.g.:
+# for t in `make -V TARGETS universe`; do
+#   __MAKE_CONF=/dev/null make -f Makefile.inc1 TARGET=$t \
+#   -V OLD_FILES -V OLD_LIBS -V OLD_DIRS check-old | \
+#   xargs -n1 | sort | uniq -d;
+# done
+#
+# For optional components, you can use the following to see if some entries
+# in OptionalObsoleteFiles.inc have been obsoleted by ObsoleteFiles.inc
+# for o in tools/build/options/WITH*; do
+#   __MAKE_CONF=/dev/null make -f Makefile.inc1 -D${o##*/} \
+#   -V OLD_FILES -V OLD_LIBS -V OLD_DIRS check-old | \
+#   xargs -n1 | sort | uniq -d;
+# done
 
 # 20101112: vgonel(9) has gone to private API a while ago
 OLD_FILES+=usr/share/man/man9/vgonel.9.gz
 # 20101112: removed gasp.info
 OLD_FILES+=usr/share/info/gasp.info.gz
-# 20101109: headers moved to machine/ to x86/
+# 20101109: headers moved from machine/ to x86/
 .if ${TARGET_ARCH} == "amd64" || ${TARGET_ARCH} == "i386"
 OLD_FILES+=usr/include/machine/mptable.h
 .endif
-# 20101101: headers moved to machine/ to x86/
+# 20101101: headers moved from machine/ to x86/
 .if ${TARGET_ARCH} == "amd64" || ${TARGET_ARCH} == "i386"
 OLD_FILES+=usr/include/machine/apicreg.h
 OLD_FILES+=usr/include/machine/mca.h
diff --git a/tools/build/mk/OptionalObsoleteFiles.inc b/tools/build/mk/OptionalObsoleteFiles.inc
index 02a4ce3..db8251c 100644
--- a/tools/build/mk/OptionalObsoleteFiles.inc
+++ b/tools/build/mk/OptionalObsoleteFiles.inc
@@ -1869,7 +1869,6 @@ OLD_FILES+=usr/lib/libfl_p.a
 OLD_FILES+=usr/lib/libform_p.a
 OLD_FILES+=usr/lib/libformw_p.a
 OLD_FILES+=usr/lib/libftpio_p.a
-OLD_FILES+=usr/lib/libg2c_p.a
 OLD_FILES+=usr/lib/libgcc_p.a
 OLD_FILES+=usr/lib/libgeom_p.a
 OLD_FILES+=usr/lib/libgnuregex_p.a
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

svn commit: r216134 - in head: share/man/man9 sys/amd64/include sys/arm/include sys/i386/include sys/ia64/include sys/mips/include sys/pc98/include sys/powerpc/include sys/sparc64/include sys/sun4v...

2010-12-02 Thread Bruce Cran
Author: brucec
Date: Thu Dec  2 22:19:30 2010
New Revision: 216134
URL: http://svn.freebsd.org/changeset/base/216134

Log:
  Disallow passing in a count of zero bytes to the bus_space(9) functions.
  
  Passing a count of zero on i386 and amd64 for [I386|AMD64]_BUS_SPACE_MEM
  causes a crash/hang since the 'loop' instruction decrements the counter
  before checking if it's zero.
  
  PR:   kern/80980
  Discussed with:   jhb

Modified:
  head/share/man/man9/bus_space.9
  head/sys/amd64/include/bus.h
  head/sys/arm/include/bus.h
  head/sys/i386/include/bus.h
  head/sys/ia64/include/bus.h
  head/sys/mips/include/bus.h
  head/sys/pc98/include/bus.h
  head/sys/powerpc/include/bus.h
  head/sys/sparc64/include/bus.h
  head/sys/sun4v/include/bus.h

Modified: head/share/man/man9/bus_space.9
==
--- head/share/man/man9/bus_space.9 Thu Dec  2 22:00:57 2010
(r216133)
+++ head/share/man/man9/bus_space.9 Thu Dec  2 22:19:30 2010
(r216134)
@@ -719,6 +719,9 @@ or which return data read from bus space
 do not obviously return an error code) do not fail.
 They could only fail
 if given invalid arguments, and in that case their behaviour is undefined.
+Functions which take a count of bytes must not pass in a count of zero; 
+doing so will cause a panic if the kernel was compiled with 
+.Cd "options INVARIANTS" .
 .Sh TYPES
 Several types are defined in
 .In machine/bus.h

Modified: head/sys/amd64/include/bus.h
==
--- head/sys/amd64/include/bus.hThu Dec  2 22:00:57 2010
(r216133)
+++ head/sys/amd64/include/bus.hThu Dec  2 22:19:30 2010
(r216134)
@@ -104,6 +104,9 @@
 #ifndef _AMD64_BUS_H_
 #define _AMD64_BUS_H_
 
+#include 
+#include 
+
 #include 
 #include 
 
@@ -268,7 +271,7 @@ static __inline void
 bus_space_read_multi_1(bus_space_tag_t tag, bus_space_handle_t bsh,
   bus_size_t offset, u_int8_t *addr, size_t count)
 {
-
+   KASSERT(count != 0, ("%s: count == 0", __func__));
if (tag == AMD64_BUS_SPACE_IO)
insb(bsh + offset, addr, count);
else {
@@ -289,7 +292,7 @@ static __inline void
 bus_space_read_multi_2(bus_space_tag_t tag, bus_space_handle_t bsh,
   bus_size_t offset, u_int16_t *addr, size_t count)
 {
-
+   KASSERT(count != 0, ("%s: count == 0", __func__));
if (tag == AMD64_BUS_SPACE_IO)
insw(bsh + offset, addr, count);
else {
@@ -310,7 +313,7 @@ static __inline void
 bus_space_read_multi_4(bus_space_tag_t tag, bus_space_handle_t bsh,
   bus_size_t offset, u_int32_t *addr, size_t count)
 {
-
+   KASSERT(count != 0, ("%s: count == 0", __func__));
if (tag == AMD64_BUS_SPACE_IO)
insl(bsh + offset, addr, count);
else {
@@ -356,7 +359,7 @@ static __inline void
 bus_space_read_region_1(bus_space_tag_t tag, bus_space_handle_t bsh,
bus_size_t offset, u_int8_t *addr, size_t count)
 {
-
+   KASSERT(count != 0, ("%s: count == 0", __func__));
if (tag == AMD64_BUS_SPACE_IO) {
int _port_ = bsh + offset;
 #ifdef __GNUCLIKE_ASM
@@ -388,7 +391,7 @@ static __inline void
 bus_space_read_region_2(bus_space_tag_t tag, bus_space_handle_t bsh,
bus_size_t offset, u_int16_t *addr, size_t count)
 {
-
+   KASSERT(count != 0, ("%s: count == 0", __func__));
if (tag == AMD64_BUS_SPACE_IO) {
int _port_ = bsh + offset;
 #ifdef __GNUCLIKE_ASM
@@ -420,7 +423,7 @@ static __inline void
 bus_space_read_region_4(bus_space_tag_t tag, bus_space_handle_t bsh,
bus_size_t offset, u_int32_t *addr, size_t count)
 {
-
+   KASSERT(count != 0, ("%s: count == 0", __func__));
if (tag == AMD64_BUS_SPACE_IO) {
int _port_ = bsh + offset;
 #ifdef __GNUCLIKE_ASM
@@ -532,7 +535,7 @@ static __inline void
 bus_space_write_multi_1(bus_space_tag_t tag, bus_space_handle_t bsh,
bus_size_t offset, const u_int8_t *addr, size_t count)
 {
-
+   KASSERT(count != 0, ("%s: count == 0", __func__));
if (tag == AMD64_BUS_SPACE_IO)
outsb(bsh + offset, addr, count);
else {
@@ -553,7 +556,7 @@ static __inline void
 bus_space_write_multi_2(bus_space_tag_t tag, bus_space_handle_t bsh,
bus_size_t offset, const u_int16_t *addr, size_t count)
 {
-
+   KASSERT(count != 0, ("%s: count == 0", __func__));
if (tag == AMD64_BUS_SPACE_IO)
outsw(bsh + offset, addr, count);
else {
@@ -574,7 +577,7 @@ static __inline void
 bus_space_write_multi_4(bus_space_tag_t tag, bus_space_handle_t bsh,
bus_size_t offset, const u_int32_t *addr, size_t count)
 {
-
+   KASSERT(count != 0, ("%s: count == 0", __func__));
if (tag == AMD64_BUS_SPA

svn commit: r216137 - head/lib/msun

2010-12-02 Thread David Schultz
Author: das
Date: Fri Dec  3 00:05:49 2010
New Revision: 216137
URL: http://svn.freebsd.org/changeset/base/216137

Log:
  Disable gcc's built-in rint() function when compiling s_nearbyint.c.
  It results in incorrect optimizations that break nearbyint().
  
  PR:   143358
  Reviewed by:  bde

Modified:
  head/lib/msun/Makefile

Modified: head/lib/msun/Makefile
==
--- head/lib/msun/Makefile  Thu Dec  2 22:37:50 2010(r216136)
+++ head/lib/msun/Makefile  Fri Dec  3 00:05:49 2010(r216137)
@@ -113,6 +113,12 @@ COMMON_SRCS:=  ${COMMON_SRCS:N${i:R}.c}
 .endfor
 .endif
 
+# Some files need certain gcc built-in functions to be disabled, since gcc's
+# model of the functions bogusly assumes -fno-trapping-math.
+XRINT_CFLAGS=  -fno-builtin-rint -fno-builtin-rintf -fno-builtin-rintl
+CFLAGS+=   ${XRINT_CFLAGS}
+XRINT_CFLAGS:= ${.IMPSRC:M*/s_nearbyint.c:C/^.+$/${XRINT_CFLAGS}/:C/^$//}
+
 SRCS=  ${COMMON_SRCS} ${ARCH_SRCS}
 
 INCS=  fenv.h math.h
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r216138 - head/usr.sbin/usbdump

2010-12-02 Thread Weongyo Jeong
Author: weongyo
Date: Fri Dec  3 00:44:07 2010
New Revision: 216138
URL: http://svn.freebsd.org/changeset/base/216138

Log:
  Changes the meaning of each characters '<' and '>' that it could be
  confused with USB OUT or USB IN packets though it just represents USB
  submit or done.  To know the USB packet direction, the endpoint address
  should be referred.
  
  Requested by: jkim

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

Modified: head/usr.sbin/usbdump/usbdump.c
==
--- head/usr.sbin/usbdump/usbdump.c Fri Dec  3 00:05:49 2010
(r216137)
+++ head/usr.sbin/usbdump/usbdump.c Fri Dec  3 00:44:07 2010
(r216138)
@@ -247,7 +247,7 @@ print_apacket(const struct bpf_xhdr *hdr
printf(" usbus%d.%d 0x%02x %s %s", up->up_busunit, up->up_address,
up->up_endpoint,
xfertype_table[up->up_xfertype],
-   up->up_type == USBPF_XFERTAP_SUBMIT ? ">" : "<");
+   up->up_type == USBPF_XFERTAP_SUBMIT ? "S" : "D");
printf(" (%d/%d)", up->up_frames, up->up_length);
if (up->up_type == USBPF_XFERTAP_DONE)
printf(" %s", errstr_table[up->up_error]);
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r216139 - head/tools/regression/lib/msun

2010-12-02 Thread David Schultz
Author: das
Date: Fri Dec  3 00:44:31 2010
New Revision: 216139
URL: http://svn.freebsd.org/changeset/base/216139

Log:
  Add some basic regression tests for nearbyint().

Added:
  head/tools/regression/lib/msun/test-nearbyint.c   (contents, props changed)
  head/tools/regression/lib/msun/test-nearbyint.t   (contents, props changed)
Modified:
  head/tools/regression/lib/msun/Makefile

Modified: head/tools/regression/lib/msun/Makefile
==
--- head/tools/regression/lib/msun/Makefile Fri Dec  3 00:44:07 2010
(r216138)
+++ head/tools/regression/lib/msun/Makefile Fri Dec  3 00:44:31 2010
(r216139)
@@ -2,7 +2,7 @@
 
 TESTS= test-conj test-csqrt test-exponential test-fenv test-fma \
test-fmaxmin test-ilogb test-invtrig test-lrint \
-   test-lround test-nan test-next test-rem test-trig
+   test-lround test-nan test-nearbyint test-next test-rem test-trig
 CFLAGS+= -O0 -lm
 
 .PHONY: tests

Added: head/tools/regression/lib/msun/test-nearbyint.c
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/tools/regression/lib/msun/test-nearbyint.c Fri Dec  3 00:44:31 
2010(r216139)
@@ -0,0 +1,100 @@
+/*-
+ * Copyright (c) 2010 David Schultz 
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+/*
+ * Tests for nearbyint{,f,l}()
+ *
+ * TODO:
+ * - adapt tests for rint(3)
+ * - tests for harder values (more mantissa bits than float)
+ * - tests in other rounding modes
+ */
+
+#include 
+__FBSDID("$FreeBSD$");
+
+#include 
+#include 
+#include 
+#include 
+
+#defineALL_STD_EXCEPT  (FE_DIVBYZERO | FE_INEXACT | FE_INVALID | \
+FE_OVERFLOW | FE_UNDERFLOW)
+
+/*
+ * Compare d1 and d2 using special rules: NaN == NaN and +0 != -0.
+ * Fail an assertion if they differ.
+ */
+static int
+fpequal(long double d1, long double d2)
+{
+
+   if (d1 != d2)
+   return (isnan(d1) && isnan(d2));
+   return (copysignl(1.0, d1) == copysignl(1.0, d2));
+}
+
+static void testit(int testnum, float in, float out)
+{
+
+feclearexcept(ALL_STD_EXCEPT);
+assert(fpequal(out, nearbyintf(in)));
+assert(fpequal(-out, nearbyintf(-in)));
+assert(fetestexcept(ALL_STD_EXCEPT) == 0);
+
+assert(fpequal(out, nearbyint(in)));
+assert(fpequal(-out, nearbyint(-in)));
+assert(fetestexcept(ALL_STD_EXCEPT) == 0);
+
+assert(fpequal(out, nearbyintl(in)));
+assert(fpequal(-out, nearbyintl(-in)));
+assert(fetestexcept(ALL_STD_EXCEPT) == 0);
+
+printf("ok %d\t\t# nearbyint(%g)\n", testnum, in);
+}
+
+static const float tests[] = {
+/* input   output (expected) */
+0.0,   0.0,
+0.5,   0.0,
+M_PI,  3,
+65536.5,   65536,
+INFINITY,  INFINITY,
+NAN,   NAN,
+};
+
+int
+main(int argc, char *argv[])
+{
+   static const int ntests = sizeof(tests) / sizeof(tests[0]) / 2;
+   int i;
+
+   printf("1..%d\n", ntests);
+   for (i = 0; i < ntests; i++)
+   testit(i + 1, tests[i * 2], tests[i * 2 + 1]);
+
+   return (0);
+}

Added: head/tools/regression/lib/msun/test-nearbyint.t
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/tools/regression/lib/msun/test-nearbyint.t Fri Dec  3 00:44:31 
2010(r216139)
@@ -0,0 +1,10 @@
+#!/bin/sh
+# $FreeBSD$
+
+cd `dirname $0`
+
+executable=`basename $0 .t`
+
+make $executable 2>&1 > /dev/null
+
+exec ./$executable
___
svn-src-head@freeb

Re: svn commit: r209110 - in head/lib/msun: . src

2010-12-02 Thread Kostik Belousov
On Thu, Dec 02, 2010 at 02:00:10PM -0500, David Schultz wrote:
> On Thu, Dec 02, 2010, Kostik Belousov wrote:
> > For __isnanf, libc exports __isn...@fbsd_1.0, and libm exports
> > __isn...@fbsd_1.2. I suspect that we could export both
> > __isn...@fbsd_1.0 and __isn...@fbsd_1.2 from libc.
> 
> I like the idea of adding an __isn...@fbsd_1.2 alias to libc for
> the benefit of people running -CURRENT.

Ok, draft of the change is below, I am not sure is it worth the churn.

I was unable to make the ld support two versions of the same symbol.
lib/msun would benefit from elimination of isnan sources if this is
committed.


diff --git a/lib/libc/gen/Makefile.inc b/lib/libc/gen/Makefile.inc
index d55bc46..f7c722e 100644
--- a/lib/libc/gen/Makefile.inc
+++ b/lib/libc/gen/Makefile.inc
@@ -19,8 +19,8 @@ SRCS+=  __getosreldate.c __xuname.c \
getosreldate.c getpagesize.c getpagesizes.c \
getpeereid.c getprogname.c getpwent.c getttyent.c \
getusershell.c getutxent.c getvfsbyname.c glob.c \
-   initgroups.c isatty.c isinf.c isnan.c jrand48.c lcong48.c \
-   lockf.c lrand48.c mrand48.c nftw.c nice.c \
+   initgroups.c isatty.c isinf.c isnan.c isnan_compat.c jrand48.c \
+   lcong48.c lockf.c lrand48.c mrand48.c nftw.c nice.c \
nlist.c nrand48.c opendir.c \
pause.c pmadvise.c popen.c posix_spawn.c \
psignal.c pututxline.c pw_scan.c pwcache.c \
diff --git a/lib/libc/gen/Symbol.map b/lib/libc/gen/Symbol.map
index f9abab5..fd0a896 100644
--- a/lib/libc/gen/Symbol.map
+++ b/lib/libc/gen/Symbol.map
@@ -200,7 +200,6 @@ FBSD_1.0 {
getvfsbyname;
__isnan;
isnan;
-   __isnanf;
isnanf;
__isinf;
isinf;
@@ -378,6 +377,7 @@ FBSD_1.2 {
sem_wait;
setutxdb;
setutxent;
+   __isnanf;
 };
 
 FBSDprivate_1.0 {
diff --git a/lib/libc/gen/isnan_compat.c b/lib/libc/gen/isnan_compat.c
new file mode 100644
index 000..f4749eb
--- /dev/null
+++ b/lib/libc/gen/isnan_compat.c
@@ -0,0 +1,17 @@
+/*
+ * The file is in public domain.
+ * Written by Konstantin Belousov 
+ *
+ * $FreeBSD$
+ */
+
+#include 
+
+__sym_compat(__isnanf, __isnanf_compat, FBSD_1.0);
+
+int
+__isnanf_compat(float f)
+{
+
+   return (__isnanf(f));
+}
diff --git a/lib/msun/Symbol.map b/lib/msun/Symbol.map
index 429a76f..8b33dca 100644
--- a/lib/msun/Symbol.map
+++ b/lib/msun/Symbol.map
@@ -118,7 +118,6 @@ FBSD_1.0 {
__isfinite;
__isfinitef;
__isfinitel;
-   isnanf;
__isnanl;
__isnormal;
__isnormalf;
@@ -221,5 +220,4 @@ FBSD_1.1 {
 
 /* First added in 9.0-CURRENT */
 FBSD_1.2 {
-   __isnanf;
 };


pgp3oWC0HQUjO.pgp
Description: PGP signature


svn commit: r216140 - head/usr.bin/man

2010-12-02 Thread Gordon Tetlow
Author: gordon
Date: Fri Dec  3 02:07:34 2010
New Revision: 216140
URL: http://svn.freebsd.org/changeset/base/216140

Log:
  Add ability to decompress different format manual pages.
  Add support for .so directive in manual pages.
  
  Approved by:  mentor (wes@)

Modified:
  head/usr.bin/man/man.sh

Modified: head/usr.bin/man/man.sh
==
--- head/usr.bin/man/man.sh Fri Dec  3 00:44:31 2010(r216139)
+++ head/usr.bin/man/man.sh Fri Dec  3 02:07:34 2010(r216140)
@@ -94,6 +94,7 @@ check_cat() {
if exists "$1"; then
use_cat=yes
catpage=$found
+   setup_cattool $catpage
decho "Found catpage $catpage"
return 0
else
@@ -108,12 +109,14 @@ check_man() {
if exists "$1"; then
# We have a match, check for a cat page
manpage=$found
+   setup_cattool $manpage
decho "Found manpage $manpage"
 
if exists "$2" && is_newer $found $manpage; then
# cat page found and is newer, use that
use_cat=yes
catpage=$found
+   setup_cattool $catpage
decho "Using catpage $catpage"
else
# no cat page or is older
@@ -240,6 +243,35 @@ manpath_warnings() {
fi
 }
 
+# Usage: man_check_for_so page path
+# Returns: True if able to resolve the file, false if it ended in tears.
+# Detects the presence of the .so directive and causes the file to be
+# redirected to another source file.
+man_check_for_so() {
+   local IFS line tstr
+
+   unset IFS
+
+   # We need to loop to accommodate multiple .so directives.
+   while true
+   do
+   line=$($cattool $manpage | head -1)
+   case "$line" in
+   .so*)   trim "${line#.so}"
+   decho "$manpage includes $tstr"
+   # Glob and check for the file.
+   if ! check_man "$path/$tstr*" ""; then
+   decho "  Unable to find $tstr"
+   return 1
+   fi
+   ;;
+   *)  break ;;
+   esac
+   done
+
+   return 0
+}
+
 # Usage: man_display_page
 # Display either the manpage or catpage depending on the use_cat variable
 man_display_page() {
@@ -258,10 +290,10 @@ man_display_page() {
ret=0
else
if [ $debug -gt 0 ]; then
-   decho "Command: $ZCAT $catpage | $PAGER"
+   decho "Command: $cattool $catpage | $PAGER"
ret=0
else
-   eval "$ZCAT $catpage | $PAGER"
+   eval "$cattool $catpage | $PAGER"
ret=$?
fi
fi
@@ -343,10 +375,10 @@ man_display_page() {
fi
 
if [ $debug -gt 0 ]; then
-   decho "Command: $ZCAT $manpage | $pipeline"
+   decho "Command: $cattool $manpage | $pipeline"
ret=0
else
-   eval "$ZCAT $manpage | $pipeline"
+   eval "$cattool $manpage | $pipeline"
ret=$?
fi
 }
@@ -361,10 +393,13 @@ man_find_and_display() {
case "$1" in
*/*)if [ -f "$1" -a -r "$1" ]; then
decho "Found a usable page, displaying that"
-   found_page=yes
unset use_cat
manpage="$1"
-   man_display_page
+   setup_cattool $manpage
+   if man_check_for_so $manpage $(dirname $manpage); then
+   found_page=yes
+   man_display_page
+   fi
return
fi
;;
@@ -380,35 +415,41 @@ man_find_and_display() {
 
# Check if there is a MACHINE specific manpath.
if find_file $p $sect $MACHINE "$1"; then
-   found_page=yes
-   man_display_page
-   if [ -n "$aflag" ]; then
-   continue 2
-   else
-   return
+   if man_check_for_so $manpage $p; then
+   found_page=yes
+   man_display_page
+   if [ -n "$aflag" ]; then
+

svn commit: r216141 - head/sys/vm

2010-12-02 Thread Warner Losh
Author: imp
Date: Fri Dec  3 04:39:48 2010
New Revision: 216141
URL: http://svn.freebsd.org/changeset/base/216141

Log:
  To make minidumps work properly on mips for memory that's direct
  mapped and entered via vm_page_setup, keep track of it like we do
  for amd64.
  
  # A separate commit will be made to move this to a capability-based ifdef
  # rather than arch-based ifdef.
  
  Submitted by: alc@
  MFC after:1 week

Modified:
  head/sys/vm/vm_page.c

Modified: head/sys/vm/vm_page.c
==
--- head/sys/vm/vm_page.c   Fri Dec  3 02:07:34 2010(r216140)
+++ head/sys/vm/vm_page.c   Fri Dec  3 04:39:48 2010(r216141)
@@ -430,11 +430,12 @@ vm_page_startup(vm_offset_t vaddr)
 */
new_end = vm_reserv_startup(&vaddr, new_end, high_water);
 #endif
-#ifdef __amd64__
+#if defined(__amd64__) || defined(__mips__)
/*
-* pmap_map on amd64 comes out of the direct-map, not kvm like i386,
-* so the pages must be tracked for a crashdump to include this data.
-* This includes the vm_page_array and the early UMA bootstrap pages.
+* pmap_map on amd64 and mips can come out of the direct-map, not kvm
+* like i386, so the pages must be tracked for a crashdump to include
+* this data.  This includes the vm_page_array and the early UMA
+* bootstrap pages.
 */
for (pa = new_end; pa < phys_avail[biggestone + 1]; pa += PAGE_SIZE)
dump_add_page(pa);
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r216142 - head/share/man/man3

2010-12-02 Thread David Schultz
Author: das
Date: Fri Dec  3 07:01:07 2010
New Revision: 216142
URL: http://svn.freebsd.org/changeset/base/216142

Log:
  Explain some of the reasons that fpsetprec() is unlikely to work as
  one might expect.  (These functions have already been deprecated for
  many years.)
  
  PR:   133583

Modified:
  head/share/man/man3/fpgetround.3

Modified: head/share/man/man3/fpgetround.3
==
--- head/share/man/man3/fpgetround.3Fri Dec  3 04:39:48 2010
(r216141)
+++ head/share/man/man3/fpgetround.3Fri Dec  3 07:01:07 2010
(r216142)
@@ -32,7 +32,7 @@
 .\" @(#)fpgetround.3   1.0 (Berkeley) 9/23/93
 .\" $FreeBSD$
 .\"
-.Dd August 23, 1993
+.Dd December 3, 2010
 .Dt FPGETROUND 3
 .Os
 .Sh NAME
@@ -164,6 +164,10 @@ and
 .Fn fpsetprec
 functions provide functionality unavailable on many platforms.
 At present, they are implemented only on the i386 and amd64 platforms.
+Changing precision isn't a supported feature:
+it may be ineffective when code is compiled to take advantage of SSE,
+and many library functions and compiler optimizations depend upon the
+default precision for correct behavior.
 .Sh SEE ALSO
 .Xr fenv 3 ,
 .Xr isnan 3
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r216122 - head/sys/powerpc/include

2010-12-02 Thread Bruce Evans

On Thu, 2 Dec 2010, Nathan Whitehorn wrote:


Log:
 Define bswap macros for constants to allow the compiler to pre-compute
 byte-swapped versions of compile-time constants. This allows use of
 bswap() and htole*() in initializers, which is required to cross-build
 btxld.


The constant case is MI so it shouldn't be repeated in many (now many + 1)
MD files.  I got cognet@ to clean this up a bit, but he wasn't able to
commit the main part (due to unresolved namespace problems IIRC).


 Obtained from: sparc64


amd64 is a better base.


Modified: head/sys/powerpc/include/endian.h
==
--- head/sys/powerpc/include/endian.h   Thu Dec  2 13:40:21 2010
(r216121)
+++ head/sys/powerpc/include/endian.h   Thu Dec  2 15:10:27 2010
(r216122)
@@ -27,7 +27,6 @@
 * SUCH DAMAGE.
 *
 *  @(#)endian.h8.1 (Berkeley) 6/10/93
- * $NetBSD: endian.h,v 1.7 1999/08/21 05:53:51 simonb Exp $
 * $FreeBSD$
 */

@@ -79,17 +78,36 @@
#define BYTE_ORDER  _BYTE_ORDER
#endif

-#ifdef __CC_SUPPORTS___INLINE


__inline is still used, but is no longer ifdefed.  Probably best.  Most
of the __CC_SUPPORTS macros are just usless obfuscations since they
are only used in a few places, and `inline' (but not __inline__) is
now Standard.  E.g., even amd64 and i386 don't use
__CC_SUPPORTS___INLINE in endian.h.  After this commit, only ia64's
endian.h uses __CC_SUPPORTS___INLINE.  The __CC_SUPPORTS_INLINE and
__CC_SUPPORTS___INLINE__ macros are even more useless than
__CC_SUPPORTS___INLINE (the former since plain inline is Standard
and the latter since __inline__ is a style bug which is used mainly
in contrib'ed code that is very unlikely to ifdef its mistakes.


+#if defined(__GNUCLIKE_BUILTIN_CONSTANT_P)
+#define__is_constant(x)__builtin_constant_p(x)
+#else
+#define__is_constant(x)0
+#endif


This won't actually work if __GNUCLIKE_BUILTIN_CONSTANT_P is not defined,
since it says that everything is variable in that case, so it will generate
inline function calls in static initializers and fail messily.  amd64 and
i386 use a better ifdef which results in _BYTEORDER_FUNC_DEFINED being
defined.  This should result in upper layers don't the right thing,
which must include handling the const case so that the interfaces can
be used in static initializers, but in fact upper layers are more broken
than here:

- of course upper layers don't handle the constant case
- the only upper layers headers that test _BYTEORDER_FUNC_DEFINED are
  sys/param.h and netinet/in.h.  Since these are not sys/endian.h,
  and since the MD endian.h is included directly in other places
  than these (mainly sys/types.h), there are namespace problems.
- in sys/param.h and netinet/in.h, _BYTEORDER_FUNC_DEFINED only affects
  the definitions of hton*() and ntohs*().  So most MD byteorder
  functions are left undefined.

In MD layers, only amd64, i386, ia64, and previously powerpc, define
_BYTEORDER_FUNC_DEFINED.  These declarations are confusing but not
wrong.  The byteorder functions that are covered by this macro are
only __hton*() and __ntoh*().  When these are defined, upper layers
refrain from defining hton*() and ntoh*(), so that in the usual case
where the latter are already defined, they are not redefined (although
they should be since redefinition of macros is harmless unless there
is a bug that makes the definitions differ), and in the unusual case
where the underscored functions are not defined, the non-underscored
functions remain undefined too, so that extern functions are used for
the latter.  Untangling this will be difficult, although it is just
an obfuscation in the usual case.


+
+#define__bswap16_const(x)  __uint16_t)(x) >> 8) & 0xff) |\
+   (((__uint16_t)(x) << 8) & 0xff00))
+#define__bswap32_const(x)  __uint32_t)(x) >> 24) & 0xff) |   \
+   (((__uint32_t)(x) >> 8) & 0xff00) |   \
+   (((__uint32_t)(x)<< 8) & 0xff) |  \
+   (((__uint32_t)(x) << 24) & 0xff00))
+#define__bswap64_const(x)  __uint64_t)(x) >> 56) & 0xff) |   \
+   (((__uint64_t)(x) >> 40) & 0xff00) |  \
+   (((__uint64_t)(x) >> 24) & 0xff) |\
+   (((__uint64_t)(x) >> 8) & 0xff00) |   \
+   (((__uint64_t)(x) << 8) & ((__uint64_t)0xff << 32)) |   \
+   (((__uint64_t)(x) << 24) & ((__uint64_t)0xff << 40)) |  \
+   (((__uint64_t)(x) << 40) & ((__uint64_t)0xff << 48)) |  \
+   (((__uint64_t)(x) << 56) & ((__uint64_t)0xff << 56)))


All MI.  Even on mips, all these macros, and corresponding functions too,
are MI, despite endianness differences.  All the swap APIs are MI.  It
is only the hton*() and ntoh*() APIs that are MD, since they sometimes
don't swap.

Mips has different mistak

svn commit: r216143 - in head: share/man/man9 sys/amd64/include sys/arm/include sys/i386/include sys/ia64/include sys/mips/include sys/pc98/include sys/powerpc/include sys/sparc64/include sys/sun4v...

2010-12-02 Thread Bruce Cran
Author: brucec
Date: Fri Dec  3 07:09:23 2010
New Revision: 216143
URL: http://svn.freebsd.org/changeset/base/216143

Log:
  Revert r216134. This checkin broke platforms where bus_space are macros:
  they need to be a single statement, and do { } while (0) doesn't work in this
  situation so revert until a solution can be devised.

Modified:
  head/share/man/man9/bus_space.9
  head/sys/amd64/include/bus.h
  head/sys/arm/include/bus.h
  head/sys/i386/include/bus.h
  head/sys/ia64/include/bus.h
  head/sys/mips/include/bus.h
  head/sys/pc98/include/bus.h
  head/sys/powerpc/include/bus.h
  head/sys/sparc64/include/bus.h
  head/sys/sun4v/include/bus.h

Modified: head/share/man/man9/bus_space.9
==
--- head/share/man/man9/bus_space.9 Fri Dec  3 07:01:07 2010
(r216142)
+++ head/share/man/man9/bus_space.9 Fri Dec  3 07:09:23 2010
(r216143)
@@ -719,9 +719,6 @@ or which return data read from bus space
 do not obviously return an error code) do not fail.
 They could only fail
 if given invalid arguments, and in that case their behaviour is undefined.
-Functions which take a count of bytes must not pass in a count of zero; 
-doing so will cause a panic if the kernel was compiled with 
-.Cd "options INVARIANTS" .
 .Sh TYPES
 Several types are defined in
 .In machine/bus.h

Modified: head/sys/amd64/include/bus.h
==
--- head/sys/amd64/include/bus.hFri Dec  3 07:01:07 2010
(r216142)
+++ head/sys/amd64/include/bus.hFri Dec  3 07:09:23 2010
(r216143)
@@ -104,9 +104,6 @@
 #ifndef _AMD64_BUS_H_
 #define _AMD64_BUS_H_
 
-#include 
-#include 
-
 #include 
 #include 
 
@@ -271,7 +268,7 @@ static __inline void
 bus_space_read_multi_1(bus_space_tag_t tag, bus_space_handle_t bsh,
   bus_size_t offset, u_int8_t *addr, size_t count)
 {
-   KASSERT(count != 0, ("%s: count == 0", __func__));
+
if (tag == AMD64_BUS_SPACE_IO)
insb(bsh + offset, addr, count);
else {
@@ -292,7 +289,7 @@ static __inline void
 bus_space_read_multi_2(bus_space_tag_t tag, bus_space_handle_t bsh,
   bus_size_t offset, u_int16_t *addr, size_t count)
 {
-   KASSERT(count != 0, ("%s: count == 0", __func__));
+
if (tag == AMD64_BUS_SPACE_IO)
insw(bsh + offset, addr, count);
else {
@@ -313,7 +310,7 @@ static __inline void
 bus_space_read_multi_4(bus_space_tag_t tag, bus_space_handle_t bsh,
   bus_size_t offset, u_int32_t *addr, size_t count)
 {
-   KASSERT(count != 0, ("%s: count == 0", __func__));
+
if (tag == AMD64_BUS_SPACE_IO)
insl(bsh + offset, addr, count);
else {
@@ -359,7 +356,7 @@ static __inline void
 bus_space_read_region_1(bus_space_tag_t tag, bus_space_handle_t bsh,
bus_size_t offset, u_int8_t *addr, size_t count)
 {
-   KASSERT(count != 0, ("%s: count == 0", __func__));
+
if (tag == AMD64_BUS_SPACE_IO) {
int _port_ = bsh + offset;
 #ifdef __GNUCLIKE_ASM
@@ -391,7 +388,7 @@ static __inline void
 bus_space_read_region_2(bus_space_tag_t tag, bus_space_handle_t bsh,
bus_size_t offset, u_int16_t *addr, size_t count)
 {
-   KASSERT(count != 0, ("%s: count == 0", __func__));
+
if (tag == AMD64_BUS_SPACE_IO) {
int _port_ = bsh + offset;
 #ifdef __GNUCLIKE_ASM
@@ -423,7 +420,7 @@ static __inline void
 bus_space_read_region_4(bus_space_tag_t tag, bus_space_handle_t bsh,
bus_size_t offset, u_int32_t *addr, size_t count)
 {
-   KASSERT(count != 0, ("%s: count == 0", __func__));
+
if (tag == AMD64_BUS_SPACE_IO) {
int _port_ = bsh + offset;
 #ifdef __GNUCLIKE_ASM
@@ -535,7 +532,7 @@ static __inline void
 bus_space_write_multi_1(bus_space_tag_t tag, bus_space_handle_t bsh,
bus_size_t offset, const u_int8_t *addr, size_t count)
 {
-   KASSERT(count != 0, ("%s: count == 0", __func__));
+
if (tag == AMD64_BUS_SPACE_IO)
outsb(bsh + offset, addr, count);
else {
@@ -556,7 +553,7 @@ static __inline void
 bus_space_write_multi_2(bus_space_tag_t tag, bus_space_handle_t bsh,
bus_size_t offset, const u_int16_t *addr, size_t count)
 {
-   KASSERT(count != 0, ("%s: count == 0", __func__));
+
if (tag == AMD64_BUS_SPACE_IO)
outsw(bsh + offset, addr, count);
else {
@@ -577,7 +574,7 @@ static __inline void
 bus_space_write_multi_4(bus_space_tag_t tag, bus_space_handle_t bsh,
bus_size_t offset, const u_int32_t *addr, size_t count)
 {
-   KASSERT(count != 0, ("%s: count == 0", __func__));
+
if (tag == AMD64_BUS_SPACE_IO)
outsl(bsh + offset, addr, count);
else {
@@ -624,7 +621,7 @@ static 

svn commit: r216144 - head/tools/tools/nanobsd

2010-12-02 Thread Warner Losh
Author: imp
Date: Fri Dec  3 07:33:43 2010
New Revision: 216144
URL: http://svn.freebsd.org/changeset/base/216144

Log:
  _WITHOUT_SRCCONF has too much baggage.  Instead, use the simpler
  SRCCONF=/dev/null.

Modified:
  head/tools/tools/nanobsd/nanobsd.sh

Modified: head/tools/tools/nanobsd/nanobsd.sh
==
--- head/tools/tools/nanobsd/nanobsd.sh Fri Dec  3 07:09:23 2010
(r216143)
+++ head/tools/tools/nanobsd/nanobsd.sh Fri Dec  3 07:33:43 2010
(r216144)
@@ -182,7 +182,7 @@ make_conf_build ( ) (
 
echo "${CONF_WORLD}" > ${NANO_MAKE_CONF_BUILD}
echo "${CONF_BUILD}" >> ${NANO_MAKE_CONF_BUILD}
-   echo "_WITHOUT_SRCCONF=t" >> ${NANO_MAKE_CONF_BUILD}
+   echo "SRCCONF=/dev/null" >> ${NANO_MAKE_CONF_BUILD}
 )
 
 build_world ( ) (
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r216145 - head/tools/tools/nanobsd

2010-12-02 Thread Warner Losh
Author: imp
Date: Fri Dec  3 07:39:29 2010
New Revision: 216145
URL: http://svn.freebsd.org/changeset/base/216145

Log:
  o Mount the device async when we're doing the copy.
  o Create a sparse file instead of a fully zerod one.  This trades the
possibiltiy of running out of space during the build for the speed
gain not having do write all those zeros...
  
  Submitted by: n_hibma

Modified:
  head/tools/tools/nanobsd/nanobsd.sh

Modified: head/tools/tools/nanobsd/nanobsd.sh
==
--- head/tools/tools/nanobsd/nanobsd.sh Fri Dec  3 07:33:43 2010
(r216144)
+++ head/tools/tools/nanobsd/nanobsd.sh Fri Dec  3 07:39:29 2010
(r216145)
@@ -404,7 +404,7 @@ newfs_part ( ) (
lbl=$3
echo newfs ${NANO_NEWFS} ${NANO_LABEL:+-L${NANO_LABEL}${lbl}} ${dev}
newfs ${NANO_NEWFS} ${NANO_LABEL:+-L${NANO_LABEL}${lbl}} ${dev}
-   mount ${dev} ${mnt}
+   mount -o async ${dev} ${mnt}
 )
 
 populate_slice ( ) (
@@ -513,8 +513,8 @@ create_i386_diskimage ( ) (
-y ${NANO_HEADS}`
else
echo "Creating md backing file..."
-   dd if=/dev/zero of=${IMG} bs=${NANO_SECTS}b \
-   count=`expr ${NANO_MEDIASIZE} / ${NANO_SECTS}`
+   rm -f ${IMG}
+   dd if=/dev/zero of=${IMG} seek=${NANO_MEDIASIZE} count=0
MD=`mdconfig -a -t vnode -f ${IMG} -x ${NANO_SECTS} \
-y ${NANO_HEADS}`
fi
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"