PERFORCE change 136474 for review

Kip Macy kmacy at FreeBSD.org
Fri Feb 29 19:48:21 UTC 2008


http://perforce.freebsd.org/chv.cgi?CH=136474

Change 136474 by kmacy at kmacy:entropy:iwarp on 2008/02/29 04:24:55

	IFC 136473

Affected files ...

.. //depot/projects/iwarp/games/fortune/datfiles/fortunes#6 integrate
.. //depot/projects/iwarp/include/unistd.h#4 integrate
.. //depot/projects/iwarp/lib/libarchive/archive_endian.h#2 integrate
.. //depot/projects/iwarp/lib/libarchive/archive_read_support_format_zip.c#4 integrate
.. //depot/projects/iwarp/lib/libarchive/archive_write_disk.c#4 integrate
.. //depot/projects/iwarp/lib/libc/gen/sysconf.c#2 integrate
.. //depot/projects/iwarp/lib/libc/stdio/fdopen.c#2 integrate
.. //depot/projects/iwarp/lib/libc/stdio/fopen.c#2 integrate
.. //depot/projects/iwarp/lib/libc/stdio/freopen.c#2 integrate
.. //depot/projects/iwarp/lib/libc/stdlib/getenv.c#2 integrate
.. //depot/projects/iwarp/lib/libc/sys/readlink.2#3 integrate
.. //depot/projects/iwarp/lib/msun/src/e_rem_pio2.c#3 integrate
.. //depot/projects/iwarp/lib/msun/src/e_rem_pio2f.c#3 integrate
.. //depot/projects/iwarp/sbin/fsck_ffs/pass1.c#2 integrate
.. //depot/projects/iwarp/sbin/fsck_ffs/pass2.c#2 integrate
.. //depot/projects/iwarp/sbin/fsck_ffs/setup.c#2 integrate
.. //depot/projects/iwarp/sbin/ipfw/ipfw.8#6 integrate
.. //depot/projects/iwarp/sbin/ipfw/ipfw2.c#6 integrate
.. //depot/projects/iwarp/share/man/man4/uscanner.4#2 integrate
.. //depot/projects/iwarp/share/man/man9/Makefile#8 integrate
.. //depot/projects/iwarp/share/man/man9/insmntque.9#1 branch
.. //depot/projects/iwarp/share/man/man9/vfs_mountedfrom.9#1 branch
.. //depot/projects/iwarp/share/man/man9/vgone.9#2 integrate
.. //depot/projects/iwarp/share/man/man9/vhold.9#2 integrate
.. //depot/projects/iwarp/share/man/man9/vput.9#2 integrate
.. //depot/projects/iwarp/share/man/man9/vref.9#2 integrate
.. //depot/projects/iwarp/share/man/man9/vrefcnt.9#1 branch
.. //depot/projects/iwarp/share/man/man9/vrele.9#2 integrate
.. //depot/projects/iwarp/share/misc/bsd-family-tree#5 integrate
.. //depot/projects/iwarp/share/misc/committers-doc.dot#3 integrate
.. //depot/projects/iwarp/share/misc/committers-ports.dot#4 integrate
.. //depot/projects/iwarp/sys/arm/include/_bus.h#2 integrate
.. //depot/projects/iwarp/sys/arm/xscale/ixp425/ixp425.c#2 integrate
.. //depot/projects/iwarp/sys/boot/i386/boot2/boot2.c#3 integrate
.. //depot/projects/iwarp/sys/boot/i386/btx/btx/Makefile#2 integrate
.. //depot/projects/iwarp/sys/boot/i386/btx/btx/btx.S#2 integrate
.. //depot/projects/iwarp/sys/boot/i386/gptboot/gptboot.c#2 integrate
.. //depot/projects/iwarp/sys/boot/i386/libi386/biosdisk.c#4 integrate
.. //depot/projects/iwarp/sys/boot/pc98/btx/btx/Makefile#2 integrate
.. //depot/projects/iwarp/sys/boot/pc98/btx/btx/btx.S#2 integrate
.. //depot/projects/iwarp/sys/cam/cam_xpt.c#5 integrate
.. //depot/projects/iwarp/sys/conf/NOTES#8 integrate
.. //depot/projects/iwarp/sys/conf/files#11 integrate
.. //depot/projects/iwarp/sys/conf/ldscript.powerpc#2 integrate
.. //depot/projects/iwarp/sys/dev/cxgb/cxgb_main.c#21 integrate
.. //depot/projects/iwarp/sys/dev/drm/drm_pciids.h#2 integrate
.. //depot/projects/iwarp/sys/dev/md/md.c#5 integrate
.. //depot/projects/iwarp/sys/dev/msk/if_msk.c#6 integrate
.. //depot/projects/iwarp/sys/dev/msk/if_mskreg.h#4 integrate
.. //depot/projects/iwarp/sys/dev/usb/ubsa.c#2 integrate
.. //depot/projects/iwarp/sys/dev/usb/usbdevs#9 integrate
.. //depot/projects/iwarp/sys/dev/usb/uscanner.c#2 integrate
.. //depot/projects/iwarp/sys/fs/coda/TODO#3 integrate
.. //depot/projects/iwarp/sys/fs/fdescfs/fdesc_vnops.c#3 integrate
.. //depot/projects/iwarp/sys/gdb/gdb_main.c#2 integrate
.. //depot/projects/iwarp/sys/geom/part/g_part_mbr.c#2 integrate
.. //depot/projects/iwarp/sys/i386/cpufreq/est.c#2 integrate
.. //depot/projects/iwarp/sys/i386/i386/identcpu.c#3 integrate
.. //depot/projects/iwarp/sys/kern/vnode_if.src#4 integrate
.. //depot/projects/iwarp/sys/netinet/ip_dummynet.c#5 integrate
.. //depot/projects/iwarp/sys/powerpc/aim/locore.S#2 integrate
.. //depot/projects/iwarp/sys/powerpc/powerpc/genassym.c#3 integrate
.. //depot/projects/iwarp/sys/security/audit/audit_worker.c#4 integrate
.. //depot/projects/iwarp/sys/vm/vm_object.c#6 integrate
.. //depot/projects/iwarp/usr.bin/awk/Makefile#3 integrate
.. //depot/projects/iwarp/usr.bin/calendar/calendars/calendar.freebsd#6 integrate
.. //depot/projects/iwarp/usr.sbin/pkg_install/add/main.c#3 integrate

