PERFORCE change 76903 for review

Marcel Moolenaar marcel at FreeBSD.org
Thu May 12 18:32:27 PDT 2005


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

Change 76903 by marcel at marcel_nfs on 2005/05/13 01:32:20

	IFC @76902

Affected files ...

.. //depot/projects/tty/etc/devd.conf#11 integrate
.. //depot/projects/tty/include/unistd.h#6 integrate
.. //depot/projects/tty/lib/libc/gen/Makefile.inc#11 integrate
.. //depot/projects/tty/lib/libc/uuid/uuid_is_nil.c#4 integrate
.. //depot/projects/tty/lib/libz/FREEBSD-upgrade#1 branch
.. //depot/projects/tty/lib/libz/adler32.c#3 integrate
.. //depot/projects/tty/lib/libz/compress.c#3 integrate
.. //depot/projects/tty/lib/libz/crc32.c#3 integrate
.. //depot/projects/tty/lib/libz/deflate.c#3 integrate
.. //depot/projects/tty/lib/libz/deflate.h#3 integrate
.. //depot/projects/tty/lib/libz/example.c#3 integrate
.. //depot/projects/tty/lib/libz/infback.c#2 integrate
.. //depot/projects/tty/lib/libz/inffast.c#3 integrate
.. //depot/projects/tty/lib/libz/inflate.c#3 integrate
.. //depot/projects/tty/lib/libz/inftrees.c#3 integrate
.. //depot/projects/tty/lib/libz/trees.c#3 integrate
.. //depot/projects/tty/lib/libz/uncompr.c#3 integrate
.. //depot/projects/tty/lib/libz/zlib.3#4 integrate
.. //depot/projects/tty/lib/libz/zutil.c#3 integrate
.. //depot/projects/tty/lib/libz/zutil.h#3 integrate
.. //depot/projects/tty/libexec/rlogind/rlogind.c#4 integrate
.. //depot/projects/tty/libexec/rshd/rshd.c#4 integrate
.. //depot/projects/tty/sbin/ipfw/ipfw.8#14 integrate
.. //depot/projects/tty/sbin/route/route.c#6 integrate
.. //depot/projects/tty/share/man/man4/ng_netflow.4#4 integrate
.. //depot/projects/tty/share/man/man4/twe.4#6 integrate
.. //depot/projects/tty/share/misc/bsd-family-tree#11 integrate
.. //depot/projects/tty/sys/amd64/amd64/mp_machdep.c#7 integrate
.. //depot/projects/tty/sys/amd64/include/cpufunc.h#7 integrate
.. //depot/projects/tty/sys/amd64/isa/isa.h#4 integrate
.. //depot/projects/tty/sys/arm/arm/vm_machdep.c#5 integrate
.. //depot/projects/tty/sys/cam/cam_xpt.c#11 integrate
.. //depot/projects/tty/sys/conf/options#20 integrate
.. //depot/projects/tty/sys/conf/options.i386#14 integrate
.. //depot/projects/tty/sys/conf/options.pc98#13 integrate
.. //depot/projects/tty/sys/dev/acpica/acpi_ec.c#8 integrate
.. //depot/projects/tty/sys/dev/ata/ata-all.h#16 integrate
.. //depot/projects/tty/sys/dev/ata/ata-chipset.c#17 integrate
.. //depot/projects/tty/sys/dev/ata/ata-lowlevel.c#11 integrate
.. //depot/projects/tty/sys/dev/ata/ata-pci.h#14 integrate
.. //depot/projects/tty/sys/dev/ata/ata-queue.c#9 integrate
.. //depot/projects/tty/sys/dev/isp/isp_freebsd.h#6 integrate
.. //depot/projects/tty/sys/dev/isp/isp_inline.h#5 integrate
.. //depot/projects/tty/sys/dev/isp/isp_pci.c#8 integrate
.. //depot/projects/tty/sys/dev/isp/ispvar.h#6 integrate
.. //depot/projects/tty/sys/dev/kbd/kbdtables.h#2 integrate
.. //depot/projects/tty/sys/dev/usb/uhub.c#6 integrate
.. //depot/projects/tty/sys/dev/usb/umass.c#13 integrate
.. //depot/projects/tty/sys/fs/nwfs/nwfs_subr.c#4 integrate
.. //depot/projects/tty/sys/fs/udf/udf_vnops.c#13 integrate
.. //depot/projects/tty/sys/geom/mirror/g_mirror.c#5 integrate
.. //depot/projects/tty/sys/geom/raid3/g_raid3_ctl.c#4 integrate
.. //depot/projects/tty/sys/geom/stripe/g_stripe.c#6 integrate
.. //depot/projects/tty/sys/i386/i386/mp_machdep.c#16 integrate
.. //depot/projects/tty/sys/i386/include/cpufunc.h#6 integrate
.. //depot/projects/tty/sys/i386/include/npx.h#4 integrate
.. //depot/projects/tty/sys/i386/isa/isa.h#6 integrate
.. //depot/projects/tty/sys/i386/isa/npx.c#11 integrate
.. //depot/projects/tty/sys/isa/isareg.h#5 integrate
.. //depot/projects/tty/sys/kern/sysv_shm.c#12 integrate
.. //depot/projects/tty/sys/kern/vfs_export.c#8 integrate
.. //depot/projects/tty/sys/kern/vfs_mount.c#14 integrate
.. //depot/projects/tty/sys/netgraph/netflow/netflow.c#4 integrate
.. //depot/projects/tty/sys/netgraph/netflow/netflow.h#2 integrate
.. //depot/projects/tty/sys/netgraph/netflow/ng_netflow.c#4 integrate
.. //depot/projects/tty/sys/netgraph/netflow/ng_netflow.h#4 integrate
.. //depot/projects/tty/sys/netgraph/ng_nat.c#3 integrate
.. //depot/projects/tty/sys/netinet/tcp_input.c#17 integrate
.. //depot/projects/tty/sys/netinet/tcp_output.c#10 integrate
.. //depot/projects/tty/sys/netinet/tcp_sack.c#4 integrate
.. //depot/projects/tty/sys/netinet/tcp_var.h#13 integrate
.. //depot/projects/tty/sys/pc98/cbus/cbus.h#2 integrate
.. //depot/projects/tty/sys/pc98/cbus/pckbd.c#2 integrate
.. //depot/projects/tty/sys/pc98/cbus/pckbdtables.h#1 branch
.. //depot/projects/tty/sys/pc98/include/npx.h#2 integrate
.. //depot/projects/tty/sys/sys/acl.h#4 integrate
.. //depot/projects/tty/sys/vm/vm_fault.c#11 integrate
.. //depot/projects/tty/usr.bin/Makefile#15 integrate
.. //depot/projects/tty/usr.bin/make/Makefile#7 integrate
.. //depot/projects/tty/usr.bin/make/cond.c#7 integrate
.. //depot/projects/tty/usr.bin/make/globals.h#4 integrate
.. //depot/projects/tty/usr.bin/make/job.c#7 integrate
.. //depot/projects/tty/usr.bin/make/job.h#6 integrate
.. //depot/projects/tty/usr.bin/make/main.c#12 integrate
.. //depot/projects/tty/usr.bin/make/parse.c#9 integrate
.. //depot/projects/tty/usr.bin/make/str.c#5 integrate
.. //depot/projects/tty/usr.bin/make/suff.c#6 integrate
.. //depot/projects/tty/usr.bin/make/var.c#9 integrate
.. //depot/projects/tty/usr.bin/make/var.h#6 integrate
.. //depot/projects/tty/usr.bin/mkuzip/mkuzip.c#3 integrate
.. //depot/projects/tty/usr.bin/rsh/rsh.c#4 integrate
.. //depot/projects/tty/usr.bin/what/what.1#4 integrate
.. //depot/projects/tty/usr.bin/what/what.c#2 integrate
.. //depot/projects/tty/usr.sbin/IPXrouted/main.c#3 integrate
.. //depot/projects/tty/usr.sbin/mount_portalfs/activate.c#4 integrate

