PERFORCE change 90389 for review
Alan Cox
alc at FreeBSD.org
Wed Jan 25 22:00:49 PST 2006
http://perforce.freebsd.org/chv.cgi?CH=90389
Change 90389 by alc at alc_home on 2006/01/26 06:00:35
IFC @90388
Affected files ...
.. //depot/projects/superpages/doc/en_US.ISO8859-1/books/handbook/mirrors/chapter.sgml#3 integrate
.. //depot/projects/superpages/src/etc/services#2 integrate
.. //depot/projects/superpages/src/include/printf.h#2 integrate
.. //depot/projects/superpages/src/lib/Makefile#3 integrate
.. //depot/projects/superpages/src/lib/libarchive/Makefile#5 integrate
.. //depot/projects/superpages/src/lib/libarchive/archive_read_support_format_tp.c#2 integrate
.. //depot/projects/superpages/src/lib/libc/gen/getttyent.c#2 integrate
.. //depot/projects/superpages/src/lib/libc/stdio/Makefile.inc#3 integrate
.. //depot/projects/superpages/src/lib/libc/stdio/xprintf.c#2 integrate
.. //depot/projects/superpages/src/lib/libc/stdio/xprintf_errno.c#1 branch
.. //depot/projects/superpages/src/lib/libc/stdio/xprintf_quote.c#1 branch
.. //depot/projects/superpages/src/lib/libc/stdio/xprintf_vis.c#2 integrate
.. //depot/projects/superpages/src/lib/libc/stdlib/grantpt.c#2 integrate
.. //depot/projects/superpages/src/lib/libc/stdlib/malloc.c#3 integrate
.. //depot/projects/superpages/src/lib/libdisk/disk.c#2 integrate
.. //depot/projects/superpages/src/lib/libdisk/libdisk.h#2 integrate
.. //depot/projects/superpages/src/lib/libdisk/write_arm_disk.c#1 branch
.. //depot/projects/superpages/src/lib/libgssapi/gss_accept_sec_context.3#2 integrate
.. //depot/projects/superpages/src/lib/libgssapi/gss_acquire_cred.3#2 integrate
.. //depot/projects/superpages/src/lib/libgssapi/gss_add_cred.3#2 integrate
.. //depot/projects/superpages/src/lib/libgssapi/gss_add_oid_set_member.3#2 integrate
.. //depot/projects/superpages/src/lib/libgssapi/gss_canonicalize_name.3#2 integrate
.. //depot/projects/superpages/src/lib/libgssapi/gss_compare_name.3#2 integrate
.. //depot/projects/superpages/src/lib/libgssapi/gss_context_time.3#2 integrate
.. //depot/projects/superpages/src/lib/libgssapi/gss_create_empty_oid_set.3#2 integrate
.. //depot/projects/superpages/src/lib/libgssapi/gss_delete_sec_context.3#2 integrate
.. //depot/projects/superpages/src/lib/libgssapi/gss_display_name.3#2 integrate
.. //depot/projects/superpages/src/lib/libgssapi/gss_display_status.3#2 integrate
.. //depot/projects/superpages/src/lib/libgssapi/gss_duplicate_name.3#2 integrate
.. //depot/projects/superpages/src/lib/libgssapi/gss_export_name.3#2 integrate
.. //depot/projects/superpages/src/lib/libgssapi/gss_export_sec_context.3#2 integrate
.. //depot/projects/superpages/src/lib/libgssapi/gss_get_mic.3#2 integrate
.. //depot/projects/superpages/src/lib/libgssapi/gss_import_name.3#2 integrate
.. //depot/projects/superpages/src/lib/libgssapi/gss_import_sec_context.3#2 integrate
.. //depot/projects/superpages/src/lib/libgssapi/gss_indicate_mechs.3#2 integrate
.. //depot/projects/superpages/src/lib/libgssapi/gss_init_sec_context.3#2 integrate
.. //depot/projects/superpages/src/lib/libgssapi/gss_inquire_context.3#2 integrate
.. //depot/projects/superpages/src/lib/libgssapi/gss_inquire_cred.3#2 integrate
.. //depot/projects/superpages/src/lib/libgssapi/gss_inquire_cred_by_mech.3#2 integrate
.. //depot/projects/superpages/src/lib/libgssapi/gss_inquire_mechs_for_name.3#2 integrate
.. //depot/projects/superpages/src/lib/libgssapi/gss_inquire_names_for_mech.3#2 integrate
.. //depot/projects/superpages/src/lib/libgssapi/gss_process_context_token.3#2 integrate
.. //depot/projects/superpages/src/lib/libgssapi/gss_release_buffer.3#2 integrate
.. //depot/projects/superpages/src/lib/libgssapi/gss_release_cred.3#2 integrate
.. //depot/projects/superpages/src/lib/libgssapi/gss_release_name.3#2 integrate
.. //depot/projects/superpages/src/lib/libgssapi/gss_release_oid_set.3#2 integrate
.. //depot/projects/superpages/src/lib/libgssapi/gss_test_oid_set_member.3#2 integrate
.. //depot/projects/superpages/src/lib/libgssapi/gss_unwrap.3#2 integrate
.. //depot/projects/superpages/src/lib/libgssapi/gss_verify_mic.3#2 integrate
.. //depot/projects/superpages/src/lib/libgssapi/gss_wrap.3#2 integrate
.. //depot/projects/superpages/src/lib/libgssapi/gss_wrap_size_limit.3#2 integrate
.. //depot/projects/superpages/src/lib/libgssapi/gssapi.3#2 integrate
.. //depot/projects/superpages/src/lib/libutil/pty.c#2 integrate
.. //depot/projects/superpages/src/release/doc/en_US.ISO8859-1/hardware/common/dev.sgml#4 integrate
.. //depot/projects/superpages/src/release/doc/share/misc/dev.archlist.txt#4 integrate
.. //depot/projects/superpages/src/sbin/rcorder/Makefile#2 integrate
.. //depot/projects/superpages/src/share/man/man4/ata.4#4 integrate
.. //depot/projects/superpages/src/share/man/man4/pcm.4#4 integrate
.. //depot/projects/superpages/src/share/man/man4/pty.4#2 integrate
.. //depot/projects/superpages/src/sys/cam/scsi/scsi_da.c#3 integrate
.. //depot/projects/superpages/src/sys/compat/linux/linux_ioctl.c#3 integrate
.. //depot/projects/superpages/src/sys/compat/linux/linux_ioctl.h#2 integrate
.. //depot/projects/superpages/src/sys/compat/linux/linux_stats.c#2 integrate
.. //depot/projects/superpages/src/sys/conf/files#7 integrate
.. //depot/projects/superpages/src/sys/dev/ata/ata-chipset.c#4 integrate
.. //depot/projects/superpages/src/sys/dev/ata/ata-pci.c#4 integrate
.. //depot/projects/superpages/src/sys/dev/ata/ata-pci.h#4 integrate
.. //depot/projects/superpages/src/sys/dev/isp/isp_pci.c#3 integrate
.. //depot/projects/superpages/src/sys/dev/rp/rp_pci.c#3 integrate
.. //depot/projects/superpages/src/sys/dev/sound/pcm/dsp.c#4 integrate
.. //depot/projects/superpages/src/sys/dev/sound/pcm/feeder_fmt.c#3 integrate
.. //depot/projects/superpages/src/sys/dev/sound/pcm/feeder_rate.c#4 integrate
.. //depot/projects/superpages/src/sys/dev/usb/umass.c#3 integrate
.. //depot/projects/superpages/src/sys/dev/usb/usbdevs#3 integrate
.. //depot/projects/superpages/src/sys/kern/kern_ktr.c#2 integrate
.. //depot/projects/superpages/src/sys/kern/kern_resource.c#3 integrate
.. //depot/projects/superpages/src/sys/kern/kern_sysctl.c#2 integrate
.. //depot/projects/superpages/src/sys/kern/subr_witness.c#4 integrate
.. //depot/projects/superpages/src/sys/kern/tty_pts.c#1 branch
.. //depot/projects/superpages/src/sys/kern/tty_pty.c#3 integrate
.. //depot/projects/superpages/src/sys/modules/amr/Makefile#2 integrate
.. //depot/projects/superpages/src/sys/net/if_bridge.c#6 integrate
.. //depot/projects/superpages/src/sys/netinet6/ip6_input.c#3 integrate
.. //depot/projects/superpages/src/sys/sys/ktr.h#3 integrate
.. //depot/projects/superpages/src/sys/sys/ttycom.h#2 integrate
.. //depot/projects/superpages/src/sys/vm/vm_contig.c#4 integrate
.. //depot/projects/superpages/src/sys/vm/vm_object.c#5 integrate
.. //depot/projects/superpages/src/tools/tools/mfc/mfc.pl#2 integrate
.. //depot/projects/superpages/www/en/donations/wantlist.sgml#6 integrate
.. //depot/projects/superpages/www/en/platforms/arm.sgml#3 integrate
.. //depot/projects/superpages/www/en/platforms/index.sgml#4 integrate
.. //depot/projects/superpages/www/en/releases/5.4R/errata.html#3 integrate
.. //depot/projects/superpages/www/en/releases/5.5R/Makefile#1 branch
.. //depot/projects/superpages/www/en/releases/5.5R/approvals.sgml#1 branch
.. //depot/projects/superpages/www/en/releases/5.5R/todo.sgml#1 branch
.. //depot/projects/superpages/www/en/releases/6.0R/errata.html#2 integrate
.. //depot/projects/superpages/www/en/releases/6.1R/Makefile#1 branch
.. //depot/projects/superpages/www/en/releases/6.1R/approvals.sgml#1 branch
.. //depot/projects/superpages/www/en/releases/6.1R/stress.xsl#1 branch
.. //depot/projects/superpages/www/en/releases/6.1R/todo.sgml#1 branch
.. //depot/projects/superpages/www/en/releases/Makefile#2 integrate
.. //depot/projects/superpages/www/share/sgml/advisories.xml#4 integrate
Differences ...
==== //depot/projects/superpages/doc/en_US.ISO8859-1/books/handbook/mirrors/chapter.sgml#3 (text+ko) ====
@@ -1,7 +1,7 @@
<!--
The FreeBSD Documentation Project
- $FreeBSD: doc/en_US.ISO8859-1/books/handbook/mirrors/chapter.sgml,v 1.404 2006/01/21 09:35:38 blackend Exp $
+ $FreeBSD: doc/en_US.ISO8859-1/books/handbook/mirrors/chapter.sgml,v 1.405 2006/01/26 02:56:13 brd Exp $
-->
<appendix id="mirrors">
@@ -387,16 +387,8 @@
(Use <command>cvs login</command> and enter the password
<quote>anoncvs</quote> when prompted.)</para>
</listitem>
+ <!-- anoncvs.FreeBSD.org is sufferring hardware troubles at the moment ...
<listitem>
- <para><emphasis>Sweden</emphasis>:
- freebsdanoncvs at anoncvs.se.FreeBSD.org:/home/ncvs
- (ssh only - no password)</para>
-
- <programlisting>SSH HostKey: 1024 a7:34:15:ee:0e:c6:65:cf:40:78:2d:f3:cd:87:bd:a6 root at apelsin.fruitsalad.org
-SSH2 HostKey: 1024 21:df:04:03:c7:26:3e:e8:36:1a:50:2d:c7:ae:b8:5f ssh_host_dsa_key.pub</programlisting>
-
- </listitem>
- <listitem>
<para><emphasis>USA</emphasis>:
freebsdanoncvs at anoncvs.FreeBSD.org:/home/ncvs
(ssh only - no password)</para>
@@ -405,6 +397,7 @@
SSH2 HostKey: 1024 52:02:38:1a:2f:a8:71:d3:f5:83:93:8d:aa:00:6f:65 ssh_host_dsa_key.pub</programlisting>
</listitem>
+ -->
<listitem>
<para><emphasis>USA</emphasis>:
anoncvs at anoncvs1.FreeBSD.org:/home/ncvs (ssh only - no
==== //depot/projects/superpages/src/etc/services#2 (text+ko) ====
@@ -16,7 +16,7 @@
# Kerberos services are for Kerberos v4, and are unofficial. Sites running
# v5 should uncomment v5 entries and comment v4 entries.
#
-# $FreeBSD: src/etc/services,v 1.102 2004/08/16 11:52:22 cperciva Exp $
+# $FreeBSD: src/etc/services,v 1.103 2006/01/25 17:37:15 maxim Exp $
# From: @(#)services 5.8 (Berkeley) 5/9/91
#
# WELL KNOWN PORT NUMBERS
@@ -1917,6 +1917,8 @@
eppc 3031/udp #Remote AppleEvents/PPC Toolbox
NSWS 3049/tcp
NSWS 3049/udp
+gds_db 3050/tcp #InterBase Database Remote Protocol
+gds_db 3050/udp #InterBase Database Remote Protocol
sj3 3086/tcp #SJ3 (kanji input)
vmodem 3141/tcp
vmodem 3141/udp
==== //depot/projects/superpages/src/include/printf.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/include/printf.h,v 1.1 2005/12/16 18:56:38 phk Exp $
+ * $FreeBSD: src/include/printf.h,v 1.2 2006/01/25 12:45:24 phk Exp $
*/
#ifndef _PRINTF_H_
@@ -124,16 +124,28 @@
int register_printf_render(int spec, printf_render *render, printf_arginfo_function *arginfo);
int register_printf_render_std(const unsigned char *specs);
+/* vprintf_errno.c */
+printf_arginfo_function __printf_arginfo_errno;
+printf_render __printf_render_errno;
+
/* vprintf_float.c */
printf_arginfo_function __printf_arginfo_float;
printf_render __printf_render_float;
+/* vprintf_hexdump.c */
+printf_arginfo_function __printf_arginfo_hexdump;
+printf_render __printf_render_hexdump;
+
/* vprintf_int.c */
printf_arginfo_function __printf_arginfo_ptr;
printf_arginfo_function __printf_arginfo_int;
printf_render __printf_render_ptr;
printf_render __printf_render_int;
+/* vprintf_quoute.c */
+printf_arginfo_function __printf_arginfo_quote;
+printf_render __printf_render_quote;
+
/* vprintf_str.c */
printf_arginfo_function __printf_arginfo_chr;
printf_render __printf_render_chr;
@@ -144,10 +156,6 @@
printf_arginfo_function __printf_arginfo_time;
printf_render __printf_render_time;
-/* vprintf_hexdump.c */
-printf_arginfo_function __printf_arginfo_hexdump;
-printf_render __printf_render_hexdump;
-
/* vprintf_vis.c */
printf_arginfo_function __printf_arginfo_vis;
printf_render __printf_render_vis;
==== //depot/projects/superpages/src/lib/Makefile#3 (text+ko) ====
@@ -1,5 +1,5 @@
# @(#)Makefile 8.1 (Berkeley) 6/4/93
-# $FreeBSD: src/lib/Makefile,v 1.209 2005/12/29 14:40:20 dfr Exp $
+# $FreeBSD: src/lib/Makefile,v 1.210 2006/01/25 11:24:37 cognet Exp $
# To satisfy shared library or ELF linkage when only the libraries being
# built are visible:
@@ -26,7 +26,7 @@
libnetgraph libradius librpcsvc libsbuf libtacplus libutil \
${_libypclnt} libalias libarchive ${_libatm} \
libbegemot ${_libbluetooth} libbsnmp libbz2 libc ${_libc_r} \
- libcalendar libcam libcompat libdevinfo libdevstat ${_libdisk} \
+ libcalendar libcam libcompat libdevinfo libdevstat libdisk \
libedit libexpat libfetch libform libftpio libgeom ${_libgpib} \
libgssapi ${_libio} libipsec \
libipx libkiconv libmagic libmemstat libmenu ${_libmilter} ${_libmp} \
@@ -68,10 +68,6 @@
_libc_r=
.endif
-.if ${MACHINE_ARCH} != "arm"
-_libdisk= libdisk
-.endif
-
.if ${MACHINE_ARCH} == "alpha"
_libio= libio
.endif
==== //depot/projects/superpages/src/lib/libarchive/Makefile#5 (text+ko) ====
@@ -1,4 +1,4 @@
-# $FreeBSD: src/lib/libarchive/Makefile,v 1.44 2006/01/18 06:26:42 kientzle Exp $
+# $FreeBSD: src/lib/libarchive/Makefile,v 1.45 2006/01/26 05:28:56 kientzle Exp $
# This Makefile is for use with the FreeBSD buid system. For
# non-FreeBSD systems, you should first "make distfile" on FreeBSD,
@@ -68,6 +68,7 @@
archive_read_support_format_cpio.c \
archive_read_support_format_iso9660.c \
archive_read_support_format_tar.c \
+ archive_read_support_format_tp.c \
archive_read_support_format_zip.c \
archive_string.c \
archive_string_sprintf.c \
==== //depot/projects/superpages/src/lib/libarchive/archive_read_support_format_tp.c#2 (text+ko) ====
@@ -25,7 +25,7 @@
*/
#include "archive_platform.h"
-__FBSDID("$FreeBSD: src/lib/libarchive/archive_read_support_format_tp.c,v 1.1 2006/01/17 03:40:42 kientzle Exp $");
+__FBSDID("$FreeBSD: src/lib/libarchive/archive_read_support_format_tp.c,v 1.2 2006/01/26 05:28:56 kientzle Exp $");
#include <sys/stat.h>
@@ -274,6 +274,7 @@
struct stat st;
struct tp *tp;
struct file_info *file;
+ const void *v;
const char *p;
ssize_t bytes_read;
int r;
@@ -283,8 +284,7 @@
/* Read the entire TOC first. */
if (!tp->toc_read) {
/* Skip the initial block. */
- bytes_read = (a->compression_read_ahead)(a,
- (const void **)&p, 512);
+ bytes_read = (a->compression_read_ahead)(a, &v, 512);
if (bytes_read < 512)
return (ARCHIVE_FATAL);
bytes_read = 512;
@@ -294,12 +294,13 @@
/* Consume TOC entries. */
do {
bytes_read = (a->compression_read_ahead)(a,
- (const void **)&p, tp->toc_size);
+ &v, tp->toc_size);
if (bytes_read < tp->toc_size)
return (ARCHIVE_FATAL);
bytes_read = tp->toc_size;
tp->current_position += bytes_read;
(a->compression_read_consume)(a, bytes_read);
+ p = (const char *)v;
file = (*tp->parse_file_info)(a, p);
if (file != NULL)
add_entry(tp, file);
==== //depot/projects/superpages/src/lib/libc/gen/getttyent.c#2 (text+ko) ====
@@ -35,19 +35,25 @@
static char sccsid[] = "@(#)getttyent.c 8.1 (Berkeley) 6/4/93";
#endif /* LIBC_SCCS and not lint */
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/gen/getttyent.c,v 1.13 2005/07/25 17:57:15 mdodd Exp $");
+__FBSDID("$FreeBSD: src/lib/libc/gen/getttyent.c,v 1.14 2006/01/26 01:34:26 cognet Exp $");
#include <ttyent.h>
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <string.h>
+#include <dirent.h>
+#include <paths.h>
static char zapchar;
static FILE *tf;
+static int maxpts = 0;
+static int curpts = 0;
+static int pts_valid = 0;
static size_t lbsize;
static char *line;
+#define PTS "pts/"
#define MALLOCCHUNK 100
static char *skip(char *);
@@ -73,6 +79,7 @@
getttyent()
{
static struct ttyent tty;
+ static char devpts_name[] = "pts/4294967295";
char *p;
int c;
size_t i;
@@ -80,8 +87,19 @@
if (!tf && !setttyent())
return (NULL);
for (;;) {
- if (!fgets(p = line, lbsize, tf))
+ if (!fgets(p = line, lbsize, tf)) {
+ if (pts_valid == 1 && curpts <= maxpts) {
+ sprintf(devpts_name, "pts/%d", curpts++);
+ tty.ty_name = devpts_name;
+ tty.ty_getty = tty.ty_type = NULL;
+ tty.ty_status = TTY_NETWORK;
+ tty.ty_window = NULL;
+ tty.ty_comment = NULL;
+ tty.ty_group = _TTYS_NOGROUP;
+ return (&tty);
+ }
return (NULL);
+ }
/* extend buffer if line was too big, and retry */
while (!index(p, '\n')) {
i = strlen(p);
@@ -209,12 +227,30 @@
int
setttyent()
{
+ DIR *devpts_dir;
if (line == NULL) {
if ((line = malloc(MALLOCCHUNK)) == NULL)
return (0);
lbsize = MALLOCCHUNK;
}
+ devpts_dir = opendir(_PATH_DEV PTS);
+ if (devpts_dir) {
+ struct dirent *dp;
+
+ while ((dp = readdir(devpts_dir))) {
+ if (strcmp(dp->d_name, ".") != 0 &&
+ strcmp(dp->d_name, "..") != 0) {
+ if (atoi(dp->d_name) > maxpts) {
+ maxpts = atoi(dp->d_name);
+ pts_valid = 1;
+ curpts = 0;
+ }
+ }
+ }
+ closedir(devpts_dir);
+ }
+ printf("it is %d %d\n", maxpts, curpts);
if (tf) {
rewind(tf);
return (1);
@@ -228,6 +264,7 @@
{
int rval;
+ pts_valid = 0;
/*
* NB: Don't free `line' because getttynam()
* may still be referencing it
==== //depot/projects/superpages/src/lib/libc/stdio/Makefile.inc#3 (text+ko) ====
@@ -1,5 +1,5 @@
# @(#)Makefile.inc 8.3 (Berkeley) 4/17/94
-# $FreeBSD: src/lib/libc/stdio/Makefile.inc,v 1.34 2005/12/16 18:56:38 phk Exp $
+# $FreeBSD: src/lib/libc/stdio/Makefile.inc,v 1.35 2006/01/25 12:45:24 phk Exp $
# stdio sources
.PATH: ${.CURDIR}/stdio
@@ -24,7 +24,8 @@
wsetup.c
SRCS+= xprintf.c xprintf_float.c xprintf_int.c xprintf_str.c
-SRCS+= xprintf_hexdump.c xprintf_time.c xprintf_vis.c
+SRCS+= xprintf_errno.c xprintf_hexdump.c xprintf_quote.c
+SRCS+= xprintf_time.c xprintf_vis.c
MAN+= fclose.3 ferror.3 fflush.3 fgetln.3 fgets.3 fgetwln.3 fgetws.3 \
flockfile.3 \
==== //depot/projects/superpages/src/lib/libc/stdio/xprintf.c#2 (text+ko) ====
@@ -30,7 +30,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $FreeBSD: src/lib/libc/stdio/xprintf.c,v 1.1 2005/12/16 18:56:38 phk Exp $
+ * $FreeBSD: src/lib/libc/stdio/xprintf.c,v 1.2 2006/01/25 12:45:24 phk Exp $
*/
#include <namespace.h>
@@ -655,6 +655,16 @@
__printf_render_hexdump,
__printf_arginfo_hexdump);
break;
+ case 'M':
+ register_printf_render(*specs,
+ __printf_render_errno,
+ __printf_arginfo_errno);
+ break;
+ case 'Q':
+ register_printf_render(*specs,
+ __printf_render_quote,
+ __printf_arginfo_quote);
+ break;
case 'T':
register_printf_render(*specs,
__printf_render_time,
==== //depot/projects/superpages/src/lib/libc/stdio/xprintf_vis.c#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/libc/stdio/xprintf_vis.c,v 1.1 2005/12/16 18:56:39 phk Exp $
+ * $FreeBSD: src/lib/libc/stdio/xprintf_vis.c,v 1.2 2006/01/25 12:45:24 phk Exp $
*/
#include <namespace.h>
@@ -54,6 +54,8 @@
ret = 0;
p = *((char **)arg[0]);
+ if (p == NULL)
+ return (__printf_out(io, pi, "(null)", 6));
if (pi->prec >= 0)
l = pi->prec;
else
==== //depot/projects/superpages/src/lib/libc/stdlib/grantpt.c#2 (text+ko) ====
@@ -32,7 +32,7 @@
#include <sys/cdefs.h>
#ifndef lint
-__FBSDID("$FreeBSD: src/lib/libc/stdlib/grantpt.c,v 1.4 2005/07/07 17:48:40 marcus Exp $");
+__FBSDID("$FreeBSD: src/lib/libc/stdlib/grantpt.c,v 1.5 2006/01/26 01:33:55 cognet Exp $");
#endif /* not lint */
#include "namespace.h"
@@ -41,6 +41,8 @@
#include <sys/wait.h>
#include <sys/time.h>
#include <sys/resource.h>
+#include <sys/sysctl.h>
+#include <sys/ioctl.h>
#include <errno.h>
#include <fcntl.h>
@@ -56,6 +58,8 @@
#define PTM_PREFIX "pty" /* pseudo tty master naming convention */
#define PTS_PREFIX "tty" /* pseudo tty slave naming convention */
+#define NEWPTS_PREFIX "pts/"
+#define PTMX "ptmx"
/*
* The following are range values for pseudo TTY devices. Pseudo TTYs have a
@@ -78,6 +82,29 @@
minor((x).st_rdev) >= 0 && \
minor((x).st_rdev) < PT_MAX)
+
+static int
+is_pts(int fd)
+{
+ int nb;
+
+ return (_ioctl(fd, TIOCGPTN, &nb) == 0);
+}
+
+int
+__use_pts(void)
+{
+ int use_pts;
+ size_t len;
+ int error;
+
+ len = sizeof(use_pts);
+ error = sysctlbyname("kern.pts.enable", &use_pts, &len, NULL, 0);
+ if (error)
+ return (0);
+ return (use_pts);
+}
+
/*
* grantpt(): grant ownership of a slave pseudo-terminal device to the
* current user.
@@ -180,6 +207,10 @@
if (oflag & ~(O_RDWR | O_NOCTTY))
errno = EINVAL;
else {
+ if (__use_pts()) {
+ fildes = _open(_PATH_DEV PTMX, oflag);
+ return (fildes);
+ }
mc1 = master + strlen(_PATH_DEV PTM_PREFIX);
mc2 = mc1 + 1;
@@ -214,6 +245,7 @@
ptsname(int fildes)
{
static char slave[] = _PATH_DEV PTS_PREFIX "XY";
+ static char new_slave[] = _PATH_DEV NEWPTS_PREFIX "4294967295";
char *retval;
struct stat sbuf;
@@ -223,11 +255,19 @@
if (!ISPTM(sbuf))
errno = EINVAL;
else {
- (void)snprintf(slave, sizeof(slave),
- _PATH_DEV PTS_PREFIX "%s",
- devname(sbuf.st_rdev, S_IFCHR) +
- strlen(PTM_PREFIX));
- retval = slave;
+ if (!is_pts(fildes)) {
+ (void)snprintf(slave, sizeof(slave),
+ _PATH_DEV PTS_PREFIX "%s",
+ devname(sbuf.st_rdev, S_IFCHR) +
+ strlen(PTM_PREFIX));
+ retval = slave;
+ } else {
+ (void)snprintf(new_slave, sizeof(new_slave),
+ _PATH_DEV NEWPTS_PREFIX "%s",
+ devname(sbuf.st_rdev, S_IFCHR) +
+ strlen(PTM_PREFIX));
+ retval = new_slave;
+ }
}
}
==== //depot/projects/superpages/src/lib/libc/stdlib/malloc.c#3 (text+ko) ====
@@ -136,7 +136,7 @@
#define MALLOC_DEBUG
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/stdlib/malloc.c,v 1.103 2006/01/23 03:32:38 jasone Exp $");
+__FBSDID("$FreeBSD: src/lib/libc/stdlib/malloc.c,v 1.105 2006/01/25 05:41:02 jasone Exp $");
#include "libc_private.h"
#ifdef MALLOC_DEBUG
@@ -303,12 +303,6 @@
*/
uint64_t nfit;
- /*
- * Number of allocation requests that were successfully serviced by this
- * bin, but that a smaller bin could have serviced.
- */
- uint64_t noverfit;
-
/* High-water marks for this bin. */
unsigned long highcached;
@@ -837,6 +831,7 @@
static void arena_large_cache(arena_t *arena, region_t *reg, bool lru);
static void arena_lru_cache(arena_t *arena, region_t *reg);
static void arena_delay_cache(arena_t *arena, region_t *reg);
+static region_t *arena_frag_reg_alloc(arena_t *arena, size_t size, bool fit);
static region_t *arena_split_reg_alloc(arena_t *arena, size_t size, bool fit);
static void arena_reg_fit(arena_t *arena, size_t size, region_t *reg,
bool restore_split);
@@ -1190,7 +1185,6 @@
stats_arenas->bins[i].nrequests +=
arena->stats.bins[i].nrequests;
stats_arenas->bins[i].nfit += arena->stats.bins[i].nfit;
- stats_arenas->bins[i].noverfit += arena->stats.bins[i].noverfit;
if (arena->stats.bins[i].highcached
> stats_arenas->bins[i].highcached) {
stats_arenas->bins[i].highcached
@@ -1238,14 +1232,13 @@
stats_arenas->frag.nrequests, stats_arenas->frag.nserviced);
malloc_printf("bins:\n");
- malloc_printf(" %4s%7s%13s%13s%13s%11s\n", "bin",
- "size", "nrequests", "nfit", "noverfit", "highcached");
+ malloc_printf(" %4s%7s%13s%13s%11s\n", "bin",
+ "size", "nrequests", "nfit", "highcached");
for (i = 0; i < NBINS; i++) {
malloc_printf(
- " %4u%7u%13llu%13llu%13llu%11lu\n",
+ " %4u%7u%13llu%13llu%11lu\n",
i, ((i + bin_shift) << opt_quantum_2pow),
stats_arenas->bins[i].nrequests, stats_arenas->bins[i].nfit,
- stats_arenas->bins[i].noverfit,
stats_arenas->bins[i].highcached);
}
@@ -1656,12 +1649,6 @@
if (bit != 0) {
/* Usable allocation found. */
ret = (i * (sizeof(int) << 3)) + bit - 1;
-#ifdef MALLOC_STATS
- if (ret == minbin)
- arena->stats.bins[minbin].nfit++;
- else
- arena->stats.bins[ret].noverfit++;
-#endif
goto RETURN;
}
}
@@ -1765,7 +1752,7 @@
}
}
-/* Try to coalesce reg with its neighbors. Return NULL if coalescing fails. */
+/* Try to coalesce reg with its neighbors. Return false if coalescing fails. */
static bool
arena_coalesce(arena_t *arena, region_t **reg, size_t size)
{
@@ -2134,6 +2121,16 @@
ret = qr_next(&tbin->regions, next.u.s.link);
assert(region_next_size_get(&ret->sep)
== ((bin + bin_shift) << opt_quantum_2pow));
+ if (region_next_free_get(&ret->sep) == false) {
+ /*
+ * Use delayed regions in LIFO order, in order to increase
+ * locality of use, and thereby (hopefully) reduce
+ * fragmentation.
+ */
+ ret = qr_prev(&tbin->regions, next.u.s.link);
+ assert(region_next_size_get(&ret->sep)
+ == ((bin + bin_shift) << opt_quantum_2pow));
+ }
qr_remove(ret, next.u.s.link);
#ifdef MALLOC_STATS
arena->stats.bins[bin].nregions--;
@@ -2263,6 +2260,7 @@
>= QUANTUM_CEILING(sizeof(region_small_sizer_t)));
size = region_next_size_get(®->sep);
+ assert(arena_coalesce(arena, ®, size) == false);
if (size <= bin_maxsize) {
arena_bin_append(arena, (size >> opt_quantum_2pow) - bin_shift,
reg);
@@ -2289,6 +2287,7 @@
assert(region_next_size_get(®->sep)
>= QUANTUM_CEILING(sizeof(region_small_sizer_t)));
assert(size == region_next_size_get(®->sep));
+ assert(arena_coalesce(arena, ®, size) == false);
if (size <= bin_maxsize) {
arena_bin_push(arena, (size >> opt_quantum_2pow) - bin_shift,
@@ -2431,16 +2430,48 @@
}
}
-static __inline region_t *
+static region_t *
arena_frag_reg_alloc(arena_t *arena, size_t size, bool fit)
{
region_t *ret;
+ size_t total_size
+#ifdef MALLOC_DEBUG
+ = 0 /* for assert() below. */
+#endif
+ ;
+ bool refill;
+ /*
+ * Clear frag if it is too small to carve a maximally sized small
+ * region from.
+ */
+ if (arena->frag != NULL) {
+ if ((total_size = region_next_size_get(&arena->frag->sep))
+ < size && size <= bin_maxsize) {
+ region_t *reg;
+
+ reg = arena->frag;
+ region_next_contig_set(®->sep);
+
+ arena->frag = NULL;
+
+ arena_delay_cache(arena, reg);
+ refill = true;
+ } else {
+ /*
+ * No need to refill. Note that total_size was set
+ * above.
+ */
+ refill = false;
+ }
+ } else
+ refill = true;
+
/*
* Try to fill frag if it's empty. Frag needs to be marked as
* allocated.
*/
- if (arena->frag == NULL) {
+ if (refill) {
region_node_t *node;
node = RB_MIN(region_tree_s, &arena->large_regions);
@@ -2456,101 +2487,109 @@
assert(region_next_free_get(&frag->sep));
region_next_free_unset(&frag->sep);
- next = (region_t *)&((char *)frag)[region_next_size_get(
- &frag->sep)];
+ total_size = region_next_size_get(&frag->sep);
+ next = (region_t *)&((char *)frag)[total_size];
assert(region_prev_free_get(&next->sep));
region_prev_free_unset(&next->sep);
arena->frag = frag;
+ } else {
+ unsigned bin;
+
+ /* Look in bins for a large enough region. */
+ if ((bin = arena_bins_search(arena, size))
+ != UINT_MAX) {
+ /* Use the smallest available region. */
+ arena->frag = arena_bin_pop(arena, bin);
+#ifdef MALLOC_STATS
+ arena->stats.frag.ncached++;
+#endif
+ total_size =
+ region_next_size_get(&arena->frag->sep);
+ assert(total_size >= size);
+ } else {
+ /* Unable to fill frag. */
+ return (NULL);
+ }
}
}
+ assert(arena->frag != NULL);
+ /* total_size has been set in all possible paths that lead to here. */
+ assert(total_size != 0);
- if (arena->frag != NULL) {
#ifdef MALLOC_STATS
- arena->stats.frag.nrequests++;
+ arena->stats.frag.nrequests++;
#endif
- if (region_next_size_get(&arena->frag->sep) >= size) {
- if (fit) {
- size_t total_size;
+ if (total_size < size) {
+ /*
+ * Frag isn't large enough to service this request. Note that
+ * this is only possible for a large request, since the refill
+ * code always makes sure to refill frag if it's too small to
+ * service a current small request.
+ */
+ assert(size > bin_maxsize);
+ return (NULL);
+ }
- /*
- * Use frag, but try to use the beginning for
- * smaller regions, and the end for larger
- * regions. This reduces fragmentation in some
- * pathological use cases. It tends to group
- * short-lived (smaller) regions, which
- * increases the effectiveness of coalescing.
- */
+ if (fit) {
+ /*
+ * Use frag, but try to use the beginning for smaller regions,
+ * and the end for larger regions. This reduces fragmentation
+ * in some pathological use cases. It tends to group
+ * short-lived (smaller) regions, which increases the
+ * effectiveness of coalescing.
+ */
- total_size =
- region_next_size_get(&arena->frag->sep);
- assert(size % quantum == 0);
+ assert(size % quantum == 0);
- if (total_size - size >= QUANTUM_CEILING(
- sizeof(region_small_sizer_t))) {
- if (size <= bin_maxsize) {
- region_t *next;
+ if (total_size - size >=
+ QUANTUM_CEILING(sizeof(region_small_sizer_t))) {
+ if (size <= bin_maxsize) {
+ region_t *next;
- /*
- * Carve space from the
- * beginning of frag.
- */
+ /* Carve space from the beginning of frag. */
- /* ret. */
- ret = arena->frag;
- region_next_size_set(&ret->sep,
- size);
- assert(region_next_free_get(
- &ret->sep) == false);
+ /* ret. */
+ ret = arena->frag;
+ region_next_size_set(&ret->sep, size);
+ assert(region_next_free_get(&ret->sep)
+ == false);
- /* next. */
- next = (region_t *)&((char *)
- ret)[size];
- region_next_size_set(&next->sep,
- total_size - size);
- assert(size >=
- QUANTUM_CEILING(sizeof(
- region_small_sizer_t)));
- region_prev_free_unset(
- &next->sep);
- region_next_free_unset(
- &next->sep);
+ /* next. */
+ next = (region_t *)&((char *)ret)[size];
+ region_next_size_set(&next->sep,
+ total_size - size);
+ assert(size >= QUANTUM_CEILING(sizeof(
+ region_small_sizer_t)));
+ region_prev_free_unset(&next->sep);
+ region_next_free_unset(&next->sep);
- /* Update frag. */
- arena->frag = next;
- } else {
- region_t *prev;
- size_t prev_size;
+ /* Update frag. */
+ arena->frag = next;
+ } else {
+ region_t *prev;
+ size_t prev_size;
- /*
- * Carve space from the end of
- * frag.
- */
+ /* Carve space from the end of frag. */
- /* prev. */
- prev_size = total_size - size;
- prev = arena->frag;
- region_next_size_set(&prev->sep,
- prev_size);
- assert(prev_size >=
- QUANTUM_CEILING(sizeof(
- region_small_sizer_t)));
- assert(region_next_free_get(
- &prev->sep) == false);
+ /* prev. */
+ prev_size = total_size - size;
+ prev = arena->frag;
+ region_next_size_set(&prev->sep, prev_size);
+ assert(prev_size >= QUANTUM_CEILING(sizeof(
+ region_small_sizer_t)));
+ assert(region_next_free_get(&prev->sep)
+ == false);
- /* ret. */
- ret = (region_t *)&((char *)
- prev)[prev_size];
- region_next_size_set(&ret->sep,
- size);
- region_prev_free_unset(
- &ret->sep);
- region_next_free_unset(
- &ret->sep);
+ /* ret. */
+ ret = (region_t *)&((char *)prev)[prev_size];
+ region_next_size_set(&ret->sep, size);
+ region_prev_free_unset(&ret->sep);
+ region_next_free_unset(&ret->sep);
#ifdef MALLOC_DEBUG
- {
+ {
region_t *next;
/* next. */
@@ -2558,83 +2597,57 @@
[region_next_size_get(&ret->sep)];
assert(region_prev_free_get(&next->sep)
== false);
- }
+ }
#endif
- }
+ }
#ifdef MALLOC_STATS
- arena->stats.nsplit++;
+ arena->stats.nsplit++;
#endif
- } else {
- /*
- * frag is close enough to the right
- * size that there isn't enough room to
- * create a neighboring region.
- */
+ } else {
+ /*
+ * Frag is close enough to the right size that there
+ * isn't enough room to create a neighboring region.
+ */
- /* ret. */
- ret = arena->frag;
- arena->frag = NULL;
- assert(region_next_free_get(&ret->sep)
- == false);
+ /* ret. */
+ ret = arena->frag;
+ arena->frag = NULL;
+ assert(region_next_free_get(&ret->sep) == false);
#ifdef MALLOC_DEBUG
- {
- region_t *next;
+ {
+ region_t *next;
- /* next. */
- next = (region_t *)&((char *)
- ret)[region_next_size_get(
- &ret->sep)];
- assert(region_prev_free_get(
- &next->sep) == false);
- }
+ /* next. */
+ next = (region_t *)&((char *)ret)[total_size];
+ assert(region_prev_free_get(&next->sep)
+ == false);
+ }
#endif
- }
+ }
#ifdef MALLOC_STATS
- arena->stats.frag.nserviced++;
+ arena->stats.frag.nserviced++;
#endif
- } else {
- /* Don't fit to the allocation size. */
+ } else {
+ /* Don't fit to the allocation size. */
- /* ret. */
- ret = arena->frag;
>>> TRUNCATED FOR MAIL (1000 lines) <<<
More information about the p4-projects
mailing list