Differences ...

==== //depot/projects/iwarp/games/fortune/datfiles/fortunes#6 (text+ko) ====

@@ -1,5 +1,5 @@
 This fortune brought to you by:
-$FreeBSD: src/games/fortune/datfiles/fortunes,v 1.255 2008/01/10 14:51:24 des Exp $
+$FreeBSD: src/games/fortune/datfiles/fortunes,v 1.257 2008/02/28 15:16:24 yar Exp $
 %
 =======================================================================
 ||								     ||
@@ -15979,6 +15979,9 @@
 %
 Don't mind him; politicians always sound like that.
 %
+Don't patch bad code -- rewrite it.
+		-- "The Elements of Programming Style", Kernighan and Plauger
+%
 Don't plan any hasty moves.
 You'll be evicted soon anyway.
 %
@@ -31243,7 +31246,7 @@
 		-- Charles Dickens
 %
 Let the machine do the dirty work.
-		-- "Elements of Programming Style", Kernighan and Ritchie
+		-- "The Elements of Programming Style", Kernighan and Plauger
 %
 Let the meek inherit the earth -- they have it coming to them.
 		-- James Thurber

==== //depot/projects/iwarp/include/unistd.h#4 (text+ko) ====

@@ -31,7 +31,7 @@
  * SUCH DAMAGE.
  *
  *	@(#)unistd.h	8.12 (Berkeley) 4/27/95
- * $FreeBSD: src/include/unistd.h,v 1.83 2008/02/12 20:09:03 ru Exp $
+ * $FreeBSD: src/include/unistd.h,v 1.84 2008/02/26 20:33:52 ru Exp $
  */
 
 #ifndef _UNISTD_H_
@@ -405,7 +405,7 @@
 /* 1003.1-2001 */
 #if __POSIX_VISIBLE >= 200112 || __XSI_VISIBLE
 int	 fchown(int, uid_t, gid_t);
-ssize_t	 readlink(const char *, char *, size_t);
+ssize_t	 readlink(const char * __restrict, char * __restrict, size_t);
 #endif
 #if __POSIX_VISIBLE >= 200112
 int	 gethostname(char *, size_t);

==== //depot/projects/iwarp/lib/libarchive/archive_endian.h#2 (text+ko) ====

@@ -23,7 +23,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $FreeBSD: src/lib/libarchive/archive_endian.h,v 1.1 2008/01/03 18:30:37 des Exp $
+ * $FreeBSD: src/lib/libarchive/archive_endian.h,v 1.2 2008/02/26 07:17:47 kientzle Exp $
  *
  * Borrowed from FreeBSD's <sys/endian.h>
  */
@@ -34,7 +34,7 @@
 /* Alignment-agnostic encode/decode bytestream to/from little/big endian. */
 
 static inline uint16_t
-be16dec(const void *pp)
+archive_be16dec(const void *pp)
 {
 	unsigned char const *p = (unsigned char const *)pp;
 
@@ -42,7 +42,7 @@
 }
 
 static inline uint32_t
-be32dec(const void *pp)
+archive_be32dec(const void *pp)
 {
 	unsigned char const *p = (unsigned char const *)pp;
 
@@ -50,15 +50,15 @@
 }
 
 static inline uint64_t
-be64dec(const void *pp)
+archive_be64dec(const void *pp)
 {
 	unsigned char const *p = (unsigned char const *)pp;
 
-	return (((uint64_t)be32dec(p) << 32) | be32dec(p + 4));
+	return (((uint64_t)archive_be32dec(p) << 32) | archive_be32dec(p + 4));
 }
 
 static inline uint16_t
-le16dec(const void *pp)
+archive_le16dec(const void *pp)
 {
 	unsigned char const *p = (unsigned char const *)pp;
 
@@ -66,7 +66,7 @@
 }
 
 static inline uint32_t
-le32dec(const void *pp)
+archive_le32dec(const void *pp)
 {
 	unsigned char const *p = (unsigned char const *)pp;
 
@@ -74,15 +74,15 @@
 }
 
 static inline uint64_t
-le64dec(const void *pp)
+archive_le64dec(const void *pp)
 {
 	unsigned char const *p = (unsigned char const *)pp;
 
-	return (((uint64_t)le32dec(p + 4) << 32) | le32dec(p));
+	return (((uint64_t)archive_le32dec(p + 4) << 32) | archive_le32dec(p));
 }
 
 static inline void
-be16enc(void *pp, uint16_t u)
+archive_be16enc(void *pp, uint16_t u)
 {
 	unsigned char *p = (unsigned char *)pp;
 
@@ -91,7 +91,7 @@
 }
 
 static inline void
-be32enc(void *pp, uint32_t u)
+archive_be32enc(void *pp, uint32_t u)
 {
 	unsigned char *p = (unsigned char *)pp;
 
@@ -102,16 +102,16 @@
 }
 
 static inline void
-be64enc(void *pp, uint64_t u)
+archive_be64enc(void *pp, uint64_t u)
 {
 	unsigned char *p = (unsigned char *)pp;
 
-	be32enc(p, u >> 32);
-	be32enc(p + 4, u & 0xffffffff);
+	archive_be32enc(p, u >> 32);
+	archive_be32enc(p + 4, u & 0xffffffff);
 }
 
 static inline void
-le16enc(void *pp, uint16_t u)
+archive_le16enc(void *pp, uint16_t u)
 {
 	unsigned char *p = (unsigned char *)pp;
 
@@ -120,7 +120,7 @@
 }
 
 static inline void
-le32enc(void *pp, uint32_t u)
+archive_le32enc(void *pp, uint32_t u)
 {
 	unsigned char *p = (unsigned char *)pp;
 
@@ -131,12 +131,12 @@
 }
 
 static inline void
-le64enc(void *pp, uint64_t u)
+archive_le64enc(void *pp, uint64_t u)
 {
 	unsigned char *p = (unsigned char *)pp;
 
-	le32enc(p, u & 0xffffffff);
-	le32enc(p + 4, u >> 32);
+	archive_le32enc(p, u & 0xffffffff);
+	archive_le32enc(p + 4, u >> 32);
 }
 
 #endif

==== //depot/projects/iwarp/lib/libarchive/archive_read_support_format_zip.c#4 (text+ko) ====

@@ -24,7 +24,7 @@
  */
 
 #include "archive_platform.h"
-__FBSDID("$FreeBSD: src/lib/libarchive/archive_read_support_format_zip.c,v 1.20 2008/01/15 16:27:15 kientzle Exp $");
+__FBSDID("$FreeBSD: src/lib/libarchive/archive_read_support_format_zip.c,v 1.22 2008/02/27 06:05:59 kientzle Exp $");
 
 #ifdef HAVE_ERRNO_H
 #include <errno.h>
@@ -278,8 +278,8 @@
 
 	zip->version = p->version[0];
 	zip->system = p->version[1];
-	zip->flags = le16dec(p->flags);
-	zip->compression = le16dec(p->compression);
+	zip->flags = archive_le16dec(p->flags);
+	zip->compression = archive_le16dec(p->compression);
 	if (zip->compression <
 	    sizeof(compression_names)/sizeof(compression_names[0]))
 		zip->compression_name = compression_names[zip->compression];
@@ -291,11 +291,11 @@
 	zip->mode = 0;
 	zip->uid = 0;
 	zip->gid = 0;
-	zip->crc32 = le32dec(p->crc32);
-	zip->filename_length = le16dec(p->filename_length);
-	zip->extra_length = le16dec(p->extra_length);
-	zip->uncompressed_size = le32dec(p->uncompressed_size);
-	zip->compressed_size = le32dec(p->compressed_size);
+	zip->crc32 = archive_le32dec(p->crc32);
+	zip->filename_length = archive_le16dec(p->filename_length);
+	zip->extra_length = archive_le16dec(p->extra_length);
+	zip->uncompressed_size = archive_le32dec(p->uncompressed_size);
+	zip->compressed_size = archive_le32dec(p->compressed_size);
 
 	(a->decompressor->consume)(a, sizeof(struct zip_file_header));
 
@@ -397,9 +397,9 @@
 					    "Truncated ZIP end-of-file record");
 					return (ARCHIVE_FATAL);
 				}