Differences ...

==== //depot/projects/tty/etc/devd.conf#11 (text+ko) ====

@@ -1,4 +1,4 @@
-# $FreeBSD: src/etc/devd.conf,v 1.22 2005/01/08 06:00:24 brooks Exp $
+# $FreeBSD: src/etc/devd.conf,v 1.23 2005/05/11 10:24:20 brian Exp $
 #
 # Refer to devd.conf(5) and devd(8) man pages for the details on how to
 # run and configure devd.
@@ -60,7 +60,7 @@
 # When a USB keyboard arrives, attach it as the console keyboard.
 attach 100 {
 	device-name "ukbd0";
-	action "kbdcontrol -k /dev/ukbd0 < /dev/console";
+	action "kbdcontrol -k /dev/ukbd0 < /dev/console && /etc/rc.d/syscons restart";
 };
 detach 100 {
 	device-name "ukbd0";

==== //depot/projects/tty/include/unistd.h#6 (text+ko) ====

@@ -31,7 +31,7 @@
  * SUCH DAMAGE.
  *
  *	@(#)unistd.h	8.12 (Berkeley) 4/27/95
- * $FreeBSD: src/include/unistd.h,v 1.76 2005/03/22 01:19:17 das Exp $
+ * $FreeBSD: src/include/unistd.h,v 1.77 2005/05/11 14:07:25 delphij Exp $
  */
 
 #ifndef _UNISTD_H_
@@ -365,6 +365,7 @@
 pid_t	 tcgetpgrp(int);
 int	 tcsetpgrp(int, pid_t);
 char	*ttyname(int);
+char	*ttyname_r(int, char *, size_t);
 int	 unlink(const char *);
 ssize_t	 write(int, const void *, size_t);
 

==== //depot/projects/tty/lib/libc/gen/Makefile.inc#11 (text+ko) ====

@@ -1,5 +1,5 @@
 #	@(#)Makefile.inc	8.6 (Berkeley) 5/4/95
-# $FreeBSD: src/lib/libc/gen/Makefile.inc,v 1.120 2005/03/07 05:01:04 das Exp $
+# $FreeBSD: src/lib/libc/gen/Makefile.inc,v 1.121 2005/05/11 14:07:25 delphij Exp $
 
 # machine-independent gen sources
 .PATH: ${.CURDIR}/${MACHINE_ARCH}/gen ${.CURDIR}/gen
@@ -143,7 +143,7 @@
 	tcsetattr.3 cfmakeraw.3 tcsetattr.3 cfsetispeed.3 \
 	tcsetattr.3 cfsetospeed.3 tcsetattr.3 cfsetspeed.3 \
 	tcsetattr.3 tcgetattr.3
-MLINKS+=ttyname.3 isatty.3 ttyname.3 ttyslot.3
+MLINKS+=ttyname.3 isatty.3 ttyname.3 ttyname_r.3 ttyname.3 ttyslot.3
 MLINKS+=tzset.3 tzsetwall.3
 MLINKS+=unvis.3 strunvis.3 unvis.3 strunvisx.3
 MLINKS+=vis.3 strvis.3 vis.3 strvisx.3

==== //depot/projects/tty/lib/libc/uuid/uuid_is_nil.c#4 (text+ko) ====

@@ -24,7 +24,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $FreeBSD: src/lib/libc/uuid/uuid_is_nil.c,v 1.3 2005/01/03 02:56:15 marcel Exp $
+ * $FreeBSD: src/lib/libc/uuid/uuid_is_nil.c,v 1.4 2005/05/11 13:18:10 delphij Exp $
  */
 
 #include <uuid.h>
@@ -37,7 +37,7 @@
 int32_t
 uuid_is_nil(const uuid_t *u, uint32_t *status)
 {
-	uint32_t *p;
+	const uint32_t *p;
 
 	if (status)
 		*status = uuid_s_ok;
@@ -49,6 +49,6 @@
 	 * Pick the largest type that has equivalent alignment constraints
 	 * as an UUID and use it to test if the UUID consists of all zeroes.
 	 */
-	p = (uint32_t*)u;
+	p = (const uint32_t*)u;
 	return ((p[0] == 0 && p[1] == 0 && p[2] == 0 && p[3] == 0) ? 1 : 0);
 }

==== //depot/projects/tty/lib/libz/adler32.c#3 (text+ko) ====

@@ -3,8 +3,7 @@
  * For conditions of distribution and use, see copyright notice in zlib.h
  */
 
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libz/adler32.c,v 1.8 2004/06/30 23:54:46 tjr Exp $");
+/* @(#) $Id$ */
 
 #define ZLIB_INTERNAL
 #include "zlib.h"

==== //depot/projects/tty/lib/libz/compress.c#3 (text+ko) ====

@@ -3,8 +3,7 @@
  * For conditions of distribution and use, see copyright notice in zlib.h
  */
 
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libz/compress.c,v 1.8 2004/06/30 23:54:46 tjr Exp $");
+/* @(#) $Id$ */
 
 #define ZLIB_INTERNAL
 #include "zlib.h"

==== //depot/projects/tty/lib/libz/crc32.c#3 (text+ko) ====

@@ -9,8 +9,15 @@
  * of two increase in speed on a Power PC G4 (PPC7455) using gcc -O3.
  */
 
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libz/crc32.c,v 1.8 2004/06/30 23:54:46 tjr Exp $");
+/* @(#) $Id$ */
+
+/*
+  Note on the use of DYNAMIC_CRC_TABLE: there is no mutex or semaphore
+  protection on the static variables used to control the first-use generation
+  of the crc tables.  Therefore, if you #define DYNAMIC_CRC_TABLE, you should
+  first call get_crc_table() to initialize the tables before allowing more than
+  one thread to use crc32().
+ */
 
 #ifdef MAKECRCH
 #  include <stdio.h>
@@ -59,7 +66,7 @@
 
 #ifdef DYNAMIC_CRC_TABLE
 
-local int crc_table_empty = 1;
+local volatile int crc_table_empty = 1;
 local unsigned long FAR crc_table[TBLS][256];
 local void make_crc_table OF((void));
 #ifdef MAKECRCH
@@ -96,38 +103,51 @@
 {
     unsigned long c;
     int n, k;
-    unsigned long poly;            /* polynomial exclusive-or pattern */
+    unsigned long poly;                 /* polynomial exclusive-or pattern */
     /* terms of polynomial defining this crc (except x^32): */
+    static volatile int first = 1;      /* flag to limit concurrent making */
     static const unsigned char p[] = {0,1,2,4,5,7,8,10,11,12,16,22,23,26};
 
-    /* make exclusive-or pattern from polynomial (0xedb88320UL) */
-    poly = 0UL;
-    for (n = 0; n < sizeof(p)/sizeof(unsigned char); n++)
-        poly |= 1UL << (31 - p[n]);
+    /* See if another task is already doing this (not thread-safe, but better
+       than nothing -- significantly reduces duration of vulnerability in
+       case the advice about DYNAMIC_CRC_TABLE is ignored) */
+    if (first) {
+        first = 0;
+
+        /* make exclusive-or pattern from polynomial (0xedb88320UL) */
+        poly = 0UL;
+        for (n = 0; n < sizeof(p)/sizeof(unsigned char); n++)
+            poly |= 1UL << (31 - p[n]);
 
-    /* generate a crc for every 8-bit value */
-    for (n = 0; n < 256; n++) {
-        c = (unsigned long)n;
-        for (k = 0; k < 8; k++)
-            c = c & 1 ? poly ^ (c >> 1) : c >> 1;
-        crc_table[0][n] = c;
-    }
+        /* generate a crc for every 8-bit value */
+        for (n = 0; n < 256; n++) {
+            c = (unsigned long)n;
+            for (k = 0; k < 8; k++)
+                c = c & 1 ? poly ^ (c >> 1) : c >> 1;
+            crc_table[0][n] = c;
+        }
 
 #ifdef BYFOUR
-    /* generate crc for each value followed by one, two, and three zeros, and
-       then the byte reversal of those as well as the first table */
-    for (n = 0; n < 256; n++) {
-        c = crc_table[0][n];
-        crc_table[4][n] = REV(c);
-        for (k = 1; k < 4; k++) {
-            c = crc_table[0][c & 0xff] ^ (c >> 8);
-            crc_table[k][n] = c;
-            crc_table[k + 4][n] = REV(c);
+        /* generate crc for each value followed by one, two, and three zeros,
+           and then the byte reversal of those as well as the first table */
+        for (n = 0; n < 256; n++) {
+            c = crc_table[0][n];
+            crc_table[4][n] = REV(c);
+            for (k = 1; k < 4; k++) {
+                c = crc_table[0][c & 0xff] ^ (c >> 8);
+                crc_table[k][n] = c;
+                crc_table[k + 4][n] = REV(c);
+            }
         }
-    }
 #endif /* BYFOUR */
 
-  crc_table_empty = 0;
+        crc_table_empty = 0;
+    }
+    else {      /* not first */
+        /* wait for the other guy to finish (not efficient, but rare) */
+        while (crc_table_empty)
+            ;
+    }
 
 #ifdef MAKECRCH
     /* write out CRC tables to crc32.h */
@@ -181,9 +201,10 @@
 const unsigned long FAR * ZEXPORT get_crc_table()
 {
 #ifdef DYNAMIC_CRC_TABLE
-  if (crc_table_empty) make_crc_table();
+    if (crc_table_empty)
+        make_crc_table();
 #endif /* DYNAMIC_CRC_TABLE */
-  return (const unsigned long FAR *)crc_table;
+    return (const unsigned long FAR *)crc_table;
 }
 
 /* ========================================================================= */

==== //depot/projects/tty/lib/libz/deflate.c#3 (text+ko) ====

@@ -1,11 +1,8 @@
 /* deflate.c -- compress data using the deflation algorithm
- * Copyright (C) 1995-2003 Jean-loup Gailly.
+ * Copyright (C) 1995-2004 Jean-loup Gailly.
  * For conditions of distribution and use, see copyright notice in zlib.h
  */
 
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libz/deflate.c,v 1.8 2004/06/30 23:54:46 tjr Exp $");
-
 /*
  *  ALGORITHM
  *
@@ -50,12 +47,12 @@
  *
  */
 
-/* @(#) $FreeBSD: src/lib/libz/deflate.c,v 1.8 2004/06/30 23:54:46 tjr Exp $ */
+/* @(#) $Id$ */
 
 #include "deflate.h"
 
 const char deflate_copyright[] =
-   " deflate 1.2.1 Copyright 1995-2003 Jean-loup Gailly ";
+   " deflate 1.2.2 Copyright 1995-2004 Jean-loup Gailly ";
 /*
   If you use the zlib library in a product, an acknowledgment is welcome
   in the documentation of your product. If for some reason you cannot

==== //depot/projects/tty/lib/libz/deflate.h#3 (text+ko) ====

@@ -8,7 +8,7 @@
    subject to change. Applications should only use zlib.h.
  */
 
-/* @(#) $FreeBSD: src/lib/libz/deflate.h,v 1.7 2004/06/30 23:54:46 tjr Exp $ */
+/* @(#) $Id$ */
 
 #ifndef DEFLATE_H
 #define DEFLATE_H
@@ -95,7 +95,6 @@
     Bytef *pending_out;  /* next pending byte to output to the stream */
     int   pending;       /* nb of bytes in the pending buffer */
     int   wrap;          /* bit 0 true for zlib, bit 1 true for gzip */
-    Byte  data_type;     /* UNKNOWN, BINARY or ASCII */
     Byte  method;        /* STORED (for zip only) or DEFLATED */
     int   last_flush;    /* value of flush param for previous deflate call */
 

==== //depot/projects/tty/lib/libz/example.c#3 (text+ko) ====

@@ -3,8 +3,7 @@
  * For conditions of distribution and use, see copyright notice in zlib.h
  */
 
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libz/example.c,v 1.8 2004/06/30 23:54:46 tjr Exp $");
+/* @(#) $Id$ */
 
 #include <stdio.h>
 #include "zlib.h"

==== //depot/projects/tty/lib/libz/infback.c#2 (text+ko) ====

@@ -434,8 +434,8 @@
                 }
             }
 
-            if (state->mode == BAD)
-                break;
+            /* handle error breaks in while */
+            if (state->mode == BAD) break;
 
             /* build code tables */
             state->next = state->codes;

==== //depot/projects/tty/lib/libz/inffast.c#3 (text+ko) ====

@@ -1,11 +1,8 @@
 /* inffast.c -- fast decoding
- * Copyright (C) 1995-2003 Mark Adler
+ * Copyright (C) 1995-2004 Mark Adler
  * For conditions of distribution and use, see copyright notice in zlib.h
  */
 
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libz/inffast.c,v 1.4 2004/06/30 23:54:46 tjr Exp $");
-
 #include "zutil.h"
 #include "inftrees.h"
 #include "inflate.h"
@@ -22,7 +19,7 @@
    - none
    No measurable difference:
    - Pentium III (Anderson)
-   - 68060 (Nikl)
+   - M68060 (Nikl)
  */
 #ifdef POSTINC
 #  define OFF 0

==== //depot/projects/tty/lib/libz/inflate.c#3 (text+ko) ====

@@ -80,9 +80,6 @@
  * The history for versions after 1.2.0 are in ChangeLog in zlib distribution.
  */
 
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libz/inflate.c,v 1.5 2004/08/26 19:37:06 nectar Exp $");
-
 #include "zutil.h"
 #include "inftrees.h"
 #include "inflate.h"
@@ -112,6 +109,7 @@
     state = (struct inflate_state FAR *)strm->state;
     strm->total_in = strm->total_out = state->total = 0;
     strm->msg = Z_NULL;
+    strm->adler = 1;        /* to support ill-conceived Java test suite */
     state->mode = HEAD;
     state->last = 0;
     state->havedict = 0;
@@ -864,8 +862,8 @@
                 }
             }
 