-				zip->crc32 = le32dec(p + 4);
-				zip->compressed_size = le32dec(p + 8);
-				zip->uncompressed_size = le32dec(p + 12);
+				zip->crc32 = archive_le32dec(p + 4);
+				zip->compressed_size = archive_le32dec(p + 8);
+				zip->uncompressed_size = archive_le32dec(p + 12);
 				(a->decompressor->consume)(a, 16);
 			}
 
@@ -636,7 +636,7 @@
 {
 	struct zip *zip;
 	const void *buff = NULL;
-	ssize_t bytes_avail;
+	off_t bytes_skipped;
 
 	zip = (struct zip *)(a->format->data);
 
@@ -659,19 +659,10 @@
 	 * If the length is at the beginning, we can skip the
 	 * compressed data much more quickly.
 	 */
-	while (zip->entry_bytes_remaining > 0) {
-		bytes_avail = (a->decompressor->read_ahead)(a, &buff, 1);
-		if (bytes_avail <= 0) {
-			archive_set_error(&a->archive,
-			    ARCHIVE_ERRNO_FILE_FORMAT,
-			    "Truncated ZIP file body");
-			return (ARCHIVE_FATAL);
-		}
-		if (bytes_avail > zip->entry_bytes_remaining)
-			bytes_avail = zip->entry_bytes_remaining;
-		(a->decompressor->consume)(a, bytes_avail);
-		zip->entry_bytes_remaining -= bytes_avail;
-	}
+	bytes_skipped = (a->decompressor->skip)(a, zip->entry_bytes_remaining);
+	if (bytes_skipped < 0)
+		return (ARCHIVE_FATAL);
+
 	/* This entry is finished and done. */
 	zip->end_of_entry_cleanup = zip->end_of_entry = 1;
 	return (ARCHIVE_OK);
@@ -707,8 +698,8 @@
 	const char *p = (const char *)extra;
 	while (offset < zip->extra_length - 4)
 	{
-		unsigned short headerid = le16dec(p + offset);
-		unsigned short datasize = le16dec(p + offset + 2);
+		unsigned short headerid = archive_le16dec(p + offset);
+		unsigned short datasize = archive_le16dec(p + offset + 2);
 		offset += 4;
 		if (offset + datasize > zip->extra_length)
 			break;
@@ -720,9 +711,9 @@
 		case 0x0001:
 			/* Zip64 extended information extra field. */
 			if (datasize >= 8)
-				zip->uncompressed_size = le64dec(p + offset);
+				zip->uncompressed_size = archive_le64dec(p + offset);
 			if (datasize >= 16)
-				zip->compressed_size = le64dec(p + offset + 8);
+				zip->compressed_size = archive_le64dec(p + offset + 8);
 			break;
 		case 0x5455:
 		{
@@ -735,11 +726,12 @@
 			{
 #ifdef DEBUG
 				fprintf(stderr, "mtime: %lld -> %d\n",
-				    (long long)zip->mtime, le32dec(p + offset));
+				    (long long)zip->mtime,
+				    archive_le32dec(p + offset));
 #endif
 				if (datasize < 4)
 					break;
-				zip->mtime = le32dec(p + offset);
+				zip->mtime = archive_le32dec(p + offset);
 				offset += 4;
 				datasize -= 4;
 			}
@@ -747,7 +739,7 @@
 			{
 				if (datasize < 4)
 					break;
-				zip->atime = le32dec(p + offset);
+				zip->atime = archive_le32dec(p + offset);
 				offset += 4;
 				datasize -= 4;
 			}
@@ -755,7 +747,7 @@
 			{
 				if (datasize < 4)
 					break;
-				zip->ctime = le32dec(p + offset);
+				zip->ctime = archive_le32dec(p + offset);
 				offset += 4;
 				datasize -= 4;
 			}
@@ -765,12 +757,13 @@
 			/* Info-ZIP Unix Extra Field (type 2) "Ux". */
 #ifdef DEBUG
 			fprintf(stderr, "uid %d gid %d\n",
-			    le16dec(p + offset), le16dec(p + offset + 2));
+			    archive_le16dec(p + offset),
+			    archive_le16dec(p + offset + 2));
 #endif
 			if (datasize >= 2)
-				zip->uid = le16dec(p + offset);
+				zip->uid = archive_le16dec(p + offset);
 			if (datasize >= 4)
-				zip->gid = le16dec(p + offset + 2);
+				zip->gid = archive_le16dec(p + offset + 2);
 			break;
 		default:
 			break;

==== //depot/projects/iwarp/lib/libarchive/archive_write_disk.c#4 (text+ko) ====

@@ -25,7 +25,7 @@
  */
 
 #include "archive_platform.h"
-__FBSDID("$FreeBSD: src/lib/libarchive/archive_write_disk.c,v 1.22 2008/02/19 05:39:35 kientzle Exp $");
+__FBSDID("$FreeBSD: src/lib/libarchive/archive_write_disk.c,v 1.23 2008/02/27 06:16:41 kientzle Exp $");
 
 #ifdef HAVE_SYS_TYPES_H
 #include <sys/types.h>
@@ -1167,7 +1167,7 @@
 	struct stat st;
 
 	/*
-	 * Gaurd against symlink tricks.  Reject any archive entry whose
+	 * Guard against symlink tricks.  Reject any archive entry whose
 	 * destination would be altered by a symlink.
 	 */
 	/* Whatever we checked last time doesn't need to be re-checked. */

==== //depot/projects/iwarp/lib/libc/gen/sysconf.c#2 (text+ko) ====

@@ -34,7 +34,7 @@
 static char sccsid[] = "@(#)sysconf.c	8.2 (Berkeley) 3/20/94";
 #endif /* LIBC_SCCS and not lint */
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/gen/sysconf.c,v 1.25 2007/04/14 13:06:57 pjd Exp $");
+__FBSDID("$FreeBSD: src/lib/libc/gen/sysconf.c,v 1.26 2008/02/27 05:56:57 wollman Exp $");
 
 #include <sys/param.h>
 #include <sys/time.h>
@@ -100,7 +100,16 @@
 		mib[1] = KERN_NGROUPS;
 		break;
 	case _SC_OPEN_MAX:
-	case _SC_STREAM_MAX:	/* assume fds run out before memory does */
+		if (getrlimit(RLIMIT_NOFILE, &rl) != 0)
+			return (-1);
+		if (rl.rlim_cur == RLIM_INFINITY)
+			return (-1);
+		if (rl.rlim_cur > LONG_MAX) {
+			errno = EOVERFLOW;
+			return (-1);
+		}
+		return ((long)rl.rlim_cur);
+	case _SC_STREAM_MAX:
 		if (getrlimit(RLIMIT_NOFILE, &rl) != 0)
 			return (-1);
 		if (rl.rlim_cur == RLIM_INFINITY)
@@ -109,6 +118,15 @@
 			errno = EOVERFLOW;
 			return (-1);
 		}