-            if (state->mode == BAD)
-                break;
+            /* handle error breaks in while */
+            if (state->mode == BAD) break;
 
             /* build code tables */
             state->next = state->codes;

==== //depot/projects/tty/lib/libz/inftrees.c#3 (text+ko) ====

@@ -1,18 +1,15 @@
 /* inftrees.c -- generate Huffman trees for efficient decoding
- * Copyright (C) 1995-2003 Mark Adler
+ * Copyright (C) 1995-2004 Mark Adler
  * For conditions of distribution and use, see copyright notice in zlib.h
  */
 
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libz/inftrees.c,v 1.4 2004/06/30 23:54:46 tjr Exp $");
-
 #include "zutil.h"
 #include "inftrees.h"
 
 #define MAXBITS 15
 
 const char inflate_copyright[] =
-   " inflate 1.2.1 Copyright 1995-2003 Mark Adler ";
+   " inflate 1.2.2 Copyright 1995-2004 Mark Adler ";
 /*
   If you use the zlib library in a product, an acknowledgment is welcome
   in the documentation of your product. If for some reason you cannot
@@ -65,7 +62,7 @@
         35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0};
     static const unsigned short lext[31] = { /* Length codes 257..285 extra */
         16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18,
-        19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 76, 66};
+        19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 199, 198};
     static const unsigned short dbase[32] = { /* Distance codes 0..29 base */
         1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193,
         257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145,
@@ -117,7 +114,15 @@
     for (max = MAXBITS; max >= 1; max--)
         if (count[max] != 0) break;
     if (root > max) root = max;
-    if (max == 0) return -1;            /* no codes! */
+    if (max == 0) {                     /* no symbols to code at all */
+        this.op = (unsigned char)64;    /* invalid code marker */
+        this.bits = (unsigned char)1;
+        this.val = (unsigned short)0;
+        *(*table)++ = this;             /* make a table to force an error */
+        *(*table)++ = this;
+        *bits = 1;
+        return 0;     /* no symbols, but wait for decoding to report error */
+    }
     for (min = 1; min <= MAXBITS; min++)
         if (count[min] != 0) break;
     if (root < min) root = min;
@@ -298,7 +303,6 @@
             drop = 0;
             len = root;
             next = *table;
-            curr = root;
             this.bits = (unsigned char)len;
         }
 