+		/*
+		 * struct __sFILE currently has a limitation that
+		 * file descriptors must fit in a signed short.
+		 * This doesn't precisely capture the letter of POSIX
+		 * but approximates the spirit.
+		 */
+		if (rl.rlim_cur > SHRT_MAX)
+			return (SHRT_MAX);
+
 		return ((long)rl.rlim_cur);
 	case _SC_JOB_CONTROL:
 		return (_POSIX_JOB_CONTROL);

==== //depot/projects/iwarp/lib/libc/stdio/fdopen.c#2 (text+ko) ====

@@ -34,7 +34,7 @@
 static char sccsid[] = "@(#)fdopen.c	8.1 (Berkeley) 6/4/93";
 #endif /* LIBC_SCCS and not lint */
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/stdio/fdopen.c,v 1.8 2007/01/09 00:28:06 imp Exp $");
+__FBSDID("$FreeBSD: src/lib/libc/stdio/fdopen.c,v 1.10 2008/02/27 21:25:19 jhb Exp $");
 
 #include "namespace.h"
 #include <sys/types.h>
@@ -42,6 +42,7 @@
 #include <unistd.h>
 #include <stdio.h>
 #include <errno.h>
+#include <limits.h>
 #include "un-namespace.h"
 #include "local.h"
 