==== //depot/projects/tty/lib/libz/trees.c#3 (text+ko) ====

@@ -29,8 +29,7 @@
  *          Addison-Wesley, 1983. ISBN 0-201-06672-6.
  */
 
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libz/trees.c,v 1.8 2004/06/30 23:54:46 tjr Exp $");
+/* @(#) $Id$ */
 
 /* #define GEN_TREES_H */
 
@@ -932,7 +931,7 @@
     if (s->level > 0) {
 
          /* Check if the file is ascii or binary */
-        if (s->data_type == Z_UNKNOWN) set_data_type(s);
+        if (s->strm->data_type == Z_UNKNOWN) set_data_type(s);
 
         /* Construct the literal and distance trees */
         build_tree(s, (tree_desc *)(&(s->l_desc)));
@@ -1132,7 +1131,7 @@
     while (n < 7)        bin_freq += s->dyn_ltree[n++].Freq;
     while (n < 128)    ascii_freq += s->dyn_ltree[n++].Freq;
     while (n < LITERALS) bin_freq += s->dyn_ltree[n++].Freq;
-    s->data_type = (Byte)(bin_freq > (ascii_freq >> 2) ? Z_BINARY : Z_ASCII);
+    s->strm->data_type = bin_freq > (ascii_freq >> 2) ? Z_BINARY : Z_ASCII;
 }
 
 /* ===========================================================================

==== //depot/projects/tty/lib/libz/uncompr.c#3 (text+ko) ====

@@ -3,8 +3,7 @@
  * For conditions of distribution and use, see copyright notice in zlib.h
  */
 
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libz/uncompr.c,v 1.8 2004/06/30 23:54:46 tjr Exp $");
+/* @(#) $Id$ */
 
 #define ZLIB_INTERNAL
 #include "zlib.h"

==== //depot/projects/tty/lib/libz/zlib.3#4 (text+ko) ====

@@ -1,6 +1,4 @@
-.\" $FreeBSD: src/lib/libz/zlib.3,v 1.7 2004/06/30 23:54:46 tjr Exp $
-.\"
-.TH ZLIB 3 "17 November 2003"
+.TH ZLIB 3 "3 October 2004"
 .SH NAME
 zlib \- compression/decompression library
 .SH SYNOPSIS
@@ -135,8 +133,8 @@
 Send questions and/or comments to zlib at gzip.org,
 or (for the Windows DLL version) to Gilles Vollant (info at winimage.com).
 .SH AUTHORS
-Version 1.2.1
-Copyright (C) 1995-2003 Jean-loup Gailly (jloup at gzip.org)
+Version 1.2.2
+Copyright (C) 1995-2004 Jean-loup Gailly (jloup at gzip.org)
 and Mark Adler (madler at alumni.caltech.edu).
 .LP
 This software is provided "as-is,"

==== //depot/projects/tty/lib/libz/zutil.c#3 (text+ko) ====

@@ -3,8 +3,7 @@
  * For conditions of distribution and use, see copyright notice in zlib.h
  */
 
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libz/zutil.c,v 1.8 2004/06/30 23:54:46 tjr Exp $");
+/* @(#) $Id$ */
 
 #include "zutil.h"
 