@@ -57,6 +58,18 @@
 	if (nofile == 0)
 		nofile = getdtablesize();
 
+	/*
+	 * File descriptors are a full int, but _file is only a short.
+	 * If we get a valid file descriptor that is greater than
+	 * SHRT_MAX, then the fd will get sign-extended into an
+	 * invalid file descriptor.  Handle this case by failing the
+	 * open.
+	 */
+	if (fd > SHRT_MAX) {
+		errno = EMFILE;
+		return (NULL);
+	}
+
 	if ((flags = __sflags(mode, &oflags)) == 0)
 		return (NULL);
 

==== //depot/projects/iwarp/lib/libc/stdio/fopen.c#2 (text+ko) ====

@@ -34,14 +34,16 @@
 static char sccsid[] = "@(#)fopen.c	8.1 (Berkeley) 6/4/93";
 #endif /* LIBC_SCCS and not lint */
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/stdio/fopen.c,v 1.11 2007/01/09 00:28:06 imp Exp $");
+__FBSDID("$FreeBSD: src/lib/libc/stdio/fopen.c,v 1.13 2008/02/27 21:25:19 jhb Exp $");
 
 #include "namespace.h"
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <fcntl.h>
+#include <unistd.h>
 #include <stdio.h>
 #include <errno.h>
+#include <limits.h>
 #include "un-namespace.h"
 
 #include "local.h"
@@ -63,6 +65,18 @@
 		fp->_flags = 0;			/* release */
 		return (NULL);
 	}
+	/*
+	 * File descriptors are a full int, but _file is only a short.
+	 * If we get a valid file descriptor that is greater than
+	 * SHRT_MAX, then the fd will get sign-extended into an
+	 * invalid file descriptor.  Handle this case by failing the
+	 * open.
+	 */
+	if (f > SHRT_MAX) {
+		_close(f);
+		errno = EMFILE;
+		return (NULL);
+	}
 	fp->_file = f;
 	fp->_flags = flags;
 	fp->_cookie = fp;

==== //depot/projects/iwarp/lib/libc/stdio/freopen.c#2 (text+ko) ====

@@ -34,13 +34,14 @@
 static char sccsid[] = "@(#)freopen.c	8.1 (Berkeley) 6/4/93";
 #endif /* LIBC_SCCS and not lint */
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/stdio/freopen.c,v 1.18 2007/01/09 00:28:06 imp Exp $");
+__FBSDID("$FreeBSD: src/lib/libc/stdio/freopen.c,v 1.20 2008/02/27 21:25:19 jhb Exp $");
 
 #include "namespace.h"
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <fcntl.h>
 #include <errno.h>
+#include <limits.h>
 #include <unistd.h>
 #include <stdio.h>
 #include <stdlib.h>
@@ -203,6 +204,20 @@
 		}
 	}
 
+	/*
+	 * File descriptors are a full int, but _file is only a short.
+	 * If we get a valid file descriptor that is greater than
+	 * SHRT_MAX, then the fd will get sign-extended into an
+	 * invalid file descriptor.  Handle this case by failing the
+	 * open.
+	 */
+	if (f > SHRT_MAX) {
+		fp->_flags = 0;		/* set it free */
+		FUNLOCKFILE(fp);
+		errno = EMFILE;
+		return (NULL);
+	}
+
 	fp->_flags = flags;
 	fp->_file = f;
 	fp->_cookie = fp;

==== //depot/projects/iwarp/lib/libc/stdlib/getenv.c#2 (text+ko) ====

@@ -23,23 +23,25 @@
  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD: src/lib/libc/stdlib/getenv.c,v 1.13 2008/02/28 04:09:08 scf Exp $");
+
+
+#include "namespace.h"
 #include <sys/types.h>
-#include <err.h>
 #include <errno.h>
 #include <stdbool.h>
 #include <stddef.h>
 #include <stdlib.h>
 #include <string.h>
+#include <unistd.h>
+#include "un-namespace.h"
 
 
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/stdlib/getenv.c,v 1.12 2007/09/22 02:30:44 scf Exp $");
-
-
-static const char CorruptEnvFindMsg[] =
-    "environment corrupt; unable to find %.*s";
+static const char CorruptEnvFindMsg[] = "environment corrupt; unable to find ";
 static const char CorruptEnvValueMsg[] =