==== //depot/projects/tty/lib/libz/zutil.h#3 (text+ko) ====

@@ -8,7 +8,7 @@
    subject to change. Applications should only use zlib.h.
  */
 
-/* @(#) $FreeBSD: src/lib/libz/zutil.h,v 1.7 2004/06/30 23:54:46 tjr Exp $ */
+/* @(#) $Id$ */
 
 #ifndef ZUTIL_H
 #define ZUTIL_H
@@ -189,9 +189,14 @@
 #    define NO_vsnprintf
 #  endif
 #endif
+#ifdef VMS
+#  define NO_vsnprintf
+#endif
 
 #ifdef HAVE_STRERROR
-   extern char *strerror OF((int));
+#  ifndef VMS
+     extern char *strerror OF((int));
+#  endif
 #  define zstrerror(errnum) strerror(errnum)
 #else
 #  define zstrerror(errnum) ""

==== //depot/projects/tty/libexec/rlogind/rlogind.c#4 (text+ko) ====

@@ -50,7 +50,7 @@
 #endif /* not lint */
 #endif
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/libexec/rlogind/rlogind.c,v 1.42 2005/02/14 17:42:57 stefanf Exp $");
+__FBSDID("$FreeBSD: src/libexec/rlogind/rlogind.c,v 1.43 2005/05/11 02:43:04 jmallett Exp $");
 
 /*
  * remote login server:
@@ -496,7 +496,7 @@
 	(void)chflags(line, 0);
 	(void)chmod(line, 0666);
 	(void)chown(line, 0, 0);
-	shutdown(netf, 2);
+	shutdown(netf, SHUT_RDWR);
 	exit(1);
 }
 

==== //depot/projects/tty/libexec/rshd/rshd.c#4 (text+ko) ====

@@ -51,7 +51,7 @@
 #endif /* not lint */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/libexec/rshd/rshd.c,v 1.50 2005/03/21 08:01:14 das Exp $");
+__FBSDID("$FreeBSD: src/libexec/rshd/rshd.c,v 1.51 2005/05/11 02:41:39 jmallett Exp $");
 
 /*
  * remote shell server:
@@ -267,7 +267,7 @@
 		if ((cc = read(STDIN_FILENO, &c, 1)) != 1) {
 			if (cc < 0)
 				syslog(LOG_NOTICE, "read: %m");
-			shutdown(0, 1+1);
+			shutdown(0, SHUT_RDWR);
 			exit(1);
 		}
 		if (c == 0)
@@ -442,7 +442,7 @@
 					errno = 0;
 					cc = read(pv[0], buf, sizeof(buf));
 					if (cc <= 0) {
-						shutdown(s, 1+1);
+						shutdown(s, SHUT_RDWR);
 						FD_CLR(pv[0], &readfrom);
 					} else {
 						(void)write(s, buf, cc);

==== //depot/projects/tty/sbin/ipfw/ipfw.8#14 (text+ko) ====

@@ -1,5 +1,5 @@
 .\"
-.\" $FreeBSD: src/sbin/ipfw/ipfw.8,v 1.169 2005/05/04 13:14:57 glebius Exp $
+.\" $FreeBSD: src/sbin/ipfw/ipfw.8,v 1.170 2005/05/11 12:58:15 glebius Exp $
 .\"
 .Dd February 22, 2005
 .Dt IPFW 8
@@ -735,7 +735,9 @@
 sysctl variable.
 .It Cm ngtee Ar cookie
 A copy of packet is diverted into netgraph, original
-packet continues with next rule.
+packet is either accepted or continues with the next rule, depending on
+.Em net.inet.ip.fw.one_pass
+sysctl variable.
 See
 .Xr ng_ipfw 4
 for more information on

==== //depot/projects/tty/sbin/route/route.c#6 (text+ko) ====

@@ -38,7 +38,7 @@
 static char sccsid[] = "@(#)route.c	8.6 (Berkeley) 4/28/95";
 #endif
 static const char rcsid[] =
-  "$FreeBSD: src/sbin/route/route.c,v 1.76 2004/06/16 06:29:41 bms Exp $";
+  "$FreeBSD: src/sbin/route/route.c,v 1.77 2005/05/11 02:50:41 jmallett Exp $";
 #endif /* not lint */
 
 #include <sys/param.h>
@@ -208,7 +208,7 @@
 	if (uid && !debugonly) {
 		errx(EX_NOPERM, "must be root to alter routing table");
 	}
-	shutdown(s, 0); /* Don't want to read back our messages */
+	shutdown(s, SHUT_RD); /* Don't want to read back our messages */
 	if (argc > 1) {
 		argv++;
 		if (argc == 2 && **argv == '-')
@@ -577,7 +577,7 @@
 	}
 	cmd = argv[0];
 	if (*cmd != 'g')