-    "environment corrupt; missing value for %s";
+    "environment corrupt; missing value for ";
 
 
 /*
@@ -97,6 +99,26 @@
 
 
 /*
+ * A simple version of warnx() to avoid the bloat of including stdio in static
+ * binaries.
+ */
+static void
+__env_warnx(const char *msg, const char *name, size_t nameLen)
+{
+	static const char nl[] = "\n";
+	static const char progSep[] = ": ";
+
+	_write(STDERR_FILENO, _getprogname(), strlen(_getprogname()));
+	_write(STDERR_FILENO, progSep, sizeof(progSep) - 1);
+	_write(STDERR_FILENO, msg, strlen(msg));
+	_write(STDERR_FILENO, name, nameLen);
+	_write(STDERR_FILENO, nl, sizeof(nl) - 1);
+
+	return;
+}
+
+
+/*
  * Inline strlen() for performance.  Also, perform check for an equals sign.
  * Cheaper here than peforming a strchr() later.
  */
@@ -341,7 +363,8 @@
 			envVars[envNdx].valueSize =
 			    strlen(envVars[envNdx].value);
 		} else {
-			warnx(CorruptEnvValueMsg, envVars[envNdx].name);
+			__env_warnx(CorruptEnvValueMsg, envVars[envNdx].name,
+			    strlen(envVars[envNdx].name));
 			errno = EFAULT;
 			goto Failure;
 		}
@@ -356,8 +379,8 @@
 		activeNdx = envVarsTotal - 1;
 		if (__findenv(envVars[envNdx].name, nameLen, &activeNdx,
 		    false) == NULL) {
-			warnx(CorruptEnvFindMsg, (int)nameLen,
-			    envVars[envNdx].name);
+			__env_warnx(CorruptEnvFindMsg, envVars[envNdx].name,
+			    nameLen);
 			errno = EFAULT;
 			goto Failure;
 		}
@@ -527,7 +550,8 @@
 		if (origEnviron != NULL)
 			for (env = origEnviron; *env != NULL; env++) {
 				if ((equals = strchr(*env, '=')) == NULL) {
-					warnx(CorruptEnvValueMsg, *env);
+					__env_warnx(CorruptEnvValueMsg, *env,
+					    strlen(*env));
 					errno = EFAULT;
 					return (-1);
 				}

==== //depot/projects/iwarp/lib/libc/sys/readlink.2#3 (text+ko) ====

@@ -26,9 +26,9 @@
 .\" SUCH DAMAGE.
 .\"
 .\"     @(#)readlink.2	8.1 (Berkeley) 6/4/93
-.\" $FreeBSD: src/lib/libc/sys/readlink.2,v 1.15 2008/02/12 20:09:03 ru Exp $
+.\" $FreeBSD: src/lib/libc/sys/readlink.2,v 1.16 2008/02/26 20:33:52 ru Exp $
 .\"
-.Dd February 12, 2008
+.Dd February 26, 2008
 .Dt READLINK 2
 .Os
 .Sh NAME
@@ -39,7 +39,7 @@
 .Sh SYNOPSIS
 .In unistd.h
 .Ft ssize_t
-.Fn readlink "const char *path" "char *buf" "size_t bufsiz"
+.Fn readlink "const char *restrict path" "char *restrict buf" "size_t bufsiz"
 .Sh DESCRIPTION
 The
 .Fn readlink

==== //depot/projects/iwarp/lib/msun/src/e_rem_pio2.c#3 (text+ko) ====

@@ -14,7 +14,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/msun/src/e_rem_pio2.c,v 1.17 2008/02/25 18:28:58 bde Exp $");
+__FBSDID("$FreeBSD: src/lib/msun/src/e_rem_pio2.c,v 1.18 2008/02/28 16:22:36 bde Exp $");
 
 /* __ieee754_rem_pio2(x,y)
  * 
@@ -126,7 +126,7 @@
 		}
 	    }
 	}
-	if(ix<=0x413921fb) { /* |x| ~<= 2^19*(pi/2), medium size */
+	if(ix<0x413921fb) {	/* |x| ~< 2^20*(pi/2), medium size */
 medium:
 	    /* Use a specialized rint() to get fn.  Assume round-to-nearest. */
 	    STRICT_ASSIGN(double,fn,x*invpio2+0x1.8p52);

==== //depot/projects/iwarp/lib/msun/src/e_rem_pio2f.c#3 (text+ko) ====

@@ -15,7 +15,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/msun/src/e_rem_pio2f.c,v 1.28 2008/02/25 22:19:17 bde Exp $");
+__FBSDID("$FreeBSD: src/lib/msun/src/e_rem_pio2f.c,v 1.29 2008/02/28 16:22:36 bde Exp $");
 
 /* __ieee754_rem_pio2f(x,y)
  *
@@ -38,8 +38,8 @@
 static const double
 half =  5.00000000000000000000e-01, /* 0x3FE00000, 0x00000000 */
 invpio2 =  6.36619772367581382433e-01, /* 0x3FE45F30, 0x6DC9C883 */
-pio2_1  =  1.57079632673412561417e+00, /* 0x3FF921FB, 0x54400000 */
-pio2_1t =  6.07710050650619224932e-11; /* 0x3DD0B461, 0x1A626331 */
+pio2_1  =  1.57079631090164184570e+00, /* 0x3FF921FB, 0x50000000 */
+pio2_1t =  1.58932547735281966916e-08; /* 0x3E5110b4, 0x611A6263 */
 
 #ifdef INLINE_REM_PIO2F
 extern inline
@@ -55,7 +55,7 @@
 	GET_FLOAT_WORD(hx,x);
 	ix = hx&0x7fffffff;
     /* 33+53 bit pi is good enough for medium size */
-	if(ix<=0x49490f80) {		/* |x| ~<= 2^19*(pi/2), medium size */
+	if(ix<0x4dc90fdb) {		/* |x| ~< 2^28*(pi/2), medium size */
 	    /* Use a specialized rint() to get fn.  Assume round-to-nearest. */
 	    STRICT_ASSIGN(double,fn,x*invpio2+0x1.8p52);
 	    fn = fn-0x1.8p52;

==== //depot/projects/iwarp/sbin/fsck_ffs/pass1.c#2 (text+ko) ====

@@ -33,7 +33,7 @@
 #endif /* not lint */
 #endif
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sbin/fsck_ffs/pass1.c,v 1.43 2004/10/08 20:44:47 truckman Exp $");
+__FBSDID("$FreeBSD: src/sbin/fsck_ffs/pass1.c,v 1.44 2008/02/26 03:08:22 delphij Exp $");
 
 #include <sys/param.h>
 #include <sys/stat.h>
@@ -93,9 +93,11 @@
 		inumber = c * sblock.fs_ipg;
 		setinodebuf(inumber);
 		getblk(&cgblk, cgtod(&sblock, c), sblock.fs_cgsize);
-		if (sblock.fs_magic == FS_UFS2_MAGIC)
+		if (sblock.fs_magic == FS_UFS2_MAGIC) {
 			inosused = cgrp.cg_initediblk;
-		else
+			if (inosused > sblock.fs_ipg)
+				inosused = sblock.fs_ipg;
+		} else
 			inosused = sblock.fs_ipg;
 		if (got_siginfo) {
 			printf("%s: phase 1: cyl group %d of %d (%d%%)\n",

==== //depot/projects/iwarp/sbin/fsck_ffs/pass2.c#2 (text+ko) ====

@@ -33,7 +33,7 @@
 #endif /* not lint */
 #endif
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sbin/fsck_ffs/pass2.c,v 1.26 2004/10/08 20:44:47 truckman Exp $");
+__FBSDID("$FreeBSD: src/sbin/fsck_ffs/pass2.c,v 1.27 2008/02/26 03:05:48 delphij Exp $");
 
 #include <sys/param.h>
 
@@ -242,6 +242,8 @@
 	/*
 	 * check for "."
 	 */
+	if (dirp->d_ino > maxino)
+		goto chk2;
 	if (idesc->id_entryno != 0)
 		goto chk1;
 	if (dirp->d_ino != 0 && strcmp(dirp->d_name, ".") == 0) {

==== //depot/projects/iwarp/sbin/fsck_ffs/setup.c#2 (text+ko) ====

@@ -33,7 +33,7 @@
 #endif /* not lint */
 #endif
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sbin/fsck_ffs/setup.c,v 1.50 2006/10/31 22:06:56 pjd Exp $");
+__FBSDID("$FreeBSD: src/sbin/fsck_ffs/setup.c,v 1.51 2008/02/26 03:03:17 delphij Exp $");
 
 #include <sys/param.h>
 #include <sys/stat.h>
@@ -349,7 +349,7 @@
 			      sblock.fs_sblockloc == sblock_try[i])) &&
 			    sblock.fs_ncg >= 1 &&
 			    sblock.fs_bsize >= MINBSIZE &&
-			    sblock.fs_bsize >= sizeof(struct fs))
+			    sblock.fs_sbsize >= roundup(sizeof(struct fs), dev_bsize))
 				break;
 		}
 		if (sblock_try[i] == -1) {

==== //depot/projects/iwarp/sbin/ipfw/ipfw.8#6 (text+ko) ====

@@ -1,5 +1,5 @@
 .\"
-.\" $FreeBSD: src/sbin/ipfw/ipfw.8,v 1.210 2008/02/24 15:37:45 piso Exp $
+.\" $FreeBSD: src/sbin/ipfw/ipfw.8,v 1.211 2008/02/27 13:52:33 dwmalone Exp $
 .\"
 .Dd November 26, 2007
 .Dt IPFW 8
@@ -1971,6 +1971,13 @@
 Even worse effects can result if you get packets from an
 interface with a much larger MTU, e.g.\& the loopback interface
 with its 16KB packets.
+The
+.Xr sysctl 8
+variables
+.Em net.inet.ip.dummynet.pipe_byte_limit
+and
+.Em net.inet.ip.dummynet.pipe_slot_limit
+control the maximum lengths that can be specified.
 .Pp
 .It Cm red | gred Ar w_q Ns / Ns Ar min_th Ns / Ns Ar max_th Ns / Ns Ar max_p
 Make use of the RED (Random Early Detection) queue management algorithm.
@@ -2190,6 +2197,13 @@
 .It Va net.inet.ip.dummynet.red_max_pkt_size : No 1500
 Parameters used in the computations of the drop probability
 for the RED algorithm.
+.It Va net.inet.ip.dummynet.pipe_byte_limit : No 1048576
+.It Va net.inet.ip.dummynet.pipe_slot_limit : No 100
+The maximum queue size that can be specified in bytes or packets.
+These limits prevent accidental exhaustion of resources such as mbufs.
+If you raise these limits,
+you should make sure the system is configured so that sufficient resources
+are available.
 .It Va net.inet.ip.fw.autoinc_step : No 100
 Delta between rule numbers when auto-generating them.
 The value must be in the range 1..1000.

==== //depot/projects/iwarp/sbin/ipfw/ipfw2.c#6 (text+ko) ====

@@ -17,7 +17,7 @@
  *
  * NEW command line interface for IP firewall facility
  *
- * $FreeBSD: src/sbin/ipfw/ipfw2.c,v 1.117 2008/02/24 15:37:45 piso Exp $
+ * $FreeBSD: src/sbin/ipfw/ipfw2.c,v 1.118 2008/02/27 13:52:33 dwmalone Exp $
  */
 
 #include <sys/param.h>
@@ -4341,11 +4341,25 @@
 			errx(EX_DATAERR, "weight must be <= 100");
 	}
 	if (p.fs.flags_fs & DN_QSIZE_IS_BYTES) {
-		if (p.fs.qsize > 1024*1024)
-			errx(EX_DATAERR, "queue size must be < 1MB");
+		size_t len;
+		long limit;
+
+		len = sizeof(limit);
+		if (sysctlbyname("net.inet.ip.dummynet.pipe_byte_limit",
+			&limit, &len, NULL, 0) == -1)
+			limit = 1024*1024;
+		if (p.fs.qsize > limit)
+			errx(EX_DATAERR, "queue size must be < %ldB", limit);
 	} else {
-		if (p.fs.qsize > 100)
-			errx(EX_DATAERR, "2 <= queue size <= 100");
+		size_t len;
+		long limit;
+
+		len = sizeof(limit);
+		if (sysctlbyname("net.inet.ip.dummynet.pipe_slot_limit",
+			&limit, &len, NULL, 0) == -1)
+			limit = 100;
+		if (p.fs.qsize > limit)
+			errx(EX_DATAERR, "2 <= queue size <= %ld", limit);
 	}
 	if (p.fs.flags_fs & DN_IS_RED) {
 		size_t len;
@@ -4363,7 +4377,6 @@
 		len = sizeof(int);
 		if (sysctlbyname("net.inet.ip.dummynet.red_lookup_depth",
 			&lookup_depth, &len, NULL, 0) == -1)
-
 		    errx(1, "sysctlbyname(\"%s\")",
 			"net.inet.ip.dummynet.red_lookup_depth");
 		if (lookup_depth == 0)

==== //depot/projects/iwarp/share/man/man4/uscanner.4#2 (text+ko) ====

@@ -28,9 +28,9 @@
 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
 .\" THE POSSIBILITY OF SUCH DAMAGE.
 .\"
-.\" $FreeBSD: src/share/man/man4/uscanner.4,v 1.31 2007/10/05 15:17:14 luigi Exp $
+.\" $FreeBSD: src/share/man/man4/uscanner.4,v 1.32 2008/02/27 10:57:51 remko Exp $
 .\"
-.Dd October 5, 2007
+.Dd February 27, 2008
 .Dt USCANNER 4
 .Os
 .Sh NAME
@@ -103,8 +103,8 @@
 .It
 Epson: GT-8400UF, GT-9300UF, GT-9700F;
 .It
-Epson Stylus: Photo RX425, CX3650, DX-5000, DX-5050, DX-6000, DX-6050
-(and possibly more in the CX-5000 and DX-3800..DX-7000 family);
+Epson Stylus: Photo RX425, CX3650, DX-5000, DX-5050, CX5400, DX-6000,
+DX-6050 (and possibly more in the CX-5000 and DX-3800..DX-7000 family);
 .It
 Hewlett Packard: Photosmart S20
 .It

==== //depot/projects/iwarp/share/man/man9/Makefile#8 (text+ko) ====

@@ -1,4 +1,4 @@
-# $FreeBSD: src/share/man/man9/Makefile,v 1.326 2008/02/13 21:54:16 attilio Exp $
+# $FreeBSD: src/share/man/man9/Makefile,v 1.330 2008/02/26 21:40:30 davidc Exp $
 
 MAN=	accept_filter.9 \
 	accf_data.9 \
@@ -124,6 +124,7 @@
 	ieee80211_radiotap.9 \
 	ifnet.9 \
 	inittodr.9 \
+	insmntque.9 \
 	intro.9 \
 	ithread.9 \
 	KASSERT.9 \
@@ -253,6 +254,7 @@
 	VFS_LOCK_GIANT.9 \
 	VFS_MOUNT.9 \
 	vfs_mount.9 \
+	vfs_mountedfrom.9 \
 	vfs_mountedon.9 \
 	VFS_QUOTACTL.9 \
 	VFS_ROOT.9 \
@@ -349,6 +351,7 @@
 	VOP_VPTOFH.9 \
 	vput.9 \
 	vref.9 \
+	vrefcnt.9 \
 	vrele.9 \
 	vslock.9 \
 	watchdog.9 \
@@ -1228,6 +1231,7 @@
 MLINKS+=VFS_LOCK_GIANT.9 VFS_UNLOCK_GIANT.9
 MLINKS+=vgone.9 vgonel.9
 MLINKS+=vhold.9 vdrop.9 \
+	vhold.9	vholdl.9 \
 	vhold.9 vdropl.9
 MLINKS+=vm_map_lock.9 vm_map_lock_downgrade.9 \
 	vm_map_lock.9 vm_map_lock_read.9 \

==== //depot/projects/iwarp/share/man/man9/vgone.9#2 (text+ko) ====


>>> TRUNCATED FOR MAIL (1000 lines) <<<


More information about the p4-projects mailing list