-		shutdown(s, 0); /* Don't want to read back our messages */
+		shutdown(s, SHUT_RD); /* Don't want to read back our messages */
 	while (--argc > 0) {
 		if (**(++argv)== '-') {
 			switch (key = keyword(1 + *argv)) {

==== //depot/projects/tty/share/man/man4/ng_netflow.4#4 (text+ko) ====

@@ -22,9 +22,9 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.\" $FreeBSD: src/share/man/man4/ng_netflow.4,v 1.9 2005/04/08 10:38:12 joel Exp $
+.\" $FreeBSD: src/share/man/man4/ng_netflow.4,v 1.10 2005/05/11 11:53:37 glebius Exp $
 .\"
-.Dd March 23, 2005
+.Dd May 11, 2005
 .Os
 .Dt NG_NETFLOW 4
 .Sh NAME
@@ -168,6 +168,9 @@
 .Xr flowctl 8 ,
 not directly from
 .Xr ngctl 8 .
+See also
+.Sx BUGS
+section.
 .El
 .Sh ASCII CONTROL MESSAGES
 Most binary control messages have an
@@ -258,6 +261,10 @@
 written by
 .An Roman V. Palagin Aq romanp at unshadow.net .
 .Sh BUGS
+Cache snapshot obtained via
+.Dv NGM_NETFLOW_SHOW
+command may lack some percentage of entries under severe load.
+.Pp
 The
 .Nm
 node type does not fill in AS numbers.

==== //depot/projects/tty/share/man/man4/twe.4#6 (text+ko) ====

@@ -22,7 +22,7 @@
 .\" (INCLUDING NEGLIGENCE OR OTHERWISE) 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/twe.4,v 1.14 2005/04/20 10:41:09 brueffer Exp $
+.\" $FreeBSD: src/share/man/man4/twe.4,v 1.15 2005/05/12 16:18:58 brueffer Exp $
 .\"
 .Dd August 15, 2004
 .Dt TWE 4
@@ -135,7 +135,7 @@
 .It twe%d: device_add_child failed
 .It twe%d: bus_generic_attach returned %d
 .Pp
-Creation of the disk devices failed, either due to communications
+Creation of the disk devices failed, either due to communication
 problems with the adapter or due to resource shortage;
 attachment of one or more units may have been aborted.
 .El

==== //depot/projects/tty/share/misc/bsd-family-tree#11 (text+ko) ====

@@ -186,7 +186,8 @@
  |      |             |      |             OpenBSD 3.6                 |
  |      |             |   NetBSD 2.0           |                       |
  |      |             |      |                 |                 DragonFly 1.2.0
- |   FreeBSD 5.4      |      |                 |                       |
+ |      |          Mac OS X  |                 |                       |
+ |   FreeBSD 5.4     10.4    |                 |                       |
  |      |             |      |                 |                       |
  |      V             |      |                 |                       |
  |                    |      |                 |                       |
@@ -420,6 +421,7 @@
 NetBSD 2.0		2004-12-09 [NBD]
 FreeBSD 4.11		2005-01-25 [FBD]
 DragonFly 1.2.0		2005-04-08 [DFB]
+Mac OS X 10.4		2005-04-29 [APL]
 FreeBSD 5.4		2005-05-09 [FBD]
 
 Bibliography
@@ -481,4 +483,4 @@
 Copyright (c) 1997-2004 Wolfram Schneider <wosch at FreeBSD.ORG>
 URL: http://cvsweb.freebsd.org/src/share/misc/bsd-family-tree
 
-$FreeBSD: src/share/misc/bsd-family-tree,v 1.90 2005/05/10 17:51:18 maxim Exp $
+$FreeBSD: src/share/misc/bsd-family-tree,v 1.91 2005/05/11 11:11:29 maxim Exp $

==== //depot/projects/tty/sys/amd64/amd64/mp_machdep.c#7 (text+ko) ====

@@ -25,7 +25,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/amd64/amd64/mp_machdep.c,v 1.253 2005/04/30 20:00:58 dwhite Exp $");
+__FBSDID("$FreeBSD: src/sys/amd64/amd64/mp_machdep.c,v 1.255 2005/05/13 00:57:04 nectar Exp $");
 
 #include "opt_cpu.h"
 #include "opt_kstack_pages.h"
@@ -142,6 +142,9 @@
 static void	release_aps(void *dummy);
 
 static int	hlt_logical_cpus;
+static u_int	hyperthreading_cpus;
+static cpumask_t	hyperthreading_cpus_mask;
+static int	hyperthreading_allowed = 1;
 static struct	sysctl_ctx_list logical_cpu_clist;
 static u_int	bootMP_size;
 
@@ -301,6 +304,7 @@
 cpu_mp_start(void)
 {
 	int i;
+	u_int threads_per_cache, p[4];
 
 	/* Initialize the logical ID to APIC ID table. */
 	for (i = 0; i < MAXCPU; i++) {
@@ -340,6 +344,48 @@
 	if (cpu_feature & CPUID_HTT)
 		logical_cpus = (cpu_procinfo & CPUID_HTT_CORES) >> 16;
 
+	/*
+	 * Work out if hyperthreading is *really* enabled.  This
+	 * is made really ugly by the fact that processors lie: Dual
+	 * core processors claim to be hyperthreaded even when they're
+	 * not, presumably because they want to be treated the same
+	 * way as HTT with respect to per-cpu software licensing.
+	 * At the time of writing (May 12, 2005) the only hyperthreaded
+	 * cpus are from Intel, and Intel's dual-core processors can be
+	 * identified via the "deterministic cache parameters" cpuid
+	 * calls.
+	 */
+	/*
+	 * First determine if this is an Intel processor which claims
+	 * to have hyperthreading support.
+	 */
+	if ((cpu_feature & CPUID_HTT) &&
+	    (strcmp(cpu_vendor, "GenuineIntel") == 0)) {
+		/*
+		 * If the "deterministic cache parameters" cpuid calls
+		 * are available, use them.
+		 */
+		if (cpu_high >= 4) {
+			/* Ask the processor about up to 32 caches. */
+			for (i = 0; i < 32; i++) {
+				cpuid_count(4, i, p);
+				threads_per_cache = ((p[0] & 0x3ffc000) >> 14) + 1;
+				if (hyperthreading_cpus < threads_per_cache)
+					hyperthreading_cpus = threads_per_cache;
+				if ((p[0] & 0x1f) == 0)
+					break;
+			}
+		}
+
+		/*
+		 * If the deterministic cache parameters are not
+		 * available, or if no caches were reported to exist,
+		 * just accept what the HTT flag indicated.
+		 */
+		if (hyperthreading_cpus == 0)
+			hyperthreading_cpus = logical_cpus;
+	}
+
 	set_logical_apic_ids();
 }
 
@@ -478,6 +524,11 @@
 	if (logical_cpus > 1 && PCPU_GET(apic_id) % logical_cpus != 0)
 		logical_cpus_mask |= PCPU_GET(cpumask);
 	
+	/* Determine if we are a hyperthread. */
+	if (hyperthreading_cpus > 1 &&
+	    PCPU_GET(apic_id) % hyperthreading_cpus != 0)
+		hyperthreading_cpus_mask |= PCPU_GET(cpumask);
+
 	/* Build our map of 'other' CPUs. */
 	PCPU_SET(other_cpus, all_cpus & ~PCPU_GET(cpumask));
 
@@ -1081,6 +1132,9 @@
 	else
 		hlt_logical_cpus = 0;
 
+	if (! hyperthreading_allowed)
+		mask |= hyperthreading_cpus_mask;
+
 	if ((mask & all_cpus) == all_cpus)
 		mask &= ~(1<<0);
 	hlt_cpus_mask = mask;
@@ -1105,6 +1159,9 @@
 	else
 		hlt_cpus_mask &= ~logical_cpus_mask;
 
+	if (! hyperthreading_allowed)
+		hlt_cpus_mask |= hyperthreading_cpus_mask;
+
 	if ((hlt_cpus_mask & all_cpus) == all_cpus)
 		hlt_cpus_mask &= ~(1<<0);
 
@@ -1112,6 +1169,34 @@
 	return (error);
 }
 
+static int
+sysctl_hyperthreading_allowed(SYSCTL_HANDLER_ARGS)
+{
+	int allowed, error;
+
+	allowed = hyperthreading_allowed;
+	error = sysctl_handle_int(oidp, &allowed, 0, req);
+	if (error || !req->newptr)
+		return (error);
+
+	if (allowed)
+		hlt_cpus_mask &= ~hyperthreading_cpus_mask;
+	else
+		hlt_cpus_mask |= hyperthreading_cpus_mask;
+
+	if (logical_cpus_mask != 0 &&
+	    (hlt_cpus_mask & logical_cpus_mask) == logical_cpus_mask)
+		hlt_logical_cpus = 1;
+	else
+		hlt_logical_cpus = 0;
+
+	if ((hlt_cpus_mask & all_cpus) == all_cpus)
+		hlt_cpus_mask &= ~(1<<0);
+
+	hyperthreading_allowed = allowed;
+	return (error);
+}
+
 static void
 cpu_hlt_setup(void *dummy __unused)
 {
@@ -1131,6 +1216,22 @@
 
 		if (hlt_logical_cpus)
 			hlt_cpus_mask |= logical_cpus_mask;
+
+		/*
+		 * If necessary for security purposes, force
+		 * hyperthreading off, regardless of the value
+		 * of hlt_logical_cpus.
+		 */
+		if (hyperthreading_cpus_mask) {
+			TUNABLE_INT_FETCH("machdep.hyperthreading_allowed",
+			    &hyperthreading_allowed);
+			SYSCTL_ADD_PROC(&logical_cpu_clist,
+			    SYSCTL_STATIC_CHILDREN(_machdep), OID_AUTO,
+			    "hyperthreading_allowed", CTLTYPE_INT|CTLFLAG_RW,
+			    0, 0, sysctl_hyperthreading_allowed, "IU", "");
+			if (! hyperthreading_allowed)
+				hlt_cpus_mask |= hyperthreading_cpus_mask;
+		}
 	}
 }
 SYSINIT(cpu_hlt, SI_SUB_SMP, SI_ORDER_ANY, cpu_hlt_setup, NULL);

==== //depot/projects/tty/sys/amd64/include/cpufunc.h#7 (text+ko) ====

@@ -27,7 +27,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $FreeBSD: src/sys/amd64/include/cpufunc.h,v 1.147 2005/03/11 22:16:09 peter Exp $
+ * $FreeBSD: src/sys/amd64/include/cpufunc.h,v 1.148 2005/05/13 00:05:55 nectar Exp $
  */
 
 /*

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


More information about the p4-projects mailing list