[Midnightbsd-cvs] src: libc/gen: Continue the merge, sync FreeBSD changes while keeping

laffer1 at midnightbsd.org laffer1 at midnightbsd.org
Sun Oct 19 19:43:51 EDT 2008


Log Message:
-----------
Continue the merge, sync FreeBSD changes while keeping enhancements

Modified Files:
--------------
    src/lib/libc/gen:
        Makefile.inc (r1.1.1.1 -> r1.2)
        __xuname.c (r1.2 -> r1.3)
        _pthread_stubs.c (r1.2 -> r1.3)
        _spinlock_stub.c (r1.2 -> r1.3)
        alarm.3 (r1.2 -> r1.3)
        alarm.c (r1.2 -> r1.3)
        arc4random.c (r1.2 -> r1.3)
        assert.c (r1.2 -> r1.3)
        basename.3 (r1.2 -> r1.3)
        clock.3 (r1.2 -> r1.3)
        clock.c (r1.2 -> r1.3)
        closedir.c (r1.2 -> r1.3)
        confstr.3 (r1.2 -> r1.3)
        confstr.c (r1.2 -> r1.3)
        crypt.c (r1.2 -> r1.3)
        ctermid.3 (r1.2 -> r1.3)
        ctermid.c (r1.2 -> r1.3)
        daemon.3 (r1.2 -> r1.3)
        daemon.c (r1.2 -> r1.3)
        devname.3 (r1.2 -> r1.3)
        devname.c (r1.2 -> r1.3)
        directory.3 (r1.2 -> r1.3)
        dirname.3 (r1.2 -> r1.3)
        disklabel.c (r1.2 -> r1.3)
        dlfcn.c (r1.2 -> r1.3)
        err.3 (r1.2 -> r1.3)
        err.c (r1.2 -> r1.3)
        errlst.c (r1.2 -> r1.3)
        exec.3 (r1.2 -> r1.3)
        exec.c (r1.2 -> r1.3)
        fnmatch.3 (r1.1.1.1 -> r1.2)
        fnmatch.c (r1.1.1.1 -> r1.2)
        frexp.3 (r1.1.1.1 -> r1.2)
        fstab.c (r1.1.1.1 -> r1.2)
        fts.3 (r1.1.1.1 -> r1.2)
        fts.c (r1.1.1.1 -> r1.2)
        ftw.3 (r1.1.1.1 -> r1.2)
        getbootfile.3 (r1.1.1.1 -> r1.2)
        getbootfile.c (r1.1.1.1 -> r1.2)
        getbsize.3 (r1.1.1.1 -> r1.2)
        getbsize.c (r1.1.1.1 -> r1.2)
        getcap.3 (r1.1.1.1 -> r1.2)
        getcap.c (r1.1.1.1 -> r1.2)
        getcwd.3 (r1.1.1.1 -> r1.2)
        getcwd.c (r1.1.1.1 -> r1.2)
        getdiskbyname.3 (r1.1.1.1 -> r1.2)
        getdomainname.3 (r1.1.1.1 -> r1.2)
        getdomainname.c (r1.1.1.1 -> r1.2)
        getfsent.3 (r1.1.1.1 -> r1.2)
        getgrent.3 (r1.1.1.1 -> r1.2)
        getgrent.c (r1.1.1.1 -> r1.2)
        getgrouplist.3 (r1.1.1.1 -> r1.2)
        getgrouplist.c (r1.1.1.1 -> r1.2)
        gethostname.3 (r1.1.1.1 -> r1.2)
        gethostname.c (r1.1.1.1 -> r1.2)
        getloadavg.3 (r1.1.1.1 -> r1.2)
        getloadavg.c (r1.1.1.1 -> r1.2)
        getlogin.c (r1.1.1.1 -> r1.2)
        getmntinfo.3 (r1.1.1.1 -> r1.2)
        getmntinfo.c (r1.1.1.1 -> r1.2)
        getnetgrent.3 (r1.1.1.1 -> r1.2)
        getnetgrent.c (r1.1.1.1 -> r1.2)
        getosreldate.3 (r1.1.1.1 -> r1.2)
        getosreldate.c (r1.1.1.1 -> r1.2)
        getpagesize.3 (r1.1.1.1 -> r1.2)
        getpagesize.c (r1.1.1.1 -> r1.2)
        getpass.3 (r1.1.1.1 -> r1.2)
        getpwent.3 (r1.1.1.1 -> r1.2)
        getpwent.c (r1.1.1.1 -> r1.2)
        getttyent.3 (r1.1.1.1 -> r1.2)
        getttyent.c (r1.1.1.1 -> r1.2)
        getusershell.3 (r1.1.1.1 -> r1.2)
        getusershell.c (r1.1.1.1 -> r1.2)
        getvfsbyname.3 (r1.1.1.1 -> r1.2)
        getvfsbyname.c (r1.1.1.1 -> r1.2)
        glob.3 (r1.1.1.1 -> r1.2)
        glob.c (r1.1.1.1 -> r1.2)
        initgroups.3 (r1.1.1.1 -> r1.2)
        initgroups.c (r1.1.1.1 -> r1.2)
        isatty.c (r1.1.1.1 -> r1.2)
        ldexp.3 (r1.1.1.1 -> r1.2)
        modf.3 (r1.1.1.1 -> r1.2)
        msgctl.3 (r1.1.1.1 -> r1.2)
        msgsnd.3 (r1.1.1.1 -> r1.2)
        nice.3 (r1.1.1.1 -> r1.2)
        nice.c (r1.1.1.1 -> r1.2)
        nlist.3 (r1.1.1.1 -> r1.2)
        nlist.c (r1.1.1.2 -> r1.2)
        opendir.c (r1.1.1.1 -> r1.2)
        pause.3 (r1.1.1.1 -> r1.2)
        pause.c (r1.1.1.1 -> r1.2)
        popen.3 (r1.1.1.1 -> r1.2)
        popen.c (r1.1.1.1 -> r1.2)
        psignal.3 (r1.1.1.1 -> r1.2)
        psignal.c (r1.1.1.1 -> r1.2)
        pw_scan.c (r1.1.1.1 -> r1.2)
        pw_scan.h (r1.1.1.1 -> r1.2)
        pwcache.3 (r1.1.1.1 -> r1.2)
        pwcache.c (r1.1.1.1 -> r1.2)
        raise.3 (r1.1.1.1 -> r1.2)
        raise.c (r1.1.1.1 -> r1.2)
        readdir.c (r1.3 -> r1.4)
        rewinddir.c (r1.1.1.1 -> r1.2)
        scandir.3 (r1.1.1.1 -> r1.2)
        scandir.c (r1.1.1.1 -> r1.2)
        seekdir.c (r1.1.1.1 -> r1.2)
        sem.c (r1.1.1.1 -> r1.2)
        sem_init.3 (r1.1.1.1 -> r1.2)
        sem_open.3 (r1.1.1.1 -> r1.2)
        sem_post.3 (r1.1.1.1 -> r1.2)
        sem_wait.3 (r1.1.1.1 -> r1.2)
        setdomainname.c (r1.1.1.1 -> r1.2)
        sethostname.c (r1.1.1.1 -> r1.2)
        setjmp.3 (r1.1.1.1 -> r1.2)
        setjmperr.c (r1.1.1.1 -> r1.2)
        setmode.3 (r1.1.1.1 -> r1.2)
        setmode.c (r1.1.1.1 -> r1.2)
        siginterrupt.3 (r1.1.1.1 -> r1.2)
        siginterrupt.c (r1.1.1.1 -> r1.2)
        siglist.c (r1.1.1.1 -> r1.2)
        signal.3 (r1.1.1.1 -> r1.2)
        signal.c (r1.1.1.1 -> r1.2)
        sigsetops.3 (r1.1.1.1 -> r1.2)
        sigsetops.c (r1.1.1.1 -> r1.2)
        sleep.3 (r1.1.1.1 -> r1.2)
        sleep.c (r1.1.1.1 -> r1.2)
        stringlist.c (r1.1.1.1 -> r1.2)
        strtofflags.3 (r1.1.1.1 -> r1.2)
        strtofflags.c (r1.1.1.1 -> r1.2)
        sysconf.3 (r1.1.1.1 -> r1.2)
        sysconf.c (r1.1.1.1 -> r1.2)
        sysctl.3 (r1.1.1.1 -> r1.2)
        sysctl.c (r1.1.1.1 -> r1.2)
        syslog.3 (r1.1.1.1 -> r1.2)
        syslog.c (r1.1.1.1 -> r1.2)
        tcgetpgrp.3 (r1.1.1.1 -> r1.2)
        tcsendbreak.3 (r1.1.1.1 -> r1.2)
        tcsetattr.3 (r1.1.1.1 -> r1.2)
        tcsetpgrp.3 (r1.2 -> r1.3)
        telldir.c (r1.2 -> r1.3)
        termios.c (r1.2 -> r1.3)
        time.3 (r1.2 -> r1.3)
        time.c (r1.2 -> r1.3)
        times.3 (r1.1.1.1 -> r1.2)
        times.c (r1.2 -> r1.3)
        timezone.3 (r1.2 -> r1.3)
        timezone.c (r1.2 -> r1.3)
        tls.c (r1.1.1.1 -> r1.2)
        ttyname.3 (r1.1.1.1 -> r1.2)
        ttyname.c (r1.2 -> r1.3)
        ttyslot.c (r1.2 -> r1.3)
        tzset.3 (r1.2 -> r1.3)
        ualarm.3 (r1.2 -> r1.3)
        ualarm.c (r1.2 -> r1.3)
        uname.3 (r1.2 -> r1.3)
        uname.c (r1.2 -> r1.3)
        unvis.3 (r1.2 -> r1.3)
        unvis.c (r1.2 -> r1.3)
        usleep.3 (r1.2 -> r1.3)
        usleep.c (r1.2 -> r1.3)
        utime.3 (r1.2 -> r1.3)
        utime.c (r1.2 -> r1.3)
        valloc.3 (r1.2 -> r1.3)
        valloc.c (r1.2 -> r1.3)
        vis.3 (r1.2 -> r1.3)
        vis.c (r1.2 -> r1.3)
        wait.c (r1.2 -> r1.3)
        wait3.c (r1.2 -> r1.3)
        waitpid.c (r1.2 -> r1.3)
        wordexp.3 (r1.1.1.1 -> r1.2)

Added Files:
-----------
    src/lib/libc/gen:
        Symbol.map (r1.1)
        __getosreldate.c (r1.1)
        fts-compat.c (r1.1)
        fts-compat.h (r1.1)

Removed Files:
-------------
    src/lib/libc/gen:
        getobjformat.3
        getobjformat.c

-------------- next part --------------
Index: wordexp.3
===================================================================
RCS file: /home/cvs/src/lib/libc/gen/wordexp.3,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L lib/libc/gen/wordexp.3 -L lib/libc/gen/wordexp.3 -u -r1.1.1.1 -r1.2
--- lib/libc/gen/wordexp.3
+++ lib/libc/gen/wordexp.3
@@ -23,7 +23,7 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.\" $FreeBSD: src/lib/libc/gen/wordexp.3,v 1.8 2004/07/28 15:43:33 tjr Exp $
+.\" $FreeBSD: src/lib/libc/gen/wordexp.3,v 1.9 2006/04/18 21:37:24 ceri Exp $
 .\"
 .Dd July 29, 2004
 .Dt WORDEXP 3
@@ -167,7 +167,7 @@
 wordexp_t we;
 
 wordexp("${EDITOR:-vi} *.c /etc/motd", &we, 0);
-execvp(we->we_wordv[0], we->we_wordv);
+execvp(we.we_wordv[0], we.we_wordv);
 .Ed
 .Sh DIAGNOSTICS
 Diagnostic messages from the shell are written to the standard error output
Index: rewinddir.c
===================================================================
RCS file: /home/cvs/src/lib/libc/gen/rewinddir.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L lib/libc/gen/rewinddir.c -L lib/libc/gen/rewinddir.c -u -r1.1.1.1 -r1.2
--- lib/libc/gen/rewinddir.c
+++ lib/libc/gen/rewinddir.c
@@ -10,10 +10,6 @@
  * 2. Redistributions in binary form must reproduce the above copyright
  *    notice, this list of conditions and the following disclaimer in the
  *    documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- *    must display the following acknowledgement:
- *	This product includes software developed by the University of
- *	California, Berkeley and its contributors.
  * 4. Neither the name of the University nor the names of its contributors
  *    may be used to endorse or promote products derived from this software
  *    without specific prior written permission.
@@ -35,7 +31,7 @@
 static char sccsid[] = "@(#)rewinddir.c	8.1 (Berkeley) 6/8/93";
 #endif /* LIBC_SCCS and not lint */
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/gen/rewinddir.c,v 1.5 2002/02/01 00:57:29 obrien Exp $");
+__FBSDID("$FreeBSD: src/lib/libc/gen/rewinddir.c,v 1.6 2007/01/09 00:27:55 imp Exp $");
 
 #include <sys/types.h>
 #include <dirent.h>
Index: nice.3
===================================================================
RCS file: /home/cvs/src/lib/libc/gen/nice.3,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L lib/libc/gen/nice.3 -L lib/libc/gen/nice.3 -u -r1.1.1.1 -r1.2
--- lib/libc/gen/nice.3
+++ lib/libc/gen/nice.3
@@ -9,10 +9,6 @@
 .\" 2. Redistributions in binary form must reproduce the above copyright
 .\"    notice, this list of conditions and the following disclaimer in the
 .\"    documentation and/or other materials provided with the distribution.
-.\" 3. All advertising materials mentioning features or use of this software
-.\"    must display the following acknowledgement:
-.\"	This product includes software developed by the University of
-.\"	California, Berkeley and its contributors.
 .\" 4. Neither the name of the University nor the names of its contributors
 .\"    may be used to endorse or promote products derived from this software
 .\"    without specific prior written permission.
@@ -30,7 +26,7 @@
 .\" SUCH DAMAGE.
 .\"
 .\"     @(#)nice.3	8.1 (Berkeley) 6/4/93
-.\" $FreeBSD: src/lib/libc/gen/nice.3,v 1.11 2001/10/01 16:08:51 ru Exp $
+.\" $FreeBSD: src/lib/libc/gen/nice.3,v 1.12 2007/01/09 00:27:54 imp Exp $
 .\"
 .Dd June 4, 1993
 .Dt NICE 3
Index: utime.c
===================================================================
RCS file: /home/cvs/src/lib/libc/gen/utime.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -L lib/libc/gen/utime.c -L lib/libc/gen/utime.c -u -r1.2 -r1.3
--- lib/libc/gen/utime.c
+++ lib/libc/gen/utime.c
@@ -31,7 +31,7 @@
 static char sccsid[] = "@(#)utime.c	8.1 (Berkeley) 6/4/93";
 #endif /* LIBC_SCCS and not lint */
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/gen/utime.c,v 1.2 2002/03/22 21:52:05 obrien Exp $");
+__FBSDID("$FreeBSD: src/lib/libc/gen/utime.c,v 1.3 2007/01/09 00:27:56 imp Exp $");
 
 #include <sys/time.h>
 
Index: getusershell.c
===================================================================
RCS file: /home/cvs/src/lib/libc/gen/getusershell.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L lib/libc/gen/getusershell.c -L lib/libc/gen/getusershell.c -u -r1.1.1.1 -r1.2
--- lib/libc/gen/getusershell.c
+++ lib/libc/gen/getusershell.c
@@ -10,10 +10,6 @@
  * 2. Redistributions in binary form must reproduce the above copyright
  *    notice, this list of conditions and the following disclaimer in the
  *    documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- *    must display the following acknowledgement:
- *	This product includes software developed by the University of
- *	California, Berkeley and its contributors.
  * 4. Neither the name of the University nor the names of its contributors
  *    may be used to endorse or promote products derived from this software
  *    without specific prior written permission.
@@ -36,7 +32,7 @@
 #endif /* LIBC_SCCS and not lint */
 /*	$NetBSD: getusershell.c,v 1.17 1999/01/25 01:09:34 lukem Exp $	*/
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/gen/getusershell.c,v 1.9 2003/04/24 20:16:21 nectar Exp $");
+__FBSDID("$FreeBSD: src/lib/libc/gen/getusershell.c,v 1.10 2007/01/09 00:27:54 imp Exp $");
 
 #include "namespace.h"
 #include <sys/param.h>
Index: times.c
===================================================================
RCS file: /home/cvs/src/lib/libc/gen/times.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -L lib/libc/gen/times.c -L lib/libc/gen/times.c -u -r1.2 -r1.3
--- lib/libc/gen/times.c
+++ lib/libc/gen/times.c
@@ -31,7 +31,7 @@
 static char sccsid[] = "@(#)times.c	8.1 (Berkeley) 6/4/93";
 #endif /* LIBC_SCCS and not lint */
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/gen/times.c,v 1.3 2005/03/08 08:12:35 phk Exp $");
+__FBSDID("$FreeBSD: src/lib/libc/gen/times.c,v 1.4 2007/01/09 00:27:55 imp Exp $");
 
 #include <sys/param.h>
 #include <sys/time.h>
Index: getvfsbyname.c
===================================================================
RCS file: /home/cvs/src/lib/libc/gen/getvfsbyname.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L lib/libc/gen/getvfsbyname.c -L lib/libc/gen/getvfsbyname.c -u -r1.1.1.1 -r1.2
--- lib/libc/gen/getvfsbyname.c
+++ lib/libc/gen/getvfsbyname.c
@@ -10,10 +10,6 @@
  * 2. Redistributions in binary form must reproduce the above copyright
  *    notice, this list of conditions and the following disclaimer in the
  *    documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- *    must display the following acknowledgement:
- *	This product includes software developed by the University of
- *	California, Berkeley and its contributors.
  * 4. Neither the name of the University nor the names of its contributors
  *    may be used to endorse or promote products derived from this software
  *    without specific prior written permission.
@@ -35,7 +31,7 @@
 static char sccsid[] = "@(#)kvm_getvfsbyname.c	8.1 (Berkeley) 4/3/95";
 #endif /* LIBC_SCCS and not lint */
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/gen/getvfsbyname.c,v 1.10 2003/10/29 10:45:01 tjr Exp $");
+__FBSDID("$FreeBSD: src/lib/libc/gen/getvfsbyname.c,v 1.11 2007/01/09 00:27:54 imp Exp $");
 
 #include <sys/param.h>
 #include <sys/mount.h>
Index: getcwd.c
===================================================================
RCS file: /home/cvs/src/lib/libc/gen/getcwd.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L lib/libc/gen/getcwd.c -L lib/libc/gen/getcwd.c -u -r1.1.1.1 -r1.2
--- lib/libc/gen/getcwd.c
+++ lib/libc/gen/getcwd.c
@@ -10,10 +10,6 @@
  * 2. Redistributions in binary form must reproduce the above copyright
  *    notice, this list of conditions and the following disclaimer in the
  *    documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- *    must display the following acknowledgement:
- *	This product includes software developed by the University of
- *	California, Berkeley and its contributors.
  * 4. Neither the name of the University nor the names of its contributors
  *    may be used to endorse or promote products derived from this software
  *    without specific prior written permission.
@@ -35,7 +31,7 @@
 static char sccsid[] = "@(#)getcwd.c	8.5 (Berkeley) 2/7/95";
 #endif /* LIBC_SCCS and not lint */
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/gen/getcwd.c,v 1.25.10.1 2005/10/04 14:33:09 ache Exp $");
+__FBSDID("$FreeBSD: src/lib/libc/gen/getcwd.c,v 1.29 2007/01/09 00:27:53 imp Exp $");
 
 #include "namespace.h"
 #include <sys/param.h>
Index: confstr.3
===================================================================
RCS file: /home/cvs/src/lib/libc/gen/confstr.3,v
retrieving revision 1.2
retrieving revision 1.3
diff -L lib/libc/gen/confstr.3 -L lib/libc/gen/confstr.3 -u -r1.2 -r1.3
--- lib/libc/gen/confstr.3
+++ lib/libc/gen/confstr.3
@@ -26,10 +26,9 @@
 .\" SUCH DAMAGE.
 .\"
 .\"	@(#)confstr.3	8.1 (Berkeley) 6/4/93
-.\" $FreeBSD: src/lib/libc/gen/confstr.3,v 1.13 2003/09/08 19:57:14 ru Exp $
-.\" $MidnightBSD$
+.\" $FreeBSD: src/lib/libc/gen/confstr.3,v 1.15 2007/01/09 00:27:53 imp Exp $
 .\"
-.Dd June 18, 2001
+.Dd December 3, 2006
 .Dt CONFSTR 3
 .Os
 .Sh NAME
@@ -89,7 +88,7 @@
 .Sh RETURN VALUES
 If the call to
 .Fn confstr
-is not successful, \-1 is returned and
+is not successful, 0 is returned and
 .Va errno
 is set appropriately.
 Otherwise, if the variable does not have a configuration defined value,
--- /dev/null
+++ lib/libc/gen/fts-compat.h
@@ -0,0 +1,145 @@
+/*
+ * Copyright (c) 1989, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *	This product includes software developed by the University of
+ *	California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)fts.h	8.3 (Berkeley) 8/14/94
+ * $FreeBSD: src/lib/libc/gen/fts-compat.h,v 1.12 2007/08/23 05:09:31 yar Exp $
+ */
+
+#ifndef	_FTS_H_
+#define	_FTS_H_
+
+typedef struct {
+	struct _ftsent *fts_cur;	/* current node */
+	struct _ftsent *fts_child;	/* linked list of children */
+	struct _ftsent **fts_array;	/* sort array */
+	dev_t fts_dev;			/* starting device # */
+	char *fts_path;			/* path for this descent */
+	int fts_rfd;			/* fd for root */
+	int fts_pathlen;		/* sizeof(path) */
+	int fts_nitems;			/* elements in the sort array */
+	int (*fts_compar)		/* compare function */
+	    (const struct _ftsent * const *, const struct _ftsent * const *);
+
+#define	FTS_COMFOLLOW	0x001		/* follow command line symlinks */
+#define	FTS_LOGICAL	0x002		/* logical walk */
+#define	FTS_NOCHDIR	0x004		/* don't change directories */
+#define	FTS_NOSTAT	0x008		/* don't get stat info */
+#define	FTS_PHYSICAL	0x010		/* physical walk */
+#define	FTS_SEEDOT	0x020		/* return dot and dot-dot */
+#define	FTS_XDEV	0x040		/* don't cross devices */
+#define	FTS_WHITEOUT	0x080		/* return whiteout information */
+#define	FTS_OPTIONMASK	0x0ff		/* valid user option mask */
+
+#define	FTS_NAMEONLY	0x100		/* (private) child names only */
+#define	FTS_STOP	0x200		/* (private) unrecoverable error */
+	int fts_options;		/* fts_open options, global flags */
+	void *fts_clientptr;		/* thunk for sort function */
+} FTS;
+
+typedef struct _ftsent {
+	struct _ftsent *fts_cycle;	/* cycle node */
+	struct _ftsent *fts_parent;	/* parent directory */
+	struct _ftsent *fts_link;	/* next file in directory */
+	union {
+		struct {
+			long __fts_number;	/* local numeric value */
+			void *__fts_pointer;	/* local address value */
+		} __struct_ftsent;
+		int64_t __fts_bignum;
+	} __union_ftsent;
+#define	fts_number	__union_ftsent.__struct_ftsent.__fts_number
+#define	fts_pointer	__union_ftsent.__struct_ftsent.__fts_pointer
+#define	fts_bignum	__union_ftsent.__fts_bignum
+	char *fts_accpath;		/* access path */
+	char *fts_path;			/* root path */
+	int fts_errno;			/* errno for this node */
+	int fts_symfd;			/* fd for symlink */
+	u_short fts_pathlen;		/* strlen(fts_path) */
+	u_short fts_namelen;		/* strlen(fts_name) */
+
+	ino_t fts_ino;			/* inode */
+	dev_t fts_dev;			/* device */
+	nlink_t fts_nlink;		/* link count */
+
+#define	FTS_ROOTPARENTLEVEL	-1
+#define	FTS_ROOTLEVEL		 0
+	short fts_level;		/* depth (-1 to N) */
+
+#define	FTS_D		 1		/* preorder directory */
+#define	FTS_DC		 2		/* directory that causes cycles */
+#define	FTS_DEFAULT	 3		/* none of the above */
+#define	FTS_DNR		 4		/* unreadable directory */
+#define	FTS_DOT		 5		/* dot or dot-dot */
+#define	FTS_DP		 6		/* postorder directory */
+#define	FTS_ERR		 7		/* error; errno is set */
+#define	FTS_F		 8		/* regular file */
+#define	FTS_INIT	 9		/* initialized only */
+#define	FTS_NS		10		/* stat(2) failed */
+#define	FTS_NSOK	11		/* no stat(2) requested */
+#define	FTS_SL		12		/* symbolic link */
+#define	FTS_SLNONE	13		/* symbolic link without target */
+#define	FTS_W		14		/* whiteout object */
+	u_short fts_info;		/* user flags for FTSENT structure */
+
+#define	FTS_DONTCHDIR	 0x01		/* don't chdir .. to the parent */
+#define	FTS_SYMFOLLOW	 0x02		/* followed a symlink to get here */
+#define	FTS_ISW		 0x04		/* this is a whiteout object */
+	u_short fts_flags;		/* private flags for FTSENT structure */
+
+#define	FTS_AGAIN	 1		/* read node again */
+#define	FTS_FOLLOW	 2		/* follow symbolic link */
+#define	FTS_NOINSTR	 3		/* no instructions */
+#define	FTS_SKIP	 4		/* discard node */
+	u_short fts_instr;		/* fts_set() instructions */
+
+	struct stat *fts_statp;		/* stat(2) information */
+	char *fts_name;			/* file name */
+	FTS *fts_fts;			/* back pointer to main FTS */
+} FTSENT;
+
+#include <sys/cdefs.h>
+
+__BEGIN_DECLS
+FTSENT	*fts_children(FTS *, int);
+int	 fts_close(FTS *);
+void	*fts_get_clientptr(FTS *);
+#define	 fts_get_clientptr(fts)	((fts)->fts_clientptr)
+FTS	*fts_get_stream(FTSENT *);
+#define	 fts_get_stream(ftsent)	((ftsent)->fts_fts)
+FTS	*fts_open(char * const *, int,
+	    int (*)(const FTSENT * const *, const FTSENT * const *));
+FTSENT	*fts_read(FTS *);
+int	 fts_set(FTS *, FTSENT *, int);
+void	 fts_set_clientptr(FTS *, void *);
+__END_DECLS
+
+#endif /* !_FTS_H_ */
Index: unvis.c
===================================================================
RCS file: /home/cvs/src/lib/libc/gen/unvis.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -L lib/libc/gen/unvis.c -L lib/libc/gen/unvis.c -u -r1.2 -r1.3
--- lib/libc/gen/unvis.c
+++ lib/libc/gen/unvis.c
@@ -31,7 +31,7 @@
 static char sccsid[] = "@(#)unvis.c	8.1 (Berkeley) 6/4/93";
 #endif /* LIBC_SCCS and not lint */
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/gen/unvis.c,v 1.9 2004/08/02 08:46:23 stefanf Exp $");
+__FBSDID("$FreeBSD: src/lib/libc/gen/unvis.c,v 1.10 2007/01/09 00:27:56 imp Exp $");
 
 #include <sys/types.h>
 #include <ctype.h>
Index: pwcache.c
===================================================================
RCS file: /home/cvs/src/lib/libc/gen/pwcache.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L lib/libc/gen/pwcache.c -L lib/libc/gen/pwcache.c -u -r1.1.1.1 -r1.2
--- lib/libc/gen/pwcache.c
+++ lib/libc/gen/pwcache.c
@@ -10,10 +10,6 @@
  * 2. Redistributions in binary form must reproduce the above copyright
  *    notice, this list of conditions and the following disclaimer in the
  *    documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- *    must display the following acknowledgement:
- *	This product includes software developed by the University of
- *	California, Berkeley and its contributors.
  * 4. Neither the name of the University nor the names of its contributors
  *    may be used to endorse or promote products derived from this software
  *    without specific prior written permission.
@@ -35,7 +31,7 @@
 static char sccsid[] = "@(#)pwcache.c	8.1 (Berkeley) 6/4/93";
 #endif /* LIBC_SCCS and not lint */
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/gen/pwcache.c,v 1.10 2002/03/22 02:35:47 imp Exp $");
+__FBSDID("$FreeBSD: src/lib/libc/gen/pwcache.c,v 1.11 2007/01/09 00:27:55 imp Exp $");
 
 #include <sys/types.h>
 
Index: msgsnd.3
===================================================================
RCS file: /home/cvs/src/lib/libc/gen/msgsnd.3,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L lib/libc/gen/msgsnd.3 -L lib/libc/gen/msgsnd.3 -u -r1.1.1.1 -r1.2
--- lib/libc/gen/msgsnd.3
+++ lib/libc/gen/msgsnd.3
@@ -29,9 +29,9 @@
 .\" (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/lib/libc/gen/msgsnd.3,v 1.20 2005/01/20 09:17:02 ru Exp $
+.\" $FreeBSD: src/lib/libc/gen/msgsnd.3,v 1.21 2006/10/12 11:42:41 ru Exp $
 .\"
-.Dd November 24, 1997
+.Dd October 12, 2006
 .Dt MSGSND 3
 .Os
 .Sh NAME
@@ -65,8 +65,13 @@
 is an integer greater than 0 that can be used for selecting messages (see
 .Xr msgrcv 3 ) ,
 .Va mtext
-is an array of bytes, with a size up to that of the system limit
-.Pf ( Dv MSGMAX ) .
+is an array of
+.Fa msgsz
+bytes.
+The argument
+.Fa msgsz
+can range from 0 to a system-imposed maximum,
+.Dv MSGMAX .
 .Pp
 If the number of bytes already on the message queue plus
 .Fa msgsz
@@ -144,7 +149,7 @@
 The
 .Fa msgsz
 argument
-is less than 0, or greater than
+is greater than
 .Va msg_qbytes .
 .Pp
 The
Index: stringlist.c
===================================================================
RCS file: /home/cvs/src/lib/libc/gen/stringlist.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L lib/libc/gen/stringlist.c -L lib/libc/gen/stringlist.c -u -r1.1.1.1 -r1.2
--- lib/libc/gen/stringlist.c
+++ lib/libc/gen/stringlist.c
@@ -10,9 +10,6 @@
  * 2. Redistributions in binary form must reproduce the above copyright
  *    notice, this list of conditions and the following disclaimer in the
  *    documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- *    must display the following acknowledgement:
- *	This product includes software developed by Christos Zoulas.
  * 4. The name of the author may not be used to endorse or promote products
  *    derived from this software without specific prior written permission.
  *
@@ -33,7 +30,7 @@
 static char *rcsid = "$NetBSD: stringlist.c,v 1.2 1997/01/17 07:26:20 lukem Exp $";
 #endif /* LIBC_SCCS and not lint */
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/gen/stringlist.c,v 1.7 2003/01/19 01:16:01 obrien Exp $");
+__FBSDID("$FreeBSD: src/lib/libc/gen/stringlist.c,v 1.8 2007/01/09 00:27:55 imp Exp $");
 
 #include "namespace.h"
 #include <stdio.h>
Index: time.c
===================================================================
RCS file: /home/cvs/src/lib/libc/gen/time.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -L lib/libc/gen/time.c -L lib/libc/gen/time.c -u -r1.2 -r1.3
--- lib/libc/gen/time.c
+++ lib/libc/gen/time.c
@@ -31,7 +31,7 @@
 static char sccsid[] = "@(#)time.c	8.1 (Berkeley) 6/4/93";
 #endif /* LIBC_SCCS and not lint */
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/gen/time.c,v 1.4 2003/07/19 02:53:46 wollman Exp $");
+__FBSDID("$FreeBSD: src/lib/libc/gen/time.c,v 1.5 2007/01/09 00:27:55 imp Exp $");
 
 #include <sys/types.h>
 #include <sys/time.h>
Index: getvfsbyname.3
===================================================================
RCS file: /home/cvs/src/lib/libc/gen/getvfsbyname.3,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L lib/libc/gen/getvfsbyname.3 -L lib/libc/gen/getvfsbyname.3 -u -r1.1.1.1 -r1.2
--- lib/libc/gen/getvfsbyname.3
+++ lib/libc/gen/getvfsbyname.3
@@ -9,10 +9,6 @@
 .\" 2. Redistributions in binary form must reproduce the above copyright
 .\"    notice, this list of conditions and the following disclaimer in the
 .\"    documentation and/or other materials provided with the distribution.
-.\" 3. All advertising materials mentioning features or use of this software
-.\"    must display the following acknowledgement:
-.\"	This product includes software developed by the University of
-.\"	California, Berkeley and its contributors.
 .\" 4. Neither the name of the University nor the names of its contributors
 .\"    may be used to endorse or promote products derived from this software
 .\"    without specific prior written permission.
@@ -30,9 +26,9 @@
 .\" SUCH DAMAGE.
 .\"
 .\"     @(#)kvm_getvfsbyname.3	8.3 (Berkeley) 5/4/95
-.\" $FreeBSD: src/lib/libc/gen/getvfsbyname.3,v 1.15 2002/12/19 09:40:21 ru Exp $
+.\" $FreeBSD: src/lib/libc/gen/getvfsbyname.3,v 1.18 2007/04/05 21:17:52 pjd Exp $
 .\"
-.Dd May 4, 1995
+.Dd April 5, 2007
 .Dt GETVFSBYNAME 3
 .Os
 .Sh NAME
@@ -85,6 +81,11 @@
 aliases some other mounted FS
 .It Dv VFCF_UNICODE
 stores file names as Unicode
+.It Dv VFCF_JAIL
+can be mounted from within a jail if
+.Va security.jail.mount_allowed
+sysctl is set to
+.Dv 1 .
 .El
 .Sh RETURN VALUES
 .Rv -std getvfsbyname
@@ -103,8 +104,10 @@
 specifies a file system that is unknown or not configured in the kernel.
 .El
 .Sh SEE ALSO
+.Xr jail 2 ,
 .Xr mount 2 ,
 .Xr sysctl 3 ,
+.Xr jail 8 ,
 .Xr mount 8 ,
 .Xr sysctl 8
 .Sh HISTORY
Index: alarm.c
===================================================================
RCS file: /home/cvs/src/lib/libc/gen/alarm.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -L lib/libc/gen/alarm.c -L lib/libc/gen/alarm.c -u -r1.2 -r1.3
--- lib/libc/gen/alarm.c
+++ lib/libc/gen/alarm.c
@@ -27,10 +27,11 @@
  * SUCH DAMAGE.
  */
 
-/* static char sccsid[] = "@(#)alarm.c	8.1 (Berkeley) 6/4/93"; */
+#if defined(LIBC_SCCS) && !defined(lint)
+static char sccsid[] = "@(#)alarm.c	8.1 (Berkeley) 6/4/93";
+#endif /* LIBC_SCCS and not lint */
 #include <sys/cdefs.h>
-/*__FBSDID("$FreeBSD: src/lib/libc/gen/alarm.c,v 1.2 2002/02/01 01:08:47 obrien Exp $");*/
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: src/lib/libc/gen/alarm.c,v 1.3 2007/01/09 00:27:53 imp Exp $");
 
 /*
  * Backwards compatible alarm.
Index: psignal.c
===================================================================
RCS file: /home/cvs/src/lib/libc/gen/psignal.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L lib/libc/gen/psignal.c -L lib/libc/gen/psignal.c -u -r1.1.1.1 -r1.2
--- lib/libc/gen/psignal.c
+++ lib/libc/gen/psignal.c
@@ -10,10 +10,6 @@
  * 2. Redistributions in binary form must reproduce the above copyright
  *    notice, this list of conditions and the following disclaimer in the
  *    documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- *    must display the following acknowledgement:
- *	This product includes software developed by the University of
- *	California, Berkeley and its contributors.
  * 4. Neither the name of the University nor the names of its contributors
  *    may be used to endorse or promote products derived from this software
  *    without specific prior written permission.
@@ -35,7 +31,7 @@
 static char sccsid[] = "@(#)psignal.c	8.1 (Berkeley) 6/4/93";
 #endif /* LIBC_SCCS and not lint */
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/gen/psignal.c,v 1.7 2002/02/01 01:08:48 obrien Exp $");
+__FBSDID("$FreeBSD: src/lib/libc/gen/psignal.c,v 1.8 2007/01/09 00:27:54 imp Exp $");
 
 /*
  * Print the name of the signal indicated
Index: wait3.c
===================================================================
RCS file: /home/cvs/src/lib/libc/gen/wait3.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -L lib/libc/gen/wait3.c -L lib/libc/gen/wait3.c -u -r1.2 -r1.3
--- lib/libc/gen/wait3.c
+++ lib/libc/gen/wait3.c
@@ -31,7 +31,7 @@
 static char sccsid[] = "@(#)wait3.c	8.1 (Berkeley) 6/4/93";
 #endif /* LIBC_SCCS and not lint */
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/gen/wait3.c,v 1.3 2002/02/01 00:57:29 obrien Exp $");
+__FBSDID("$FreeBSD: src/lib/libc/gen/wait3.c,v 1.4 2007/01/09 00:27:56 imp Exp $");
 
 #include "namespace.h"
 #include <sys/types.h>
Index: signal.3
===================================================================
RCS file: /home/cvs/src/lib/libc/gen/signal.3,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L lib/libc/gen/signal.3 -L lib/libc/gen/signal.3 -u -r1.1.1.1 -r1.2
--- lib/libc/gen/signal.3
+++ lib/libc/gen/signal.3
@@ -9,10 +9,6 @@
 .\" 2. Redistributions in binary form must reproduce the above copyright
 .\"    notice, this list of conditions and the following disclaimer in the
 .\"    documentation and/or other materials provided with the distribution.
-.\" 3. All advertising materials mentioning features or use of this software
-.\"    must display the following acknowledgement:
-.\"	This product includes software developed by the University of
-.\"	California, Berkeley and its contributors.
 .\" 4. Neither the name of the University nor the names of its contributors
 .\"    may be used to endorse or promote products derived from this software
 .\"    without specific prior written permission.
@@ -30,7 +26,7 @@
 .\" SUCH DAMAGE.
 .\"
 .\"     @(#)signal.3	8.3 (Berkeley) 4/19/94
-.\" $FreeBSD: src/lib/libc/gen/signal.3,v 1.40 2004/12/29 19:40:56 keramida Exp $
+.\" $FreeBSD: src/lib/libc/gen/signal.3,v 1.42 2007/01/09 00:27:55 imp Exp $
 .\"
 .Dd June 7, 2004
 .Dt SIGNAL 3
@@ -60,6 +56,7 @@
 .Fx Ap s
 equivalent but easier to read typedef'd version:
 .Ft typedef "void \*(lp*sig_t\*(rp \*(lpint\*(rp" ;
+.Pp
 .Ft sig_t
 .Fn signal "int sig" "sig_t func"
 .Sh DESCRIPTION
--- lib/libc/gen/getobjformat.c
+++ /dev/null
@@ -1,44 +0,0 @@
-/*-
- * Copyright (c) 1998 John D. Polstra
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/gen/getobjformat.c,v 1.7 2002/09/17 01:48:50 peter Exp $");
-
-#include <sys/param.h>
-#include <objformat.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-int
-getobjformat(char *buf, size_t bufsize, int *argcp, char **argv)
-{
-
-	if (bufsize < 4)
-		return -1;
-	strcpy(buf, "elf");
-	return 3;
-}
Index: sigsetops.c
===================================================================
RCS file: /home/cvs/src/lib/libc/gen/sigsetops.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L lib/libc/gen/sigsetops.c -L lib/libc/gen/sigsetops.c -u -r1.1.1.1 -r1.2
--- lib/libc/gen/sigsetops.c
+++ lib/libc/gen/sigsetops.c
@@ -10,10 +10,6 @@
  * 2. Redistributions in binary form must reproduce the above copyright
  *    notice, this list of conditions and the following disclaimer in the
  *    documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- *    must display the following acknowledgement:
- *	This product includes software developed by the University of
- *	California, Berkeley and its contributors.
  * 4. Neither the name of the University nor the names of its contributors
  *    may be used to endorse or promote products derived from this software
  *    without specific prior written permission.
@@ -37,7 +33,7 @@
 static char sccsid[] = "@(#)sigsetops.c	8.1 (Berkeley) 6/4/93";
 #endif /* LIBC_SCCS and not lint */
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/gen/sigsetops.c,v 1.8 2002/02/01 00:57:29 obrien Exp $");
+__FBSDID("$FreeBSD: src/lib/libc/gen/sigsetops.c,v 1.9 2007/01/09 00:27:55 imp Exp $");
 
 #include <errno.h>
 #include <signal.h>
Index: getnetgrent.3
===================================================================
RCS file: /home/cvs/src/lib/libc/gen/getnetgrent.3,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L lib/libc/gen/getnetgrent.3 -L lib/libc/gen/getnetgrent.3 -u -r1.1.1.1 -r1.2
--- lib/libc/gen/getnetgrent.3
+++ lib/libc/gen/getnetgrent.3
@@ -9,10 +9,6 @@
 .\" 2. Redistributions in binary form must reproduce the above copyright
 .\"    notice, this list of conditions and the following disclaimer in the
 .\"    documentation and/or other materials provided with the distribution.
-.\" 3. All advertising materials mentioning features or use of this software
-.\"    must display the following acknowledgement:
-.\"	This product includes software developed by the University of
-.\"	California, Berkeley and its contributors.
 .\" 4. Neither the name of the University nor the names of its contributors
 .\"    may be used to endorse or promote products derived from this software
 .\"    without specific prior written permission.
@@ -30,7 +26,7 @@
 .\" SUCH DAMAGE.
 .\"
 .\"     @(#)getnetgrent.3	8.1 (Berkeley) 6/4/93
-.\" $FreeBSD: src/lib/libc/gen/getnetgrent.3,v 1.12 2005/01/20 09:17:02 ru Exp $
+.\" $FreeBSD: src/lib/libc/gen/getnetgrent.3,v 1.13 2007/01/09 00:27:54 imp Exp $
 .\"
 .Dd June 4, 1993
 .Dt GETNETGRENT 3
Index: scandir.c
===================================================================
RCS file: /home/cvs/src/lib/libc/gen/scandir.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L lib/libc/gen/scandir.c -L lib/libc/gen/scandir.c -u -r1.1.1.1 -r1.2
--- lib/libc/gen/scandir.c
+++ lib/libc/gen/scandir.c
@@ -10,10 +10,6 @@
  * 2. Redistributions in binary form must reproduce the above copyright
  *    notice, this list of conditions and the following disclaimer in the
  *    documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- *    must display the following acknowledgement:
- *	This product includes software developed by the University of
- *	California, Berkeley and its contributors.
  * 4. Neither the name of the University nor the names of its contributors
  *    may be used to endorse or promote products derived from this software
  *    without specific prior written permission.
@@ -35,7 +31,7 @@
 static char sccsid[] = "@(#)scandir.c	8.3 (Berkeley) 1/2/94";
 #endif /* LIBC_SCCS and not lint */
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/gen/scandir.c,v 1.7 2002/02/01 01:32:19 obrien Exp $");
+__FBSDID("$FreeBSD: src/lib/libc/gen/scandir.c,v 1.8 2007/01/09 00:27:55 imp Exp $");
 
 /*
  * Scan the directory dirname calling select to make a list of selected
Index: nlist.3
===================================================================
RCS file: /home/cvs/src/lib/libc/gen/nlist.3,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L lib/libc/gen/nlist.3 -L lib/libc/gen/nlist.3 -u -r1.1.1.1 -r1.2
--- lib/libc/gen/nlist.3
+++ lib/libc/gen/nlist.3
@@ -9,10 +9,6 @@
 .\" 2. Redistributions in binary form must reproduce the above copyright
 .\"    notice, this list of conditions and the following disclaimer in the
 .\"    documentation and/or other materials provided with the distribution.
-.\" 3. All advertising materials mentioning features or use of this software
-.\"    must display the following acknowledgement:
-.\"	This product includes software developed by the University of
-.\"	California, Berkeley and its contributors.
 .\" 4. Neither the name of the University nor the names of its contributors
 .\"    may be used to endorse or promote products derived from this software
 .\"    without specific prior written permission.
@@ -30,7 +26,7 @@
 .\" SUCH DAMAGE.
 .\"
 .\"     @(#)nlist.3	8.3 (Berkeley) 4/19/94
-.\" $FreeBSD: src/lib/libc/gen/nlist.3,v 1.7 2001/10/01 16:08:51 ru Exp $
+.\" $FreeBSD: src/lib/libc/gen/nlist.3,v 1.8 2007/01/09 00:27:54 imp Exp $
 .\"
 .Dd April 19, 1994
 .Dt NLIST 3
Index: getmntinfo.3
===================================================================
RCS file: /home/cvs/src/lib/libc/gen/getmntinfo.3,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L lib/libc/gen/getmntinfo.3 -L lib/libc/gen/getmntinfo.3 -u -r1.1.1.1 -r1.2
--- lib/libc/gen/getmntinfo.3
+++ lib/libc/gen/getmntinfo.3
@@ -9,10 +9,6 @@
 .\" 2. Redistributions in binary form must reproduce the above copyright
 .\"    notice, this list of conditions and the following disclaimer in the
 .\"    documentation and/or other materials provided with the distribution.
-.\" 3. All advertising materials mentioning features or use of this software
-.\"    must display the following acknowledgement:
-.\"	This product includes software developed by the University of
-.\"	California, Berkeley and its contributors.
 .\" 4. Neither the name of the University nor the names of its contributors
 .\"    may be used to endorse or promote products derived from this software
 .\"    without specific prior written permission.
@@ -30,7 +26,7 @@
 .\" SUCH DAMAGE.
 .\"
 .\"     @(#)getmntinfo.3	8.1 (Berkeley) 6/9/93
-.\" $FreeBSD: src/lib/libc/gen/getmntinfo.3,v 1.12 2002/12/19 09:40:21 ru Exp $
+.\" $FreeBSD: src/lib/libc/gen/getmntinfo.3,v 1.13 2007/01/09 00:27:54 imp Exp $
 .\"
 .Dd June 9, 1993
 .Dt GETMNTINFO 3
Index: frexp.3
===================================================================
RCS file: /home/cvs/src/lib/libc/gen/frexp.3,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L lib/libc/gen/frexp.3 -L lib/libc/gen/frexp.3 -u -r1.1.1.1 -r1.2
--- lib/libc/gen/frexp.3
+++ lib/libc/gen/frexp.3
@@ -13,10 +13,6 @@
 .\" 2. Redistributions in binary form must reproduce the above copyright
 .\"    notice, this list of conditions and the following disclaimer in the
 .\"    documentation and/or other materials provided with the distribution.
-.\" 3. All advertising materials mentioning features or use of this software
-.\"    must display the following acknowledgement:
-.\"	This product includes software developed by the University of
-.\"	California, Berkeley and its contributors.
 .\" 4. Neither the name of the University nor the names of its contributors
 .\"    may be used to endorse or promote products derived from this software
 .\"    without specific prior written permission.
@@ -34,7 +30,7 @@
 .\" SUCH DAMAGE.
 .\"
 .\"     @(#)frexp.3	8.1 (Berkeley) 6/4/93
-.\" $FreeBSD: src/lib/libc/gen/frexp.3,v 1.12 2005/03/07 05:00:54 das Exp $
+.\" $FreeBSD: src/lib/libc/gen/frexp.3,v 1.13 2007/01/09 00:27:53 imp Exp $
 .\"
 .Dd March 4, 2005
 .Dt FREXP 3
Index: setmode.3
===================================================================
RCS file: /home/cvs/src/lib/libc/gen/setmode.3,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L lib/libc/gen/setmode.3 -L lib/libc/gen/setmode.3 -u -r1.1.1.1 -r1.2
--- lib/libc/gen/setmode.3
+++ lib/libc/gen/setmode.3
@@ -9,10 +9,6 @@
 .\" 2. Redistributions in binary form must reproduce the above copyright
 .\"    notice, this list of conditions and the following disclaimer in the
 .\"    documentation and/or other materials provided with the distribution.
-.\" 3. All advertising materials mentioning features or use of this software
-.\"    must display the following acknowledgement:
-.\"	This product includes software developed by the University of
-.\"	California, Berkeley and its contributors.
 .\" 4. Neither the name of the University nor the names of its contributors
 .\"    may be used to endorse or promote products derived from this software
 .\"    without specific prior written permission.
@@ -30,7 +26,7 @@
 .\" SUCH DAMAGE.
 .\"
 .\"     @(#)setmode.3	8.2 (Berkeley) 4/28/95
-.\" $FreeBSD: src/lib/libc/gen/setmode.3,v 1.11 2001/10/01 16:08:51 ru Exp $
+.\" $FreeBSD: src/lib/libc/gen/setmode.3,v 1.12 2007/01/09 00:27:55 imp Exp $
 .\"
 .Dd April 28, 1995
 .Dt SETMODE 3
Index: err.c
===================================================================
RCS file: /home/cvs/src/lib/libc/gen/err.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -L lib/libc/gen/err.c -L lib/libc/gen/err.c -u -r1.2 -r1.3
--- lib/libc/gen/err.c
+++ lib/libc/gen/err.c
@@ -27,10 +27,11 @@
  * SUCH DAMAGE.
  */
 
-/* static char sccsid[] = "@(#)err.c	8.1 (Berkeley) 6/4/93"; */
+#if defined(LIBC_SCCS) && !defined(lint)
+static char sccsid[] = "@(#)err.c	8.1 (Berkeley) 6/4/93";
+#endif /* LIBC_SCCS and not lint */
 #include <sys/cdefs.h>
-/*__FBSDID("$FreeBSD: src/lib/libc/gen/err.c,v 1.13 2002/03/29 22:43:41 markm Exp $");*/
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: src/lib/libc/gen/err.c,v 1.14 2007/01/09 00:27:53 imp Exp $");
 
 #include "namespace.h"
 #include <err.h>
Index: strtofflags.3
===================================================================
RCS file: /home/cvs/src/lib/libc/gen/strtofflags.3,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L lib/libc/gen/strtofflags.3 -L lib/libc/gen/strtofflags.3 -u -r1.1.1.1 -r1.2
--- lib/libc/gen/strtofflags.3
+++ lib/libc/gen/strtofflags.3
@@ -9,10 +9,6 @@
 .\" 2. Redistributions in binary form must reproduce the above copyright
 .\"    notice, this list of conditions and the following disclaimer in the
 .\"    documentation and/or other materials provided with the distribution.
-.\" 3. All advertising materials mentioning features or use of this software
-.\"    must display the following acknowledgement:
-.\"	This product includes software developed by the University of
-.\"	California, Berkeley and its contributors.
 .\" 4. Neither the name of the University nor the names of its contributors
 .\"    may be used to endorse or promote products derived from this software
 .\"    without specific prior written permission.
@@ -30,7 +26,7 @@
 .\" SUCH DAMAGE.
 .\"
 .\"     @(#)setmode.3	8.2 (Berkeley) 4/28/95
-.\" $FreeBSD: src/lib/libc/gen/strtofflags.3,v 1.7 2001/10/01 16:08:51 ru Exp $
+.\" $FreeBSD: src/lib/libc/gen/strtofflags.3,v 1.8 2007/01/09 00:27:55 imp Exp $
 .\"
 .Dd January 1, 2000
 .Dt STRTOFFLAGS 3
Index: pause.3
===================================================================
RCS file: /home/cvs/src/lib/libc/gen/pause.3,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L lib/libc/gen/pause.3 -L lib/libc/gen/pause.3 -u -r1.1.1.1 -r1.2
--- lib/libc/gen/pause.3
+++ lib/libc/gen/pause.3
@@ -9,10 +9,6 @@
 .\" 2. Redistributions in binary form must reproduce the above copyright
 .\"    notice, this list of conditions and the following disclaimer in the
 .\"    documentation and/or other materials provided with the distribution.
-.\" 3. All advertising materials mentioning features or use of this software
-.\"    must display the following acknowledgement:
-.\"	This product includes software developed by the University of
-.\"	California, Berkeley and its contributors.
 .\" 4. Neither the name of the University nor the names of its contributors
 .\"    may be used to endorse or promote products derived from this software
 .\"    without specific prior written permission.
@@ -30,7 +26,7 @@
 .\" SUCH DAMAGE.
 .\"
 .\"     @(#)pause.3	8.1 (Berkeley) 6/4/93
-.\" $FreeBSD: src/lib/libc/gen/pause.3,v 1.8 2001/10/01 16:08:51 ru Exp $
+.\" $FreeBSD: src/lib/libc/gen/pause.3,v 1.9 2007/01/09 00:27:54 imp Exp $
 .\"
 .Dd June 4, 1993
 .Dt PAUSE 3
Index: devname.3
===================================================================
RCS file: /home/cvs/src/lib/libc/gen/devname.3,v
retrieving revision 1.2
retrieving revision 1.3
diff -L lib/libc/gen/devname.3 -L lib/libc/gen/devname.3 -u -r1.2 -r1.3
--- lib/libc/gen/devname.3
+++ lib/libc/gen/devname.3
@@ -26,8 +26,7 @@
 .\" SUCH DAMAGE.
 .\"
 .\"     @(#)devname.3	8.2 (Berkeley) 4/29/95
-.\" $FreeBSD: src/lib/libc/gen/devname.3,v 1.18 2005/02/23 02:02:38 trhodes Exp $
-.\" $MidnightBSD$
+.\" $FreeBSD: src/lib/libc/gen/devname.3,v 1.19 2007/01/09 00:27:53 imp Exp $
 .\"
 .Dd February 22, 2005
 .Dt DEVNAME 3
Index: sem_open.3
===================================================================
RCS file: /home/cvs/src/lib/libc/gen/sem_open.3,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L lib/libc/gen/sem_open.3 -L lib/libc/gen/sem_open.3 -u -r1.1.1.1 -r1.2
--- lib/libc/gen/sem_open.3
+++ lib/libc/gen/sem_open.3
@@ -25,7 +25,7 @@
 .\" OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
 .\" EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 .\"
-.\" $FreeBSD: src/lib/libc/gen/sem_open.3,v 1.12 2004/07/02 16:45:56 ru Exp $
+.\" $FreeBSD: src/lib/libc/gen/sem_open.3,v 1.12.22.1 2008/01/07 21:29:29 jhb Exp $
 .\"
 .Dd January 15, 2003
 .Dt SEM_OPEN 3
@@ -168,7 +168,7 @@
 The system limit on semaphores has been reached.
 .It Bq Er ENOENT
 .Dv O_CREAT
-is set but the named semaphore does not exist.
+is not set but the named semaphore does not exist.
 .It Bq Er ENOSPC
 There is not enough space to create the semaphore.
 .El
Index: sem.c
===================================================================
RCS file: /home/cvs/src/lib/libc/gen/sem.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L lib/libc/gen/sem.c -L lib/libc/gen/sem.c -u -r1.1.1.1 -r1.2
--- lib/libc/gen/sem.c
+++ lib/libc/gen/sem.c
@@ -26,7 +26,7 @@
  * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
  * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  *
- * $FreeBSD: src/lib/libc/gen/sem.c,v 1.13 2004/02/06 15:15:44 deischen Exp $
+ * $FreeBSD: src/lib/libc/gen/sem.c,v 1.15 2005/10/18 17:24:03 stefanf Exp $
  */
 
 /*
@@ -57,6 +57,7 @@
  * sem_post() may need to be wrapped to be signal-safe.
  */
 #include "namespace.h"
+#include <sys/types.h>
 #include <sys/queue.h>
 #include <errno.h>
 #include <fcntl.h>
@@ -321,7 +322,7 @@
 
 int
 __sem_timedwait(sem_t * __restrict sem,
-    struct timespec * __restrict abs_timeout)
+    const struct timespec * __restrict abs_timeout)
 {
 	if (sem_check_validity(sem) != 0)
 		return (-1);
--- /dev/null
+++ lib/libc/gen/Symbol.map
@@ -0,0 +1,449 @@
+/*
+ * $FreeBSD: src/lib/libc/gen/Symbol.map,v 1.6 2007/05/31 13:01:33 deischen Exp $
+ */
+
+FBSD_1.0 {
+	__xuname;
+	pthread_atfork;
+	pthread_attr_destroy;
+	pthread_attr_getdetachstate;
+	pthread_attr_getguardsize;
+	pthread_attr_getinheritsched;
+	pthread_attr_getschedparam;
+	pthread_attr_getschedpolicy;
+	pthread_attr_getscope;
+	pthread_attr_getstackaddr;
+	pthread_attr_getstacksize;
+	pthread_attr_init;
+	pthread_attr_setdetachstate;
+	pthread_attr_setguardsize;
+	pthread_attr_setinheritsched;
+	pthread_attr_setschedparam;
+	pthread_attr_setschedpolicy;
+	pthread_attr_setscope;
+	pthread_attr_setstackaddr;
+	pthread_attr_setstacksize;
+	pthread_cancel;
+	pthread_cleanup_pop;
+	pthread_cleanup_push;
+	pthread_cond_broadcast;
+	pthread_cond_destroy;
+	pthread_cond_init;
+	pthread_cond_signal;
+	pthread_cond_timedwait;
+	pthread_cond_wait;
+	pthread_detach;
+	pthread_equal;
+	pthread_exit;
+	pthread_getspecific;
+	pthread_join;
+	pthread_key_create;
+	pthread_key_delete;
+	pthread_kill;
+	pthread_main_np;
+	pthread_mutex_destroy;
+	pthread_mutex_init;
+	pthread_mutex_lock;
+	pthread_mutex_trylock;
+	pthread_mutex_unlock;
+	pthread_mutexattr_destroy;
+	pthread_mutexattr_init;
+	pthread_mutexattr_settype;
+	pthread_once;
+	pthread_rwlock_destroy;
+	pthread_rwlock_init;
+	pthread_rwlock_rdlock;
+	pthread_rwlock_tryrdlock;
+	pthread_rwlock_trywrlock;
+	pthread_rwlock_unlock;
+	pthread_rwlock_wrlock;
+	pthread_self;
+	pthread_setcancelstate;
+	pthread_setcanceltype;
+	pthread_setspecific;
+	pthread_sigmask;
+	pthread_testcancel;
+	alarm;
+	arc4random;
+	arc4random_addrandom;
+	arc4random_stir;
+	__assert;
+	basename;
+	check_utility_compat;
+	clock;
+	closedir;
+	confstr;
+	encrypt;
+	des_setkey;
+	des_cipher;
+	setkey;
+	ctermid;
+	ctermid_r;
+	daemon;
+	devname;
+	devname_r;
+	dirname;
+	getdiskbyname;
+	dladdr;
+	dlclose;
+	dlerror;
+	dlfunc;
+	dllockinit;
+	dlopen;
+	dlsym;
+	dlvsym;
+	dlinfo;
+	dl_iterate_phdr;
+	drand48;
+	erand48;
+	err_set_file;
+	err_set_exit;
+	err;
+	verr;
+	errc;
+	verrc;
+	errx;
+	verrx;
+	warn;
+	vwarn;
+	warnc;
+	vwarnc;
+	warnx;
+	vwarnx;
+	sys_errlist;
+	sys_nerr;
+	errno;
+	execl;
+	execle;
+	execlp;
+	execv;
+	execvp;
+	execvP;
+	fmtcheck;
+	fmtmsg;
+	fnmatch;
+	__fpclassifyf;
+	__fpclassifyd;
+	__fpclassifyl;
+	frexp;
+	setfstab;
+	getfstab;
+	getfsent;
+	getfsspec;
+	getfsfile;
+	setfsent;
+	endfsent;
+	ftok;
+	fts_open;
+	fts_close;
+	fts_read;
+	fts_set;
+	fts_children;
+	fts_get_clientptr;
+	fts_get_stream;
+	fts_set_clientptr;
+	ftw;
+	glob;
+	globfree;
+	getbootfile;
+	getbsize;
+	cgetset;
+	cgetcap;
+	cgetent;
+	cgetmatch;
+	cgetfirst;
+	cgetclose;
+	cgetnext;
+	cgetstr;
+	cgetustr;
+	cgetnum;
+	getcwd;
+	getdomainname;
+	setgrent;
+	setgroupent;
+	endgrent;
+	getgrent_r;
+	getgrnam_r;
+	getgrgid_r;
+	getgrnam;
+	getgrgid;
+	getgrent;
+	/*
+	 * Why are __gr_parse_entry() and __gr_match_entry() not static in
+	 * gen/getgrent.c?
+	 */
+	getgrouplist;
+	gethostname;
+	getloadavg;
+	getlogin;
+	getlogin_r;
+	getmntinfo;
+	setnetgrent;
+	getnetgrent;
+	endnetgrent;
+	innetgr;
+	getosreldate;
+	getpagesize;
+	getpeereid;
+	_getprogname;
+	getprogname;
+	setpwent;
+	setpassent;
+	endpwent;
+	getpwent_r;
+	getpwnam_r;
+	getpwuid_r;
+	getpwnam;
+	getpwuid;
+	getpwent;
+	getttynam;
+	getttyent;
+	setttyent;
+	endttyent;
+	isdialuptty;
+	isnettty;
+	getusershell;
+	endusershell;
+	setusershell;
+	getvfsbyname;
+	__isnan;
+	isnan;
+	__isnanf;
+	isnanf;
+	__isinf;
+	isinf;
+	__isinff;
+	__isinfl;
+	isatty;
+	initgroups;
+	jrand48;
+	lcong48;
+	ldexp;
+	lockf;
+	lrand48;
+	mrand48;
+	nftw;
+	nice;
+	nlist;
+	nrand48;
+	opendir;
+	pause;
+	posix_madvise;
+	popen;
+	pclose;
+	shm_open;
+	shm_unlink;
+	pselect;
+	psignal;
+	raise;
+	readdir;
+	readdir_r;
+	readpassphrase;
+	getpass;
+	rewinddir;
+	scandir;
+	alphasort;
+	seed48;
+	seekdir;
+	user_from_uid;
+	group_from_gid;
+	sem_init;
+	sem_destroy;
+	sem_open;
+	sem_close;
+	sem_unlink;
+	sem_wait;
+	sem_trywait;
+	sem_timedwait;
+	sem_post;
+	sem_getvalue;
+	semctl;
+	setdomainname;
+	sethostname;
+	longjmperror;
+	getmode;
+	setmode;
+	setproctitle;
+	setprogname;
+	siginterrupt;
+	sys_signame;
+	sys_siglist;
+	sys_nsig;
+	signal;
+	sigaddset;
+	sigdelset;
+	sigemptyset;
+	sigfillset;
+	sigismember;
+	sleep;
+	srand48;
+	fstatvfs;
+	statvfs;
+	sl_init;
+	sl_add;
+	sl_free;
+	sl_find;
+	fflagstostr;
+	strtofflags;
+	sysconf;
+	sysctl;
+	sysctlbyname;
+	sysctlnametomib;
+	syslog;
+	vsyslog;
+	openlog;
+	closelog;
+	setlogmask;
+	ttyslot;
+	ttyname_r;
+	ttyname;
+	timezone;
+	times;
+	time;
+	telldir;
+	tcgetattr;
+	tcsetattr;
+	tcsetpgrp;
+	tcgetpgrp;
+	cfgetospeed;
+	cfgetispeed;
+	cfsetospeed;
+	cfsetispeed;
+	cfsetspeed;
+	cfmakeraw;
+	tcsendbreak;
+	_init_tls;
+	__tls_get_addr;
+	tcdrain;
+	tcflush;
+	tcflow;
+	ualarm;
+	ulimit;
+	uname;
+	unvis;
+	strunvis;
+	strunvisx;
+	usleep;
+	utime;
+	valloc;
+	vis;
+	strvis;
+	strvisx;
+	wait;
+	wait3;
+	waitpid;
+	wordexp;
+	wordfree;
+};
+
+FBSDprivate_1.0 {
+	/* needed by thread libraries */
+	__thr_jtable;
+
+	_pthread_atfork;
+	_pthread_attr_destroy;
+	_pthread_attr_getdetachstate;
+	_pthread_attr_getguardsize;
+	_pthread_attr_getinheritsched;
+	_pthread_attr_getschedparam;
+	_pthread_attr_getschedpolicy;
+	_pthread_attr_getscope;
+	_pthread_attr_getstackaddr;
+	_pthread_attr_getstacksize;
+	_pthread_attr_init;
+	_pthread_attr_setdetachstate;
+	_pthread_attr_setguardsize;
+	_pthread_attr_setinheritsched;
+	_pthread_attr_setschedparam;
+	_pthread_attr_setschedpolicy;
+	_pthread_attr_setscope;
+	_pthread_attr_setstackaddr;
+	_pthread_attr_setstacksize;
+	_pthread_cancel;
+	_pthread_cleanup_pop;
+	_pthread_cleanup_push;
+	_pthread_cond_broadcast;
+	_pthread_cond_destroy;
+	_pthread_cond_init;
+	_pthread_cond_signal;
+	_pthread_cond_timedwait;
+	_pthread_cond_wait;
+	_pthread_detach;
+	_pthread_equal;
+	_pthread_exit;
+	_pthread_getspecific;
+	_pthread_join;
+	_pthread_key_create;
+	_pthread_key_delete;
+	_pthread_kill;
+	_pthread_main_np;
+	_pthread_mutex_destroy;
+	_pthread_mutex_init;
+	_pthread_mutex_lock;
+	_pthread_mutex_trylock;
+	_pthread_mutex_unlock;
+	_pthread_mutexattr_destroy;
+	_pthread_mutexattr_init;
+	_pthread_mutexattr_settype;
+	_pthread_once;
+	_pthread_rwlock_destroy;
+	_pthread_rwlock_init;
+	_pthread_rwlock_rdlock;
+	_pthread_rwlock_tryrdlock;
+	_pthread_rwlock_trywrlock;
+	_pthread_rwlock_unlock;
+	_pthread_rwlock_wrlock;
+	_pthread_self;
+	_pthread_setcancelstate;
+	_pthread_setcanceltype;
+	_pthread_setspecific;
+	_pthread_sigmask;
+	_pthread_testcancel;
+	_spinlock;
+	_spinlock_debug;
+	_spinunlock;
+	_rtld_error;		/* for private use */
+	_rtld_thread_init;	/* for private use */
+	_err;
+	_warn;
+	__fmtcheck;
+	/* __pw_match_entry; */
+	/* __pw_parse_entry; */
+	__fdnlist;	/* used by libkvm */
+	/* __aout_fdnlist; */
+	/* __elf_is_okay__; */
+	/* __elf_fdnlist; */
+	__opendir2;
+	__pause;
+	_pause;
+	__pselect;
+	__pw_scan;	/* Used by (at least) libutil */
+	__raise;
+	_raise;
+	__sem_init;
+	__sem_destroy;
+	__sem_open;
+	__sem_close;
+	__sem_unlink;
+	__sem_wait;
+	__sem_trywait;
+	__sem_timedwait;
+	__sem_post;
+	__sem_getvalue;
+	__sleep;
+	_sleep;
+	_rtld_allocate_tls;
+	_rtld_free_tls;
+#if defined(i386)
+	___libc_tls_get_addr;	/* x86 only */
+#endif
+	__libc_tls_get_addr;
+	__tcdrain;
+	_tcdrain;
+	__usleep;
+	_usleep;
+	__wait;
+	_wait;
+	__waitpid;
+	_waitpid;
+};
Index: raise.c
===================================================================
RCS file: /home/cvs/src/lib/libc/gen/raise.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L lib/libc/gen/raise.c -L lib/libc/gen/raise.c -u -r1.1.1.1 -r1.2
--- lib/libc/gen/raise.c
+++ lib/libc/gen/raise.c
@@ -10,10 +10,6 @@
  * 2. Redistributions in binary form must reproduce the above copyright
  *    notice, this list of conditions and the following disclaimer in the
  *    documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- *    must display the following acknowledgement:
- *	This product includes software developed by the University of
- *	California, Berkeley and its contributors.
  * 4. Neither the name of the University nor the names of its contributors
  *    may be used to endorse or promote products derived from this software
  *    without specific prior written permission.
@@ -35,7 +31,7 @@
 static char sccsid[] = "@(#)raise.c	8.1 (Berkeley) 6/4/93";
 #endif /* LIBC_SCCS and not lint */
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/gen/raise.c,v 1.4 2003/07/19 05:22:56 davidxu Exp $");
+__FBSDID("$FreeBSD: src/lib/libc/gen/raise.c,v 1.5 2007/01/09 00:27:55 imp Exp $");
 
 #include <signal.h>
 #include <unistd.h>
Index: syslog.3
===================================================================
RCS file: /home/cvs/src/lib/libc/gen/syslog.3,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L lib/libc/gen/syslog.3 -L lib/libc/gen/syslog.3 -u -r1.1.1.1 -r1.2
--- lib/libc/gen/syslog.3
+++ lib/libc/gen/syslog.3
@@ -9,10 +9,6 @@
 .\" 2. Redistributions in binary form must reproduce the above copyright
 .\"    notice, this list of conditions and the following disclaimer in the
 .\"    documentation and/or other materials provided with the distribution.
-.\" 3. All advertising materials mentioning features or use of this software
-.\"    must display the following acknowledgement:
-.\"	This product includes software developed by the University of
-.\"	California, Berkeley and its contributors.
 .\" 4. Neither the name of the University nor the names of its contributors
 .\"    may be used to endorse or promote products derived from this software
 .\"    without specific prior written permission.
@@ -30,7 +26,7 @@
 .\" SUCH DAMAGE.
 .\"
 .\"     @(#)syslog.3	8.1 (Berkeley) 6/4/93
-.\" $FreeBSD: src/lib/libc/gen/syslog.3,v 1.24 2004/12/30 13:09:34 krion Exp $
+.\" $FreeBSD: src/lib/libc/gen/syslog.3,v 1.25 2007/01/09 00:27:55 imp Exp $
 .\"
 .Dd December 30, 2004
 .Dt SYSLOG 3
Index: _pthread_stubs.c
===================================================================
RCS file: /home/cvs/src/lib/libc/gen/_pthread_stubs.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -L lib/libc/gen/_pthread_stubs.c -L lib/libc/gen/_pthread_stubs.c -u -r1.2 -r1.3
--- lib/libc/gen/_pthread_stubs.c
+++ lib/libc/gen/_pthread_stubs.c
@@ -25,11 +25,11 @@
  */
 
 #include <sys/cdefs.h>
-/*__FBSDID("$FreeBSD: src/lib/libc/gen/_pthread_stubs.c,v 1.11 2004/07/29 18:07:08 kan Exp $"); */
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: src/lib/libc/gen/_pthread_stubs.c,v 1.13 2006/03/05 18:10:27 deischen Exp $");
 
 #include <signal.h>
 #include <pthread.h>
+#include <stdlib.h>
 
 #include "libc_private.h"
 
@@ -53,39 +53,72 @@
 static void 		*stub_null(void);
 static struct pthread	*stub_self(void);
 static int		stub_zero(void);
+static int		stub_true(void);
+static void		stub_exit(void);
 
 #define	PJT_DUAL_ENTRY(entry)	\
 	(pthread_func_t)entry, (pthread_func_t)entry
 
 pthread_func_entry_t __thr_jtable[PJT_MAX] = {
-	{PJT_DUAL_ENTRY(stub_zero)},	/* PJT_COND_BROADCAST */
-	{PJT_DUAL_ENTRY(stub_zero)},	/* PJT_COND_DESTROY */
-	{PJT_DUAL_ENTRY(stub_zero)},	/* PJT_COND_INIT */
-	{PJT_DUAL_ENTRY(stub_zero)},	/* PJT_COND_SIGNAL */
-	{PJT_DUAL_ENTRY(stub_zero)},	/* PJT_COND_WAIT */
-	{PJT_DUAL_ENTRY(stub_null)},	/* PJT_GETSPECIFIC */
-	{PJT_DUAL_ENTRY(stub_zero)},	/* PJT_KEY_CREATE */
-	{PJT_DUAL_ENTRY(stub_zero)},	/* PJT_KEY_DELETE */
-	{PJT_DUAL_ENTRY(stub_main)},	/* PJT_MAIN_NP */
-	{PJT_DUAL_ENTRY(stub_zero)},	/* PJT_MUTEX_DESTROY */
-	{PJT_DUAL_ENTRY(stub_zero)},	/* PJT_MUTEX_INIT */
-	{PJT_DUAL_ENTRY(stub_zero)},	/* PJT_MUTEX_LOCK */
-	{PJT_DUAL_ENTRY(stub_zero)},	/* PJT_MUTEX_TRYLOCK */
-	{PJT_DUAL_ENTRY(stub_zero)},	/* PJT_MUTEX_UNLOCK */
-	{PJT_DUAL_ENTRY(stub_zero)},	/* PJT_MUTEXATTR_DESTROY */
-	{PJT_DUAL_ENTRY(stub_zero)},	/* PJT_MUTEXATTR_INIT */
-	{PJT_DUAL_ENTRY(stub_zero)},	/* PJT_MUTEXATTR_SETTYPE */
-	{PJT_DUAL_ENTRY(stub_zero)},	/* PJT_ONCE */
-	{PJT_DUAL_ENTRY(stub_zero)},	/* PJT_RWLOCK_DESTROY */
-	{PJT_DUAL_ENTRY(stub_zero)},	/* PJT_RWLOCK_INIT */
-	{PJT_DUAL_ENTRY(stub_zero)},	/* PJT_RWLOCK_RDLOCK */
-	{PJT_DUAL_ENTRY(stub_zero)},	/* PJT_RWLOCK_TRYRDLOCK */
-	{PJT_DUAL_ENTRY(stub_zero)},	/* PJT_RWLOCK_TRYWRLOCK */
-	{PJT_DUAL_ENTRY(stub_zero)},	/* PJT_RWLOCK_UNLOCK */
-	{PJT_DUAL_ENTRY(stub_zero)},	/* PJT_RWLOCK_WRLOCK */
-	{PJT_DUAL_ENTRY(stub_self)},	/* PJT_SELF */
-	{PJT_DUAL_ENTRY(stub_zero)},	/* PJT_SETSPECIFIC */
-	{PJT_DUAL_ENTRY(stub_zero)}	/* PJT_SIGMASK */
+	{PJT_DUAL_ENTRY(stub_zero)},    /* PJT_ATFORK */
+	{PJT_DUAL_ENTRY(stub_zero)},    /* PJT_ATTR_DESTROY */
+	{PJT_DUAL_ENTRY(stub_zero)},    /* PJT_ATTR_GETDETACHSTATE */
+	{PJT_DUAL_ENTRY(stub_zero)},    /* PJT_ATTR_GETGUARDSIZE */
+	{PJT_DUAL_ENTRY(stub_zero)},    /* PJT_ATTR_GETINHERITSCHED */
+	{PJT_DUAL_ENTRY(stub_zero)},    /* PJT_ATTR_GETSCHEDPARAM */
+	{PJT_DUAL_ENTRY(stub_zero)},    /* PJT_ATTR_GETSCHEDPOLICY */
+	{PJT_DUAL_ENTRY(stub_zero)},    /* PJT_ATTR_GETSCOPE */
+	{PJT_DUAL_ENTRY(stub_zero)},    /* PJT_ATTR_GETSTACKADDR */
+	{PJT_DUAL_ENTRY(stub_zero)},    /* PJT_ATTR_GETSTACKSIZE */
+	{PJT_DUAL_ENTRY(stub_zero)},    /* PJT_ATTR_INIT */
+	{PJT_DUAL_ENTRY(stub_zero)},    /* PJT_ATTR_SETDETACHSTATE */
+	{PJT_DUAL_ENTRY(stub_zero)},    /* PJT_ATTR_SETGUARDSIZE */
+	{PJT_DUAL_ENTRY(stub_zero)},    /* PJT_ATTR_SETINHERITSCHED */
+	{PJT_DUAL_ENTRY(stub_zero)},    /* PJT_ATTR_SETSCHEDPARAM */
+	{PJT_DUAL_ENTRY(stub_zero)},    /* PJT_ATTR_SETSCHEDPOLICY */
+	{PJT_DUAL_ENTRY(stub_zero)},    /* PJT_ATTR_SETSCOPE */
+	{PJT_DUAL_ENTRY(stub_zero)},    /* PJT_ATTR_SETSTACKADDR */
+	{PJT_DUAL_ENTRY(stub_zero)},    /* PJT_ATTR_SETSTACKSIZE */
+	{PJT_DUAL_ENTRY(stub_zero)},    /* PJT_CANCEL */
+	{PJT_DUAL_ENTRY(stub_zero)},    /* PJT_CLEANUP_POP */
+	{PJT_DUAL_ENTRY(stub_zero)},    /* PJT_CLEANUP_PUSH */
+	{PJT_DUAL_ENTRY(stub_zero)},    /* PJT_COND_BROADCAST */
+	{PJT_DUAL_ENTRY(stub_zero)},    /* PJT_COND_DESTROY */
+	{PJT_DUAL_ENTRY(stub_zero)},    /* PJT_COND_INIT */
+	{PJT_DUAL_ENTRY(stub_zero)},    /* PJT_COND_SIGNAL */
+	{PJT_DUAL_ENTRY(stub_zero)},    /* PJT_COND_TIMEDWAIT */
+	{PJT_DUAL_ENTRY(stub_zero)},    /* PJT_COND_WAIT */
+	{PJT_DUAL_ENTRY(stub_zero)},    /* PJT_DETACH */
+	{PJT_DUAL_ENTRY(stub_true)},    /* PJT_EQUAL */
+	{PJT_DUAL_ENTRY(stub_exit)},    /* PJT_EXIT */
+	{PJT_DUAL_ENTRY(stub_null)},    /* PJT_GETSPECIFIC */
+	{PJT_DUAL_ENTRY(stub_zero)},    /* PJT_JOIN */
+	{PJT_DUAL_ENTRY(stub_zero)},    /* PJT_KEY_CREATE */
+	{PJT_DUAL_ENTRY(stub_zero)},    /* PJT_KEY_DELETE */
+	{PJT_DUAL_ENTRY(stub_zero)},    /* PJT_KILL */
+	{PJT_DUAL_ENTRY(stub_main)},    /* PJT_MAIN_NP */
+	{PJT_DUAL_ENTRY(stub_zero)},    /* PJT_MUTEXATTR_DESTROY */
+	{PJT_DUAL_ENTRY(stub_zero)},    /* PJT_MUTEXATTR_INIT */
+	{PJT_DUAL_ENTRY(stub_zero)},    /* PJT_MUTEXATTR_SETTYPE */
+	{PJT_DUAL_ENTRY(stub_zero)},    /* PJT_MUTEX_DESTROY */
+	{PJT_DUAL_ENTRY(stub_zero)},    /* PJT_MUTEX_INIT */
+	{PJT_DUAL_ENTRY(stub_zero)},    /* PJT_MUTEX_LOCK */
+	{PJT_DUAL_ENTRY(stub_zero)},    /* PJT_MUTEX_TRYLOCK */
+	{PJT_DUAL_ENTRY(stub_zero)},    /* PJT_MUTEX_UNLOCK */
+	{PJT_DUAL_ENTRY(stub_zero)},    /* PJT_ONCE */
+	{PJT_DUAL_ENTRY(stub_zero)},    /* PJT_RWLOCK_DESTROY */
+	{PJT_DUAL_ENTRY(stub_zero)},    /* PJT_RWLOCK_INIT */
+	{PJT_DUAL_ENTRY(stub_zero)},    /* PJT_RWLOCK_RDLOCK */
+	{PJT_DUAL_ENTRY(stub_zero)},    /* PJT_RWLOCK_TRYRDLOCK */
+	{PJT_DUAL_ENTRY(stub_zero)},    /* PJT_RWLOCK_TRYWRLOCK */
+	{PJT_DUAL_ENTRY(stub_zero)},    /* PJT_RWLOCK_UNLOCK */
+	{PJT_DUAL_ENTRY(stub_zero)},    /* PJT_RWLOCK_WRLOCK */
+	{PJT_DUAL_ENTRY(stub_self)},    /* PJT_SELF */
+	{PJT_DUAL_ENTRY(stub_zero)},    /* PJT_SETCANCELSTATE */
+	{PJT_DUAL_ENTRY(stub_zero)},    /* PJT_SETCANCELTYPE */
+	{PJT_DUAL_ENTRY(stub_zero)},    /* PJT_SETSPECIFIC */
+	{PJT_DUAL_ENTRY(stub_zero)},    /* PJT_SIGMASK */
+	{PJT_DUAL_ENTRY(stub_zero)},    /* PJT_TESTCANCEL */
 };
 
 /*
@@ -98,8 +131,8 @@
 #define	FUNC_EXP(name)		__CONCAT(name, _exp)
 
 #define	STUB_FUNC(name, idx, ret)				\
-	static ret FUNC_EXP(name)(void) __used;		\
-	static ret FUNC_INT(name)(void) __used;		\
+	static ret FUNC_EXP(name)(void) __used;			\
+	static ret FUNC_INT(name)(void) __used;			\
 	WEAK_REF(FUNC_EXP(name), name);				\
 	WEAK_REF(FUNC_INT(name), __CONCAT(_, name));		\
 	typedef ret (*FUNC_TYPE(name))(void);			\
@@ -177,7 +210,7 @@
 STUB_FUNC1(pthread_cond_destroy, PJT_COND_DESTROY, int, void *)
 STUB_FUNC2(pthread_cond_init,	PJT_COND_INIT, int, void *, void *)
 STUB_FUNC1(pthread_cond_signal,	PJT_COND_SIGNAL, int, void *)
-STUB_FUNC1(pthread_cond_wait,	PJT_COND_WAIT, int, void *)
+STUB_FUNC2(pthread_cond_wait,	PJT_COND_WAIT, int, void *, void *)
 STUB_FUNC1(pthread_getspecific,	PJT_GETSPECIFIC, void *, pthread_key_t)
 STUB_FUNC2(pthread_key_create,	PJT_KEY_CREATE, int, void *, void *)
 STUB_FUNC1(pthread_key_delete,	PJT_KEY_DELETE, int, pthread_key_t)
@@ -201,6 +234,37 @@
 STUB_FUNC(pthread_self,		PJT_SELF, pthread_t)
 STUB_FUNC2(pthread_setspecific, PJT_SETSPECIFIC, int, pthread_key_t, void *)
 STUB_FUNC3(pthread_sigmask, PJT_SIGMASK, int, int, void *, void *)
+STUB_FUNC3(pthread_atfork, PJT_ATFORK, int, void *, void *, void*)
+STUB_FUNC1(pthread_attr_destroy, PJT_ATTR_DESTROY, int, void *);
+STUB_FUNC2(pthread_attr_getdetachstate, PJT_ATTR_GETDETACHSTATE, int, void *, void *)
+STUB_FUNC2(pthread_attr_getguardsize, PJT_ATTR_GETGUARDSIZE, int, void *, void *)
+STUB_FUNC2(pthread_attr_getstackaddr, PJT_ATTR_GETSTACKADDR, int, void *, void *)
+STUB_FUNC2(pthread_attr_getstacksize, PJT_ATTR_GETSTACKSIZE, int, void *, void *)
+STUB_FUNC2(pthread_attr_getinheritsched, PJT_ATTR_GETINHERITSCHED, int, void *, void *)
+STUB_FUNC2(pthread_attr_getschedparam, PJT_ATTR_GETSCHEDPARAM, int, void *, void *)
+STUB_FUNC2(pthread_attr_getschedpolicy, PJT_ATTR_GETSCHEDPOLICY, int, void *, void *)
+STUB_FUNC2(pthread_attr_getscope, PJT_ATTR_GETSCOPE, int, void *, void *)
+STUB_FUNC1(pthread_attr_init, PJT_ATTR_INIT, int, void *)
+STUB_FUNC2(pthread_attr_setdetachstate, PJT_ATTR_SETDETACHSTATE, int, void *, int)
+STUB_FUNC2(pthread_attr_setguardsize, PJT_ATTR_SETGUARDSIZE, int, void *, size_t)
+STUB_FUNC2(pthread_attr_setstackaddr, PJT_ATTR_SETSTACKADDR, int, void *, void *)
+STUB_FUNC2(pthread_attr_setstacksize, PJT_ATTR_SETSTACKSIZE, int, void *, size_t)
+STUB_FUNC2(pthread_attr_setinheritsched, PJT_ATTR_SETINHERITSCHED, int, void *, int)
+STUB_FUNC2(pthread_attr_setschedparam, PJT_ATTR_SETSCHEDPARAM, int, void *, void *)
+STUB_FUNC2(pthread_attr_setschedpolicy, PJT_ATTR_SETSCHEDPOLICY, int, void *, int)
+STUB_FUNC2(pthread_attr_setscope, PJT_ATTR_SETSCOPE, int, void *, int)
+STUB_FUNC1(pthread_cancel, PJT_CANCEL, int, void *)
+STUB_FUNC1(pthread_cleanup_pop, PJT_CLEANUP_POP, int, int)
+STUB_FUNC2(pthread_cleanup_push, PJT_CLEANUP_PUSH, void, void *, void *)
+STUB_FUNC3(pthread_cond_timedwait, PJT_COND_TIMEDWAIT, int, void *, void *, void *)
+STUB_FUNC1(pthread_detach, PJT_DETACH, int, void *)
+STUB_FUNC2(pthread_equal, PJT_EQUAL, int, void *, void *)
+STUB_FUNC1(pthread_exit, PJT_EXIT, void, void *)
+STUB_FUNC2(pthread_join, PJT_JOIN, int, void *, void *)
+STUB_FUNC2(pthread_kill, PJT_KILL, int, void *, int)
+STUB_FUNC2(pthread_setcancelstate, PJT_SETCANCELSTATE, int, int, void *)
+STUB_FUNC2(pthread_setcanceltype, PJT_SETCANCELTYPE, int, int, void *)
+STUB_FUNC(pthread_testcancel, PJT_TESTCANCEL, void)
 
 static int
 stub_zero(void)
@@ -225,3 +289,15 @@
 {
 	return (-1);
 }
+
+static int
+stub_true(void)
+{
+	return (1);
+}
+
+static void
+stub_exit(void)
+{
+	exit(0);
+}
Index: wait.c
===================================================================
RCS file: /home/cvs/src/lib/libc/gen/wait.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -L lib/libc/gen/wait.c -L lib/libc/gen/wait.c -u -r1.2 -r1.3
--- lib/libc/gen/wait.c
+++ lib/libc/gen/wait.c
@@ -31,7 +31,7 @@
 static char sccsid[] = "@(#)wait.c	8.1 (Berkeley) 6/4/93";
 #endif /* LIBC_SCCS and not lint */
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/gen/wait.c,v 1.6 2002/02/01 00:57:29 obrien Exp $");
+__FBSDID("$FreeBSD: src/lib/libc/gen/wait.c,v 1.7 2007/01/09 00:27:56 imp Exp $");
 
 #include "namespace.h"
 #include <sys/types.h>
Index: syslog.c
===================================================================
RCS file: /home/cvs/src/lib/libc/gen/syslog.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L lib/libc/gen/syslog.c -L lib/libc/gen/syslog.c -u -r1.1.1.1 -r1.2
--- lib/libc/gen/syslog.c
+++ lib/libc/gen/syslog.c
@@ -10,10 +10,6 @@
  * 2. Redistributions in binary form must reproduce the above copyright
  *    notice, this list of conditions and the following disclaimer in the
  *    documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- *    must display the following acknowledgement:
- *	This product includes software developed by the University of
- *	California, Berkeley and its contributors.
  * 4. Neither the name of the University nor the names of its contributors
  *    may be used to endorse or promote products derived from this software
  *    without specific prior written permission.
@@ -35,7 +31,7 @@
 static char sccsid[] = "@(#)syslog.c	8.5 (Berkeley) 4/29/95";
 #endif /* LIBC_SCCS and not lint */
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/gen/syslog.c,v 1.35.2.1 2005/10/08 17:57:10 delphij Exp $");
+__FBSDID("$FreeBSD: src/lib/libc/gen/syslog.c,v 1.39 2007/01/09 00:27:55 imp Exp $");
 
 #include "namespace.h"
 #include <sys/types.h>
@@ -116,7 +112,7 @@
 		h->base += len;
 		h->left -= len;
 	}
-	return 0;
+	return len;
 }
 
 /*
@@ -153,6 +149,8 @@
 		pri &= LOG_PRIMASK|LOG_FACMASK;
 	}
 
+	saved_errno = errno;
+
 	THREAD_LOCK();
 
 	/* Check priority against setlogmask values. */
@@ -161,8 +159,6 @@
 		return;
 	}
 
-	saved_errno = errno;
-
 	/* Set default facility if none specified. */
 	if ((pri & LOG_FACMASK) == 0)
 		pri |= LogFacility;
Index: unvis.3
===================================================================
RCS file: /home/cvs/src/lib/libc/gen/unvis.3,v
retrieving revision 1.2
retrieving revision 1.3
diff -L lib/libc/gen/unvis.3 -L lib/libc/gen/unvis.3 -u -r1.2 -r1.3
--- lib/libc/gen/unvis.3
+++ lib/libc/gen/unvis.3
@@ -26,7 +26,7 @@
 .\" SUCH DAMAGE.
 .\"
 .\"     @(#)unvis.3	8.2 (Berkeley) 12/11/93
-.\" $FreeBSD: src/lib/libc/gen/unvis.3,v 1.17 2004/07/03 22:30:08 ru Exp $
+.\" $FreeBSD: src/lib/libc/gen/unvis.3,v 1.18 2007/01/09 00:27:56 imp Exp $
 .\"
 .Dd December 11, 1993
 .Dt UNVIS 3
Index: popen.c
===================================================================
RCS file: /home/cvs/src/lib/libc/gen/popen.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L lib/libc/gen/popen.c -L lib/libc/gen/popen.c -u -r1.1.1.1 -r1.2
--- lib/libc/gen/popen.c
+++ lib/libc/gen/popen.c
@@ -13,10 +13,6 @@
  * 2. Redistributions in binary form must reproduce the above copyright
  *    notice, this list of conditions and the following disclaimer in the
  *    documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- *    must display the following acknowledgement:
- *	This product includes software developed by the University of
- *	California, Berkeley and its contributors.
  * 4. Neither the name of the University nor the names of its contributors
  *    may be used to endorse or promote products derived from this software
  *    without specific prior written permission.
@@ -38,7 +34,7 @@
 static char sccsid[] = "@(#)popen.c	8.3 (Berkeley) 5/3/95";
 #endif /* LIBC_SCCS and not lint */
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/gen/popen.c,v 1.18 2003/01/04 00:15:15 tjr Exp $");
+__FBSDID("$FreeBSD: src/lib/libc/gen/popen.c,v 1.19 2007/01/09 00:27:54 imp Exp $");
 
 #include "namespace.h"
 #include <sys/param.h>
Index: devname.c
===================================================================
RCS file: /home/cvs/src/lib/libc/gen/devname.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -L lib/libc/gen/devname.c -L lib/libc/gen/devname.c -u -r1.2 -r1.3
--- lib/libc/gen/devname.c
+++ lib/libc/gen/devname.c
@@ -27,10 +27,11 @@
  * SUCH DAMAGE.
  */
 
-/* static char sccsid[] = "@(#)devname.c	8.2 (Berkeley) 4/29/95"; */
+#if defined(LIBC_SCCS) && !defined(lint)
+static char sccsid[] = "@(#)devname.c	8.2 (Berkeley) 4/29/95";
+#endif /* LIBC_SCCS and not lint */
 #include <sys/cdefs.h>
-/*__FBSDID("$FreeBSD: src/lib/libc/gen/devname.c,v 1.9 2003/06/20 09:52:27 phk Exp $"); */
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: src/lib/libc/gen/devname.c,v 1.11 2007/01/09 00:27:53 imp Exp $");
 
 #include <sys/types.h>
 #include <sys/sysctl.h>
@@ -38,6 +39,7 @@
 #include <err.h>
 #include <fcntl.h>
 #include <stdio.h>
+#include <stdlib.h>
 #include <string.h>
 #include <sys/param.h>
 #include <sys/stat.h>
Index: setjmp.3
===================================================================
RCS file: /home/cvs/src/lib/libc/gen/setjmp.3,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L lib/libc/gen/setjmp.3 -L lib/libc/gen/setjmp.3 -u -r1.1.1.1 -r1.2
--- lib/libc/gen/setjmp.3
+++ lib/libc/gen/setjmp.3
@@ -13,10 +13,6 @@
 .\" 2. Redistributions in binary form must reproduce the above copyright
 .\"    notice, this list of conditions and the following disclaimer in the
 .\"    documentation and/or other materials provided with the distribution.
-.\" 3. All advertising materials mentioning features or use of this software
-.\"    must display the following acknowledgement:
-.\"	This product includes software developed by the University of
-.\"	California, Berkeley and its contributors.
 .\" 4. Neither the name of the University nor the names of its contributors
 .\"    may be used to endorse or promote products derived from this software
 .\"    without specific prior written permission.
@@ -34,7 +30,7 @@
 .\" SUCH DAMAGE.
 .\"
 .\"     @(#)setjmp.3	8.1 (Berkeley) 6/4/93
-.\" $FreeBSD: src/lib/libc/gen/setjmp.3,v 1.12 2004/07/03 22:30:08 ru Exp $
+.\" $FreeBSD: src/lib/libc/gen/setjmp.3,v 1.13 2007/01/09 00:27:55 imp Exp $
 .\"
 .Dd June 4, 1993
 .Dt SETJMP 3
Index: strtofflags.c
===================================================================
RCS file: /home/cvs/src/lib/libc/gen/strtofflags.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L lib/libc/gen/strtofflags.c -L lib/libc/gen/strtofflags.c -u -r1.1.1.1 -r1.2
--- lib/libc/gen/strtofflags.c
+++ lib/libc/gen/strtofflags.c
@@ -10,10 +10,6 @@
  * 2. Redistributions in binary form must reproduce the above copyright
  *    notice, this list of conditions and the following disclaimer in the
  *    documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- *    must display the following acknowledgement:
- *	This product includes software developed by the University of
- *	California, Berkeley and its contributors.
  * 4. Neither the name of the University nor the names of its contributors
  *    may be used to endorse or promote products derived from this software
  *    without specific prior written permission.
@@ -35,7 +31,7 @@
 static char sccsid[] = "@(#)stat_flags.c	8.1 (Berkeley) 5/31/93";
 #endif /* LIBC_SCCS and not lint */
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/gen/strtofflags.c,v 1.22 2002/04/16 11:03:22 joe Exp $");
+__FBSDID("$FreeBSD: src/lib/libc/gen/strtofflags.c,v 1.24 2007/01/09 00:27:55 imp Exp $");
 
 #include <sys/types.h>
 #include <sys/stat.h>
@@ -43,6 +39,7 @@
 #include <stddef.h>
 #include <stdlib.h>
 #include <string.h>
+#include <unistd.h>
 
 static struct {
 	char *name;
Index: crypt.c
===================================================================
RCS file: /home/cvs/src/lib/libc/gen/crypt.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -L lib/libc/gen/crypt.c -L lib/libc/gen/crypt.c -u -r1.2 -r1.3
--- lib/libc/gen/crypt.c
+++ lib/libc/gen/crypt.c
@@ -13,10 +13,6 @@
  * 2. Redistributions in binary form must reproduce the above copyright
  *    notice, this list of conditions and the following disclaimer in the
  *    documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- *    must display the following acknowledgement:
- *	This product includes software developed by the University of
- *	California, Berkeley and its contributors.
  * 4. Neither the name of the University nor the names of its contributors
  *    may be used to endorse or promote products derived from this software
  *    without specific prior written permission.
@@ -34,10 +30,12 @@
  * SUCH DAMAGE.
  */
 
+#if defined(LIBC_SCCS) && !defined(lint)
 /* from static char sccsid[] = "@(#)crypt.c	5.11 (Berkeley) 6/25/91"; */
+#endif /* LIBC_SCCS and not lint */
+
 #include <sys/cdefs.h>
-/* __FBSDID("$FreeBSD: src/lib/libc/gen/crypt.c,v 1.8 2002/10/18 16:24:20 markm Exp $"); */
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: src/lib/libc/gen/crypt.c,v 1.9 2007/01/09 00:27:53 imp Exp $");
 
 #include <stdio.h>
 #include <string.h>
Index: ttyname.c
===================================================================
RCS file: /home/cvs/src/lib/libc/gen/ttyname.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -L lib/libc/gen/ttyname.c -L lib/libc/gen/ttyname.c -u -r1.2 -r1.3
--- lib/libc/gen/ttyname.c
+++ lib/libc/gen/ttyname.c
@@ -31,7 +31,7 @@
 static char sccsid[] = "@(#)ttyname.c	8.2 (Berkeley) 1/27/94";
 #endif /* LIBC_SCCS and not lint */
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/gen/ttyname.c,v 1.23 2005/05/20 15:39:20 ume Exp $");
+__FBSDID("$FreeBSD: src/lib/libc/gen/ttyname.c,v 1.24 2007/01/09 00:27:55 imp Exp $");
 
 #include "namespace.h"
 #include <sys/types.h>
Index: fts.c
===================================================================
RCS file: /home/cvs/src/lib/libc/gen/fts.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L lib/libc/gen/fts.c -L lib/libc/gen/fts.c -u -r1.1.1.1 -r1.2
--- lib/libc/gen/fts.c
+++ lib/libc/gen/fts.c
@@ -10,10 +10,6 @@
  * 2. Redistributions in binary form must reproduce the above copyright
  *    notice, this list of conditions and the following disclaimer in the
  *    documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- *    must display the following acknowledgement:
- *	This product includes software developed by the University of
- *	California, Berkeley and its contributors.
  * 4. Neither the name of the University nor the names of its contributors
  *    may be used to endorse or promote products derived from this software
  *    without specific prior written permission.
@@ -40,7 +36,7 @@
 #endif
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/gen/fts.c,v 1.27 2004/06/08 06:23:23 das Exp $");
+__FBSDID("$FreeBSD: src/lib/libc/gen/fts.c,v 1.28 2007/01/09 00:27:53 imp Exp $");
 
 #include "namespace.h"
 #include <sys/param.h>
Index: vis.3
===================================================================
RCS file: /home/cvs/src/lib/libc/gen/vis.3,v
retrieving revision 1.2
retrieving revision 1.3
diff -L lib/libc/gen/vis.3 -L lib/libc/gen/vis.3 -u -r1.2 -r1.3
--- lib/libc/gen/vis.3
+++ lib/libc/gen/vis.3
@@ -26,9 +26,9 @@
 .\" SUCH DAMAGE.
 .\"
 .\"     From: @(#)vis.3	8.1 (Berkeley) 6/9/93
-.\" $FreeBSD: src/lib/libc/gen/vis.3,v 1.27 2005/01/15 11:40:33 ru Exp $
+.\" $FreeBSD: src/lib/libc/gen/vis.3,v 1.30 2007/01/09 00:27:56 imp Exp $
 .\"
-.Dd March 21, 2004
+.Dd April 9, 2006
 .Dt VIS 3
 .Os
 .Sh NAME
@@ -239,6 +239,8 @@
 .Dv NL No (012)
 .It Li \er
 .Dv CR No (015)
+.It Li \es
+.Dv SP No (040)
 .It Li \et
 .Dv HT No (011)
 .It Li \ev
Index: valloc.c
===================================================================
RCS file: /home/cvs/src/lib/libc/gen/valloc.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -L lib/libc/gen/valloc.c -L lib/libc/gen/valloc.c -u -r1.2 -r1.3
--- lib/libc/gen/valloc.c
+++ lib/libc/gen/valloc.c
@@ -31,18 +31,18 @@
 static char sccsid[] = "@(#)valloc.c	8.1 (Berkeley) 6/4/93";
 #endif /* LIBC_SCCS and not lint */
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/gen/valloc.c,v 1.3 2002/03/22 21:52:05 obrien Exp $");
+__FBSDID("$FreeBSD: src/lib/libc/gen/valloc.c,v 1.5 2007/01/09 00:27:56 imp Exp $");
 
 #include <stdlib.h>
 #include <unistd.h>
 
 void *
-valloc(i)
-	size_t i;
+valloc(size_t i)
 {
-	long valsiz = getpagesize(), j;
-	void *cp = malloc(i + (valsiz-1));
+	void	*ret;
 
-	j = ((long)cp + (valsiz-1)) &~ (valsiz-1);
-	return ((void *)j);
+	if (posix_memalign(&ret, getpagesize(), i) != 0)
+		ret = NULL;
+
+	return ret;
 }
Index: fstab.c
===================================================================
RCS file: /home/cvs/src/lib/libc/gen/fstab.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L lib/libc/gen/fstab.c -L lib/libc/gen/fstab.c -u -r1.1.1.1 -r1.2
--- lib/libc/gen/fstab.c
+++ lib/libc/gen/fstab.c
@@ -10,10 +10,6 @@
  * 2. Redistributions in binary form must reproduce the above copyright
  *    notice, this list of conditions and the following disclaimer in the
  *    documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- *    must display the following acknowledgement:
- *	This product includes software developed by the University of
- *	California, Berkeley and its contributors.
  * 4. Neither the name of the University nor the names of its contributors
  *    may be used to endorse or promote products derived from this software
  *    without specific prior written permission.
@@ -35,7 +31,7 @@
 static char sccsid[] = "@(#)fstab.c	8.1 (Berkeley) 6/4/93";
 #endif /* LIBC_SCCS and not lint */
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/gen/fstab.c,v 1.14 2003/04/07 12:55:00 mdodd Exp $");
+__FBSDID("$FreeBSD: src/lib/libc/gen/fstab.c,v 1.15 2007/01/09 00:27:53 imp Exp $");
 
 #include "namespace.h"
 #include <sys/param.h>
Index: siglist.c
===================================================================
RCS file: /home/cvs/src/lib/libc/gen/siglist.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L lib/libc/gen/siglist.c -L lib/libc/gen/siglist.c -u -r1.1.1.1 -r1.2
--- lib/libc/gen/siglist.c
+++ lib/libc/gen/siglist.c
@@ -10,10 +10,6 @@
  * 2. Redistributions in binary form must reproduce the above copyright
  *    notice, this list of conditions and the following disclaimer in the
  *    documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- *    must display the following acknowledgement:
- *	This product includes software developed by the University of
- *	California, Berkeley and its contributors.
  * 4. Neither the name of the University nor the names of its contributors
  *    may be used to endorse or promote products derived from this software
  *    without specific prior written permission.
@@ -35,9 +31,8 @@
 static char sccsid[] = "@(#)siglist.c	8.1 (Berkeley) 6/4/93";
 #endif /* LIBC_SCCS and not lint */
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/gen/siglist.c,v 1.4 2002/09/07 08:14:19 jmallett Exp $");
+__FBSDID("$FreeBSD: src/lib/libc/gen/siglist.c,v 1.6 2007/01/20 08:24:01 maxim Exp $");
 
-#include <sys/cdefs.h>
 #include <signal.h>
 
 const char *const sys_signame[NSIG] = {
Index: getnetgrent.c
===================================================================
RCS file: /home/cvs/src/lib/libc/gen/getnetgrent.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L lib/libc/gen/getnetgrent.c -L lib/libc/gen/getnetgrent.c -u -r1.1.1.1 -r1.2
--- lib/libc/gen/getnetgrent.c
+++ lib/libc/gen/getnetgrent.c
@@ -13,10 +13,6 @@
  * 2. Redistributions in binary form must reproduce the above copyright
  *    notice, this list of conditions and the following disclaimer in the
  *    documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- *    must display the following acknowledgement:
- *	This product includes software developed by the University of
- *	California, Berkeley and its contributors.
  * 4. Neither the name of the University nor the names of its contributors
  *    may be used to endorse or promote products derived from this software
  *    without specific prior written permission.
@@ -38,7 +34,7 @@
 static char sccsid[] = "@(#)getnetgrent.c	8.2 (Berkeley) 4/27/95";
 #endif /* LIBC_SCCS and not lint */
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/gen/getnetgrent.c,v 1.33.2.1 2005/10/07 19:38:07 jon Exp $");
+__FBSDID("$FreeBSD: src/lib/libc/gen/getnetgrent.c,v 1.35 2007/01/09 00:27:54 imp Exp $");
 
 #include <ctype.h>
 #include <stdio.h>
Index: popen.3
===================================================================
RCS file: /home/cvs/src/lib/libc/gen/popen.3,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L lib/libc/gen/popen.3 -L lib/libc/gen/popen.3 -u -r1.1.1.1 -r1.2
--- lib/libc/gen/popen.3
+++ lib/libc/gen/popen.3
@@ -9,10 +9,6 @@
 .\" 2. Redistributions in binary form must reproduce the above copyright
 .\"    notice, this list of conditions and the following disclaimer in the
 .\"    documentation and/or other materials provided with the distribution.
-.\" 3. All advertising materials mentioning features or use of this software
-.\"    must display the following acknowledgement:
-.\"	This product includes software developed by the University of
-.\"	California, Berkeley and its contributors.
 .\" 4. Neither the name of the University nor the names of its contributors
 .\"    may be used to endorse or promote products derived from this software
 .\"    without specific prior written permission.
@@ -30,7 +26,7 @@
 .\" SUCH DAMAGE.
 .\"
 .\"     @(#)popen.3	8.2 (Berkeley) 5/3/95
-.\" $FreeBSD: src/lib/libc/gen/popen.3,v 1.17 2005/01/20 09:17:02 ru Exp $
+.\" $FreeBSD: src/lib/libc/gen/popen.3,v 1.18 2007/01/09 00:27:54 imp Exp $
 .\"
 .Dd May 3, 1995
 .Dt POPEN 3
Index: initgroups.3
===================================================================
RCS file: /home/cvs/src/lib/libc/gen/initgroups.3,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L lib/libc/gen/initgroups.3 -L lib/libc/gen/initgroups.3 -u -r1.1.1.1 -r1.2
--- lib/libc/gen/initgroups.3
+++ lib/libc/gen/initgroups.3
@@ -9,10 +9,6 @@
 .\" 2. Redistributions in binary form must reproduce the above copyright
 .\"    notice, this list of conditions and the following disclaimer in the
 .\"    documentation and/or other materials provided with the distribution.
-.\" 3. All advertising materials mentioning features or use of this software
-.\"    must display the following acknowledgement:
-.\"	This product includes software developed by the University of
-.\"	California, Berkeley and its contributors.
 .\" 4. Neither the name of the University nor the names of its contributors
 .\"    may be used to endorse or promote products derived from this software
 .\"    without specific prior written permission.
@@ -30,7 +26,7 @@
 .\" SUCH DAMAGE.
 .\"
 .\"     @(#)initgroups.3	8.1 (Berkeley) 6/4/93
-.\" $FreeBSD: src/lib/libc/gen/initgroups.3,v 1.12 2002/01/22 17:32:53 markm Exp $
+.\" $FreeBSD: src/lib/libc/gen/initgroups.3,v 1.13 2007/01/09 00:27:54 imp Exp $
 .\"
 .Dd June 4, 1993
 .Dt INITGROUPS 3
Index: time.3
===================================================================
RCS file: /home/cvs/src/lib/libc/gen/time.3,v
retrieving revision 1.2
retrieving revision 1.3
diff -L lib/libc/gen/time.3 -L lib/libc/gen/time.3 -u -r1.2 -r1.3
--- lib/libc/gen/time.3
+++ lib/libc/gen/time.3
@@ -30,7 +30,7 @@
 .\" SUCH DAMAGE.
 .\"
 .\"     @(#)time.3	8.1 (Berkeley) 6/4/93
-.\" $FreeBSD: src/lib/libc/gen/time.3,v 1.14 2005/01/20 09:17:02 ru Exp $
+.\" $FreeBSD: src/lib/libc/gen/time.3,v 1.15 2007/01/09 00:27:55 imp Exp $
 .\"
 .Dd July 18, 2003
 .Dt TIME 3
Index: sysctl.c
===================================================================
RCS file: /home/cvs/src/lib/libc/gen/sysctl.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L lib/libc/gen/sysctl.c -L lib/libc/gen/sysctl.c -u -r1.1.1.1 -r1.2
--- lib/libc/gen/sysctl.c
+++ lib/libc/gen/sysctl.c
@@ -10,10 +10,6 @@
  * 2. Redistributions in binary form must reproduce the above copyright
  *    notice, this list of conditions and the following disclaimer in the
  *    documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- *    must display the following acknowledgement:
- *	This product includes software developed by the University of
- *	California, Berkeley and its contributors.
  * 4. Neither the name of the University nor the names of its contributors
  *    may be used to endorse or promote products derived from this software
  *    without specific prior written permission.
@@ -35,7 +31,7 @@
 static char sccsid[] = "@(#)sysctl.c	8.2 (Berkeley) 1/4/94";
 #endif /* LIBC_SCCS and not lint */
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/gen/sysctl.c,v 1.5 2003/02/16 17:29:09 nectar Exp $");
+__FBSDID("$FreeBSD: src/lib/libc/gen/sysctl.c,v 1.6 2007/01/09 00:27:55 imp Exp $");
 
 #include <sys/param.h>
 #include <sys/sysctl.h>
Index: getbootfile.c
===================================================================
RCS file: /home/cvs/src/lib/libc/gen/getbootfile.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L lib/libc/gen/getbootfile.c -L lib/libc/gen/getbootfile.c -u -r1.1.1.1 -r1.2
--- lib/libc/gen/getbootfile.c
+++ lib/libc/gen/getbootfile.c
@@ -10,10 +10,6 @@
  * 2. Redistributions in binary form must reproduce the above copyright
  *    notice, this list of conditions and the following disclaimer in the
  *    documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- *    must display the following acknowledgement:
- *	This product includes software developed by the University of
- *	California, Berkeley and its contributors.
  * 4. Neither the name of the University nor the names of its contributors
  *    may be used to endorse or promote products derived from this software
  *    without specific prior written permission.
@@ -35,7 +31,7 @@
 static char sccsid[] = "From: @(#)gethostname.c	8.1 (Berkeley) 6/4/93";
 #endif /* LIBC_SCCS and not lint */
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/gen/getbootfile.c,v 1.8 2005/05/03 15:28:07 delphij Exp $");
+__FBSDID("$FreeBSD: src/lib/libc/gen/getbootfile.c,v 1.9 2007/01/09 00:27:53 imp Exp $");
 
 #include <sys/param.h>
 #include <sys/sysctl.h>
Index: getgrouplist.c
===================================================================
RCS file: /home/cvs/src/lib/libc/gen/getgrouplist.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L lib/libc/gen/getgrouplist.c -L lib/libc/gen/getgrouplist.c -u -r1.1.1.1 -r1.2
--- lib/libc/gen/getgrouplist.c
+++ lib/libc/gen/getgrouplist.c
@@ -10,10 +10,6 @@
  * 2. Redistributions in binary form must reproduce the above copyright
  *    notice, this list of conditions and the following disclaimer in the
  *    documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- *    must display the following acknowledgement:
- *	This product includes software developed by the University of
- *	California, Berkeley and its contributors.
  * 4. Neither the name of the University nor the names of its contributors
  *    may be used to endorse or promote products derived from this software
  *    without specific prior written permission.
@@ -35,7 +31,7 @@
 static char sccsid[] = "@(#)getgrouplist.c	8.2 (Berkeley) 12/8/94";
 #endif /* LIBC_SCCS and not lint */
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/gen/getgrouplist.c,v 1.14 2005/05/03 16:20:03 delphij Exp $");
+__FBSDID("$FreeBSD: src/lib/libc/gen/getgrouplist.c,v 1.15 2007/01/09 00:27:53 imp Exp $");
 
 /*
  * get credential
Index: confstr.c
===================================================================
RCS file: /home/cvs/src/lib/libc/gen/confstr.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -L lib/libc/gen/confstr.c -L lib/libc/gen/confstr.c -u -r1.2 -r1.3
--- lib/libc/gen/confstr.c
+++ lib/libc/gen/confstr.c
@@ -27,10 +27,11 @@
  * SUCH DAMAGE.
  */
 
-/* static char sccsid[] = "@(#)confstr.c	8.1 (Berkeley) 6/4/93"; */
+#if defined(LIBC_SCCS) && !defined(lint)
+static char sccsid[] = "@(#)confstr.c	8.1 (Berkeley) 6/4/93";
+#endif /* LIBC_SCCS and not lint */
 #include <sys/cdefs.h>
-/*__FBSDID("$FreeBSD: src/lib/libc/gen/confstr.c,v 1.9 2003/05/01 19:03:13 nectar Exp $"); */
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: src/lib/libc/gen/confstr.c,v 1.10 2007/01/09 00:27:53 imp Exp $");
 
 #include <sys/param.h>
 
Index: ualarm.3
===================================================================
RCS file: /home/cvs/src/lib/libc/gen/ualarm.3,v
retrieving revision 1.2
retrieving revision 1.3
diff -L lib/libc/gen/ualarm.3 -L lib/libc/gen/ualarm.3 -u -r1.2 -r1.3
--- lib/libc/gen/ualarm.3
+++ lib/libc/gen/ualarm.3
@@ -26,7 +26,7 @@
 .\" SUCH DAMAGE.
 .\"
 .\"     From: @(#)ualarm.3	8.2 (Berkeley) 4/19/94
-.\" $FreeBSD: src/lib/libc/gen/ualarm.3,v 1.19 2004/07/02 23:52:10 ru Exp $
+.\" $FreeBSD: src/lib/libc/gen/ualarm.3,v 1.20 2007/01/09 00:27:56 imp Exp $
 .\"
 .Dd April 19, 1994
 .Dt UALARM 3
Index: pwcache.3
===================================================================
RCS file: /home/cvs/src/lib/libc/gen/pwcache.3,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L lib/libc/gen/pwcache.3 -L lib/libc/gen/pwcache.3 -u -r1.1.1.1 -r1.2
--- lib/libc/gen/pwcache.3
+++ lib/libc/gen/pwcache.3
@@ -9,10 +9,6 @@
 .\" 2. Redistributions in binary form must reproduce the above copyright
 .\"    notice, this list of conditions and the following disclaimer in the
 .\"    documentation and/or other materials provided with the distribution.
-.\" 3. All advertising materials mentioning features or use of this software
-.\"    must display the following acknowledgement:
-.\"	This product includes software developed by the University of
-.\"	California, Berkeley and its contributors.
 .\" 4. Neither the name of the University nor the names of its contributors
 .\"    may be used to endorse or promote products derived from this software
 .\"    without specific prior written permission.
@@ -30,9 +26,9 @@
 .\" SUCH DAMAGE.
 .\"
 .\"     @(#)pwcache.3	8.1 (Berkeley) 6/9/93
-.\" $FreeBSD: src/lib/libc/gen/pwcache.3,v 1.12 2002/03/22 02:35:47 imp Exp $
+.\" $FreeBSD: src/lib/libc/gen/pwcache.3,v 1.15 2007/01/09 00:27:55 imp Exp $
 .\"
-.Dd June 9, 1993
+.Dd March 22, 2002
 .Dt PWCACHE 3
 .Os
 .Sh NAME
@@ -43,10 +39,10 @@
 .Sh SYNOPSIS
 .In pwd.h
 .Ft const char *
-.Fn user_from_uid "unsigned long uid" "int nouser"
+.Fn user_from_uid "uid_t uid" "int nouser"
 .In grp.h
 .Ft const char *
-.Fn group_from_gid "unsigned long gid" "int nogroup"
+.Fn group_from_gid "gid_t gid" "int nogroup"
 .Sh DESCRIPTION
 The
 .Fn user_from_uid
Index: glob.c
===================================================================
RCS file: /home/cvs/src/lib/libc/gen/glob.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L lib/libc/gen/glob.c -L lib/libc/gen/glob.c -u -r1.1.1.1 -r1.2
--- lib/libc/gen/glob.c
+++ lib/libc/gen/glob.c
@@ -13,10 +13,6 @@
  * 2. Redistributions in binary form must reproduce the above copyright
  *    notice, this list of conditions and the following disclaimer in the
  *    documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- *    must display the following acknowledgement:
- *	This product includes software developed by the University of
- *	California, Berkeley and its contributors.
  * 4. Neither the name of the University nor the names of its contributors
  *    may be used to endorse or promote products derived from this software
  *    without specific prior written permission.
@@ -38,7 +34,7 @@
 static char sccsid[] = "@(#)glob.c	8.3 (Berkeley) 10/13/93";
 #endif /* LIBC_SCCS and not lint */
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/gen/glob.c,v 1.22.8.1 2005/10/04 14:31:10 ache Exp $");
+__FBSDID("$FreeBSD: src/lib/libc/gen/glob.c,v 1.26 2007/01/09 00:27:54 imp Exp $");
 
 /*
  * glob(3) -- a superset of the one defined in POSIX 1003.2.
@@ -144,7 +140,7 @@
 
 
 static int	 compare(const void *, const void *);
-static int	 g_Ctoc(const Char *, char *, u_int);
+static int	 g_Ctoc(const Char *, char *, size_t);
 static int	 g_lstat(Char *, struct stat *, glob_t *);
 static DIR	*g_opendir(Char *, glob_t *);
 static Char	*g_strchr(Char *, wchar_t);
@@ -152,34 +148,31 @@
 static Char	*g_strcat(Char *, const Char *);
 #endif
 static int	 g_stat(Char *, struct stat *, glob_t *);
-static int	 glob0(const Char *, glob_t *, int *);
-static int	 glob1(Char *, glob_t *, int *);
-static int	 glob2(Char *, Char *, Char *, Char *, glob_t *, int *);
-static int	 glob3(Char *, Char *, Char *, Char *, Char *, glob_t *, int *);
-static int	 globextend(const Char *, glob_t *, int *);
+static int	 glob0(const Char *, glob_t *, size_t *);
+static int	 glob1(Char *, glob_t *, size_t *);
+static int	 glob2(Char *, Char *, Char *, Char *, glob_t *, size_t *);
+static int	 glob3(Char *, Char *, Char *, Char *, Char *, glob_t *, size_t *);
+static int	 globextend(const Char *, glob_t *, size_t *);
 static const Char *	
 		 globtilde(const Char *, Char *, size_t, glob_t *);
-static int	 globexp1(const Char *, glob_t *, int *);
-static int	 globexp2(const Char *, const Char *, glob_t *, int *, int *);
+static int	 globexp1(const Char *, glob_t *, size_t *);
+static int	 globexp2(const Char *, const Char *, glob_t *, int *, size_t *);
 static int	 match(Char *, Char *, Char *);
 #ifdef DEBUG
 static void	 qprintf(const char *, Char *);
 #endif
 
 int
-glob(pattern, flags, errfunc, pglob)
-	const char *pattern;
-	int flags, (*errfunc)(const char *, int);
-	glob_t *pglob;
+glob(const char *pattern, int flags, int (*errfunc)(const char *, int), glob_t *pglob)
 {
-	const u_char *patnext;
-	int limit;
+	const char *patnext;
+	size_t limit;
 	Char *bufnext, *bufend, patbuf[MAXPATHLEN], prot;
 	mbstate_t mbs;
 	wchar_t wc;
 	size_t clen;
 
-	patnext = (u_char *) pattern;
+	patnext = pattern;
 	if (!(flags & GLOB_APPEND)) {
 		pglob->gl_pathc = 0;
 		pglob->gl_pathv = NULL;
@@ -244,10 +237,7 @@
  * characters
  */
 static int
-globexp1(pattern, pglob, limit)
-	const Char *pattern;
-	glob_t *pglob;
-	int *limit;
+globexp1(const Char *pattern, glob_t *pglob, size_t *limit)
 {
 	const Char* ptr = pattern;
 	int rv;
@@ -270,10 +260,7 @@
  * If it fails then it tries to glob the rest of the pattern and returns.
  */
 static int
-globexp2(ptr, pattern, pglob, rv, limit)
-	const Char *ptr, *pattern;
-	glob_t *pglob;
-	int *rv, *limit;
+globexp2(const Char *ptr, const Char *pattern, glob_t *pglob, int *rv, size_t *limit)
 {
 	int     i;
 	Char   *lm, *ls;
@@ -377,11 +364,7 @@
  * expand tilde from the passwd file.
  */
 static const Char *
-globtilde(pattern, patbuf, patbuf_len, pglob)
-	const Char *pattern;
-	Char *patbuf;
-	size_t patbuf_len;
-	glob_t *pglob;
+globtilde(const Char *pattern, Char *patbuf, size_t patbuf_len, glob_t *pglob)
 {
 	struct passwd *pwd;
 	char *h;
@@ -447,13 +430,11 @@
  * if things went well, nonzero if errors occurred.
  */
 static int
-glob0(pattern, pglob, limit)
-	const Char *pattern;
-	glob_t *pglob;
-	int *limit;
+glob0(const Char *pattern, glob_t *pglob, size_t *limit)
 {
 	const Char *qpatnext;
-	int c, err, oldpathc;
+	int c, err;
+	size_t oldpathc;
 	Char *bufnext, patbuf[MAXPATHLEN];
 
 	qpatnext = globtilde(pattern, patbuf, MAXPATHLEN, pglob);
@@ -536,17 +517,13 @@
 }
 
 static int
-compare(p, q)
-	const void *p, *q;
+compare(const void *p, const void *q)
 {
 	return(strcmp(*(char **)p, *(char **)q));
 }
 
 static int
-glob1(pattern, pglob, limit)
-	Char *pattern;
-	glob_t *pglob;
-	int *limit;
+glob1(Char *pattern, glob_t *pglob, size_t *limit)
 {
 	Char pathbuf[MAXPATHLEN];
 
@@ -563,10 +540,8 @@
  * meta characters.
  */
 static int
-glob2(pathbuf, pathend, pathend_last, pattern, pglob, limit)
-	Char *pathbuf, *pathend, *pathend_last, *pattern;
-	glob_t *pglob;
-	int *limit;
+glob2(Char *pathbuf, Char *pathend, Char *pathend_last, Char *pattern,
+      glob_t *pglob, size_t *limit)
 {
 	struct stat sb;
 	Char *p, *q;
@@ -623,10 +598,9 @@
 }
 
 static int
-glob3(pathbuf, pathend, pathend_last, pattern, restpattern, pglob, limit)
-	Char *pathbuf, *pathend, *pathend_last, *pattern, *restpattern;
-	glob_t *pglob;
-	int *limit;
+glob3(Char *pathbuf, Char *pathend, Char *pathend_last,
+      Char *pattern, Char *restpattern,
+      glob_t *pglob, size_t *limit)
 {
 	struct dirent *dp;
 	DIR *dirp;
@@ -666,7 +640,7 @@
 	else
 		readdirfunc = readdir;
 	while ((dp = (*readdirfunc)(dirp))) {
-		u_char *sc;
+		char *sc;
 		Char *dc;
 		wchar_t wc;
 		size_t clen;
@@ -677,7 +651,7 @@
 			continue;
 		memset(&mbs, 0, sizeof(mbs));
 		dc = pathend;
-		sc = (u_char *) dp->d_name;
+		sc = dp->d_name;
 		while (dc < pathend_last) {
 			clen = mbrtowc(&wc, sc, MB_LEN_MAX, &mbs);
 			if (clen == (size_t)-1 || clen == (size_t)-2) {
@@ -722,14 +696,10 @@
  *	gl_pathv points to (gl_offs + gl_pathc + 1) items.
  */
 static int
-globextend(path, pglob, limit)
-	const Char *path;
-	glob_t *pglob;
-	int *limit;
+globextend(const Char *path, glob_t *pglob, size_t *limit)
 {
 	char **pathv;
-	int i;
-	u_int newsize, len;
+	size_t i, newsize, len;
 	char *copy;
 	const Char *p;
 
@@ -753,7 +723,7 @@
 	if (pglob->gl_pathv == NULL && pglob->gl_offs > 0) {
 		/* first time around -- clear initial gl_offs items */
 		pathv += pglob->gl_offs;
-		for (i = pglob->gl_offs; --i >= 0; )
+		for (i = pglob->gl_offs + 1; --i > 0; )
 			*--pathv = NULL;
 	}
 	pglob->gl_pathv = pathv;
@@ -777,8 +747,7 @@
  * pattern causes a recursion level.
  */
 static int
-match(name, pat, patend)
-	Char *name, *pat, *patend;
+match(Char *name, Char *pat, Char *patend)
 {
 	int ok, negate_range;
 	Char c, k;
@@ -829,10 +798,9 @@
 
 /* Free allocated data belonging to a glob_t structure. */
 void
-globfree(pglob)
-	glob_t *pglob;
+globfree(glob_t *pglob)
 {
-	int i;
+	size_t i;
 	char **pp;
 
 	if (pglob->gl_pathv != NULL) {
@@ -846,9 +814,7 @@
 }
 
 static DIR *
-g_opendir(str, pglob)
-	Char *str;
-	glob_t *pglob;
+g_opendir(Char *str, glob_t *pglob)
 {
 	char buf[MAXPATHLEN];
 
@@ -866,10 +832,7 @@
 }
 
 static int
-g_lstat(fn, sb, pglob)
-	Char *fn;
-	struct stat *sb;
-	glob_t *pglob;
+g_lstat(Char *fn, struct stat *sb, glob_t *pglob)
 {
 	char buf[MAXPATHLEN];
 
@@ -883,10 +846,7 @@
 }
 
 static int
-g_stat(fn, sb, pglob)
-	Char *fn;
-	struct stat *sb;
-	glob_t *pglob;
+g_stat(Char *fn, struct stat *sb, glob_t *pglob)
 {
 	char buf[MAXPATHLEN];
 
@@ -900,10 +860,9 @@
 }
 
 static Char *
-g_strchr(str, ch)
-	Char *str;
-	wchar_t ch;
+g_strchr(Char *str, wchar_t ch)
 {
+
 	do {
 		if (*str == ch)
 			return (str);
@@ -912,10 +871,7 @@
 }
 
 static int
-g_Ctoc(str, buf, len)
-	const Char *str;
-	char *buf;
-	u_int len;
+g_Ctoc(const Char *str, char *buf, size_t len)
 {
 	mbstate_t mbs;
 	size_t clen;
@@ -936,9 +892,7 @@
 
 #ifdef DEBUG
 static void
-qprintf(str, s)
-	const char *str;
-	Char *s;
+qprintf(const char *str, Char *s)
 {
 	Char *p;
 
Index: signal.c
===================================================================
RCS file: /home/cvs/src/lib/libc/gen/signal.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L lib/libc/gen/signal.c -L lib/libc/gen/signal.c -u -r1.1.1.1 -r1.2
--- lib/libc/gen/signal.c
+++ lib/libc/gen/signal.c
@@ -10,10 +10,6 @@
  * 2. Redistributions in binary form must reproduce the above copyright
  *    notice, this list of conditions and the following disclaimer in the
  *    documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- *    must display the following acknowledgement:
- *	This product includes software developed by the University of
- *	California, Berkeley and its contributors.
  * 4. Neither the name of the University nor the names of its contributors
  *    may be used to endorse or promote products derived from this software
  *    without specific prior written permission.
@@ -35,7 +31,7 @@
 static char sccsid[] = "@(#)signal.c	8.1 (Berkeley) 6/4/93";
 #endif /* LIBC_SCCS and not lint */
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/gen/signal.c,v 1.3 2002/02/01 00:57:29 obrien Exp $");
+__FBSDID("$FreeBSD: src/lib/libc/gen/signal.c,v 1.4 2007/01/09 00:27:55 imp Exp $");
 
 /*
  * Almost backwards compatible signal.
Index: uname.c
===================================================================
RCS file: /home/cvs/src/lib/libc/gen/uname.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -L lib/libc/gen/uname.c -L lib/libc/gen/uname.c -u -r1.2 -r1.3
--- lib/libc/gen/uname.c
+++ lib/libc/gen/uname.c
@@ -31,7 +31,7 @@
 static char sccsid[] = "From: @(#)uname.c	8.1 (Berkeley) 1/4/94";
 #endif /* LIBC_SCCS and not lint */
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/gen/uname.c,v 1.9 2002/02/01 00:57:29 obrien Exp $");
+__FBSDID("$FreeBSD: src/lib/libc/gen/uname.c,v 1.10 2007/01/09 00:27:56 imp Exp $");
 
 #define uname wrapped_uname
 #include <sys/param.h>
Index: sysconf.c
===================================================================
RCS file: /home/cvs/src/lib/libc/gen/sysconf.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L lib/libc/gen/sysconf.c -L lib/libc/gen/sysconf.c -u -r1.1.1.1 -r1.2
--- lib/libc/gen/sysconf.c
+++ lib/libc/gen/sysconf.c
@@ -13,10 +13,6 @@
  * 2. Redistributions in binary form must reproduce the above copyright
  *    notice, this list of conditions and the following disclaimer in the
  *    documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- *    must display the following acknowledgement:
- *	This product includes software developed by the University of
- *	California, Berkeley and its contributors.
  * 4. Neither the name of the University nor the names of its contributors
  *    may be used to endorse or promote products derived from this software
  *    without specific prior written permission.
@@ -38,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.20 2002/11/17 08:54:29 dougb Exp $");
+__FBSDID("$FreeBSD: src/lib/libc/gen/sysconf.c,v 1.25 2007/04/14 13:06:57 pjd Exp $");
 
 #include <sys/param.h>
 #include <sys/time.h>
@@ -77,10 +73,9 @@
 	struct rlimit rl;
 	size_t len;
 	int mib[2], sverrno, value;
-	long defaultresult;
+	long lvalue, defaultresult;
 	const char *path;
 
-	len = sizeof(value);
 	defaultresult = -1;
 
 	switch (name) {
@@ -170,11 +165,11 @@
 do_NAME_MAX:
 		sverrno = errno;
 		errno = 0;
-		value = pathconf(path, _PC_NAME_MAX);
-		if (value == -1 && errno != 0)
+		lvalue = pathconf(path, _PC_NAME_MAX);
+		if (lvalue == -1 && errno != 0)
 			return (-1);
 		errno = sverrno;
-		return (value);
+		return (lvalue);
 
 	case _SC_ASYNCHRONOUS_IO:
 #if _POSIX_ASYNCHRONOUS_IO == 0
@@ -297,12 +292,13 @@
 	case _SC_TIMER_MAX:
 		mib[0] = CTL_P1003_1B;
 		mib[1] = CTL_P1003_1B_TIMER_MAX;
-
-yesno:		if (sysctl(mib, 2, &value, &len, NULL, 0) == -1)
+yesno:
+		len = sizeof(value);
+		if (sysctl(mib, 2, &value, &len, NULL, 0) == -1)
 			return (-1);
 		if (value == 0)
 			return (defaultresult);
-		return (value);
+		return ((long)value);
 
 	case _SC_2_PBS:
 	case _SC_2_PBS_ACCOUNTING:
@@ -530,8 +526,9 @@
 		return (_XOPEN_REALTIME_THREADS);
 #endif
 	case _SC_XOPEN_SHM:
+		len = sizeof(lvalue);
 		sverrno = errno;
-		if (sysctlbyname("kern.ipc.shmmin", &value, &len, NULL, 
+		if (sysctlbyname("kern.ipc.shmmin", &lvalue, &len, NULL,
 		    0) == -1) {
 			errno = sverrno;
 			return (-1);
@@ -574,9 +571,20 @@
 		mib[1] = HW_NCPU;
 		break;
 
+#ifdef _SC_PHYS_PAGES
+	case _SC_PHYS_PAGES:
+		len = sizeof(lvalue);
+		if (sysctlbyname("hw.availpages", &lvalue, &len, NULL, 0) == -1)
+			return (-1);
+		return (lvalue);
+#endif
+
 	default:
 		errno = EINVAL;
 		return (-1);
 	}
-	return (sysctl(mib, 2, &value, &len, NULL, 0) == -1 ? -1 : value);
+	len = sizeof(value);
+	if (sysctl(mib, 2, &value, &len, NULL, 0) == -1)
+		value = -1;
+	return ((long)value);
 }
Index: arc4random.c
===================================================================
RCS file: /home/cvs/src/lib/libc/gen/arc4random.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -L lib/libc/gen/arc4random.c -L lib/libc/gen/arc4random.c -u -r1.2 -r1.3
--- lib/libc/gen/arc4random.c
+++ lib/libc/gen/arc4random.c
@@ -24,8 +24,7 @@
  */
 
 #include <sys/cdefs.h>
-/*__FBSDID("$FreeBSD: src/lib/libc/gen/arc4random.c,v 1.10 2004/03/24 14:44:57 green Exp $"); */
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: src/lib/libc/gen/arc4random.c,v 1.12 2007/05/25 10:40:33 delphij Exp $");
 
 #include "namespace.h"
 #include <sys/types.h>
@@ -62,14 +61,15 @@
 static struct arc4_stream rs;
 static int rs_initialized;
 static int rs_stired;
+static int arc4_count;
 
 static inline u_int8_t arc4_getbyte(struct arc4_stream *);
 static void arc4_stir(struct arc4_stream *);
 
-static inline void 
+static inline void
 arc4_init(struct arc4_stream *as)
 {
-	int n;
+	int     n;
 
 	for (n = 0; n < 256; n++)
 		as->s[n] = n;
@@ -77,10 +77,10 @@
 	as->j = 0;
 }
 
-static inline void 
+static inline void
 arc4_addrandom(struct arc4_stream *as, u_char *dat, int datlen)
 {
-	int n;
+	int     n;
 	u_int8_t si;
 
 	as->i--;
@@ -96,7 +96,7 @@
 static void
 arc4_stir(struct arc4_stream *as)
 {
-	int fd, n;
+	int     fd, n;
 	struct {
 		struct timeval tv;
 		pid_t pid;
@@ -123,7 +123,8 @@
 	 * by Ilya Mironov.
 	 */
 	for (n = 0; n < 1024; n++)
-		arc4_getbyte(as);
+		(void) arc4_getbyte(as);
+	arc4_count = 400000;
 }
 
 static inline u_int8_t
@@ -166,14 +167,14 @@
 static void
 arc4_check_stir(void)
 {
-	if (!rs_stired) {
+	if (!rs_stired || --arc4_count == 0) {
 		arc4_stir(&rs);
 		rs_stired = 1;
 	}
 }
 
 void
-arc4random_stir()
+arc4random_stir(void)
 {
 	THREAD_LOCK();
 	arc4_check_init();
@@ -192,7 +193,7 @@
 }
 
 u_int32_t
-arc4random()
+arc4random(void)
 {
 	u_int32_t rnd;
 
Index: ftw.3
===================================================================
RCS file: /home/cvs/src/lib/libc/gen/ftw.3,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L lib/libc/gen/ftw.3 -L lib/libc/gen/ftw.3 -u -r1.1.1.1 -r1.2
--- lib/libc/gen/ftw.3
+++ lib/libc/gen/ftw.3
@@ -18,7 +18,7 @@
 .\" Agency (DARPA) and Air Force Research Laboratory, Air Force
 .\" Materiel Command, USAF, under agreement number F39502-99-1-0512.
 .\"
-.\" $FreeBSD: src/lib/libc/gen/ftw.3,v 1.2 2004/07/07 20:11:35 ru Exp $
+.\" $FreeBSD: src/lib/libc/gen/ftw.3,v 1.3 2005/11/23 15:41:36 ru Exp $
 .\"
 .Dd July 5, 2004
 .Dt FTW 3
@@ -37,7 +37,7 @@
 .Ft int
 .Fo nftw
 .Fa "const char *path"
-.Fa "int \*[lp]*fn\*[rp]\*[lp](const char *, const struct stat *, int, struct FTW *\*[rp]"
+.Fa "int \*[lp]*fn\*[rp]\*[lp]const char *, const struct stat *, int, struct FTW *\*[rp]"
 .Fa "int maxfds"
 .Fa "int flags"
 .Fc
Index: sysctl.3
===================================================================
RCS file: /home/cvs/src/lib/libc/gen/sysctl.3,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L lib/libc/gen/sysctl.3 -L lib/libc/gen/sysctl.3 -u -r1.1.1.1 -r1.2
--- lib/libc/gen/sysctl.3
+++ lib/libc/gen/sysctl.3
@@ -9,10 +9,6 @@
 .\" 2. Redistributions in binary form must reproduce the above copyright
 .\"    notice, this list of conditions and the following disclaimer in the
 .\"    documentation and/or other materials provided with the distribution.
-.\" 3. All advertising materials mentioning features or use of this software
-.\"    must display the following acknowledgement:
-.\"	This product includes software developed by the University of
-.\"	California, Berkeley and its contributors.
 .\" 4. Neither the name of the University nor the names of its contributors
 .\"    may be used to endorse or promote products derived from this software
 .\"    without specific prior written permission.
@@ -30,9 +26,9 @@
 .\" SUCH DAMAGE.
 .\"
 .\"	@(#)sysctl.3	8.4 (Berkeley) 5/9/95
-.\" $FreeBSD: src/lib/libc/gen/sysctl.3,v 1.66 2005/06/15 19:04:03 ru Exp $
+.\" $FreeBSD: src/lib/libc/gen/sysctl.3,v 1.69 2007/04/10 11:19:52 ru Exp $
 .\"
-.Dd January 23, 2001
+.Dd April 10, 2007
 .Dt SYSCTL 3
 .Os
 .Sh NAME
@@ -329,6 +325,7 @@
 .It "KERN_CLOCKRATE	struct clockinfo	no"
 .It "KERN_FILE	struct file	no"
 .It "KERN_HOSTID	integer	yes"
+.It "KERN_HOSTUUID	string	yes"
 .It "KERN_HOSTNAME	string	yes"
 .It "KERN_JOB_CONTROL	integer	no"
 .It "KERN_MAXFILES	integer	yes"
@@ -378,7 +375,9 @@
 .Va struct file ,
 whose size depends on the current number of such objects in the system.
 .It Li KERN_HOSTID
-Get or set the host id.
+Get or set the host ID.
+.It Li KERN_HOSTUUID
+Get or set the host's universally unique identifier (UUID).
 .It Li KERN_HOSTNAME
 Get or set the hostname.
 .It Li KERN_JOB_CONTROL
Index: nlist.c
===================================================================
RCS file: /home/cvs/src/lib/libc/gen/nlist.c,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -L lib/libc/gen/nlist.c -L lib/libc/gen/nlist.c -u -r1.1.1.2 -r1.2
--- lib/libc/gen/nlist.c
+++ lib/libc/gen/nlist.c
@@ -10,10 +10,6 @@
  * 2. Redistributions in binary form must reproduce the above copyright
  *    notice, this list of conditions and the following disclaimer in the
  *    documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- *    must display the following acknowledgement:
- *	This product includes software developed by the University of
- *	California, Berkeley and its contributors.
  * 4. Neither the name of the University nor the names of its contributors
  *    may be used to endorse or promote products derived from this software
  *    without specific prior written permission.
@@ -35,7 +31,7 @@
 static char sccsid[] = "@(#)nlist.c	8.1 (Berkeley) 6/4/93";
 #endif /* LIBC_SCCS and not lint */
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/gen/nlist.c,v 1.18.12.1 2005/12/30 22:13:56 marcel Exp $");
+__FBSDID("$FreeBSD: src/lib/libc/gen/nlist.c,v 1.20 2007/01/09 00:27:54 imp Exp $");
 
 #include "namespace.h"
 #include <sys/param.h>
Index: getcap.3
===================================================================
RCS file: /home/cvs/src/lib/libc/gen/getcap.3,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L lib/libc/gen/getcap.3 -L lib/libc/gen/getcap.3 -u -r1.1.1.1 -r1.2
--- lib/libc/gen/getcap.3
+++ lib/libc/gen/getcap.3
@@ -12,10 +12,6 @@
 .\" 2. Redistributions in binary form must reproduce the above copyright
 .\"    notice, this list of conditions and the following disclaimer in the
 .\"    documentation and/or other materials provided with the distribution.
-.\" 3. All advertising materials mentioning features or use of this software
-.\"    must display the following acknowledgement:
-.\"	This product includes software developed by the University of
-.\"	California, Berkeley and its contributors.
 .\" 4. Neither the name of the University nor the names of its contributors
 .\"    may be used to endorse or promote products derived from this software
 .\"    without specific prior written permission.
@@ -33,9 +29,9 @@
 .\" SUCH DAMAGE.
 .\"
 .\"	@(#)getcap.3	8.4 (Berkeley) 5/13/94
-.\" $FreeBSD: src/lib/libc/gen/getcap.3,v 1.27 2005/02/13 23:45:46 ru Exp $
+.\" $FreeBSD: src/lib/libc/gen/getcap.3,v 1.30 2007/02/11 18:14:49 maxim Exp $
 .\"
-.Dd May 13, 1994
+.Dd March 22, 2002
 .Dt GETCAP 3
 .Os
 .Sh NAME
@@ -55,19 +51,19 @@
 .Sh SYNOPSIS
 .In stdlib.h
 .Ft int
-.Fn cgetent "char **buf" "char **db_array" "char *name"
+.Fn cgetent "char **buf" "char **db_array" "const char *name"
 .Ft int
-.Fn cgetset "char *ent"
+.Fn cgetset "const char *ent"
 .Ft int
-.Fn cgetmatch "char *buf" "char *name"
+.Fn cgetmatch "const char *buf" "const char *name"
 .Ft char *
-.Fn cgetcap "char *buf" "char *cap" "int type"
+.Fn cgetcap "char *buf" "const char *cap" "int type"
 .Ft int
-.Fn cgetnum "char *buf" "char *cap" "long *num"
+.Fn cgetnum "char *buf" "const char *cap" "long *num"
 .Ft int
-.Fn cgetstr "char *buf" "char *cap" "char **str"
+.Fn cgetstr "char *buf" "const char *cap" "char **str"
 .Ft int
-.Fn cgetustr "char *buf" "char *cap" "char **str"
+.Fn cgetustr "char *buf" "const char *cap" "char **str"
 .Ft int
 .Fn cgetfirst "char **buf" "char **db_array"
 .Ft int
@@ -531,7 +527,7 @@
 The
 .Fn cgetent ,
 and
-.Fn cgetseq
+.Fn cgetset
 functions may fail and set
 .Va errno
 for any of the errors specified for the library functions:
Index: getpagesize.3
===================================================================
RCS file: /home/cvs/src/lib/libc/gen/getpagesize.3,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L lib/libc/gen/getpagesize.3 -L lib/libc/gen/getpagesize.3 -u -r1.1.1.1 -r1.2
--- lib/libc/gen/getpagesize.3
+++ lib/libc/gen/getpagesize.3
@@ -9,10 +9,6 @@
 .\" 2. Redistributions in binary form must reproduce the above copyright
 .\"    notice, this list of conditions and the following disclaimer in the
 .\"    documentation and/or other materials provided with the distribution.
-.\" 3. All advertising materials mentioning features or use of this software
-.\"    must display the following acknowledgement:
-.\"	This product includes software developed by the University of
-.\"	California, Berkeley and its contributors.
 .\" 4. Neither the name of the University nor the names of its contributors
 .\"    may be used to endorse or promote products derived from this software
 .\"    without specific prior written permission.
@@ -30,7 +26,7 @@
 .\" SUCH DAMAGE.
 .\"
 .\"     @(#)getpagesize.3	8.1 (Berkeley) 6/4/93
-.\" $FreeBSD: src/lib/libc/gen/getpagesize.3,v 1.11 2002/12/27 12:15:28 schweikh Exp $
+.\" $FreeBSD: src/lib/libc/gen/getpagesize.3,v 1.12 2007/01/09 00:27:54 imp Exp $
 .\"
 .Dd June 4, 1993
 .Dt GETPAGESIZE 3
Index: getbootfile.3
===================================================================
RCS file: /home/cvs/src/lib/libc/gen/getbootfile.3,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L lib/libc/gen/getbootfile.3 -L lib/libc/gen/getbootfile.3 -u -r1.1.1.1 -r1.2
--- lib/libc/gen/getbootfile.3
+++ lib/libc/gen/getbootfile.3
@@ -9,10 +9,6 @@
 .\" 2. Redistributions in binary form must reproduce the above copyright
 .\"    notice, this list of conditions and the following disclaimer in the
 .\"    documentation and/or other materials provided with the distribution.
-.\" 3. All advertising materials mentioning features or use of this software
-.\"    must display the following acknowledgement:
-.\"	This product includes software developed by the University of
-.\"	California, Berkeley and its contributors.
 .\" 4. Neither the name of the University nor the names of its contributors
 .\"    may be used to endorse or promote products derived from this software
 .\"    without specific prior written permission.
@@ -30,7 +26,7 @@
 .\" SUCH DAMAGE.
 .\"
 .\"     From: @(#)gethostname.3	8.1 (Berkeley) 6/4/93
-.\" $FreeBSD: src/lib/libc/gen/getbootfile.3,v 1.13 2005/01/20 09:17:02 ru Exp $
+.\" $FreeBSD: src/lib/libc/gen/getbootfile.3,v 1.14 2007/01/09 00:27:53 imp Exp $
 .\"
 .Dd September 23, 1994
 .Dt GETBOOTFILE 3
Index: termios.c
===================================================================
RCS file: /home/cvs/src/lib/libc/gen/termios.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -L lib/libc/gen/termios.c -L lib/libc/gen/termios.c -u -r1.2 -r1.3
--- lib/libc/gen/termios.c
+++ lib/libc/gen/termios.c
@@ -31,7 +31,7 @@
 static char sccsid[] = "@(#)termios.c	8.2 (Berkeley) 2/21/94";
 #endif /* LIBC_SCCS and not lint */
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/gen/termios.c,v 1.13 2002/05/28 16:59:39 alfred Exp $");
+__FBSDID("$FreeBSD: src/lib/libc/gen/termios.c,v 1.14 2007/01/09 00:27:55 imp Exp $");
 
 #include "namespace.h"
 #include <sys/types.h>
Index: ctermid.3
===================================================================
RCS file: /home/cvs/src/lib/libc/gen/ctermid.3,v
retrieving revision 1.2
retrieving revision 1.3
diff -L lib/libc/gen/ctermid.3 -L lib/libc/gen/ctermid.3 -u -r1.2 -r1.3
--- lib/libc/gen/ctermid.3
+++ lib/libc/gen/ctermid.3
@@ -26,8 +26,7 @@
 .\" SUCH DAMAGE.
 .\"
 .\"     @(#)ctermid.3	8.1 (Berkeley) 6/4/93
-.\" $FreeBSD: src/lib/libc/gen/ctermid.3,v 1.11 2003/09/08 19:57:14 ru Exp $
-.\" $MidnightBSD$
+.\" $FreeBSD: src/lib/libc/gen/ctermid.3,v 1.12 2007/01/09 00:27:53 imp Exp $
 .\"
 .Dd June 4, 1993
 .Dt CTERMID 3
Index: pw_scan.c
===================================================================
RCS file: /home/cvs/src/lib/libc/gen/pw_scan.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L lib/libc/gen/pw_scan.c -L lib/libc/gen/pw_scan.c -u -r1.1.1.1 -r1.2
--- lib/libc/gen/pw_scan.c
+++ lib/libc/gen/pw_scan.c
@@ -10,10 +10,6 @@
  * 2. Redistributions in binary form must reproduce the above copyright
  *    notice, this list of conditions and the following disclaimer in the
  *    documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- *    must display the following acknowledgement:
- *	This product includes software developed by the University of
- *	California, Berkeley and its contributors.
  * 4. Neither the name of the University nor the names of its contributors
  *    may be used to endorse or promote products derived from this software
  *    without specific prior written permission.
@@ -35,7 +31,7 @@
 static char sccsid[] = "@(#)pw_scan.c	8.3 (Berkeley) 4/2/94";
 #endif /* LIBC_SCCS and not lint */
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/gen/pw_scan.c,v 1.25 2004/01/18 21:33:25 charnier Exp $");
+__FBSDID("$FreeBSD: src/lib/libc/gen/pw_scan.c,v 1.26 2007/01/09 00:27:55 imp Exp $");
 
 /*
  * This module is used to "verify" password entries by chpass(1) and
Index: setdomainname.c
===================================================================
RCS file: /home/cvs/src/lib/libc/gen/setdomainname.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L lib/libc/gen/setdomainname.c -L lib/libc/gen/setdomainname.c -u -r1.1.1.1 -r1.2
--- lib/libc/gen/setdomainname.c
+++ lib/libc/gen/setdomainname.c
@@ -10,10 +10,6 @@
  * 2. Redistributions in binary form must reproduce the above copyright
  *    notice, this list of conditions and the following disclaimer in the
  *    documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- *    must display the following acknowledgement:
- *	This product includes software developed by the University of
- *	California, Berkeley and its contributors.
  * 4. Neither the name of the University nor the names of its contributors
  *    may be used to endorse or promote products derived from this software
  *    without specific prior written permission.
@@ -35,7 +31,7 @@
 static char sccsid[] = "@(#)sethostname.c	8.1 (Berkeley) 6/4/93";
 #endif /* LIBC_SCCS and not lint */
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/gen/setdomainname.c,v 1.7 2002/02/01 00:57:29 obrien Exp $");
+__FBSDID("$FreeBSD: src/lib/libc/gen/setdomainname.c,v 1.8 2007/01/09 00:27:55 imp Exp $");
 
 #include <sys/param.h>
 #include <sys/sysctl.h>
Index: clock.c
===================================================================
RCS file: /home/cvs/src/lib/libc/gen/clock.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -L lib/libc/gen/clock.c -L lib/libc/gen/clock.c -u -r1.2 -r1.3
--- lib/libc/gen/clock.c
+++ lib/libc/gen/clock.c
@@ -27,10 +27,11 @@
  * SUCH DAMAGE.
  */
 
-/* static char sccsid[] = "@(#)clock.c	8.1 (Berkeley) 6/4/93"; */
+#if defined(LIBC_SCCS) && !defined(lint)
+static char sccsid[] = "@(#)clock.c	8.1 (Berkeley) 6/4/93";
+#endif /* LIBC_SCCS and not lint */
 #include <sys/cdefs.h>
-/* __FBSDID("$FreeBSD: src/lib/libc/gen/clock.c,v 1.3 2002/03/22 21:52:05 obrien Exp $"); */
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: src/lib/libc/gen/clock.c,v 1.4 2007/01/09 00:27:53 imp Exp $");
 
 #include <sys/param.h>
 #include <sys/time.h>
Index: errlst.c
===================================================================
RCS file: /home/cvs/src/lib/libc/gen/errlst.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -L lib/libc/gen/errlst.c -L lib/libc/gen/errlst.c -u -r1.2 -r1.3
--- lib/libc/gen/errlst.c
+++ lib/libc/gen/errlst.c
@@ -27,10 +27,11 @@
  * SUCH DAMAGE.
  */
 
-/*static char sccsid[] = "@(#)errlst.c	8.2 (Berkeley) 11/16/93";*/
+#if defined(LIBC_SCCS) && !defined(lint)
+static char sccsid[] = "@(#)errlst.c	8.2 (Berkeley) 11/16/93";
+#endif /* LIBC_SCCS and not lint */
 #include <sys/cdefs.h>
-/*__FBSDID("$FreeBSD: src/lib/libc/gen/errlst.c,v 1.8 2005/04/02 12:33:28 das Exp $");*/
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: src/lib/libc/gen/errlst.c,v 1.9 2007/01/09 00:27:53 imp Exp $");
 
 #include <stdio.h>
 
Index: msgctl.3
===================================================================
RCS file: /home/cvs/src/lib/libc/gen/msgctl.3,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L lib/libc/gen/msgctl.3 -L lib/libc/gen/msgctl.3 -u -r1.1.1.1 -r1.2
--- lib/libc/gen/msgctl.3
+++ lib/libc/gen/msgctl.3
@@ -29,7 +29,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/lib/libc/gen/msgctl.3,v 1.19 2003/09/08 19:57:14 ru Exp $
+.\" $FreeBSD: src/lib/libc/gen/msgctl.3,v 1.20 2006/08/09 18:05:44 maxim Exp $
 .\"/
 .Dd November 24, 1997
 .Dt MSGCTL 3
@@ -83,7 +83,7 @@
 The
 .Vt ipc_perm
 structure used inside the
-.Vt shmid_ds
+.Vt msqid_ds
 structure is defined in
 .In sys/ipc.h
 and looks like this:
Index: getbsize.3
===================================================================
RCS file: /home/cvs/src/lib/libc/gen/getbsize.3,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L lib/libc/gen/getbsize.3 -L lib/libc/gen/getbsize.3 -u -r1.1.1.1 -r1.2
--- lib/libc/gen/getbsize.3
+++ lib/libc/gen/getbsize.3
@@ -9,10 +9,6 @@
 .\" 2. Redistributions in binary form must reproduce the above copyright
 .\"    notice, this list of conditions and the following disclaimer in the
 .\"    documentation and/or other materials provided with the distribution.
-.\" 3. All advertising materials mentioning features or use of this software
-.\"    must display the following acknowledgement:
-.\"	This product includes software developed by the University of
-.\"	California, Berkeley and its contributors.
 .\" 4. Neither the name of the University nor the names of its contributors
 .\"    may be used to endorse or promote products derived from this software
 .\"    without specific prior written permission.
@@ -30,7 +26,7 @@
 .\" SUCH DAMAGE.
 .\"
 .\"     @(#)getbsize.3	8.1 (Berkeley) 6/4/93
-.\" $FreeBSD: src/lib/libc/gen/getbsize.3,v 1.10 2002/12/30 11:12:16 obrien Exp $
+.\" $FreeBSD: src/lib/libc/gen/getbsize.3,v 1.11 2007/01/09 00:27:53 imp Exp $
 .\"
 .Dd June 4, 1993
 .Dt GETBSIZE 3
Index: getdomainname.c
===================================================================
RCS file: /home/cvs/src/lib/libc/gen/getdomainname.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L lib/libc/gen/getdomainname.c -L lib/libc/gen/getdomainname.c -u -r1.1.1.1 -r1.2
--- lib/libc/gen/getdomainname.c
+++ lib/libc/gen/getdomainname.c
@@ -10,10 +10,6 @@
  * 2. Redistributions in binary form must reproduce the above copyright
  *    notice, this list of conditions and the following disclaimer in the
  *    documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- *    must display the following acknowledgement:
- *	This product includes software developed by the University of
- *	California, Berkeley and its contributors.
  * 4. Neither the name of the University nor the names of its contributors
  *    may be used to endorse or promote products derived from this software
  *    without specific prior written permission.
@@ -35,7 +31,7 @@
 static char sccsid[] = "@(#)gethostname.c	8.1 (Berkeley) 6/4/93";
 #endif /* LIBC_SCCS and not lint */
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/gen/getdomainname.c,v 1.7 2002/02/01 00:57:29 obrien Exp $");
+__FBSDID("$FreeBSD: src/lib/libc/gen/getdomainname.c,v 1.8 2007/01/09 00:27:53 imp Exp $");
 
 #include <sys/param.h>
 #include <sys/sysctl.h>
Index: __xuname.c
===================================================================
RCS file: /home/cvs/src/lib/libc/gen/__xuname.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -L lib/libc/gen/__xuname.c -L lib/libc/gen/__xuname.c -u -r1.2 -r1.3
--- lib/libc/gen/__xuname.c
+++ lib/libc/gen/__xuname.c
@@ -27,14 +27,18 @@
  * SUCH DAMAGE.
  */
 
+#if defined(LIBC_SCCS) && !defined(lint)
 /*static char sccsid[] = "From: @(#)uname.c	8.1 (Berkeley) 1/4/94";*/
+#endif /* LIBC_SCCS and not lint */
 #include <sys/cdefs.h>
-/*__FBSDID("$FreeBSD: src/lib/libc/gen/__xuname.c,v 1.9 2002/02/01 00:57:29 obrien Exp $"); */
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: src/lib/libc/gen/__xuname.c,v 1.13 2007/01/09 00:27:52 imp Exp $");
+
 #include <sys/param.h>
 #include <sys/sysctl.h>
 #include <sys/utsname.h>
 #include <errno.h>
+#include <stdlib.h>
+#include <string.h>
 
 int
 __xuname(int namesize, void *namebuf)
@@ -65,6 +69,8 @@
 			rval = -1;
 	}
 	name->sysname[sizeof(name->sysname) - 1] = '\0';
+	if ((p = getenv("UNAME_s")))
+		strlcpy(name->sysname, p, sizeof(name->sysname));
 
 	mib[0] = CTL_KERN;
 	mib[1] = KERN_HOSTNAME;
@@ -89,6 +95,8 @@
 			rval = -1;
 	}
 	name->release[sizeof(name->release) - 1] = '\0';
+	if ((p = getenv("UNAME_r")))
+		strlcpy(name->release, p, sizeof(name->release));
 
 	/* The version may have newlines in it, turn them into spaces. */
 	mib[0] = CTL_KERN;
@@ -110,6 +118,8 @@
 				*p = '\0';
 		}
 	}
+	if ((p = getenv("UNAME_v")))
+		strlcpy(name->version, p, sizeof(name->version));
 
 	mib[0] = CTL_HW;
 	mib[1] = HW_MACHINE;
@@ -122,5 +132,7 @@
 			rval = -1;
 	}
 	name->machine[sizeof(name->machine) - 1] = '\0';
+	if ((p = getenv("UNAME_m")))
+		strlcpy(name->machine, p, sizeof(name->machine));
 	return (rval);
 }
Index: exec.3
===================================================================
RCS file: /home/cvs/src/lib/libc/gen/exec.3,v
retrieving revision 1.2
retrieving revision 1.3
diff -L lib/libc/gen/exec.3 -L lib/libc/gen/exec.3 -u -r1.2 -r1.3
--- lib/libc/gen/exec.3
+++ lib/libc/gen/exec.3
@@ -26,8 +26,7 @@
 .\" SUCH DAMAGE.
 .\"
 .\"     @(#)exec.3	8.3 (Berkeley) 1/24/94
-.\" $FreeBSD: src/lib/libc/gen/exec.3,v 1.25 2005/02/13 22:25:12 ru Exp $
-.\" $MidnightBSD$
+.\" $FreeBSD: src/lib/libc/gen/exec.3,v 1.26 2007/01/09 00:27:53 imp Exp $
 .\"
 .Dd January 24, 1994
 .Dt EXEC 3
Index: getpwent.3
===================================================================
RCS file: /home/cvs/src/lib/libc/gen/getpwent.3,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L lib/libc/gen/getpwent.3 -L lib/libc/gen/getpwent.3 -u -r1.1.1.1 -r1.2
--- lib/libc/gen/getpwent.3
+++ lib/libc/gen/getpwent.3
@@ -9,10 +9,6 @@
 .\" 2. Redistributions in binary form must reproduce the above copyright
 .\"    notice, this list of conditions and the following disclaimer in the
 .\"    documentation and/or other materials provided with the distribution.
-.\" 3. All advertising materials mentioning features or use of this software
-.\"    must display the following acknowledgement:
-.\"	This product includes software developed by the University of
-.\"	California, Berkeley and its contributors.
 .\" 4. Neither the name of the University nor the names of its contributors
 .\"    may be used to endorse or promote products derived from this software
 .\"    without specific prior written permission.
@@ -30,7 +26,7 @@
 .\" SUCH DAMAGE.
 .\"
 .\"     From: @(#)getpwent.3	8.2 (Berkeley) 12/11/93
-.\" $FreeBSD: src/lib/libc/gen/getpwent.3,v 1.29 2005/02/13 22:25:12 ru Exp $
+.\" $FreeBSD: src/lib/libc/gen/getpwent.3,v 1.30 2007/01/09 00:27:54 imp Exp $
 .\"
 .Dd April 16, 2003
 .Dt GETPWENT 3
Index: getmntinfo.c
===================================================================
RCS file: /home/cvs/src/lib/libc/gen/getmntinfo.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L lib/libc/gen/getmntinfo.c -L lib/libc/gen/getmntinfo.c -u -r1.1.1.1 -r1.2
--- lib/libc/gen/getmntinfo.c
+++ lib/libc/gen/getmntinfo.c
@@ -10,10 +10,6 @@
  * 2. Redistributions in binary form must reproduce the above copyright
  *    notice, this list of conditions and the following disclaimer in the
  *    documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- *    must display the following acknowledgement:
- *	This product includes software developed by the University of
- *	California, Berkeley and its contributors.
  * 4. Neither the name of the University nor the names of its contributors
  *    may be used to endorse or promote products derived from this software
  *    without specific prior written permission.
@@ -35,7 +31,7 @@
 static char sccsid[] = "@(#)getmntinfo.c	8.1 (Berkeley) 6/4/93";
 #endif /* LIBC_SCCS and not lint */
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/gen/getmntinfo.c,v 1.4 2002/02/01 00:57:29 obrien Exp $");
+__FBSDID("$FreeBSD: src/lib/libc/gen/getmntinfo.c,v 1.5 2007/01/09 00:27:54 imp Exp $");
 
 #include <sys/param.h>
 #include <sys/ucred.h>
Index: modf.3
===================================================================
RCS file: /home/cvs/src/lib/libc/gen/modf.3,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L lib/libc/gen/modf.3 -L lib/libc/gen/modf.3 -u -r1.1.1.1 -r1.2
--- lib/libc/gen/modf.3
+++ lib/libc/gen/modf.3
@@ -13,10 +13,6 @@
 .\" 2. Redistributions in binary form must reproduce the above copyright
 .\"    notice, this list of conditions and the following disclaimer in the
 .\"    documentation and/or other materials provided with the distribution.
-.\" 3. All advertising materials mentioning features or use of this software
-.\"    must display the following acknowledgement:
-.\"	This product includes software developed by the University of
-.\"	California, Berkeley and its contributors.
 .\" 4. Neither the name of the University nor the names of its contributors
 .\"    may be used to endorse or promote products derived from this software
 .\"    without specific prior written permission.
@@ -34,7 +30,7 @@
 .\" SUCH DAMAGE.
 .\"
 .\"     @(#)modf.3	8.1 (Berkeley) 6/4/93
-.\" $FreeBSD: src/lib/libc/gen/modf.3,v 1.8 2002/12/18 13:33:02 ru Exp $
+.\" $FreeBSD: src/lib/libc/gen/modf.3,v 1.9 2007/01/09 00:27:54 imp Exp $
 .\"
 .Dd June 4, 1993
 .Dt MODF 3
Index: readdir.c
===================================================================
RCS file: /home/cvs/src/lib/libc/gen/readdir.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -L lib/libc/gen/readdir.c -L lib/libc/gen/readdir.c -u -r1.3 -r1.4
--- lib/libc/gen/readdir.c
+++ lib/libc/gen/readdir.c
@@ -31,7 +31,7 @@
 static char sccsid[] = "@(#)readdir.c	8.3 (Berkeley) 9/29/94";
 #endif /* LIBC_SCCS and not lint */
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/gen/readdir.c,v 1.11 2002/02/26 21:39:32 alfred Exp $");
+__FBSDID("$FreeBSD: src/lib/libc/gen/readdir.c,v 1.13 2007/01/09 00:27:55 imp Exp $");
 
 #include "namespace.h"
 #include <sys/param.h>
@@ -42,6 +42,7 @@
 #include "un-namespace.h"
 
 #include "libc_private.h"
+#include "telldir.h"
 
 /*
  * get next entry in a directory.
Index: tcsendbreak.3
===================================================================
RCS file: /home/cvs/src/lib/libc/gen/tcsendbreak.3,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L lib/libc/gen/tcsendbreak.3 -L lib/libc/gen/tcsendbreak.3 -u -r1.1.1.1 -r1.2
--- lib/libc/gen/tcsendbreak.3
+++ lib/libc/gen/tcsendbreak.3
@@ -9,10 +9,6 @@
 .\" 2. Redistributions in binary form must reproduce the above copyright
 .\"    notice, this list of conditions and the following disclaimer in the
 .\"    documentation and/or other materials provided with the distribution.
-.\" 3. All advertising materials mentioning features or use of this software
-.\"    must display the following acknowledgement:
-.\"	This product includes software developed by the University of
-.\"	California, Berkeley and its contributors.
 .\" 4. Neither the name of the University nor the names of its contributors
 .\"    may be used to endorse or promote products derived from this software
 .\"    without specific prior written permission.
@@ -30,7 +26,7 @@
 .\" SUCH DAMAGE.
 .\"
 .\"	@(#)tcsendbreak.3	8.1 (Berkeley) 6/4/93
-.\" $FreeBSD: src/lib/libc/gen/tcsendbreak.3,v 1.9 2002/12/19 09:40:21 ru Exp $
+.\" $FreeBSD: src/lib/libc/gen/tcsendbreak.3,v 1.10 2007/01/09 00:27:55 imp Exp $
 .\"
 .Dd June 4, 1993
 .Dt TCSENDBREAK 3
Index: gethostname.3
===================================================================
RCS file: /home/cvs/src/lib/libc/gen/gethostname.3,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L lib/libc/gen/gethostname.3 -L lib/libc/gen/gethostname.3 -u -r1.1.1.1 -r1.2
--- lib/libc/gen/gethostname.3
+++ lib/libc/gen/gethostname.3
@@ -9,10 +9,6 @@
 .\" 2. Redistributions in binary form must reproduce the above copyright
 .\"    notice, this list of conditions and the following disclaimer in the
 .\"    documentation and/or other materials provided with the distribution.
-.\" 3. All advertising materials mentioning features or use of this software
-.\"    must display the following acknowledgement:
-.\"	This product includes software developed by the University of
-.\"	California, Berkeley and its contributors.
 .\" 4. Neither the name of the University nor the names of its contributors
 .\"    may be used to endorse or promote products derived from this software
 .\"    without specific prior written permission.
@@ -30,7 +26,7 @@
 .\" SUCH DAMAGE.
 .\"
 .\"     @(#)gethostname.3	8.1 (Berkeley) 6/4/93
-.\" $FreeBSD: src/lib/libc/gen/gethostname.3,v 1.16 2004/07/03 22:30:08 ru Exp $
+.\" $FreeBSD: src/lib/libc/gen/gethostname.3,v 1.17 2007/01/09 00:27:54 imp Exp $
 .\"
 .Dd August 18, 2003
 .Dt GETHOSTNAME 3
Index: getpwent.c
===================================================================
RCS file: /home/cvs/src/lib/libc/gen/getpwent.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L lib/libc/gen/getpwent.c -L lib/libc/gen/getpwent.c -u -r1.1.1.1 -r1.2
--- lib/libc/gen/getpwent.c
+++ lib/libc/gen/getpwent.c
@@ -31,7 +31,7 @@
  *
  */
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/gen/getpwent.c,v 1.89 2004/05/17 18:27:05 kientzle Exp $");
+__FBSDID("$FreeBSD: src/lib/libc/gen/getpwent.c,v 1.90 2006/04/28 12:03:35 ume Exp $");
 
 #include "namespace.h"
 #include <sys/param.h>
@@ -61,6 +61,9 @@
 #include "libc_private.h"
 #include "pw_scan.h"
 #include "nss_tls.h"
+#ifdef NS_CACHING
+#include "nscache.h"
+#endif
 
 #ifndef CTASSERT
 #define CTASSERT(x)		_CTASSERT(x, __LINE__)
@@ -195,9 +198,233 @@
 static	int	 compat_redispatch(struct compat_state *, enum nss_lookup_type,
 		    enum nss_lookup_type, const char *, const char *, uid_t,
 		    struct passwd *, char *, size_t, int *);
+
+#ifdef NS_CACHING
+static	int	 pwd_id_func(char *, size_t *, va_list ap, void *);
+static	int	 pwd_marshal_func(char *, size_t *, void *, va_list, void *);
+static	int	 pwd_unmarshal_func(char *, size_t, void *, va_list, void *);
+
+static int
+pwd_id_func(char *buffer, size_t *buffer_size, va_list ap, void *cache_mdata)
+{
+	char	*name;
+	uid_t	uid;
+	size_t	size, desired_size;
+	int	res = NS_UNAVAIL;
+	enum nss_lookup_type lookup_type;
+
+	lookup_type = (enum nss_lookup_type)cache_mdata;
+	switch (lookup_type) {
+	case nss_lt_name:
+		name = va_arg(ap, char *);
+		size = strlen(name);
+		desired_size = sizeof(enum nss_lookup_type) + size + 1;
+		if (desired_size > *buffer_size) {
+			res = NS_RETURN;
+			goto fin;
+		}
+
+		memcpy(buffer, &lookup_type, sizeof(enum nss_lookup_type));
+		memcpy(buffer + sizeof(enum nss_lookup_type), name, size + 1);
+
+		res = NS_SUCCESS;
+		break;
+	case nss_lt_id:
+		uid = va_arg(ap, uid_t);
+		desired_size = sizeof(enum nss_lookup_type) + sizeof(uid_t);
+		if (desired_size > *buffer_size) {
+			res = NS_RETURN;
+			goto fin;
+		}
+
+		memcpy(buffer, &lookup_type, sizeof(enum nss_lookup_type));
+		memcpy(buffer + sizeof(enum nss_lookup_type), &uid,
+		    sizeof(uid_t));
+
+		res = NS_SUCCESS;
+		break;
+	default:
+		/* should be unreachable */
+		return (NS_UNAVAIL);
+	}
+
+fin:
+	*buffer_size = desired_size;
+	return (res);
+}
+
+static int
+pwd_marshal_func(char *buffer, size_t *buffer_size, void *retval, va_list ap,
+    void *cache_mdata)
+{
+	char *name;
+	uid_t uid;
+	struct passwd *pwd;
+	char *orig_buf;
+	size_t orig_buf_size;
+
+	struct passwd new_pwd;
+	size_t desired_size, size;
+	char *p;
+
+	switch ((enum nss_lookup_type)cache_mdata) {
+	case nss_lt_name:
+		name = va_arg(ap, char *);
+		break;
+	case nss_lt_id:
+		uid = va_arg(ap, uid_t);
+		break;
+	case nss_lt_all:
+		break;
+	default:
+		/* should be unreachable */
+		return (NS_UNAVAIL);
+	}
+
+	pwd = va_arg(ap, struct passwd *);
+	orig_buf = va_arg(ap, char *);
+	orig_buf_size = va_arg(ap, size_t);
+
+	desired_size = sizeof(struct passwd) + sizeof(char *) +
+	    strlen(pwd->pw_name) + 1;
+	if (pwd->pw_passwd != NULL)
+		desired_size += strlen(pwd->pw_passwd) + 1;
+	if (pwd->pw_class != NULL)
+		desired_size += strlen(pwd->pw_class) + 1;
+	if (pwd->pw_gecos != NULL)
+		desired_size += strlen(pwd->pw_gecos) + 1;
+	if (pwd->pw_dir != NULL)
+		desired_size += strlen(pwd->pw_dir) + 1;
+	if (pwd->pw_shell != NULL)
+		desired_size += strlen(pwd->pw_shell) + 1;
+
+	if (*buffer_size < desired_size) {
+		/* this assignment is here for future use */
+		*buffer_size = desired_size;
+		return (NS_RETURN);
+	}
+
+	memcpy(&new_pwd, pwd, sizeof(struct passwd));
+	memset(buffer, 0, desired_size);
+
+	*buffer_size = desired_size;
+	p = buffer + sizeof(struct passwd) + sizeof(char *);
+	memcpy(buffer + sizeof(struct passwd), &p, sizeof(char *));
+
+	if (new_pwd.pw_name != NULL) {
+		size = strlen(new_pwd.pw_name);
+		memcpy(p, new_pwd.pw_name, size);
+		new_pwd.pw_name = p;
+		p += size + 1;
+	}
+
+	if (new_pwd.pw_passwd != NULL) {
+		size = strlen(new_pwd.pw_passwd);
+		memcpy(p, new_pwd.pw_passwd, size);
+		new_pwd.pw_passwd = p;
+		p += size + 1;
+	}
+
+	if (new_pwd.pw_class != NULL) {
+		size = strlen(new_pwd.pw_class);
+		memcpy(p, new_pwd.pw_class, size);
+		new_pwd.pw_class = p;
+		p += size + 1;
+	}
+
+	if (new_pwd.pw_gecos != NULL) {
+		size = strlen(new_pwd.pw_gecos);
+		memcpy(p, new_pwd.pw_gecos, size);
+		new_pwd.pw_gecos = p;
+		p += size + 1;
+	}
+
+	if (new_pwd.pw_dir != NULL) {
+		size = strlen(new_pwd.pw_dir);
+		memcpy(p, new_pwd.pw_dir, size);
+		new_pwd.pw_dir = p;
+		p += size + 1;
+	}
+
+	if (new_pwd.pw_shell != NULL) {
+		size = strlen(new_pwd.pw_shell);
+		memcpy(p, new_pwd.pw_shell, size);
+		new_pwd.pw_shell = p;
+		p += size + 1;
+	}
+
+	memcpy(buffer, &new_pwd, sizeof(struct passwd));
+	return (NS_SUCCESS);
+}
+
+static int
+pwd_unmarshal_func(char *buffer, size_t buffer_size, void *retval, va_list ap,
+    void *cache_mdata)
+{
+	char *name;
+	uid_t uid;
+	struct passwd *pwd;
+	char *orig_buf;
+	size_t orig_buf_size;
+	int *ret_errno;
+
+	char *p;
+
+	switch ((enum nss_lookup_type)cache_mdata) {
+	case nss_lt_name:
+		name = va_arg(ap, char *);
+		break;
+	case nss_lt_id:
+		uid = va_arg(ap, uid_t);
+		break;
+	case nss_lt_all:
+		break;
+	default:
+		/* should be unreachable */
+		return (NS_UNAVAIL);
+	}
+
+	pwd = va_arg(ap, struct passwd *);
+	orig_buf = va_arg(ap, char *);
+	orig_buf_size = va_arg(ap, size_t);
+	ret_errno = va_arg(ap, int *);
+
+	if (orig_buf_size <
+	    buffer_size - sizeof(struct passwd) - sizeof(char *)) {
+		*ret_errno = ERANGE;
+		return (NS_RETURN);
+	}
+
+	memcpy(pwd, buffer, sizeof(struct passwd));
+	memcpy(&p, buffer + sizeof(struct passwd), sizeof(char *));
+	memcpy(orig_buf, buffer + sizeof(struct passwd) + sizeof(char *),
+	    buffer_size - sizeof(struct passwd) - sizeof(char *));
+
+	NS_APPLY_OFFSET(pwd->pw_name, orig_buf, p, char *);
+	NS_APPLY_OFFSET(pwd->pw_passwd, orig_buf, p, char *);
+	NS_APPLY_OFFSET(pwd->pw_class, orig_buf, p, char *);
+	NS_APPLY_OFFSET(pwd->pw_gecos, orig_buf, p, char *);
+	NS_APPLY_OFFSET(pwd->pw_dir, orig_buf, p, char *);
+	NS_APPLY_OFFSET(pwd->pw_shell, orig_buf, p, char *);
+
+	if (retval != NULL)
+		*((struct passwd **)retval) = pwd;
+
+	return (NS_SUCCESS);
+}
+
+NSS_MP_CACHE_HANDLING(passwd);
+#endif /* NS_CACHING */
+
 void
 setpwent(void)
 {
+#ifdef NS_CACHING
+	static const nss_cache_info cache_info = NS_MP_CACHE_INFO_INITIALIZER(
+		passwd, (void *)nss_lt_all,
+		NULL, NULL);
+#endif
+
 	static const ns_dtab dtab[] = {
 		{ NSSRC_FILES, files_setpwent, (void *)SETPWENT },
 #ifdef HESIOD
@@ -207,6 +434,9 @@
 		{ NSSRC_NIS, nis_setpwent, (void *)SETPWENT },
 #endif
 		{ NSSRC_COMPAT, compat_setpwent, (void *)SETPWENT },
+#ifdef NS_CACHING
+		NS_CACHE_CB(&cache_info)
+#endif
 		{ NULL, NULL, NULL }
 	};
 	(void)_nsdispatch(NULL, dtab, NSDB_PASSWD, "setpwent", defaultsrc, 0);
@@ -216,6 +446,12 @@
 int
 setpassent(int stayopen)
 {
+#ifdef NS_CACHING
+	static const nss_cache_info cache_info = NS_MP_CACHE_INFO_INITIALIZER(
+		passwd, (void *)nss_lt_all,
+		NULL, NULL);
+#endif
+
 	static const ns_dtab dtab[] = {
 		{ NSSRC_FILES, files_setpwent, (void *)SETPWENT },
 #ifdef HESIOD
@@ -225,6 +461,9 @@
 		{ NSSRC_NIS, nis_setpwent, (void *)SETPWENT },
 #endif
 		{ NSSRC_COMPAT, compat_setpwent, (void *)SETPWENT },
+#ifdef NS_CACHING
+		NS_CACHE_CB(&cache_info)
+#endif
 		{ NULL, NULL, NULL }
 	};
 	(void)_nsdispatch(NULL, dtab, NSDB_PASSWD, "setpwent", defaultsrc,
@@ -236,6 +475,12 @@
 void
 endpwent(void)
 {
+#ifdef NS_CACHING
+	static const nss_cache_info cache_info = NS_MP_CACHE_INFO_INITIALIZER(
+		passwd, (void *)nss_lt_all,
+		NULL, NULL);
+#endif
+
 	static const ns_dtab dtab[] = {
 		{ NSSRC_FILES, files_setpwent, (void *)ENDPWENT },
 #ifdef HESIOD
@@ -245,6 +490,9 @@
 		{ NSSRC_NIS, nis_setpwent, (void *)ENDPWENT },
 #endif
 		{ NSSRC_COMPAT, compat_setpwent, (void *)ENDPWENT },
+#ifdef NS_CACHING
+		NS_CACHE_CB(&cache_info)
+#endif
 		{ NULL, NULL, NULL }
 	};
 	(void)_nsdispatch(NULL, dtab, NSDB_PASSWD, "endpwent", defaultsrc);
@@ -255,6 +503,12 @@
 getpwent_r(struct passwd *pwd, char *buffer, size_t bufsize,
     struct passwd **result)
 {
+#ifdef NS_CACHING
+	static const nss_cache_info cache_info = NS_MP_CACHE_INFO_INITIALIZER(
+		passwd, (void *)nss_lt_all,
+		pwd_marshal_func, pwd_unmarshal_func);
+#endif
+
 	static const ns_dtab dtab[] = {
 		{ NSSRC_FILES, files_passwd, (void *)nss_lt_all },
 #ifdef HESIOD
@@ -264,6 +518,9 @@
 		{ NSSRC_NIS, nis_passwd, (void *)nss_lt_all },
 #endif
 		{ NSSRC_COMPAT, compat_passwd, (void *)nss_lt_all },
+#ifdef NS_CACHING
+		NS_CACHE_CB(&cache_info)
+#endif
 		{ NULL, NULL, NULL }
 	};
 	int	rv, ret_errno;
@@ -284,6 +541,13 @@
 getpwnam_r(const char *name, struct passwd *pwd, char *buffer, size_t bufsize,
     struct passwd **result)
 {
+#ifdef NS_CACHING
+	static const nss_cache_info cache_info =
+    		NS_COMMON_CACHE_INFO_INITIALIZER(
+		passwd, (void *)nss_lt_name,
+		pwd_id_func, pwd_marshal_func, pwd_unmarshal_func);
+#endif
+
 	static const ns_dtab dtab[] = {
 		{ NSSRC_FILES, files_passwd, (void *)nss_lt_name },
 #ifdef HESIOD
@@ -293,6 +557,9 @@
 		{ NSSRC_NIS, nis_passwd, (void *)nss_lt_name },
 #endif
 		{ NSSRC_COMPAT, compat_passwd, (void *)nss_lt_name },
+#ifdef NS_CACHING
+		NS_CACHE_CB(&cache_info)
+#endif
 		{ NULL, NULL, NULL }
 	};
 	int	rv, ret_errno;
@@ -313,6 +580,13 @@
 getpwuid_r(uid_t uid, struct passwd *pwd, char *buffer, size_t bufsize,
     struct passwd **result)
 {
+#ifdef NS_CACHING
+	static const nss_cache_info cache_info =
+    		NS_COMMON_CACHE_INFO_INITIALIZER(
+		passwd, (void *)nss_lt_id,
+		pwd_id_func, pwd_marshal_func, pwd_unmarshal_func);
+#endif
+
 	static const ns_dtab dtab[] = {
 		{ NSSRC_FILES, files_passwd, (void *)nss_lt_id },
 #ifdef HESIOD
@@ -322,6 +596,9 @@
 		{ NSSRC_NIS, nis_passwd, (void *)nss_lt_id },
 #endif
 		{ NSSRC_COMPAT, compat_passwd, (void *)nss_lt_id },
+#ifdef NS_CACHING
+		NS_CACHE_CB(&cache_info)
+#endif
 		{ NULL, NULL, NULL }
 	};
 	int	rv, ret_errno;
Index: sem_wait.3
===================================================================
RCS file: /home/cvs/src/lib/libc/gen/sem_wait.3,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L lib/libc/gen/sem_wait.3 -L lib/libc/gen/sem_wait.3 -u -r1.1.1.1 -r1.2
--- lib/libc/gen/sem_wait.3
+++ lib/libc/gen/sem_wait.3
@@ -25,7 +25,7 @@
 .\" OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
 .\" EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 .\"
-.\" $FreeBSD: src/lib/libc/gen/sem_wait.3,v 1.12.8.1 2005/07/17 19:28:55 rwatson Exp $
+.\" $FreeBSD: src/lib/libc/gen/sem_wait.3,v 1.13 2005/07/13 13:15:22 rwatson Exp $
 .\"
 .Dd February 15, 2000
 .Dt SEM_WAIT 3
Index: getdomainname.3
===================================================================
RCS file: /home/cvs/src/lib/libc/gen/getdomainname.3,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L lib/libc/gen/getdomainname.3 -L lib/libc/gen/getdomainname.3 -u -r1.1.1.1 -r1.2
--- lib/libc/gen/getdomainname.3
+++ lib/libc/gen/getdomainname.3
@@ -9,10 +9,6 @@
 .\" 2. Redistributions in binary form must reproduce the above copyright
 .\"    notice, this list of conditions and the following disclaimer in the
 .\"    documentation and/or other materials provided with the distribution.
-.\" 3. All advertising materials mentioning features or use of this software
-.\"    must display the following acknowledgement:
-.\"	This product includes software developed by the University of
-.\"	California, Berkeley and its contributors.
 .\" 4. Neither the name of the University nor the names of its contributors
 .\"    may be used to endorse or promote products derived from this software
 .\"    without specific prior written permission.
@@ -30,7 +26,7 @@
 .\" SUCH DAMAGE.
 .\"
 .\"     @(#)gethostname.3	8.1 (Berkeley) 6/4/93
-.\" $FreeBSD: src/lib/libc/gen/getdomainname.3,v 1.20 2005/01/20 09:17:02 ru Exp $
+.\" $FreeBSD: src/lib/libc/gen/getdomainname.3,v 1.21 2007/01/09 00:27:53 imp Exp $
 .\"
 .Dd May 6, 1994
 .Dt GETDOMAINNAME 3
Index: scandir.3
===================================================================
RCS file: /home/cvs/src/lib/libc/gen/scandir.3,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L lib/libc/gen/scandir.3 -L lib/libc/gen/scandir.3 -u -r1.1.1.1 -r1.2
--- lib/libc/gen/scandir.3
+++ lib/libc/gen/scandir.3
@@ -9,10 +9,6 @@
 .\" 2. Redistributions in binary form must reproduce the above copyright
 .\"    notice, this list of conditions and the following disclaimer in the
 .\"    documentation and/or other materials provided with the distribution.
-.\" 3. All advertising materials mentioning features or use of this software
-.\"    must display the following acknowledgement:
-.\"	This product includes software developed by the University of
-.\"	California, Berkeley and its contributors.
 .\" 4. Neither the name of the University nor the names of its contributors
 .\"    may be used to endorse or promote products derived from this software
 .\"    without specific prior written permission.
@@ -30,7 +26,7 @@
 .\" SUCH DAMAGE.
 .\"
 .\"     @(#)scandir.3	8.1 (Berkeley) 6/4/93
-.\" $FreeBSD: src/lib/libc/gen/scandir.3,v 1.8 2002/12/19 09:40:21 ru Exp $
+.\" $FreeBSD: src/lib/libc/gen/scandir.3,v 1.9 2007/01/09 00:27:55 imp Exp $
 .\"
 .Dd June 4, 1993
 .Dt SCANDIR 3
Index: siginterrupt.3
===================================================================
RCS file: /home/cvs/src/lib/libc/gen/siginterrupt.3,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L lib/libc/gen/siginterrupt.3 -L lib/libc/gen/siginterrupt.3 -u -r1.1.1.1 -r1.2
--- lib/libc/gen/siginterrupt.3
+++ lib/libc/gen/siginterrupt.3
@@ -9,10 +9,6 @@
 .\" 2. Redistributions in binary form must reproduce the above copyright
 .\"    notice, this list of conditions and the following disclaimer in the
 .\"    documentation and/or other materials provided with the distribution.
-.\" 3. All advertising materials mentioning features or use of this software
-.\"    must display the following acknowledgement:
-.\"	This product includes software developed by the University of
-.\"	California, Berkeley and its contributors.
 .\" 4. Neither the name of the University nor the names of its contributors
 .\"    may be used to endorse or promote products derived from this software
 .\"    without specific prior written permission.
@@ -30,7 +26,7 @@
 .\" SUCH DAMAGE.
 .\"
 .\"     @(#)siginterrupt.3	8.1 (Berkeley) 6/4/93
-.\" $FreeBSD: src/lib/libc/gen/siginterrupt.3,v 1.14 2002/12/19 09:40:21 ru Exp $
+.\" $FreeBSD: src/lib/libc/gen/siginterrupt.3,v 1.15 2007/01/09 00:27:55 imp Exp $
 .\"
 .Dd June 4, 1993
 .Dt SIGINTERRUPT 3
Index: seekdir.c
===================================================================
RCS file: /home/cvs/src/lib/libc/gen/seekdir.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L lib/libc/gen/seekdir.c -L lib/libc/gen/seekdir.c -u -r1.1.1.1 -r1.2
--- lib/libc/gen/seekdir.c
+++ lib/libc/gen/seekdir.c
@@ -10,10 +10,6 @@
  * 2. Redistributions in binary form must reproduce the above copyright
  *    notice, this list of conditions and the following disclaimer in the
  *    documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- *    must display the following acknowledgement:
- *	This product includes software developed by the University of
- *	California, Berkeley and its contributors.
  * 4. Neither the name of the University nor the names of its contributors
  *    may be used to endorse or promote products derived from this software
  *    without specific prior written permission.
@@ -35,7 +31,7 @@
 static char sccsid[] = "@(#)seekdir.c	8.1 (Berkeley) 6/4/93";
 #endif /* LIBC_SCCS and not lint */
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/gen/seekdir.c,v 1.5 2002/02/01 00:57:29 obrien Exp $");
+__FBSDID("$FreeBSD: src/lib/libc/gen/seekdir.c,v 1.6 2007/01/09 00:27:55 imp Exp $");
 
 #include "namespace.h"
 #include <sys/param.h>
Index: dirname.3
===================================================================
RCS file: /home/cvs/src/lib/libc/gen/dirname.3,v
retrieving revision 1.2
retrieving revision 1.3
diff -L lib/libc/gen/dirname.3 -L lib/libc/gen/dirname.3 -u -r1.2 -r1.3
--- lib/libc/gen/dirname.3
+++ lib/libc/gen/dirname.3
@@ -25,10 +25,9 @@
 .\" ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 .\"
 .\" $OpenBSD: dirname.3,v 1.9 2000/04/18 03:01:25 aaron Exp $
-.\" $FreeBSD: src/lib/libc/gen/dirname.3,v 1.8 2004/07/02 23:52:10 ru Exp $
-.\" $MidnightBSD$
+.\" $FreeBSD: src/lib/libc/gen/dirname.3,v 1.9 2006/10/12 14:31:17 ru Exp $
 .\"
-.Dd August 17, 1997
+.Dd October 12, 2006
 .Dt DIRNAME 3
 .Os
 .Sh NAME
@@ -59,6 +58,20 @@
 returns a pointer to the string
 .Qq \&. ,
 signifying the current directory.
+.Sh IMPLEMENTATION NOTES
+The
+.Fn dirname
+function
+returns a pointer to internal storage space allocated on the first call
+that will be overwritten
+by subsequent calls.
+.Pp
+Other vendor implementations of
+.Fn dirname
+may modify the contents of the string passed to
+.Fn dirname ;
+this should be taken into account when writing code which calls this function
+if portability is desired.
 .Sh RETURN VALUES
 On successful completion,
 .Fn dirname
@@ -78,19 +91,6 @@
 The path component to be returned was larger than
 .Dv MAXPATHLEN .
 .El
-.Sh WARNINGS
-The
-.Fn dirname
-function
-returns a pointer to internal static storage space that will be overwritten
-by subsequent calls (each function has its own separate storage).
-.Pp
-Other vendor implementations of
-.Fn dirname
-may modify the contents of the string passed to
-.Fn dirname ;
-this should be taken into account when writing code which calls this function
-if portability is desired.
 .Sh SEE ALSO
 .Xr basename 1 ,
 .Xr dirname 1 ,
Index: gethostname.c
===================================================================
RCS file: /home/cvs/src/lib/libc/gen/gethostname.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L lib/libc/gen/gethostname.c -L lib/libc/gen/gethostname.c -u -r1.1.1.1 -r1.2
--- lib/libc/gen/gethostname.c
+++ lib/libc/gen/gethostname.c
@@ -10,10 +10,6 @@
  * 2. Redistributions in binary form must reproduce the above copyright
  *    notice, this list of conditions and the following disclaimer in the
  *    documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- *    must display the following acknowledgement:
- *	This product includes software developed by the University of
- *	California, Berkeley and its contributors.
  * 4. Neither the name of the University nor the names of its contributors
  *    may be used to endorse or promote products derived from this software
  *    without specific prior written permission.
@@ -35,12 +31,13 @@
 static char sccsid[] = "@(#)gethostname.c	8.1 (Berkeley) 6/4/93";
 #endif /* LIBC_SCCS and not lint */
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/gen/gethostname.c,v 1.5 2003/08/19 23:01:46 wollman Exp $");
+__FBSDID("$FreeBSD: src/lib/libc/gen/gethostname.c,v 1.8 2007/01/09 00:27:54 imp Exp $");
 
 #include <sys/param.h>
 #include <sys/sysctl.h>
 
 #include <errno.h>
+#include <unistd.h>
 
 int
 gethostname(name, namelen)
@@ -49,9 +46,6 @@
 {
 	int mib[2];
 
-	/* Kluge to avoid ABI breakage. */
-	namelen = (int)namelen;
-
 	mib[0] = CTL_KERN;
 	mib[1] = KERN_HOSTNAME;
 	if (sysctl(mib, 2, name, &namelen, NULL, 0) == -1) {
Index: getpass.3
===================================================================
RCS file: /home/cvs/src/lib/libc/gen/getpass.3,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L lib/libc/gen/getpass.3 -L lib/libc/gen/getpass.3 -u -r1.1.1.1 -r1.2
--- lib/libc/gen/getpass.3
+++ lib/libc/gen/getpass.3
@@ -9,10 +9,6 @@
 .\" 2. Redistributions in binary form must reproduce the above copyright
 .\"    notice, this list of conditions and the following disclaimer in the
 .\"    documentation and/or other materials provided with the distribution.
-.\" 3. All advertising materials mentioning features or use of this software
-.\"    must display the following acknowledgement:
-.\"	This product includes software developed by the University of
-.\"	California, Berkeley and its contributors.
 .\" 4. Neither the name of the University nor the names of its contributors
 .\"    may be used to endorse or promote products derived from this software
 .\"    without specific prior written permission.
@@ -30,7 +26,7 @@
 .\" SUCH DAMAGE.
 .\"
 .\"     @(#)getpass.3	8.1 (Berkeley) 6/4/93
-.\" $FreeBSD: src/lib/libc/gen/getpass.3,v 1.11 2001/11/22 09:48:54 ru Exp $
+.\" $FreeBSD: src/lib/libc/gen/getpass.3,v 1.12 2007/01/09 00:27:54 imp Exp $
 .\"
 .Dd June 4, 1993
 .Dt GETPASS 3
Index: sleep.3
===================================================================
RCS file: /home/cvs/src/lib/libc/gen/sleep.3,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L lib/libc/gen/sleep.3 -L lib/libc/gen/sleep.3 -u -r1.1.1.1 -r1.2
--- lib/libc/gen/sleep.3
+++ lib/libc/gen/sleep.3
@@ -9,10 +9,6 @@
 .\" 2. Redistributions in binary form must reproduce the above copyright
 .\"    notice, this list of conditions and the following disclaimer in the
 .\"    documentation and/or other materials provided with the distribution.
-.\" 3. All advertising materials mentioning features or use of this software
-.\"    must display the following acknowledgement:
-.\"	This product includes software developed by the University of
-.\"	California, Berkeley and its contributors.
 .\" 4. Neither the name of the University nor the names of its contributors
 .\"    may be used to endorse or promote products derived from this software
 .\"    without specific prior written permission.
@@ -30,7 +26,7 @@
 .\" SUCH DAMAGE.
 .\"
 .\"     @(#)sleep.3	8.1 (Berkeley) 6/4/93
-.\" $FreeBSD: src/lib/libc/gen/sleep.3,v 1.16 2004/07/02 23:52:10 ru Exp $
+.\" $FreeBSD: src/lib/libc/gen/sleep.3,v 1.17 2007/01/09 00:27:55 imp Exp $
 .\"
 .Dd February 13, 1998
 .Dt SLEEP 3
Index: ctermid.c
===================================================================
RCS file: /home/cvs/src/lib/libc/gen/ctermid.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -L lib/libc/gen/ctermid.c -L lib/libc/gen/ctermid.c -u -r1.2 -r1.3
--- lib/libc/gen/ctermid.c
+++ lib/libc/gen/ctermid.c
@@ -27,10 +27,11 @@
  * SUCH DAMAGE.
  */
 
-/* static char sccsid[] = "@(#)ctermid.c	8.1 (Berkeley) 6/4/93"; */
+#if defined(LIBC_SCCS) && !defined(lint)
+static char sccsid[] = "@(#)ctermid.c	8.1 (Berkeley) 6/4/93";
+#endif /* LIBC_SCCS and not lint */
 #include <sys/cdefs.h>
-/*__FBSDID("$FreeBSD: src/lib/libc/gen/ctermid.c,v 1.3 2002/03/22 21:52:05 obrien Exp $");*/
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: src/lib/libc/gen/ctermid.c,v 1.4 2007/01/09 00:27:53 imp Exp $");
 
 #include <stdio.h>
 #include <paths.h>
Index: getgrent.c
===================================================================
RCS file: /home/cvs/src/lib/libc/gen/getgrent.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L lib/libc/gen/getgrent.c -L lib/libc/gen/getgrent.c -u -r1.1.1.1 -r1.2
--- lib/libc/gen/getgrent.c
+++ lib/libc/gen/getgrent.c
@@ -31,7 +31,7 @@
  *
  */
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/gen/getgrent.c,v 1.32 2004/05/17 22:15:49 kientzle Exp $");
+__FBSDID("$FreeBSD: src/lib/libc/gen/getgrent.c,v 1.36 2006/09/18 09:34:48 maxim Exp $");
 
 #include "namespace.h"
 #include <sys/param.h>
@@ -57,7 +57,9 @@
 #include "un-namespace.h"
 #include "libc_private.h"
 #include "nss_tls.h"
-
+#ifdef NS_CACHING
+#include "nscache.h"
+#endif
 
 enum constants {
 	GRP_STORAGE_INITIAL	= 1 << 10, /* 1 KByte */
@@ -141,11 +143,235 @@
 static	int	 compat_setgrent(void *, void *, va_list);
 static	int	 compat_group(void *, void *, va_list);
 
+#ifdef NS_CACHING
+static	int	 grp_id_func(char *, size_t *, va_list, void *);
+static	int	 grp_marshal_func(char *, size_t *, void *, va_list, void *);
+static	int	 grp_unmarshal_func(char *, size_t, void *, va_list, void *);
+
+static int
+grp_id_func(char *buffer, size_t *buffer_size, va_list ap, void *cache_mdata)
+{
+	char	*name;
+	gid_t	gid;
+
+	size_t	desired_size, size;
+	int	res = NS_UNAVAIL;
+	enum nss_lookup_type lookup_type;
+
+
+	lookup_type = (enum nss_lookup_type)cache_mdata;
+	switch (lookup_type) {
+	case nss_lt_name:
+		name = va_arg(ap, char *);
+		size = strlen(name);
+		desired_size = sizeof(enum nss_lookup_type) + size + 1;
+		if (desired_size > *buffer_size) {
+			res = NS_RETURN;
+			goto fin;
+		}
+
+		memcpy(buffer, &lookup_type, sizeof(enum nss_lookup_type));
+		memcpy(buffer + sizeof(enum nss_lookup_type), name, size + 1);
+
+		res = NS_SUCCESS;
+		break;
+	case nss_lt_id:
+		gid = va_arg(ap, gid_t);
+		desired_size = sizeof(enum nss_lookup_type) + sizeof(gid_t);
+		if (desired_size > *buffer_size) {
+			res = NS_RETURN;
+			goto fin;
+		}
+
+		memcpy(buffer, &lookup_type, sizeof(enum nss_lookup_type));
+		memcpy(buffer + sizeof(enum nss_lookup_type), &gid,
+		    sizeof(gid_t));
+
+		res = NS_SUCCESS;
+		break;
+	default:
+		/* should be unreachable */
+		return (NS_UNAVAIL);
+	}
+
+fin:
+	*buffer_size = desired_size;
+	return (res);
+}
+
+static int
+grp_marshal_func(char *buffer, size_t *buffer_size, void *retval, va_list ap,
+    void *cache_mdata)
+{
+	char *name;
+	gid_t gid;
+	struct group *grp;
+	char *orig_buf;
+	size_t orig_buf_size;
+
+	struct group new_grp;
+	size_t desired_size, size, mem_size;
+	char *p, **mem;
+
+	switch ((enum nss_lookup_type)cache_mdata) {
+	case nss_lt_name:
+		name = va_arg(ap, char *);
+		break;
+	case nss_lt_id:
+		gid = va_arg(ap, gid_t);
+		break;
+	case nss_lt_all:
+		break;
+	default:
+		/* should be unreachable */
+		return (NS_UNAVAIL);
+	}
+
+	grp = va_arg(ap, struct group *);
+	orig_buf = va_arg(ap, char *);
+	orig_buf_size = va_arg(ap, size_t);
+
+	desired_size = _ALIGNBYTES + sizeof(struct group) + sizeof(char *);
+
+	if (grp->gr_name != NULL)
+		desired_size += strlen(grp->gr_name) + 1;
+	if (grp->gr_passwd != NULL)
+		desired_size += strlen(grp->gr_passwd) + 1;
+
+	if (grp->gr_mem != NULL) {
+		mem_size = 0;
+		for (mem = grp->gr_mem; *mem; ++mem) {
+			desired_size += strlen(*mem) + 1;
+			++mem_size;
+		}
+
+		desired_size += _ALIGNBYTES + (mem_size + 1) * sizeof(char *);
+	}
+
+	if (desired_size > *buffer_size) {
+		/* this assignment is here for future use */
+		*buffer_size = desired_size;
+		return (NS_RETURN);
+	}
+
+	memcpy(&new_grp, grp, sizeof(struct group));
+	memset(buffer, 0, desired_size);
+
+	*buffer_size = desired_size;
+	p = buffer + sizeof(struct group) + sizeof(char *);
+	memcpy(buffer + sizeof(struct group), &p, sizeof(char *));
+	p = (char *)_ALIGN(p);
+
+	if (new_grp.gr_name != NULL) {
+		size = strlen(new_grp.gr_name);
+		memcpy(p, new_grp.gr_name, size);
+		new_grp.gr_name = p;
+		p += size + 1;
+	}
+
+	if (new_grp.gr_passwd != NULL) {
+		size = strlen(new_grp.gr_passwd);
+		memcpy(p, new_grp.gr_passwd, size);
+		new_grp.gr_passwd = p;
+		p += size + 1;
+	}
+
+	if (new_grp.gr_mem != NULL) {
+		p = (char *)_ALIGN(p);
+		memcpy(p, new_grp.gr_mem, sizeof(char *) * mem_size);
+		new_grp.gr_mem = (char **)p;
+		p += sizeof(char *) * (mem_size + 1);
+
+		for (mem = new_grp.gr_mem; *mem; ++mem) {
+			size = strlen(*mem);
+			memcpy(p, *mem, size);
+			*mem = p;
+			p += size + 1;
+		}
+	}
+
+	memcpy(buffer, &new_grp, sizeof(struct group));
+	return (NS_SUCCESS);
+}
+
+static int
+grp_unmarshal_func(char *buffer, size_t buffer_size, void *retval, va_list ap,
+    void *cache_mdata)
+{
+	char *name;
+	gid_t gid;
+	struct group *grp;
+	char *orig_buf;
+	size_t orig_buf_size;
+	int *ret_errno;
+
+	char *p;
+	char **mem;
+
+	switch ((enum nss_lookup_type)cache_mdata) {
+	case nss_lt_name:
+		name = va_arg(ap, char *);
+		break;
+	case nss_lt_id:
+		gid = va_arg(ap, gid_t);
+		break;
+	case nss_lt_all:
+		break;
+	default:
+		/* should be unreachable */
+		return (NS_UNAVAIL);
+	}
+
+	grp = va_arg(ap, struct group *);
+	orig_buf = va_arg(ap, char *);
+	orig_buf_size = va_arg(ap, size_t);
+	ret_errno = va_arg(ap, int *);
+
+	if (orig_buf_size <
+	    buffer_size - sizeof(struct group) - sizeof(char *)) {
+		*ret_errno = ERANGE;
+		return (NS_RETURN);
+	}
+
+	memcpy(grp, buffer, sizeof(struct group));
+	memcpy(&p, buffer + sizeof(struct group), sizeof(char *));
+
+	orig_buf = (char *)_ALIGN(orig_buf);
+	memcpy(orig_buf, buffer + sizeof(struct group) + sizeof(char *) +
+	    _ALIGN(p) - (size_t)p,
+	    buffer_size - sizeof(struct group) - sizeof(char *) -
+	    _ALIGN(p) + (size_t)p);
+	p = (char *)_ALIGN(p);
+
+	NS_APPLY_OFFSET(grp->gr_name, orig_buf, p, char *);
+	NS_APPLY_OFFSET(grp->gr_passwd, orig_buf, p, char *);
+	if (grp->gr_mem != NULL) {
+		NS_APPLY_OFFSET(grp->gr_mem, orig_buf, p, char **);
+
+		for (mem = grp->gr_mem; *mem; ++mem)
+			NS_APPLY_OFFSET(*mem, orig_buf, p, char *);
+	}
+
+	if (retval != NULL)
+		*((struct group **)retval) = grp;
+
+	return (NS_SUCCESS);
+}
+
+NSS_MP_CACHE_HANDLING(group);
+#endif /* NS_CACHING */
+
 
 /* XXX IEEE Std 1003.1, 2003 specifies `void setgrent(void)' */
 int				
 setgrent(void)
 {
+#ifdef NS_CACHING
+	static const nss_cache_info cache_info = NS_MP_CACHE_INFO_INITIALIZER(
+		group, (void *)nss_lt_all,
+		NULL, NULL);
+#endif
+
 	static const ns_dtab dtab[] = {
 		{ NSSRC_FILES, files_setgrent, (void *)SETGRENT },
 #ifdef HESIOD
@@ -155,6 +381,9 @@
 		{ NSSRC_NIS, nis_setgrent, (void *)SETGRENT },
 #endif
 		{ NSSRC_COMPAT, compat_setgrent, (void *)SETGRENT },
+#ifdef NS_CACHING
+		NS_CACHE_CB(&cache_info)
+#endif
 		{ NULL, NULL, NULL }
 	};
 	(void)_nsdispatch(NULL, dtab, NSDB_GROUP, "setgrent", defaultsrc, 0);
@@ -165,6 +394,12 @@
 int
 setgroupent(int stayopen)
 {
+#ifdef NS_CACHING
+	static const nss_cache_info cache_info = NS_MP_CACHE_INFO_INITIALIZER(
+		group, (void *)nss_lt_all,
+		NULL, NULL);
+#endif
+
 	static const ns_dtab dtab[] = {
 		{ NSSRC_FILES, files_setgrent, (void *)SETGRENT },
 #ifdef HESIOD
@@ -174,6 +409,9 @@
 		{ NSSRC_NIS, nis_setgrent, (void *)SETGRENT },
 #endif
 		{ NSSRC_COMPAT, compat_setgrent, (void *)SETGRENT },
+#ifdef NS_CACHING
+		NS_CACHE_CB(&cache_info)
+#endif
 		{ NULL, NULL, NULL }
 	};
 	(void)_nsdispatch(NULL, dtab, NSDB_GROUP, "setgrent", defaultsrc,
@@ -185,6 +423,12 @@
 void
 endgrent(void)
 {
+#ifdef NS_CACHING
+	static const nss_cache_info cache_info = NS_MP_CACHE_INFO_INITIALIZER(
+		group, (void *)nss_lt_all,
+		NULL, NULL);
+#endif
+
 	static const ns_dtab dtab[] = {
 		{ NSSRC_FILES, files_setgrent, (void *)ENDGRENT },
 #ifdef HESIOD
@@ -194,6 +438,9 @@
 		{ NSSRC_NIS, nis_setgrent, (void *)ENDGRENT },
 #endif
 		{ NSSRC_COMPAT, compat_setgrent, (void *)ENDGRENT },
+#ifdef NS_CACHING
+		NS_CACHE_CB(&cache_info)
+#endif
 		{ NULL, NULL, NULL }
 	};
 	(void)_nsdispatch(NULL, dtab, NSDB_GROUP, "endgrent", defaultsrc);
@@ -204,6 +451,12 @@
 getgrent_r(struct group *grp, char *buffer, size_t bufsize,
     struct group **result)
 {
+#ifdef NS_CACHING
+	static const nss_cache_info cache_info = NS_MP_CACHE_INFO_INITIALIZER(
+		group, (void *)nss_lt_all,
+		grp_marshal_func, grp_unmarshal_func);
+#endif
+
 	static const ns_dtab dtab[] = {
 		{ NSSRC_FILES, files_group, (void *)nss_lt_all },
 #ifdef HESIOD
@@ -213,6 +466,9 @@
 		{ NSSRC_NIS, nis_group, (void *)nss_lt_all },
 #endif
 		{ NSSRC_COMPAT, compat_group, (void *)nss_lt_all },
+#ifdef NS_CACHING
+		NS_CACHE_CB(&cache_info)
+#endif
 		{ NULL, NULL, NULL }
 	};
 	int	rv, ret_errno;
@@ -232,6 +488,13 @@
 getgrnam_r(const char *name, struct group *grp, char *buffer, size_t bufsize,
     struct group **result)
 {
+#ifdef NS_CACHING
+	static const nss_cache_info cache_info =
+    		NS_COMMON_CACHE_INFO_INITIALIZER(
+		group, (void *)nss_lt_name,
+		grp_id_func, grp_marshal_func, grp_unmarshal_func);
+#endif
+
 	static const ns_dtab dtab[] = {
 		{ NSSRC_FILES, files_group, (void *)nss_lt_name },
 #ifdef HESIOD
@@ -241,6 +504,9 @@
 		{ NSSRC_NIS, nis_group, (void *)nss_lt_name },
 #endif
 		{ NSSRC_COMPAT, compat_group, (void *)nss_lt_name },
+#ifdef NS_CACHING
+		NS_CACHE_CB(&cache_info)
+#endif
 		{ NULL, NULL, NULL }
 	};
 	int	rv, ret_errno;
@@ -260,6 +526,13 @@
 getgrgid_r(gid_t gid, struct group *grp, char *buffer, size_t bufsize,
     struct group **result)
 {
+#ifdef NS_CACHING
+	static const nss_cache_info cache_info =
+    		NS_COMMON_CACHE_INFO_INITIALIZER(
+		group, (void *)nss_lt_id,
+		grp_id_func, grp_marshal_func, grp_unmarshal_func);
+#endif
+
 	static const ns_dtab dtab[] = {
 		{ NSSRC_FILES, files_group, (void *)nss_lt_id },
 #ifdef HESIOD
@@ -269,6 +542,9 @@
 		{ NSSRC_NIS, nis_group, (void *)nss_lt_id },
 #endif
 		{ NSSRC_COMPAT, compat_group, (void *)nss_lt_id },
+#ifdef NS_CACHING
+		NS_CACHE_CB(&cache_info)
+#endif
 		{ NULL, NULL, NULL }
 	};
 	int	rv, ret_errno;
@@ -445,6 +721,7 @@
 	gid_t			 gid;
 	char			*buffer;
 	size_t			 bufsize, linesize;
+	off_t			 pos;
 	int			 rv, stayopen, *errnop;
 
 	name = NULL;
@@ -481,6 +758,7 @@
 		stayopen = st->stayopen;
 	}
 	rv = NS_NOTFOUND;
+	pos = ftello(st->fp);
 	while ((line = fgetln(st->fp, &linesize)) != NULL) {
 		if (line[linesize-1] == '\n')
 			linesize--;
@@ -502,6 +780,7 @@
 		    &buffer[linesize + 1], bufsize - linesize - 1, errnop);
 		if (rv & NS_TERMINATE)
 			break;
+		pos = ftello(st->fp);
 	}
 	if (!stayopen && st->fp != NULL) {
 		fclose(st->fp);
@@ -509,6 +788,8 @@
 	}
 	if (rv == NS_SUCCESS && retval != NULL)
 		*(struct group **)retval = grp;
+	else if (rv == NS_RETURN && *errnop == ERANGE && st->fp != NULL)
+		fseeko(st->fp, pos, SEEK_SET);
 	return (rv);
 }
 
@@ -907,6 +1188,7 @@
 	char			*buffer, *p;
 	void			*discard;
 	size_t			 bufsize, linesize;
+	off_t			 pos;
 	int			 rv, stayopen, *errnop;
 
 #define set_lookup_type(x, y) do { 				\
@@ -1010,6 +1292,7 @@
 		break;
 	}
 	rv = NS_NOTFOUND;
+	pos = ftello(st->fp);
 	while ((line = fgetln(st->fp, &linesize)) != NULL) {
 		if (line[linesize-1] == '\n')
 			linesize--;
@@ -1050,6 +1333,7 @@
 		    &buffer[linesize + 1], bufsize - linesize - 1, errnop);
 		if (rv & NS_TERMINATE)
 			break;
+		pos = ftello(st->fp);
 	}
 fin:
 	if (!stayopen && st->fp != NULL) {
@@ -1058,6 +1342,8 @@
 	}
 	if (rv == NS_SUCCESS && retval != NULL)
 		*(struct group **)retval = grp;
+	else if (rv == NS_RETURN && *errnop == ERANGE && st->fp != NULL)
+		fseeko(st->fp, pos, SEEK_SET);
 	return (rv);
 #undef set_lookup_type
 }
Index: ualarm.c
===================================================================
RCS file: /home/cvs/src/lib/libc/gen/ualarm.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -L lib/libc/gen/ualarm.c -L lib/libc/gen/ualarm.c -u -r1.2 -r1.3
--- lib/libc/gen/ualarm.c
+++ lib/libc/gen/ualarm.c
@@ -31,7 +31,7 @@
 static char sccsid[] = "@(#)ualarm.c	8.1 (Berkeley) 6/4/93";
 #endif /* LIBC_SCCS and not lint */
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/gen/ualarm.c,v 1.4 2002/12/29 00:59:09 mike Exp $");
+__FBSDID("$FreeBSD: src/lib/libc/gen/ualarm.c,v 1.5 2007/01/09 00:27:56 imp Exp $");
 
 #include <sys/time.h>
 #include <unistd.h>
Index: sleep.c
===================================================================
RCS file: /home/cvs/src/lib/libc/gen/sleep.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L lib/libc/gen/sleep.c -L lib/libc/gen/sleep.c -u -r1.1.1.1 -r1.2
--- lib/libc/gen/sleep.c
+++ lib/libc/gen/sleep.c
@@ -10,10 +10,6 @@
  * 2. Redistributions in binary form must reproduce the above copyright
  *    notice, this list of conditions and the following disclaimer in the
  *    documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- *    must display the following acknowledgement:
- *	This product includes software developed by the University of
- *	California, Berkeley and its contributors.
  * 4. Neither the name of the University nor the names of its contributors
  *    may be used to endorse or promote products derived from this software
  *    without specific prior written permission.
@@ -35,7 +31,7 @@
 static char sccsid[] = "@(#)sleep.c	8.1 (Berkeley) 6/4/93";
 #endif /* LIBC_SCCS and not lint */
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/gen/sleep.c,v 1.31 2002/02/01 00:57:29 obrien Exp $");
+__FBSDID("$FreeBSD: src/lib/libc/gen/sleep.c,v 1.32 2007/01/09 00:27:55 imp Exp $");
 
 #include "namespace.h"
 #include <errno.h>
Index: opendir.c
===================================================================
RCS file: /home/cvs/src/lib/libc/gen/opendir.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L lib/libc/gen/opendir.c -L lib/libc/gen/opendir.c -u -r1.1.1.1 -r1.2
--- lib/libc/gen/opendir.c
+++ lib/libc/gen/opendir.c
@@ -10,10 +10,6 @@
  * 2. Redistributions in binary form must reproduce the above copyright
  *    notice, this list of conditions and the following disclaimer in the
  *    documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- *    must display the following acknowledgement:
- *	This product includes software developed by the University of
- *	California, Berkeley and its contributors.
  * 4. Neither the name of the University nor the names of its contributors
  *    may be used to endorse or promote products derived from this software
  *    without specific prior written permission.
@@ -35,7 +31,7 @@
 static char sccsid[] = "@(#)opendir.c	8.8 (Berkeley) 5/1/95";
 #endif /* LIBC_SCCS and not lint */
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/gen/opendir.c,v 1.22 2004/08/14 17:46:10 stefanf Exp $");
+__FBSDID("$FreeBSD: src/lib/libc/gen/opendir.c,v 1.23 2007/01/09 00:27:54 imp Exp $");
 
 #include "namespace.h"
 #include <sys/param.h>
Index: tls.c
===================================================================
RCS file: /home/cvs/src/lib/libc/gen/tls.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L lib/libc/gen/tls.c -L lib/libc/gen/tls.c -u -r1.1.1.1 -r1.2
--- lib/libc/gen/tls.c
+++ lib/libc/gen/tls.c
@@ -23,7 +23,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- *	$FreeBSD: src/lib/libc/gen/tls.c,v 1.8 2005/03/21 13:17:16 davidxu Exp $
+ *	$FreeBSD: src/lib/libc/gen/tls.c,v 1.14 2007/02/25 21:23:50 kientzle Exp $
  */
 
 /*
@@ -36,12 +36,9 @@
 #include <stdlib.h>
 #include <string.h>
 #include <elf.h>
-#include <assert.h>
 
 #include "libc_private.h"
 
-/* XXX not sure what variants to use for arm. */
-
 __weak_reference(__libc_allocate_tls, _rtld_allocate_tls);
 __weak_reference(__libc_free_tls, _rtld_free_tls);
 
@@ -60,11 +57,16 @@
 void *__libc_allocate_tls(void *oldtls, size_t tcbsize, size_t tcbalign);
 void __libc_free_tls(void *tls, size_t tcbsize, size_t tcbalign);
 
-#if defined(__ia64__) || defined(__alpha__) || defined(__powerpc__)
-#define TLS_VARIANT_I
+#if defined(__amd64__)
+#define TLS_TCB_ALIGN 16
+#elif defined(__i386__) || \
+    defined(__sparc64__)
+#define TLS_TCB_ALIGN sizeof(void *)
+#else
+#error TLS_TCB_ALIGN undefined for target architecture
 #endif
-#if defined(__i386__) || defined(__amd64__) || defined(__sparc64__) || \
-    defined(__arm__)
+
+#if defined(__i386__) || defined(__amd64__) || defined(__sparc64__)
 #define TLS_VARIANT_II
 #endif
 
@@ -75,9 +77,6 @@
 
 static size_t tls_static_space;
 static size_t tls_init_size;
-#ifdef TLS_VARIANT_I
-static size_t tls_init_offset;
-#endif
 static void *tls_init;
 #endif
 
@@ -104,67 +103,69 @@
 
 #ifdef TLS_VARIANT_I
 
+#define	TLS_TCB_SIZE	(2 * sizeof(void *))
+
 /*
  * Free Static TLS using the Variant I method.
  */
 void
-__libc_free_tls(void *tls, size_t tcbsize __unused, size_t tcbalign __unused)
+__libc_free_tls(void *tcb, size_t tcbsize, size_t tcbalign __unused)
 {
-	Elf_Addr* dtv;
+	Elf_Addr *dtv;
+	Elf_Addr **tls;
 
-	dtv = ((Elf_Addr**)tls)[0];
-	free(tls);
+	tls = (Elf_Addr **)((Elf_Addr)tcb + tcbsize - TLS_TCB_SIZE);
+	dtv = tls[0];
 	free(dtv);
+	free(tcb);
 }
 
 /*
  * Allocate Static TLS using the Variant I method.
  */
 void *
-__libc_allocate_tls(void *oldtls, size_t tcbsize, size_t tcbalign __unused)
+__libc_allocate_tls(void *oldtcb, size_t tcbsize, size_t tcbalign __unused)
 {
-	size_t size;
-	char *tls;
 	Elf_Addr *dtv;
+	Elf_Addr **tls;
+	char *tcb;
 
-	size = tls_static_space;
-	if (size < tcbsize)
-		size = tcbsize;
+	if (oldtcb != NULL && tcbsize == TLS_TCB_SIZE)
+		return (oldtcb);
 
-	tls = malloc(size);
-	dtv = malloc(3 * sizeof(Elf_Addr));
-
-	*(Elf_Addr **) tls = dtv;
-
-	dtv[0] = 1;
-	dtv[1] = 1;
-	dtv[2] = (Elf_Addr)(tls + tls_init_offset);
-	if (oldtls) {
-		/*
-		 * Copy the static TLS block over whole.
-		 */
-		memcpy(tls + tls_init_offset,
-		    (char *)oldtls + tls_init_offset,
-		    tls_static_space - tls_init_offset);
+	tcb = calloc(1, tls_static_space + tcbsize);
+	tls = (Elf_Addr **)(tcb + tcbsize - TLS_TCB_SIZE);
 
-		/*
-		 * We assume that this block was the one we created with
-		 * allocate_initial_tls().
-		 */
-		_rtld_free_tls(oldtls, 2 * sizeof(Elf_Addr), sizeof(Elf_Addr));
+	if (oldtcb != NULL) {
+		memcpy(tls, oldtcb, tls_static_space + TLS_TCB_SIZE);
+		free(oldtcb);
+
+		/* Adjust the DTV. */
+		dtv = tls[0];
+		dtv[2] = (Elf_Addr)tls + TLS_TCB_SIZE;
 	} else {
-		memcpy(tls + tls_init_offset, tls_init, tls_init_size);
-		memset(tls + tls_init_offset + tls_init_size,
-		    0, tls_static_space - tls_init_size);
+		dtv = malloc(3 * sizeof(Elf_Addr));
+		tls[0] = dtv;
+		dtv[0] = 1;
+		dtv[1] = 1;
+		dtv[2] = (Elf_Addr)tls + TLS_TCB_SIZE;
+
+		if (tls_init_size > 0)
+			memcpy((void*)dtv[2], tls_init, tls_init_size);
+		if (tls_static_space > tls_init_size)
+			memset((void*)(dtv[2] + tls_init_size), 0,
+			    tls_static_space - tls_init_size);
 	}
 
-	return tls;
+	return(tcb); 
 }
 
 #endif
 
 #ifdef TLS_VARIANT_II
 
+#define	TLS_TCB_SIZE	(3 * sizeof(Elf_Addr))
+
 /*
  * Free Static TLS using the Variant II method.
  */
@@ -201,8 +202,9 @@
 
 	size = round(tls_static_space, tcbalign);
 
-	assert(tcbsize >= 2*sizeof(Elf_Addr));
-	tls = malloc(size + tcbsize);
+	if (tcbsize < 2 * sizeof(Elf_Addr))
+		tcbsize = 2 * sizeof(Elf_Addr);
+	tls = calloc(1, size + tcbsize);
 	dtv = malloc(3 * sizeof(Elf_Addr));
 
 	segbase = (Elf_Addr)(tls + size);
@@ -295,22 +297,14 @@
 
 	for (i = 0; (unsigned) i < phnum; i++) {
 		if (phdr[i].p_type == PT_TLS) {
-#ifdef TLS_VARIANT_I
-			tls_static_space = round(2*sizeof(Elf_Addr),
-			    phdr[i].p_align) + phdr[i].p_memsz;
-			tls_init_offset = round(2*sizeof(Elf_Addr),
-			    phdr[i].p_align);
-#else			    
 			tls_static_space = round(phdr[i].p_memsz,
 			    phdr[i].p_align);
-#endif
 			tls_init_size = phdr[i].p_filesz;
 			tls_init = (void*) phdr[i].p_vaddr;
 		}
 	}
 
-	tls = _rtld_allocate_tls(NULL, 2*sizeof(Elf_Addr),
-	    sizeof(Elf_Addr));
+	tls = _rtld_allocate_tls(NULL, TLS_TCB_SIZE, TLS_TCB_ALIGN);
 
 	_set_tp(tls);
 #endif
Index: _spinlock_stub.c
===================================================================
RCS file: /home/cvs/src/lib/libc/gen/_spinlock_stub.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -L lib/libc/gen/_spinlock_stub.c -L lib/libc/gen/_spinlock_stub.c -u -r1.2 -r1.3
--- lib/libc/gen/_spinlock_stub.c
+++ lib/libc/gen/_spinlock_stub.c
@@ -10,10 +10,7 @@
  * 2. Redistributions in binary form must reproduce the above copyright
  *    notice, this list of conditions and the following disclaimer in the
  *    documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- *    must display the following acknowledgement:
- *	This product includes software developed by John Birrell.
- * 4. Neither the name of the author nor the names of any co-contributors
+ * 3. Neither the name of the author nor the names of any co-contributors
  *    may be used to endorse or promote products derived from this software
  *    without specific prior written permission.
  *
@@ -31,8 +28,7 @@
  */
 
 #include <sys/cdefs.h>
-/*__FBSDID("$FreeBSD: src/lib/libc/gen/_spinlock_stub.c,v 1.8 2003/03/26 04:02:24 jeff Exp $");*/
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: src/lib/libc/gen/_spinlock_stub.c,v 1.10 2007/01/12 07:31:30 imp Exp $");
 
 #include <stdio.h>
 
@@ -44,7 +40,7 @@
  */
 __weak_reference(_atomic_lock_stub, _atomic_lock);
 __weak_reference(_spinlock_stub, _spinlock);
-__weak_reference(_spinlock_stub, _spinunlock);
+__weak_reference(_spinunlock_stub, _spinunlock);
 __weak_reference(_spinlock_debug_stub, _spinlock_debug);
 
 
Index: usleep.c
===================================================================
RCS file: /home/cvs/src/lib/libc/gen/usleep.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -L lib/libc/gen/usleep.c -L lib/libc/gen/usleep.c -u -r1.2 -r1.3
--- lib/libc/gen/usleep.c
+++ lib/libc/gen/usleep.c
@@ -31,7 +31,7 @@
 static char sccsid[] = "@(#)usleep.c	8.1 (Berkeley) 6/4/93";
 #endif /* LIBC_SCCS and not lint */
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/gen/usleep.c,v 1.28.12.1 2005/10/08 17:56:53 delphij Exp $");
+__FBSDID("$FreeBSD: src/lib/libc/gen/usleep.c,v 1.30 2007/01/09 00:27:56 imp Exp $");
 
 #include "namespace.h"
 #include <time.h>
Index: dlfcn.c
===================================================================
RCS file: /home/cvs/src/lib/libc/gen/dlfcn.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -L lib/libc/gen/dlfcn.c -L lib/libc/gen/dlfcn.c -u -r1.2 -r1.3
--- lib/libc/gen/dlfcn.c
+++ lib/libc/gen/dlfcn.c
@@ -25,13 +25,13 @@
  */
 
 #include <sys/cdefs.h>
-/*__FBSDID("$FreeBSD: src/lib/libc/gen/dlfcn.c,v 1.12 2004/03/05 08:10:17 markm Exp $");*/
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: src/lib/libc/gen/dlfcn.c,v 1.14 2007/04/03 18:35:20 kan Exp $");
 
 /*
  * Linkage to services provided by the dynamic linker.
  */
 #include <dlfcn.h>
+#include <link.h>
 #include <stddef.h>
 
 static const char sorry[] = "Service unavailable";
@@ -105,6 +105,15 @@
 	return NULL;
 }
 
+#pragma weak dlvsym
+void *
+dlvsym(void * __restrict handle, const char * __restrict name,
+    const char * __restrict version)
+{
+	_rtld_error(sorry);
+	return NULL;
+}
+
 #pragma weak dlinfo
 int
 dlinfo(void * __restrict handle, int request, void * __restrict p)
@@ -119,3 +128,12 @@
 {
 	_rtld_error(sorry);
 }
+
+#pragma weak dl_iterate_phdr
+int
+dl_iterate_phdr(int (*callback)(struct dl_phdr_info *, size_t, void *),
+    void *data)
+{
+	_rtld_error(sorry);
+	return 0;
+}
Index: disklabel.c
===================================================================
RCS file: /home/cvs/src/lib/libc/gen/disklabel.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -L lib/libc/gen/disklabel.c -L lib/libc/gen/disklabel.c -u -r1.2 -r1.3
--- lib/libc/gen/disklabel.c
+++ lib/libc/gen/disklabel.c
@@ -27,10 +27,11 @@
  * SUCH DAMAGE.
  */
 
-/* static char sccsid[] = "@(#)disklabel.c	8.2 (Berkeley) 5/3/95"; */
+#if defined(LIBC_SCCS) && !defined(lint)
+static char sccsid[] = "@(#)disklabel.c	8.2 (Berkeley) 5/3/95";
+#endif /* LIBC_SCCS and not lint */
 #include <sys/cdefs.h>
-/*__FBSDID("$FreeBSD: src/lib/libc/gen/disklabel.c,v 1.16 2002/08/16 15:33:20 bmilekic Exp $");*/
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: src/lib/libc/gen/disklabel.c,v 1.17 2007/01/09 00:27:53 imp Exp $");
 
 #include <sys/param.h>
 #define DKTYPENAMES
Index: closedir.c
===================================================================
RCS file: /home/cvs/src/lib/libc/gen/closedir.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -L lib/libc/gen/closedir.c -L lib/libc/gen/closedir.c -u -r1.2 -r1.3
--- lib/libc/gen/closedir.c
+++ lib/libc/gen/closedir.c
@@ -27,11 +27,11 @@
  * SUCH DAMAGE.
  */
 
-/* static char sccsid[] = "@(#)closedir.c	8.1 (Berkeley) 6/10/93"; */
-
+#if defined(LIBC_SCCS) && !defined(lint)
+static char sccsid[] = "@(#)closedir.c	8.1 (Berkeley) 6/10/93";
+#endif /* LIBC_SCCS and not lint */
 #include <sys/cdefs.h>
-/* __FBSDID("$FreeBSD: src/lib/libc/gen/closedir.c,v 1.10 2002/02/01 00:57:29 obrien Exp $"); */
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: src/lib/libc/gen/closedir.c,v 1.11 2007/01/09 00:27:53 imp Exp $");
 
 #include "namespace.h"
 #include <sys/types.h>
Index: clock.3
===================================================================
RCS file: /home/cvs/src/lib/libc/gen/clock.3,v
retrieving revision 1.2
retrieving revision 1.3
diff -L lib/libc/gen/clock.3 -L lib/libc/gen/clock.3 -u -r1.2 -r1.3
--- lib/libc/gen/clock.3
+++ lib/libc/gen/clock.3
@@ -30,8 +30,7 @@
 .\" SUCH DAMAGE.
 .\"
 .\"     @(#)clock.3	8.1 (Berkeley) 6/4/93
-.\" $FreeBSD: src/lib/libc/gen/clock.3,v 1.11 2001/11/20 13:43:58 ru Exp $
-.\" $MidnightBSD$
+.\" $FreeBSD: src/lib/libc/gen/clock.3,v 1.12 2007/01/09 00:27:53 imp Exp $
 .\"
 .Dd June 4, 1993
 .Dt CLOCK 3
Index: getgrouplist.3
===================================================================
RCS file: /home/cvs/src/lib/libc/gen/getgrouplist.3,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L lib/libc/gen/getgrouplist.3 -L lib/libc/gen/getgrouplist.3 -u -r1.1.1.1 -r1.2
--- lib/libc/gen/getgrouplist.3
+++ lib/libc/gen/getgrouplist.3
@@ -9,10 +9,6 @@
 .\" 2. Redistributions in binary form must reproduce the above copyright
 .\"    notice, this list of conditions and the following disclaimer in the
 .\"    documentation and/or other materials provided with the distribution.
-.\" 3. All advertising materials mentioning features or use of this software
-.\"    must display the following acknowledgement:
-.\"	This product includes software developed by the University of
-.\"	California, Berkeley and its contributors.
 .\" 4. Neither the name of the University nor the names of its contributors
 .\"    may be used to endorse or promote products derived from this software
 .\"    without specific prior written permission.
@@ -30,7 +26,7 @@
 .\" SUCH DAMAGE.
 .\"
 .\"     @(#)getgrouplist.3	8.1 (Berkeley) 6/9/93
-.\" $FreeBSD: src/lib/libc/gen/getgrouplist.3,v 1.8 2002/01/22 17:32:53 markm Exp $
+.\" $FreeBSD: src/lib/libc/gen/getgrouplist.3,v 1.9 2007/01/09 00:27:53 imp Exp $
 .\"
 .Dd June 9, 1993
 .Dt GETGROUPLIST 3
Index: isatty.c
===================================================================
RCS file: /home/cvs/src/lib/libc/gen/isatty.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L lib/libc/gen/isatty.c -L lib/libc/gen/isatty.c -u -r1.1.1.1 -r1.2
--- lib/libc/gen/isatty.c
+++ lib/libc/gen/isatty.c
@@ -10,10 +10,6 @@
  * 2. Redistributions in binary form must reproduce the above copyright
  *    notice, this list of conditions and the following disclaimer in the
  *    documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- *    must display the following acknowledgement:
- *	This product includes software developed by the University of
- *	California, Berkeley and its contributors.
  * 4. Neither the name of the University nor the names of its contributors
  *    may be used to endorse or promote products derived from this software
  *    without specific prior written permission.
@@ -35,7 +31,7 @@
 static char sccsid[] = "@(#)isatty.c	8.1 (Berkeley) 6/4/93";
 #endif /* LIBC_SCCS and not lint */
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/gen/isatty.c,v 1.5 2002/02/01 00:57:29 obrien Exp $");
+__FBSDID("$FreeBSD: src/lib/libc/gen/isatty.c,v 1.6 2007/01/09 00:27:54 imp Exp $");
 
 #include <termios.h>
 #include <unistd.h>
Index: ttyname.3
===================================================================
RCS file: /home/cvs/src/lib/libc/gen/ttyname.3,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L lib/libc/gen/ttyname.3 -L lib/libc/gen/ttyname.3 -u -r1.1.1.1 -r1.2
--- lib/libc/gen/ttyname.3
+++ lib/libc/gen/ttyname.3
@@ -9,10 +9,6 @@
 .\" 2. Redistributions in binary form must reproduce the above copyright
 .\"    notice, this list of conditions and the following disclaimer in the
 .\"    documentation and/or other materials provided with the distribution.
-.\" 3. All advertising materials mentioning features or use of this software
-.\"    must display the following acknowledgement:
-.\"	This product includes software developed by the University of
-.\"	California, Berkeley and its contributors.
 .\" 4. Neither the name of the University nor the names of its contributors
 .\"    may be used to endorse or promote products derived from this software
 .\"    without specific prior written permission.
@@ -30,7 +26,7 @@
 .\" SUCH DAMAGE.
 .\"
 .\"     @(#)ttyname.3	8.1 (Berkeley) 6/4/93
-.\" $FreeBSD: src/lib/libc/gen/ttyname.3,v 1.13 2005/06/15 19:04:03 ru Exp $
+.\" $FreeBSD: src/lib/libc/gen/ttyname.3,v 1.14 2007/01/09 00:27:55 imp Exp $
 .\"
 .Dd May 14, 2005
 .Dt TTYNAME 3
Index: waitpid.c
===================================================================
RCS file: /home/cvs/src/lib/libc/gen/waitpid.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -L lib/libc/gen/waitpid.c -L lib/libc/gen/waitpid.c -u -r1.2 -r1.3
--- lib/libc/gen/waitpid.c
+++ lib/libc/gen/waitpid.c
@@ -31,7 +31,7 @@
 static char sccsid[] = "@(#)waitpid.c	8.1 (Berkeley) 6/4/93";
 #endif /* LIBC_SCCS and not lint */
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/gen/waitpid.c,v 1.6 2002/02/01 00:57:29 obrien Exp $");
+__FBSDID("$FreeBSD: src/lib/libc/gen/waitpid.c,v 1.7 2007/01/09 00:27:56 imp Exp $");
 
 #include "namespace.h"
 #include <sys/types.h>
Index: getusershell.3
===================================================================
RCS file: /home/cvs/src/lib/libc/gen/getusershell.3,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L lib/libc/gen/getusershell.3 -L lib/libc/gen/getusershell.3 -u -r1.1.1.1 -r1.2
--- lib/libc/gen/getusershell.3
+++ lib/libc/gen/getusershell.3
@@ -11,10 +11,6 @@
 .\" 2. Redistributions in binary form must reproduce the above copyright
 .\"    notice, this list of conditions and the following disclaimer in the
 .\"    documentation and/or other materials provided with the distribution.
-.\" 3. All advertising materials mentioning features or use of this software
-.\"    must display the following acknowledgement:
-.\"	This product includes software developed by the University of
-.\"	California, Berkeley and its contributors.
 .\" 4. Neither the name of the University nor the names of its contributors
 .\"    may be used to endorse or promote products derived from this software
 .\"    without specific prior written permission.
@@ -32,7 +28,7 @@
 .\" SUCH DAMAGE.
 .\"
 .\"     @(#)getusershell.3	8.1 (Berkeley) 6/4/93
-.\" $FreeBSD: src/lib/libc/gen/getusershell.3,v 1.11 2005/02/09 18:03:13 ru Exp $
+.\" $FreeBSD: src/lib/libc/gen/getusershell.3,v 1.12 2007/01/09 00:27:54 imp Exp $
 .\"
 .Dd January 16, 1999
 .Dt GETUSERSHELL 3
Index: setmode.c
===================================================================
RCS file: /home/cvs/src/lib/libc/gen/setmode.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L lib/libc/gen/setmode.c -L lib/libc/gen/setmode.c -u -r1.1.1.1 -r1.2
--- lib/libc/gen/setmode.c
+++ lib/libc/gen/setmode.c
@@ -13,10 +13,6 @@
  * 2. Redistributions in binary form must reproduce the above copyright
  *    notice, this list of conditions and the following disclaimer in the
  *    documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- *    must display the following acknowledgement:
- *	This product includes software developed by the University of
- *	California, Berkeley and its contributors.
  * 4. Neither the name of the University nor the names of its contributors
  *    may be used to endorse or promote products derived from this software
  *    without specific prior written permission.
@@ -38,7 +34,7 @@
 static char sccsid[] = "@(#)setmode.c	8.2 (Berkeley) 3/25/94";
 #endif /* LIBC_SCCS and not lint */
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/gen/setmode.c,v 1.10 2005/04/08 21:15:38 stefanf Exp $");
+__FBSDID("$FreeBSD: src/lib/libc/gen/setmode.c,v 1.11 2007/01/09 00:27:55 imp Exp $");
 
 #include "namespace.h"
 #include <sys/types.h>
Index: timezone.3
===================================================================
RCS file: /home/cvs/src/lib/libc/gen/timezone.3,v
retrieving revision 1.2
retrieving revision 1.3
diff -L lib/libc/gen/timezone.3 -L lib/libc/gen/timezone.3 -u -r1.2 -r1.3
--- lib/libc/gen/timezone.3
+++ lib/libc/gen/timezone.3
@@ -26,7 +26,7 @@
 .\" SUCH DAMAGE.
 .\"
 .\"	@(#)timezone.3	8.2 (Berkeley) 4/19/94
-.\" $FreeBSD: src/lib/libc/gen/timezone.3,v 1.9 2002/12/19 09:40:21 ru Exp $
+.\" $FreeBSD: src/lib/libc/gen/timezone.3,v 1.10 2007/01/09 00:27:55 imp Exp $
 .\"
 .Dd April 19, 1994
 .Dt TIMEZONE 3
Index: glob.3
===================================================================
RCS file: /home/cvs/src/lib/libc/gen/glob.3,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L lib/libc/gen/glob.3 -L lib/libc/gen/glob.3 -u -r1.1.1.1 -r1.2
--- lib/libc/gen/glob.3
+++ lib/libc/gen/glob.3
@@ -11,10 +11,6 @@
 .\" 2. Redistributions in binary form must reproduce the above copyright
 .\"    notice, this list of conditions and the following disclaimer in the
 .\"    documentation and/or other materials provided with the distribution.
-.\" 3. All advertising materials mentioning features or use of this software
-.\"    must display the following acknowledgement:
-.\"	This product includes software developed by the University of
-.\"	California, Berkeley and its contributors.
 .\" 4. Neither the name of the University nor the names of its contributors
 .\"    may be used to endorse or promote products derived from this software
 .\"    without specific prior written permission.
@@ -32,7 +28,7 @@
 .\" SUCH DAMAGE.
 .\"
 .\"     @(#)glob.3	8.3 (Berkeley) 4/16/94
-.\" $FreeBSD: src/lib/libc/gen/glob.3,v 1.30 2004/09/01 23:28:27 tjr Exp $
+.\" $FreeBSD: src/lib/libc/gen/glob.3,v 1.32 2007/01/09 00:27:54 imp Exp $
 .\"
 .Dd September 1, 2004
 .Dt GLOB 3
@@ -63,9 +59,9 @@
 which contains at least the following fields:
 .Bd -literal
 typedef struct {
-	int gl_pathc;		/* count of total paths so far */
-	int gl_matchc;		/* count of paths matching pattern */
-	int gl_offs;		/* reserved at beginning of gl_pathv */
+	size_t gl_pathc;	/* count of total paths so far */
+	size_t gl_matchc;	/* count of paths matching pattern */
+	size_t gl_offs;		/* reserved at beginning of gl_pathv */
 	int gl_flags;		/* returned flags */
 	char **gl_pathv;	/* list of paths matching pattern */
 } glob_t;
Index: psignal.3
===================================================================
RCS file: /home/cvs/src/lib/libc/gen/psignal.3,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L lib/libc/gen/psignal.3 -L lib/libc/gen/psignal.3 -u -r1.1.1.1 -r1.2
--- lib/libc/gen/psignal.3
+++ lib/libc/gen/psignal.3
@@ -9,10 +9,6 @@
 .\" 2. Redistributions in binary form must reproduce the above copyright
 .\"    notice, this list of conditions and the following disclaimer in the
 .\"    documentation and/or other materials provided with the distribution.
-.\" 3. All advertising materials mentioning features or use of this software
-.\"    must display the following acknowledgement:
-.\"	This product includes software developed by the University of
-.\"	California, Berkeley and its contributors.
 .\" 4. Neither the name of the University nor the names of its contributors
 .\"    may be used to endorse or promote products derived from this software
 .\"    without specific prior written permission.
@@ -30,7 +26,7 @@
 .\" SUCH DAMAGE.
 .\"
 .\"     @(#)psignal.3	8.2 (Berkeley) 2/27/95
-.\" $FreeBSD: src/lib/libc/gen/psignal.3,v 1.16 2002/12/30 21:18:02 schweikh Exp $
+.\" $FreeBSD: src/lib/libc/gen/psignal.3,v 1.17 2007/01/09 00:27:54 imp Exp $
 .\"
 .Dd February 27, 1995
 .Dt PSIGNAL 3
Index: usleep.3
===================================================================
RCS file: /home/cvs/src/lib/libc/gen/usleep.3,v
retrieving revision 1.2
retrieving revision 1.3
diff -L lib/libc/gen/usleep.3 -L lib/libc/gen/usleep.3 -u -r1.2 -r1.3
--- lib/libc/gen/usleep.3
+++ lib/libc/gen/usleep.3
@@ -26,7 +26,7 @@
 .\" SUCH DAMAGE.
 .\"
 .\"     @(#)usleep.3	8.1 (Berkeley) 6/4/93
-.\" $FreeBSD: src/lib/libc/gen/usleep.3,v 1.18 2002/12/29 00:59:09 mike Exp $
+.\" $FreeBSD: src/lib/libc/gen/usleep.3,v 1.19 2007/01/09 00:27:56 imp Exp $
 .\"
 .Dd February 13, 1998
 .Dt USLEEP 3
Index: directory.3
===================================================================
RCS file: /home/cvs/src/lib/libc/gen/directory.3,v
retrieving revision 1.2
retrieving revision 1.3
diff -L lib/libc/gen/directory.3 -L lib/libc/gen/directory.3 -u -r1.2 -r1.3
--- lib/libc/gen/directory.3
+++ lib/libc/gen/directory.3
@@ -26,8 +26,7 @@
 .\" SUCH DAMAGE.
 .\"
 .\"     @(#)directory.3	8.1 (Berkeley) 6/4/93
-.\" $FreeBSD: src/lib/libc/gen/directory.3,v 1.15 2004/07/03 22:30:08 ru Exp $
-.\" $MidnightBSD$
+.\" $FreeBSD: src/lib/libc/gen/directory.3,v 1.16 2007/01/09 00:27:53 imp Exp $
 .\"
 .Dd June 4, 1993
 .Dt DIRECTORY 3
Index: getfsent.3
===================================================================
RCS file: /home/cvs/src/lib/libc/gen/getfsent.3,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L lib/libc/gen/getfsent.3 -L lib/libc/gen/getfsent.3 -u -r1.1.1.1 -r1.2
--- lib/libc/gen/getfsent.3
+++ lib/libc/gen/getfsent.3
@@ -9,10 +9,6 @@
 .\" 2. Redistributions in binary form must reproduce the above copyright
 .\"    notice, this list of conditions and the following disclaimer in the
 .\"    documentation and/or other materials provided with the distribution.
-.\" 3. All advertising materials mentioning features or use of this software
-.\"    must display the following acknowledgement:
-.\"	This product includes software developed by the University of
-.\"	California, Berkeley and its contributors.
 .\" 4. Neither the name of the University nor the names of its contributors
 .\"    may be used to endorse or promote products derived from this software
 .\"    without specific prior written permission.
@@ -30,7 +26,7 @@
 .\" SUCH DAMAGE.
 .\"
 .\"     @(#)getfsent.3	8.1 (Berkeley) 6/4/93
-.\" $FreeBSD: src/lib/libc/gen/getfsent.3,v 1.16 2004/06/21 19:30:45 mpp Exp $
+.\" $FreeBSD: src/lib/libc/gen/getfsent.3,v 1.17 2007/01/09 00:27:53 imp Exp $
 .\"
 .Dd April 7, 2003
 .Dt GETFSENT 3
Index: getttyent.c
===================================================================
RCS file: /home/cvs/src/lib/libc/gen/getttyent.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L lib/libc/gen/getttyent.c -L lib/libc/gen/getttyent.c -u -r1.1.1.1 -r1.2
--- lib/libc/gen/getttyent.c
+++ lib/libc/gen/getttyent.c
@@ -10,10 +10,6 @@
  * 2. Redistributions in binary form must reproduce the above copyright
  *    notice, this list of conditions and the following disclaimer in the
  *    documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- *    must display the following acknowledgement:
- *	This product includes software developed by the University of
- *	California, Berkeley and its contributors.
  * 4. Neither the name of the University nor the names of its contributors
  *    may be used to endorse or promote products derived from this software
  *    without specific prior written permission.
@@ -35,19 +31,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.12.14.1 2005/07/25 20:19:39 mdodd Exp $");
+__FBSDID("$FreeBSD: src/lib/libc/gen/getttyent.c,v 1.16 2007/01/09 00:27:54 imp 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 +75,7 @@
 getttyent()
 {
 	static struct ttyent tty;
+	static char devpts_name[] = "pts/4294967295";
 	char *p;
 	int c;
 	size_t i;
@@ -80,8 +83,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 +223,29 @@
 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);
+	}
 	if (tf) {
 		rewind(tf);
 		return (1);
@@ -228,6 +259,7 @@
 {
 	int rval;
 
+	pts_valid = 0;
 	/*
          * NB: Don't free `line' because getttynam()
 	 * may still be referencing it
Index: setjmperr.c
===================================================================
RCS file: /home/cvs/src/lib/libc/gen/setjmperr.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L lib/libc/gen/setjmperr.c -L lib/libc/gen/setjmperr.c -u -r1.1.1.1 -r1.2
--- lib/libc/gen/setjmperr.c
+++ lib/libc/gen/setjmperr.c
@@ -10,10 +10,6 @@
  * 2. Redistributions in binary form must reproduce the above copyright
  *    notice, this list of conditions and the following disclaimer in the
  *    documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- *    must display the following acknowledgement:
- *	This product includes software developed by the University of
- *	California, Berkeley and its contributors.
  * 4. Neither the name of the University nor the names of its contributors
  *    may be used to endorse or promote products derived from this software
  *    without specific prior written permission.
@@ -35,7 +31,7 @@
 static char sccsid[] = "@(#)setjmperr.c	8.1 (Berkeley) 6/4/93";
 #endif /* LIBC_SCCS and not lint */
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/gen/setjmperr.c,v 1.5 2002/02/01 00:57:29 obrien Exp $");
+__FBSDID("$FreeBSD: src/lib/libc/gen/setjmperr.c,v 1.6 2007/01/09 00:27:55 imp Exp $");
 
 /*
  * This routine is called from longjmp() when an error occurs.
Index: siginterrupt.c
===================================================================
RCS file: /home/cvs/src/lib/libc/gen/siginterrupt.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L lib/libc/gen/siginterrupt.c -L lib/libc/gen/siginterrupt.c -u -r1.1.1.1 -r1.2
--- lib/libc/gen/siginterrupt.c
+++ lib/libc/gen/siginterrupt.c
@@ -10,10 +10,6 @@
  * 2. Redistributions in binary form must reproduce the above copyright
  *    notice, this list of conditions and the following disclaimer in the
  *    documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- *    must display the following acknowledgement:
- *	This product includes software developed by the University of
- *	California, Berkeley and its contributors.
  * 4. Neither the name of the University nor the names of its contributors
  *    may be used to endorse or promote products derived from this software
  *    without specific prior written permission.
@@ -35,7 +31,7 @@
 static char sccsid[] = "@(#)siginterrupt.c	8.1 (Berkeley) 6/4/93";
 #endif /* LIBC_SCCS and not lint */
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/gen/siginterrupt.c,v 1.4 2002/02/01 00:57:29 obrien Exp $");
+__FBSDID("$FreeBSD: src/lib/libc/gen/siginterrupt.c,v 1.5 2007/01/09 00:27:55 imp Exp $");
 
 #include "namespace.h"
 #include <signal.h>
Index: fnmatch.3
===================================================================
RCS file: /home/cvs/src/lib/libc/gen/fnmatch.3,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L lib/libc/gen/fnmatch.3 -L lib/libc/gen/fnmatch.3 -u -r1.1.1.1 -r1.2
--- lib/libc/gen/fnmatch.3
+++ lib/libc/gen/fnmatch.3
@@ -11,10 +11,6 @@
 .\" 2. Redistributions in binary form must reproduce the above copyright
 .\"    notice, this list of conditions and the following disclaimer in the
 .\"    documentation and/or other materials provided with the distribution.
-.\" 3. All advertising materials mentioning features or use of this software
-.\"    must display the following acknowledgement:
-.\"	This product includes software developed by the University of
-.\"	California, Berkeley and its contributors.
 .\" 4. Neither the name of the University nor the names of its contributors
 .\"    may be used to endorse or promote products derived from this software
 .\"    without specific prior written permission.
@@ -32,7 +28,7 @@
 .\" SUCH DAMAGE.
 .\"
 .\"     @(#)fnmatch.3	8.3 (Berkeley) 4/28/95
-.\" $FreeBSD: src/lib/libc/gen/fnmatch.3,v 1.18 2004/07/18 06:56:40 tjr Exp $
+.\" $FreeBSD: src/lib/libc/gen/fnmatch.3,v 1.19 2007/01/09 00:27:53 imp Exp $
 .\"
 .Dd July 18, 2004
 .Dt FNMATCH 3
Index: daemon.c
===================================================================
RCS file: /home/cvs/src/lib/libc/gen/daemon.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -L lib/libc/gen/daemon.c -L lib/libc/gen/daemon.c -u -r1.2 -r1.3
--- lib/libc/gen/daemon.c
+++ lib/libc/gen/daemon.c
@@ -27,15 +27,17 @@
  * SUCH DAMAGE.
  */
 
-/* static char sccsid[] = "@(#)daemon.c	8.1 (Berkeley) 6/4/93"; */
+#if defined(LIBC_SCCS) && !defined(lint)
+static char sccsid[] = "@(#)daemon.c	8.1 (Berkeley) 6/4/93";
+#endif /* LIBC_SCCS and not lint */
 #include <sys/cdefs.h>
-/* __FBSDID("$FreeBSD: src/lib/libc/gen/daemon.c,v 1.6 2003/11/10 22:01:42 ghelmer Exp $"); */
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: src/lib/libc/gen/daemon.c,v 1.8 2007/01/09 00:27:53 imp Exp $");
 
 #include "namespace.h"
 #include <errno.h>
 #include <fcntl.h>
 #include <paths.h>
+#include <stdlib.h>
 #include <signal.h>
 #include <unistd.h>
 #include "un-namespace.h"
Index: sem_init.3
===================================================================
RCS file: /home/cvs/src/lib/libc/gen/sem_init.3,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L lib/libc/gen/sem_init.3 -L lib/libc/gen/sem_init.3 -u -r1.1.1.1 -r1.2
--- lib/libc/gen/sem_init.3
+++ lib/libc/gen/sem_init.3
@@ -25,7 +25,7 @@
 .\" OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
 .\" EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 .\"
-.\" $FreeBSD: src/lib/libc/gen/sem_init.3,v 1.17.8.1 2005/07/17 19:28:55 rwatson Exp $
+.\" $FreeBSD: src/lib/libc/gen/sem_init.3,v 1.18 2005/07/13 13:15:21 rwatson Exp $
 .\"
 .Dd February 15, 2000
 .Dt SEM_INIT 3
Index: getdiskbyname.3
===================================================================
RCS file: /home/cvs/src/lib/libc/gen/getdiskbyname.3,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L lib/libc/gen/getdiskbyname.3 -L lib/libc/gen/getdiskbyname.3 -u -r1.1.1.1 -r1.2
--- lib/libc/gen/getdiskbyname.3
+++ lib/libc/gen/getdiskbyname.3
@@ -9,10 +9,6 @@
 .\" 2. Redistributions in binary form must reproduce the above copyright
 .\"    notice, this list of conditions and the following disclaimer in the
 .\"    documentation and/or other materials provided with the distribution.
-.\" 3. All advertising materials mentioning features or use of this software
-.\"    must display the following acknowledgement:
-.\"	This product includes software developed by the University of
-.\"	California, Berkeley and its contributors.
 .\" 4. Neither the name of the University nor the names of its contributors
 .\"    may be used to endorse or promote products derived from this software
 .\"    without specific prior written permission.
@@ -30,7 +26,7 @@
 .\" SUCH DAMAGE.
 .\"
 .\"     @(#)getdiskbyname.3	8.1 (Berkeley) 6/4/93
-.\" $FreeBSD: src/lib/libc/gen/getdiskbyname.3,v 1.9 2004/07/02 23:52:10 ru Exp $
+.\" $FreeBSD: src/lib/libc/gen/getdiskbyname.3,v 1.10 2007/01/09 00:27:53 imp Exp $
 .\"
 .Dd June 4, 1993
 .Dt GETDISKBYNAME 3
Index: getcwd.3
===================================================================
RCS file: /home/cvs/src/lib/libc/gen/getcwd.3,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L lib/libc/gen/getcwd.3 -L lib/libc/gen/getcwd.3 -u -r1.1.1.1 -r1.2
--- lib/libc/gen/getcwd.3
+++ lib/libc/gen/getcwd.3
@@ -9,10 +9,6 @@
 .\" 2. Redistributions in binary form must reproduce the above copyright
 .\"    notice, this list of conditions and the following disclaimer in the
 .\"    documentation and/or other materials provided with the distribution.
-.\" 3. All advertising materials mentioning features or use of this software
-.\"    must display the following acknowledgement:
-.\"	This product includes software developed by the University of
-.\"	California, Berkeley and its contributors.
 .\" 4. Neither the name of the University nor the names of its contributors
 .\"    may be used to endorse or promote products derived from this software
 .\"    without specific prior written permission.
@@ -30,7 +26,7 @@
 .\" SUCH DAMAGE.
 .\"
 .\"     @(#)getcwd.3	8.2 (Berkeley) 12/11/93
-.\" $FreeBSD: src/lib/libc/gen/getcwd.3,v 1.16 2003/09/08 19:57:14 ru Exp $
+.\" $FreeBSD: src/lib/libc/gen/getcwd.3,v 1.17 2007/01/09 00:27:53 imp Exp $
 .\"
 .Dd November 24, 1997
 .Dt GETCWD 3
Index: basename.3
===================================================================
RCS file: /home/cvs/src/lib/libc/gen/basename.3,v
retrieving revision 1.2
retrieving revision 1.3
diff -L lib/libc/gen/basename.3 -L lib/libc/gen/basename.3 -u -r1.2 -r1.3
--- lib/libc/gen/basename.3
+++ lib/libc/gen/basename.3
@@ -25,10 +25,9 @@
 .\" ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 .\"
 .\" $OpenBSD: basename.3,v 1.12 2000/04/18 03:01:25 aaron Exp $
-.\" $FreeBSD: src/lib/libc/gen/basename.3,v 1.7 2004/07/02 23:52:10 ru Exp $
-.\" $MidnightBSD$
+.\" $FreeBSD: src/lib/libc/gen/basename.3,v 1.8 2006/10/12 14:31:17 ru Exp $
 .\"
-.Dd August 17, 1997
+.Dd October 12, 2006
 .Dt BASENAME 3
 .Os
 .Sh NAME
@@ -59,6 +58,13 @@
 is a null pointer or the empty string, a pointer to the string
 .Qq \&.
 is returned.
+.Sh IMPLEMENTATION NOTES
+The
+.Fn basename
+function
+returns a pointer to internal storage space allocated on the first call
+that will be overwritten
+by subsequent calls.
 .Sh RETURN VALUES
 On successful completion,
 .Fn basename
@@ -78,12 +84,6 @@
 The path component to be returned was larger than
 .Dv MAXPATHLEN .
 .El
-.Sh WARNINGS
-The
-.Fn basename
-function
-returns a pointer to internal static storage space that will be overwritten
-by subsequent calls.
 .Sh SEE ALSO
 .Xr basename 1 ,
 .Xr dirname 1 ,
Index: tcsetattr.3
===================================================================
RCS file: /home/cvs/src/lib/libc/gen/tcsetattr.3,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L lib/libc/gen/tcsetattr.3 -L lib/libc/gen/tcsetattr.3 -u -r1.1.1.1 -r1.2
--- lib/libc/gen/tcsetattr.3
+++ lib/libc/gen/tcsetattr.3
@@ -9,10 +9,6 @@
 .\" 2. Redistributions in binary form must reproduce the above copyright
 .\"    notice, this list of conditions and the following disclaimer in the
 .\"    documentation and/or other materials provided with the distribution.
-.\" 3. All advertising materials mentioning features or use of this software
-.\"    must display the following acknowledgement:
-.\"	This product includes software developed by the University of
-.\"	California, Berkeley and its contributors.
 .\" 4. Neither the name of the University nor the names of its contributors
 .\"    may be used to endorse or promote products derived from this software
 .\"    without specific prior written permission.
@@ -30,7 +26,7 @@
 .\" SUCH DAMAGE.
 .\"
 .\"	@(#)tcsetattr.3	8.3 (Berkeley) 1/2/94
-.\" $FreeBSD: src/lib/libc/gen/tcsetattr.3,v 1.13 2003/09/08 19:57:14 ru Exp $
+.\" $FreeBSD: src/lib/libc/gen/tcsetattr.3,v 1.14 2007/01/09 00:27:55 imp Exp $
 .\"
 .Dd January 2, 1994
 .Dt TCSETATTR 3
Index: raise.3
===================================================================
RCS file: /home/cvs/src/lib/libc/gen/raise.3,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L lib/libc/gen/raise.3 -L lib/libc/gen/raise.3 -u -r1.1.1.1 -r1.2
--- lib/libc/gen/raise.3
+++ lib/libc/gen/raise.3
@@ -13,10 +13,6 @@
 .\" 2. Redistributions in binary form must reproduce the above copyright
 .\"    notice, this list of conditions and the following disclaimer in the
 .\"    documentation and/or other materials provided with the distribution.
-.\" 3. All advertising materials mentioning features or use of this software
-.\"    must display the following acknowledgement:
-.\"	This product includes software developed by the University of
-.\"	California, Berkeley and its contributors.
 .\" 4. Neither the name of the University nor the names of its contributors
 .\"    may be used to endorse or promote products derived from this software
 .\"    without specific prior written permission.
@@ -34,7 +30,7 @@
 .\" SUCH DAMAGE.
 .\"
 .\"     @(#)raise.3	8.1 (Berkeley) 6/4/93
-.\" $FreeBSD: src/lib/libc/gen/raise.3,v 1.7 2001/10/01 16:08:51 ru Exp $
+.\" $FreeBSD: src/lib/libc/gen/raise.3,v 1.8 2007/01/09 00:27:55 imp Exp $
 .\"
 .Dd June 4, 1993
 .Dt RAISE 3
Index: getloadavg.c
===================================================================
RCS file: /home/cvs/src/lib/libc/gen/getloadavg.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L lib/libc/gen/getloadavg.c -L lib/libc/gen/getloadavg.c -u -r1.1.1.1 -r1.2
--- lib/libc/gen/getloadavg.c
+++ lib/libc/gen/getloadavg.c
@@ -10,10 +10,6 @@
  * 2. Redistributions in binary form must reproduce the above copyright
  *    notice, this list of conditions and the following disclaimer in the
  *    documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- *    must display the following acknowledgement:
- *	This product includes software developed by the University of
- *	California, Berkeley and its contributors.
  * 4. Neither the name of the University nor the names of its contributors
  *    may be used to endorse or promote products derived from this software
  *    without specific prior written permission.
@@ -35,7 +31,7 @@
 static char sccsid[] = "@(#)getloadavg.c	8.1 (Berkeley) 6/4/93";
 #endif /* LIBC_SCCS and not lint */
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/gen/getloadavg.c,v 1.2 2002/03/22 21:52:05 obrien Exp $");
+__FBSDID("$FreeBSD: src/lib/libc/gen/getloadavg.c,v 1.3 2007/01/09 00:27:54 imp Exp $");
 
 #include <sys/param.h>
 #include <sys/time.h>
Index: valloc.3
===================================================================
RCS file: /home/cvs/src/lib/libc/gen/valloc.3,v
retrieving revision 1.2
retrieving revision 1.3
diff -L lib/libc/gen/valloc.3 -L lib/libc/gen/valloc.3 -u -r1.2 -r1.3
--- lib/libc/gen/valloc.3
+++ lib/libc/gen/valloc.3
@@ -26,9 +26,9 @@
 .\" SUCH DAMAGE.
 .\"
 .\"     @(#)valloc.3	8.1 (Berkeley) 6/4/93
-.\" $FreeBSD: src/lib/libc/gen/valloc.3,v 1.10 2002/12/18 13:33:02 ru Exp $
+.\" $FreeBSD: src/lib/libc/gen/valloc.3,v 1.14 2007/03/28 18:55:44 jasone Exp $
 .\"
-.Dd June 4, 1993
+.Dd September 13, 2005
 .Dt VALLOC 3
 .Os
 .Sh NAME
@@ -41,12 +41,11 @@
 .Ft void *
 .Fn valloc "size_t size"
 .Sh DESCRIPTION
-.Bf -symbolic
 The
 .Fn valloc
-function is obsoleted by the current version of
-.Xr malloc 3 ,
-which aligns page-sized and larger allocations.
+function is obsoleted by
+.Xr posix_memalign 3 ,
+which can be used to request page-aligned allocations.
 .Ef
 .Pp
 The
@@ -55,23 +54,23 @@
 allocates
 .Fa size
 bytes aligned on a page boundary.
-It is implemented by calling
-.Xr malloc 3
-with a slightly larger request, saving the true beginning of the block
-allocated, and returning a properly aligned pointer.
 .Sh RETURN VALUES
 The
 .Fn valloc
 function returns
 a pointer to the allocated space if successful; otherwise
-a null pointer is returned
+a null pointer is returned.
+.Sh SEE ALSO
+.Xr posix_memalign 3
 .Sh HISTORY
 The
 .Fn valloc
 function appeared in
 .Bx 3.0 .
-.Sh BUGS
-A
-.Fn vfree
-function
-has not been implemented.
+.Pp
+The
+.Fn valloc
+function correctly allocated memory that could be deallocated via
+.Fn free
+starting in
+.Fx 7.0 .
Index: getosreldate.c
===================================================================
RCS file: /home/cvs/src/lib/libc/gen/getosreldate.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L lib/libc/gen/getosreldate.c -L lib/libc/gen/getosreldate.c -u -r1.1.1.1 -r1.2
--- lib/libc/gen/getosreldate.c
+++ lib/libc/gen/getosreldate.c
@@ -10,10 +10,6 @@
  * 2. Redistributions in binary form must reproduce the above copyright
  *    notice, this list of conditions and the following disclaimer in the
  *    documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- *    must display the following acknowledgement:
- *	This product includes software developed by the University of
- *	California, Berkeley and its contributors.
  * 4. Neither the name of the University nor the names of its contributors
  *    may be used to endorse or promote products derived from this software
  *    without specific prior written permission.
@@ -35,10 +31,13 @@
 static char sccsid[] = "@(#)gethostid.c	8.1 (Berkeley) 6/2/93";
 #endif /* LIBC_SCCS and not lint */
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/gen/getosreldate.c,v 1.6 2002/05/28 16:59:39 alfred Exp $");
+__FBSDID("$FreeBSD: src/lib/libc/gen/getosreldate.c,v 1.9 2007/01/09 00:27:54 imp Exp $");
 
 #include <sys/param.h>
 #include <sys/sysctl.h>
+#include <stdlib.h>
+
+#include <osreldate.h>
 
 int
 getosreldate(void)
@@ -47,10 +46,14 @@
 	size_t size;
 	int value;
 
+	char *temp;
+
 	mib[0] = CTL_KERN;
 	mib[1] = KERN_OSRELDATE;
 	size = sizeof value;
 	if (sysctl(mib, 2, &value, &size, NULL, 0) == -1)
 		return (-1);
+	if ((temp = getenv("OSVERSION")))
+		value = atoi(temp);
 	return (value);
 }
Index: utime.3
===================================================================
RCS file: /home/cvs/src/lib/libc/gen/utime.3,v
retrieving revision 1.2
retrieving revision 1.3
diff -L lib/libc/gen/utime.3 -L lib/libc/gen/utime.3 -u -r1.2 -r1.3
--- lib/libc/gen/utime.3
+++ lib/libc/gen/utime.3
@@ -26,7 +26,7 @@
 .\" SUCH DAMAGE.
 .\"
 .\"     @(#)utime.3	8.1 (Berkeley) 6/4/93
-.\" $FreeBSD: src/lib/libc/gen/utime.3,v 1.13 2005/01/20 09:17:02 ru Exp $
+.\" $FreeBSD: src/lib/libc/gen/utime.3,v 1.14 2007/01/09 00:27:56 imp Exp $
 .\"
 .Dd June 4, 1993
 .Dt UTIME 3
Index: fnmatch.c
===================================================================
RCS file: /home/cvs/src/lib/libc/gen/fnmatch.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L lib/libc/gen/fnmatch.c -L lib/libc/gen/fnmatch.c -u -r1.1.1.1 -r1.2
--- lib/libc/gen/fnmatch.c
+++ lib/libc/gen/fnmatch.c
@@ -13,10 +13,6 @@
  * 2. Redistributions in binary form must reproduce the above copyright
  *    notice, this list of conditions and the following disclaimer in the
  *    documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- *    must display the following acknowledgement:
- *	This product includes software developed by the University of
- *	California, Berkeley and its contributors.
  * 4. Neither the name of the University nor the names of its contributors
  *    may be used to endorse or promote products derived from this software
  *    without specific prior written permission.
@@ -38,7 +34,7 @@
 static char sccsid[] = "@(#)fnmatch.c	8.2 (Berkeley) 4/16/94";
 #endif /* LIBC_SCCS and not lint */
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/gen/fnmatch.c,v 1.17 2005/04/08 21:24:23 stefanf Exp $");
+__FBSDID("$FreeBSD: src/lib/libc/gen/fnmatch.c,v 1.18 2007/01/09 00:27:53 imp Exp $");
 
 /*
  * Function fnmatch() as specified in POSIX 1003.2-1992, section B.6.
Index: sethostname.c
===================================================================
RCS file: /home/cvs/src/lib/libc/gen/sethostname.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L lib/libc/gen/sethostname.c -L lib/libc/gen/sethostname.c -u -r1.1.1.1 -r1.2
--- lib/libc/gen/sethostname.c
+++ lib/libc/gen/sethostname.c
@@ -10,10 +10,6 @@
  * 2. Redistributions in binary form must reproduce the above copyright
  *    notice, this list of conditions and the following disclaimer in the
  *    documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- *    must display the following acknowledgement:
- *	This product includes software developed by the University of
- *	California, Berkeley and its contributors.
  * 4. Neither the name of the University nor the names of its contributors
  *    may be used to endorse or promote products derived from this software
  *    without specific prior written permission.
@@ -35,11 +31,13 @@
 static char sccsid[] = "@(#)sethostname.c	8.1 (Berkeley) 6/4/93";
 #endif /* LIBC_SCCS and not lint */
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/gen/sethostname.c,v 1.4 2002/05/28 16:59:39 alfred Exp $");
+__FBSDID("$FreeBSD: src/lib/libc/gen/sethostname.c,v 1.6 2007/01/09 00:27:55 imp Exp $");
 
 #include <sys/param.h>
 #include <sys/sysctl.h>
 
+#include <unistd.h>
+
 int
 sethostname(const char *name, int namelen)
 {
Index: daemon.3
===================================================================
RCS file: /home/cvs/src/lib/libc/gen/daemon.3,v
retrieving revision 1.2
retrieving revision 1.3
diff -L lib/libc/gen/daemon.3 -L lib/libc/gen/daemon.3 -u -r1.2 -r1.3
--- lib/libc/gen/daemon.3
+++ lib/libc/gen/daemon.3
@@ -26,8 +26,7 @@
 .\" SUCH DAMAGE.
 .\"
 .\"	@(#)daemon.3	8.1 (Berkeley) 6/9/93
-.\" $FreeBSD: src/lib/libc/gen/daemon.3,v 1.14 2003/11/10 22:04:51 ghelmer Exp $
-.\" $MidnightBSD$
+.\" $FreeBSD: src/lib/libc/gen/daemon.3,v 1.15 2007/01/09 00:27:53 imp Exp $
 .\"
 .Dd June 9, 1993
 .Dt DAEMON 3
Index: pause.c
===================================================================
RCS file: /home/cvs/src/lib/libc/gen/pause.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L lib/libc/gen/pause.c -L lib/libc/gen/pause.c -u -r1.1.1.1 -r1.2
--- lib/libc/gen/pause.c
+++ lib/libc/gen/pause.c
@@ -10,10 +10,6 @@
  * 2. Redistributions in binary form must reproduce the above copyright
  *    notice, this list of conditions and the following disclaimer in the
  *    documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- *    must display the following acknowledgement:
- *	This product includes software developed by the University of
- *	California, Berkeley and its contributors.
  * 4. Neither the name of the University nor the names of its contributors
  *    may be used to endorse or promote products derived from this software
  *    without specific prior written permission.
@@ -35,7 +31,7 @@
 static char sccsid[] = "@(#)pause.c	8.1 (Berkeley) 6/4/93";
 #endif /* LIBC_SCCS and not lint */
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/gen/pause.c,v 1.6 2002/02/01 00:57:29 obrien Exp $");
+__FBSDID("$FreeBSD: src/lib/libc/gen/pause.c,v 1.7 2007/01/09 00:27:54 imp Exp $");
 
 #include <signal.h>
 #include <unistd.h>
--- /dev/null
+++ lib/libc/gen/__getosreldate.c
@@ -0,0 +1,61 @@
+/*-
+ * Copyright (c) 2007 Peter Wemm
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD: src/lib/libc/gen/__getosreldate.c,v 1.1 2007/07/04 23:27:38 peter Exp $");
+
+#include <sys/param.h>
+#include <sys/sysctl.h>
+
+/*
+ * This is private to libc.  It is intended for wrapping syscall stubs in order
+ * to avoid having to put SIGSYS signal handlers in place to test for presence
+ * of new syscalls.  This caches the result in order to be as quick as possible.
+ *
+ * Use getosreldate(3) for public use as it respects the $OSVERSION environment
+ * variable.
+ */
+
+int
+__getosreldate(void)
+{
+	static int osreldate;
+	size_t len;
+	int oid[2];
+	int error, osrel;
+
+	if (osreldate != 0)
+		return (osreldate);
+	
+	oid[0] = CTL_KERN;
+	oid[1] = KERN_OSRELDATE;
+	osrel = 0;
+	len = sizeof(osrel);
+	error = sysctl(oid, 2, &osrel, &len, NULL, 0);
+	if (error == 0 && osrel > 0 && len == sizeof(osrel))
+		osreldate = osrel;
+	return (osreldate);
+}
Index: getttyent.3
===================================================================
RCS file: /home/cvs/src/lib/libc/gen/getttyent.3,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L lib/libc/gen/getttyent.3 -L lib/libc/gen/getttyent.3 -u -r1.1.1.1 -r1.2
--- lib/libc/gen/getttyent.3
+++ lib/libc/gen/getttyent.3
@@ -9,10 +9,6 @@
 .\" 2. Redistributions in binary form must reproduce the above copyright
 .\"    notice, this list of conditions and the following disclaimer in the
 .\"    documentation and/or other materials provided with the distribution.
-.\" 3. All advertising materials mentioning features or use of this software
-.\"    must display the following acknowledgement:
-.\"	This product includes software developed by the University of
-.\"	California, Berkeley and its contributors.
 .\" 4. Neither the name of the University nor the names of its contributors
 .\"    may be used to endorse or promote products derived from this software
 .\"    without specific prior written permission.
@@ -30,7 +26,7 @@
 .\" SUCH DAMAGE.
 .\"
 .\"     @(#)getttyent.3	8.1 (Berkeley) 6/4/93
-.\" $FreeBSD: src/lib/libc/gen/getttyent.3,v 1.14 2004/07/05 17:12:52 ru Exp $
+.\" $FreeBSD: src/lib/libc/gen/getttyent.3,v 1.15 2007/01/09 00:27:54 imp Exp $
 .\"
 .Dd November 17, 1996
 .Dt GETTTYENT 3
Index: ttyslot.c
===================================================================
RCS file: /home/cvs/src/lib/libc/gen/ttyslot.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -L lib/libc/gen/ttyslot.c -L lib/libc/gen/ttyslot.c -u -r1.2 -r1.3
--- lib/libc/gen/ttyslot.c
+++ lib/libc/gen/ttyslot.c
@@ -31,7 +31,7 @@
 static char sccsid[] = "@(#)ttyslot.c	8.1 (Berkeley) 6/4/93";
 #endif /* LIBC_SCCS and not lint */
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/gen/ttyslot.c,v 1.4 2002/02/01 01:08:48 obrien Exp $");
+__FBSDID("$FreeBSD: src/lib/libc/gen/ttyslot.c,v 1.5 2007/01/09 00:27:56 imp Exp $");
 
 #include <ttyent.h>
 #include <stdio.h>
Index: telldir.c
===================================================================
RCS file: /home/cvs/src/lib/libc/gen/telldir.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -L lib/libc/gen/telldir.c -L lib/libc/gen/telldir.c -u -r1.2 -r1.3
--- lib/libc/gen/telldir.c
+++ lib/libc/gen/telldir.c
@@ -31,7 +31,7 @@
 static char sccsid[] = "@(#)telldir.c	8.1 (Berkeley) 6/4/93";
 #endif /* LIBC_SCCS and not lint */
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/gen/telldir.c,v 1.8 2002/02/01 00:57:29 obrien Exp $");
+__FBSDID("$FreeBSD: src/lib/libc/gen/telldir.c,v 1.9 2007/01/09 00:27:55 imp Exp $");
 
 #include "namespace.h"
 #include <sys/param.h>
Index: ldexp.3
===================================================================
RCS file: /home/cvs/src/lib/libc/gen/ldexp.3,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L lib/libc/gen/ldexp.3 -L lib/libc/gen/ldexp.3 -u -r1.1.1.1 -r1.2
--- lib/libc/gen/ldexp.3
+++ lib/libc/gen/ldexp.3
@@ -13,10 +13,6 @@
 .\" 2. Redistributions in binary form must reproduce the above copyright
 .\"    notice, this list of conditions and the following disclaimer in the
 .\"    documentation and/or other materials provided with the distribution.
-.\" 3. All advertising materials mentioning features or use of this software
-.\"    must display the following acknowledgement:
-.\"	This product includes software developed by the University of
-.\"	California, Berkeley and its contributors.
 .\" 4. Neither the name of the University nor the names of its contributors
 .\"    may be used to endorse or promote products derived from this software
 .\"    without specific prior written permission.
@@ -34,7 +30,7 @@
 .\" SUCH DAMAGE.
 .\"
 .\"     @(#)ldexp.3	8.2 (Berkeley) 4/19/94
-.\" $FreeBSD: src/lib/libc/gen/ldexp.3,v 1.10 2005/03/07 05:00:54 das Exp $
+.\" $FreeBSD: src/lib/libc/gen/ldexp.3,v 1.11 2007/01/09 00:27:54 imp Exp $
 .\"
 .Dd March 4, 2005
 .Dt LDEXP 3
Index: sem_post.3
===================================================================
RCS file: /home/cvs/src/lib/libc/gen/sem_post.3,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L lib/libc/gen/sem_post.3 -L lib/libc/gen/sem_post.3 -u -r1.1.1.1 -r1.2
--- lib/libc/gen/sem_post.3
+++ lib/libc/gen/sem_post.3
@@ -25,7 +25,7 @@
 .\" OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
 .\" EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 .\"
-.\" $FreeBSD: src/lib/libc/gen/sem_post.3,v 1.14.8.1 2005/07/17 19:28:55 rwatson Exp $
+.\" $FreeBSD: src/lib/libc/gen/sem_post.3,v 1.15 2005/07/13 13:15:21 rwatson Exp $
 .\"
 .Dd February 15, 2000
 .Dt SEM_POST 3
Index: sysconf.3
===================================================================
RCS file: /home/cvs/src/lib/libc/gen/sysconf.3,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L lib/libc/gen/sysconf.3 -L lib/libc/gen/sysconf.3 -u -r1.1.1.1 -r1.2
--- lib/libc/gen/sysconf.3
+++ lib/libc/gen/sysconf.3
@@ -9,10 +9,6 @@
 .\" 2. Redistributions in binary form must reproduce the above copyright
 .\"    notice, this list of conditions and the following disclaimer in the
 .\"    documentation and/or other materials provided with the distribution.
-.\" 3. All advertising materials mentioning features or use of this software
-.\"    must display the following acknowledgement:
-.\"	This product includes software developed by the University of
-.\"	California, Berkeley and its contributors.
 .\" 4. Neither the name of the University nor the names of its contributors
 .\"    may be used to endorse or promote products derived from this software
 .\"    without specific prior written permission.
@@ -30,9 +26,9 @@
 .\" SUCH DAMAGE.
 .\"
 .\"	@(#)sysconf.3	8.3 (Berkeley) 4/19/94
-.\" $FreeBSD: src/lib/libc/gen/sysconf.3,v 1.21 2005/01/20 09:17:02 ru Exp $
+.\" $FreeBSD: src/lib/libc/gen/sysconf.3,v 1.25 2007/01/09 00:27:55 imp Exp $
 .\"
-.Dd June 18, 2001
+.Dd December 14, 2006
 .Dt SYSCONF 3
 .Os
 .Sh NAME
@@ -89,6 +85,8 @@
 The number of processors currently online.
 .It Li _SC_OPEN_MAX
 The maximum number of open files per user id.
+.It Li _SC_PAGESIZE
+The size of a system page in bytes.
 .It Li _SC_STREAM_MAX
 The minimum maximum number of streams that a process may have open
 at any one time.
@@ -165,6 +163,19 @@
 Return 1 if the system supports the User Portability Utilities Option,
 otherwise \-1.
 .El
+.Pp
+These values also exist, but may not be standard:
+.Pp
+.Bl -tag -width 6n
+.Pp
+.It Li _SC_PHYS_PAGES
+The number of pages of physical memory.
+Note that it is possible that the product of this value and the value of
+.Li _SC_PAGESIZE
+will overflow a
+.Vt long
+in some configurations on a 32bit machine.
+.El
 .Sh RETURN VALUES
 If the call to
 .Fn sysconf
Index: err.3
===================================================================
RCS file: /home/cvs/src/lib/libc/gen/err.3,v
retrieving revision 1.2
retrieving revision 1.3
diff -L lib/libc/gen/err.3 -L lib/libc/gen/err.3 -u -r1.2 -r1.3
--- lib/libc/gen/err.3
+++ lib/libc/gen/err.3
@@ -26,8 +26,7 @@
 .\" SUCH DAMAGE.
 .\"
 .\"	From: @(#)err.3	8.1 (Berkeley) 6/9/93
-.\" $FreeBSD: src/lib/libc/gen/err.3,v 1.20 2004/10/04 14:04:37 jkoshy Exp $
-.\" $MidnightBSD$
+.\" $FreeBSD: src/lib/libc/gen/err.3,v 1.23 2007/01/09 00:27:53 imp Exp $
 .\"
 .Dd March 6, 1999
 .Dt ERR 3
@@ -95,7 +94,7 @@
 If the
 .Fa fmt
 argument is not NULL, the
-.Xr printf 3
+.Xr printf 3 Ns
 -like formatted error message is output.
 The output is terminated by a newline character.
 .Pp
@@ -111,7 +110,7 @@
 .Fn vwarnc
 functions append an error message obtained from
 .Xr strerror 3
-based on a code or the global variable
+based on a supplied error code value or the global variable
 .Va errno ,
 preceded by another colon and space unless the
 .Fa fmt
Index: fts.3
===================================================================
RCS file: /home/cvs/src/lib/libc/gen/fts.3,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L lib/libc/gen/fts.3 -L lib/libc/gen/fts.3 -u -r1.1.1.1 -r1.2
--- lib/libc/gen/fts.3
+++ lib/libc/gen/fts.3
@@ -9,10 +9,6 @@
 .\" 2. Redistributions in binary form must reproduce the above copyright
 .\"    notice, this list of conditions and the following disclaimer in the
 .\"    documentation and/or other materials provided with the distribution.
-.\" 3. All advertising materials mentioning features or use of this software
-.\"    must display the following acknowledgement:
-.\"	This product includes software developed by the University of
-.\"	California, Berkeley and its contributors.
 .\" 4. Neither the name of the University nor the names of its contributors
 .\"    may be used to endorse or promote products derived from this software
 .\"    without specific prior written permission.
@@ -30,7 +26,7 @@
 .\" SUCH DAMAGE.
 .\"
 .\"     @(#)fts.3	8.5 (Berkeley) 4/16/94
-.\" $FreeBSD: src/lib/libc/gen/fts.3,v 1.22 2005/01/07 07:03:19 pjd Exp $
+.\" $FreeBSD: src/lib/libc/gen/fts.3,v 1.23 2007/01/09 00:27:53 imp Exp $
 .\"
 .Dd January 7, 2005
 .Dt FTS 3
Index: initgroups.c
===================================================================
RCS file: /home/cvs/src/lib/libc/gen/initgroups.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L lib/libc/gen/initgroups.c -L lib/libc/gen/initgroups.c -u -r1.1.1.1 -r1.2
--- lib/libc/gen/initgroups.c
+++ lib/libc/gen/initgroups.c
@@ -10,10 +10,6 @@
  * 2. Redistributions in binary form must reproduce the above copyright
  *    notice, this list of conditions and the following disclaimer in the
  *    documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- *    must display the following acknowledgement:
- *	This product includes software developed by the University of
- *	California, Berkeley and its contributors.
  * 4. Neither the name of the University nor the names of its contributors
  *    may be used to endorse or promote products derived from this software
  *    without specific prior written permission.
@@ -35,7 +31,7 @@
 static char sccsid[] = "@(#)initgroups.c	8.1 (Berkeley) 6/4/93";
 #endif
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/gen/initgroups.c,v 1.8 2003/11/19 15:51:26 dds Exp $");
+__FBSDID("$FreeBSD: src/lib/libc/gen/initgroups.c,v 1.9 2007/01/09 00:27:54 imp Exp $");
 
 #include <sys/param.h>
 
Index: vis.c
===================================================================
RCS file: /home/cvs/src/lib/libc/gen/vis.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -L lib/libc/gen/vis.c -L lib/libc/gen/vis.c -u -r1.2 -r1.3
--- lib/libc/gen/vis.c
+++ lib/libc/gen/vis.c
@@ -31,7 +31,7 @@
 static char sccsid[] = "@(#)vis.c	8.1 (Berkeley) 7/19/93";
 #endif /* LIBC_SCCS and not lint */
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/gen/vis.c,v 1.13 2003/10/30 12:41:50 phk Exp $");
+__FBSDID("$FreeBSD: src/lib/libc/gen/vis.c,v 1.14 2007/01/09 00:27:56 imp Exp $");
 
 #include <sys/types.h>
 #include <limits.h>
Index: times.3
===================================================================
RCS file: /home/cvs/src/lib/libc/gen/times.3,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L lib/libc/gen/times.3 -L lib/libc/gen/times.3 -u -r1.1.1.1 -r1.2
--- lib/libc/gen/times.3
+++ lib/libc/gen/times.3
@@ -9,10 +9,6 @@
 .\" 2. Redistributions in binary form must reproduce the above copyright
 .\"    notice, this list of conditions and the following disclaimer in the
 .\"    documentation and/or other materials provided with the distribution.
-.\" 3. All advertising materials mentioning features or use of this software
-.\"    must display the following acknowledgement:
-.\"	This product includes software developed by the University of
-.\"	California, Berkeley and its contributors.
 .\" 4. Neither the name of the University nor the names of its contributors
 .\"    may be used to endorse or promote products derived from this software
 .\"    without specific prior written permission.
@@ -30,7 +26,7 @@
 .\" SUCH DAMAGE.
 .\"
 .\"     @(#)times.3	8.1 (Berkeley) 6/4/93
-.\" $FreeBSD: src/lib/libc/gen/times.3,v 1.10 2001/10/01 16:08:51 ru Exp $
+.\" $FreeBSD: src/lib/libc/gen/times.3,v 1.11 2007/01/09 00:27:55 imp Exp $
 .\"
 .Dd June 4, 1993
 .Dt TIMES 3
--- /dev/null
+++ lib/libc/gen/fts-compat.c
@@ -0,0 +1,1222 @@
+/*-
+ * Copyright (c) 1990, 1993, 1994
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 4. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $OpenBSD: fts.c,v 1.22 1999/10/03 19:22:22 millert Exp $
+ */
+
+#if 0
+#if defined(LIBC_SCCS) && !defined(lint)
+static char sccsid[] = "@(#)fts.c	8.6 (Berkeley) 8/14/94";
+#endif /* LIBC_SCCS and not lint */
+#endif
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD: src/lib/libc/gen/fts-compat.c,v 1.29 2007/08/23 05:09:31 yar Exp $");
+
+#include "namespace.h"
+#include <sys/param.h>
+#include <sys/mount.h>
+#include <sys/stat.h>
+
+#include <dirent.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <fts.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include "un-namespace.h"
+
+static FTSENT	*fts_alloc(FTS *, char *, int);
+static FTSENT	*fts_build(FTS *, int);
+static void	 fts_lfree(FTSENT *);
+static void	 fts_load(FTS *, FTSENT *);
+static size_t	 fts_maxarglen(char * const *);
+static void	 fts_padjust(FTS *, FTSENT *);
+static int	 fts_palloc(FTS *, size_t);
+static FTSENT	*fts_sort(FTS *, FTSENT *, int);
+static u_short	 fts_stat(FTS *, FTSENT *, int);
+static int	 fts_safe_changedir(FTS *, FTSENT *, int, char *);
+static int	 fts_ufslinks(FTS *, const FTSENT *);
+
+#define	ISDOT(a)	(a[0] == '.' && (!a[1] || (a[1] == '.' && !a[2])))
+
+#define	CLR(opt)	(sp->fts_options &= ~(opt))
+#define	ISSET(opt)	(sp->fts_options & (opt))
+#define	SET(opt)	(sp->fts_options |= (opt))
+
+#define	FCHDIR(sp, fd)	(!ISSET(FTS_NOCHDIR) && fchdir(fd))
+
+/* fts_build flags */
+#define	BCHILD		1		/* fts_children */
+#define	BNAMES		2		/* fts_children, names only */
+#define	BREAD		3		/* fts_read */
+
+/*
+ * Internal representation of an FTS, including extra implementation
+ * details.  The FTS returned from fts_open points to this structure's
+ * ftsp_fts member (and can be cast to an _fts_private as required)
+ */
+struct _fts_private {
+	FTS		ftsp_fts;
+	struct statfs	ftsp_statfs;
+	dev_t		ftsp_dev;
+	int		ftsp_linksreliable;
+};
+
+/*
+ * The "FTS_NOSTAT" option can avoid a lot of calls to stat(2) if it
+ * knows that a directory could not possibly have subdirectories.  This
+ * is decided by looking at the link count: a subdirectory would
+ * increment its parent's link count by virtue of its own ".." entry.
+ * This assumption only holds for UFS-like filesystems that implement
+ * links and directories this way, so we must punt for others.
+ */
+
+static const char *ufslike_filesystems[] = {
+	"ufs",
+	"nfs",
+	"nfs4",
+	"ext2fs",
+	0
+};
+
+FTS *
+fts_open(argv, options, compar)
+	char * const *argv;
+	int options;
+	int (*compar)(const FTSENT * const *, const FTSENT * const *);
+{
+	struct _fts_private *priv;
+	FTS *sp;
+	FTSENT *p, *root;
+	int nitems;
+	FTSENT *parent, *tmp;
+	int len;
+
+	/* Options check. */
+	if (options & ~FTS_OPTIONMASK) {
+		errno = EINVAL;
+		return (NULL);
+	}
+
+	/* Allocate/initialize the stream. */
+	if ((priv = malloc(sizeof(*priv))) == NULL)
+		return (NULL);
+	memset(priv, 0, sizeof(*priv));
+	sp = &priv->ftsp_fts;
+	sp->fts_compar = compar;
+	sp->fts_options = options;
+
+	/* Shush, GCC. */
+	tmp = NULL;
+
+	/* Logical walks turn on NOCHDIR; symbolic links are too hard. */
+	if (ISSET(FTS_LOGICAL))
+		SET(FTS_NOCHDIR);
+
+	/*
+	 * Start out with 1K of path space, and enough, in any case,
+	 * to hold the user's paths.
+	 */
+	if (fts_palloc(sp, MAX(fts_maxarglen(argv), MAXPATHLEN)))
+		goto mem1;
+
+	/* Allocate/initialize root's parent. */
+	if ((parent = fts_alloc(sp, "", 0)) == NULL)
+		goto mem2;
+	parent->fts_level = FTS_ROOTPARENTLEVEL;
+
+	/* Allocate/initialize root(s). */
+	for (root = NULL, nitems = 0; *argv != NULL; ++argv, ++nitems) {
+		/* Don't allow zero-length paths. */
+		if ((len = strlen(*argv)) == 0) {
+			errno = ENOENT;
+			goto mem3;
+		}
+
+		p = fts_alloc(sp, *argv, len);
+		p->fts_level = FTS_ROOTLEVEL;
+		p->fts_parent = parent;
+		p->fts_accpath = p->fts_name;
+		p->fts_info = fts_stat(sp, p, ISSET(FTS_COMFOLLOW));
+
+		/* Command-line "." and ".." are real directories. */
+		if (p->fts_info == FTS_DOT)
+			p->fts_info = FTS_D;
+
+		/*
+		 * If comparison routine supplied, traverse in sorted
+		 * order; otherwise traverse in the order specified.
+		 */
+		if (compar) {
+			p->fts_link = root;
+			root = p;
+		} else {
+			p->fts_link = NULL;
+			if (root == NULL)
+				tmp = root = p;
+			else {
+				tmp->fts_link = p;
+				tmp = p;
+			}
+		}
+	}
+	if (compar && nitems > 1)
+		root = fts_sort(sp, root, nitems);
+
+	/*
+	 * Allocate a dummy pointer and make fts_read think that we've just
+	 * finished the node before the root(s); set p->fts_info to FTS_INIT
+	 * so that everything about the "current" node is ignored.
+	 */
+	if ((sp->fts_cur = fts_alloc(sp, "", 0)) == NULL)
+		goto mem3;
+	sp->fts_cur->fts_link = root;
+	sp->fts_cur->fts_info = FTS_INIT;
+
+	/*
+	 * If using chdir(2), grab a file descriptor pointing to dot to ensure
+	 * that we can get back here; this could be avoided for some paths,
+	 * but almost certainly not worth the effort.  Slashes, symbolic links,
+	 * and ".." are all fairly nasty problems.  Note, if we can't get the
+	 * descriptor we run anyway, just more slowly.
+	 */
+	if (!ISSET(FTS_NOCHDIR) && (sp->fts_rfd = _open(".", O_RDONLY, 0)) < 0)
+		SET(FTS_NOCHDIR);
+
+	return (sp);
+
+mem3:	fts_lfree(root);
+	free(parent);
+mem2:	free(sp->fts_path);
+mem1:	free(sp);
+	return (NULL);
+}
+
+static void
+fts_load(sp, p)
+	FTS *sp;
+	FTSENT *p;
+{
+	int len;
+	char *cp;
+
+	/*
+	 * Load the stream structure for the next traversal.  Since we don't
+	 * actually enter the directory until after the preorder visit, set
+	 * the fts_accpath field specially so the chdir gets done to the right
+	 * place and the user can access the first node.  From fts_open it's
+	 * known that the path will fit.
+	 */
+	len = p->fts_pathlen = p->fts_namelen;
+	memmove(sp->fts_path, p->fts_name, len + 1);
+	if ((cp = strrchr(p->fts_name, '/')) && (cp != p->fts_name || cp[1])) {
+		len = strlen(++cp);
+		memmove(p->fts_name, cp, len + 1);
+		p->fts_namelen = len;
+	}
+	p->fts_accpath = p->fts_path = sp->fts_path;
+	sp->fts_dev = p->fts_dev;
+}
+
+int
+fts_close(sp)
+	FTS *sp;
+{
+	FTSENT *freep, *p;
+	int saved_errno;
+
+	/*
+	 * This still works if we haven't read anything -- the dummy structure
+	 * points to the root list, so we step through to the end of the root
+	 * list which has a valid parent pointer.
+	 */
+	if (sp->fts_cur) {
+		for (p = sp->fts_cur; p->fts_level >= FTS_ROOTLEVEL;) {
+			freep = p;
+			p = p->fts_link != NULL ? p->fts_link : p->fts_parent;
+			free(freep);
+		}
+		free(p);
+	}
+
+	/* Free up child linked list, sort array, path buffer. */
+	if (sp->fts_child)
+		fts_lfree(sp->fts_child);
+	if (sp->fts_array)
+		free(sp->fts_array);
+	free(sp->fts_path);
+
+	/* Return to original directory, save errno if necessary. */
+	if (!ISSET(FTS_NOCHDIR)) {
+		saved_errno = fchdir(sp->fts_rfd) ? errno : 0;
+		(void)_close(sp->fts_rfd);
+
+		/* Set errno and return. */
+		if (saved_errno != 0) {
+			/* Free up the stream pointer. */
+			free(sp);
+			errno = saved_errno;
+			return (-1);
+		}
+	}
+
+	/* Free up the stream pointer. */
+	free(sp);
+	return (0);
+}
+
+/*
+ * Special case of "/" at the end of the path so that slashes aren't
+ * appended which would cause paths to be written as "....//foo".
+ */
+#define	NAPPEND(p)							\
+	(p->fts_path[p->fts_pathlen - 1] == '/'				\
+	    ? p->fts_pathlen - 1 : p->fts_pathlen)
+
+FTSENT *
+fts_read(sp)
+	FTS *sp;
+{
+	FTSENT *p, *tmp;
+	int instr;
+	char *t;
+	int saved_errno;
+
+	/* If finished or unrecoverable error, return NULL. */
+	if (sp->fts_cur == NULL || ISSET(FTS_STOP))
+		return (NULL);
+
+	/* Set current node pointer. */
+	p = sp->fts_cur;
+
+	/* Save and zero out user instructions. */
+	instr = p->fts_instr;
+	p->fts_instr = FTS_NOINSTR;
+
+	/* Any type of file may be re-visited; re-stat and re-turn. */
+	if (instr == FTS_AGAIN) {
+		p->fts_info = fts_stat(sp, p, 0);
+		return (p);
+	}
+
+	/*
+	 * Following a symlink -- SLNONE test allows application to see
+	 * SLNONE and recover.  If indirecting through a symlink, have
+	 * keep a pointer to current location.  If unable to get that
+	 * pointer, follow fails.
+	 */
+	if (instr == FTS_FOLLOW &&
+	    (p->fts_info == FTS_SL || p->fts_info == FTS_SLNONE)) {
+		p->fts_info = fts_stat(sp, p, 1);
+		if (p->fts_info == FTS_D && !ISSET(FTS_NOCHDIR)) {
+			if ((p->fts_symfd = _open(".", O_RDONLY, 0)) < 0) {
+				p->fts_errno = errno;
+				p->fts_info = FTS_ERR;
+			} else
+				p->fts_flags |= FTS_SYMFOLLOW;
+		}
+		return (p);
+	}
+
+	/* Directory in pre-order. */
+	if (p->fts_info == FTS_D) {
+		/* If skipped or crossed mount point, do post-order visit. */
+		if (instr == FTS_SKIP ||
+		    (ISSET(FTS_XDEV) && p->fts_dev != sp->fts_dev)) {
+			if (p->fts_flags & FTS_SYMFOLLOW)
+				(void)_close(p->fts_symfd);
+			if (sp->fts_child) {
+				fts_lfree(sp->fts_child);
+				sp->fts_child = NULL;
+			}
+			p->fts_info = FTS_DP;
+			return (p);
+		}
+
+		/* Rebuild if only read the names and now traversing. */
+		if (sp->fts_child != NULL && ISSET(FTS_NAMEONLY)) {
+			CLR(FTS_NAMEONLY);
+			fts_lfree(sp->fts_child);
+			sp->fts_child = NULL;
+		}
+
+		/*
+		 * Cd to the subdirectory.
+		 *
+		 * If have already read and now fail to chdir, whack the list
+		 * to make the names come out right, and set the parent errno
+		 * so the application will eventually get an error condition.
+		 * Set the FTS_DONTCHDIR flag so that when we logically change
+		 * directories back to the parent we don't do a chdir.
+		 *
+		 * If haven't read do so.  If the read fails, fts_build sets
+		 * FTS_STOP or the fts_info field of the node.
+		 */
+		if (sp->fts_child != NULL) {
+			if (fts_safe_changedir(sp, p, -1, p->fts_accpath)) {
+				p->fts_errno = errno;
+				p->fts_flags |= FTS_DONTCHDIR;
+				for (p = sp->fts_child; p != NULL;
+				    p = p->fts_link)
+					p->fts_accpath =
+					    p->fts_parent->fts_accpath;
+			}
+		} else if ((sp->fts_child = fts_build(sp, BREAD)) == NULL) {
+			if (ISSET(FTS_STOP))
+				return (NULL);
+			return (p);
+		}
+		p = sp->fts_child;
+		sp->fts_child = NULL;
+		goto name;
+	}
+
+	/* Move to the next node on this level. */
+next:	tmp = p;
+	if ((p = p->fts_link) != NULL) {
+		free(tmp);
+
+		/*
+		 * If reached the top, return to the original directory (or
+		 * the root of the tree), and load the paths for the next root.
+		 */
+		if (p->fts_level == FTS_ROOTLEVEL) {
+			if (FCHDIR(sp, sp->fts_rfd)) {
+				SET(FTS_STOP);
+				return (NULL);
+			}
+			fts_load(sp, p);
+			return (sp->fts_cur = p);
+		}
+
+		/*
+		 * User may have called fts_set on the node.  If skipped,
+		 * ignore.  If followed, get a file descriptor so we can
+		 * get back if necessary.
+		 */
+		if (p->fts_instr == FTS_SKIP)
+			goto next;
+		if (p->fts_instr == FTS_FOLLOW) {
+			p->fts_info = fts_stat(sp, p, 1);
+			if (p->fts_info == FTS_D && !ISSET(FTS_NOCHDIR)) {
+				if ((p->fts_symfd =
+				    _open(".", O_RDONLY, 0)) < 0) {
+					p->fts_errno = errno;
+					p->fts_info = FTS_ERR;
+				} else
+					p->fts_flags |= FTS_SYMFOLLOW;
+			}
+			p->fts_instr = FTS_NOINSTR;
+		}
+
+name:		t = sp->fts_path + NAPPEND(p->fts_parent);
+		*t++ = '/';
+		memmove(t, p->fts_name, p->fts_namelen + 1);
+		return (sp->fts_cur = p);
+	}
+
+	/* Move up to the parent node. */
+	p = tmp->fts_parent;
+	free(tmp);
+
+	if (p->fts_level == FTS_ROOTPARENTLEVEL) {
+		/*
+		 * Done; free everything up and set errno to 0 so the user
+		 * can distinguish between error and EOF.
+		 */
+		free(p);
+		errno = 0;
+		return (sp->fts_cur = NULL);
+	}
+
+	/* NUL terminate the pathname. */
+	sp->fts_path[p->fts_pathlen] = '\0';
+
+	/*
+	 * Return to the parent directory.  If at a root node or came through
+	 * a symlink, go back through the file descriptor.  Otherwise, cd up
+	 * one directory.
+	 */
+	if (p->fts_level == FTS_ROOTLEVEL) {
+		if (FCHDIR(sp, sp->fts_rfd)) {
+			SET(FTS_STOP);
+			return (NULL);
+		}
+	} else if (p->fts_flags & FTS_SYMFOLLOW) {
+		if (FCHDIR(sp, p->fts_symfd)) {
+			saved_errno = errno;
+			(void)_close(p->fts_symfd);
+			errno = saved_errno;
+			SET(FTS_STOP);
+			return (NULL);
+		}
+		(void)_close(p->fts_symfd);
+	} else if (!(p->fts_flags & FTS_DONTCHDIR) &&
+	    fts_safe_changedir(sp, p->fts_parent, -1, "..")) {
+		SET(FTS_STOP);
+		return (NULL);
+	}
+	p->fts_info = p->fts_errno ? FTS_ERR : FTS_DP;
+	return (sp->fts_cur = p);
+}
+
+/*
+ * Fts_set takes the stream as an argument although it's not used in this
+ * implementation; it would be necessary if anyone wanted to add global
+ * semantics to fts using fts_set.  An error return is allowed for similar
+ * reasons.
+ */
+/* ARGSUSED */
+int
+fts_set(sp, p, instr)
+	FTS *sp;
+	FTSENT *p;
+	int instr;
+{
+	if (instr != 0 && instr != FTS_AGAIN && instr != FTS_FOLLOW &&
+	    instr != FTS_NOINSTR && instr != FTS_SKIP) {
+		errno = EINVAL;
+		return (1);
+	}
+	p->fts_instr = instr;
+	return (0);
+}
+
+FTSENT *
+fts_children(sp, instr)
+	FTS *sp;
+	int instr;
+{
+	FTSENT *p;
+	int fd;
+
+	if (instr != 0 && instr != FTS_NAMEONLY) {
+		errno = EINVAL;
+		return (NULL);
+	}
+
+	/* Set current node pointer. */
+	p = sp->fts_cur;
+
+	/*
+	 * Errno set to 0 so user can distinguish empty directory from
+	 * an error.
+	 */
+	errno = 0;
+
+	/* Fatal errors stop here. */
+	if (ISSET(FTS_STOP))
+		return (NULL);
+
+	/* Return logical hierarchy of user's arguments. */
+	if (p->fts_info == FTS_INIT)
+		return (p->fts_link);
+
+	/*
+	 * If not a directory being visited in pre-order, stop here.  Could
+	 * allow FTS_DNR, assuming the user has fixed the problem, but the
+	 * same effect is available with FTS_AGAIN.
+	 */
+	if (p->fts_info != FTS_D /* && p->fts_info != FTS_DNR */)
+		return (NULL);
+
+	/* Free up any previous child list. */
+	if (sp->fts_child != NULL)
+		fts_lfree(sp->fts_child);
+
+	if (instr == FTS_NAMEONLY) {
+		SET(FTS_NAMEONLY);
+		instr = BNAMES;
+	} else
+		instr = BCHILD;
+
+	/*
+	 * If using chdir on a relative path and called BEFORE fts_read does
+	 * its chdir to the root of a traversal, we can lose -- we need to
+	 * chdir into the subdirectory, and we don't know where the current
+	 * directory is, so we can't get back so that the upcoming chdir by
+	 * fts_read will work.
+	 */
+	if (p->fts_level != FTS_ROOTLEVEL || p->fts_accpath[0] == '/' ||
+	    ISSET(FTS_NOCHDIR))
+		return (sp->fts_child = fts_build(sp, instr));
+
+	if ((fd = _open(".", O_RDONLY, 0)) < 0)
+		return (NULL);
+	sp->fts_child = fts_build(sp, instr);
+	if (fchdir(fd))
+		return (NULL);
+	(void)_close(fd);
+	return (sp->fts_child);
+}
+
+#ifndef fts_get_clientptr
+#error "fts_get_clientptr not defined"
+#endif
+
+void *
+(fts_get_clientptr)(FTS *sp)
+{
+
+	return (fts_get_clientptr(sp));
+}
+
+#ifndef fts_get_stream
+#error "fts_get_stream not defined"
+#endif
+
+FTS *
+(fts_get_stream)(FTSENT *p)
+{
+	return (fts_get_stream(p));
+}
+
+void
+fts_set_clientptr(FTS *sp, void *clientptr)
+{
+
+	sp->fts_clientptr = clientptr;
+}
+
+/*
+ * This is the tricky part -- do not casually change *anything* in here.  The
+ * idea is to build the linked list of entries that are used by fts_children
+ * and fts_read.  There are lots of special cases.
+ *
+ * The real slowdown in walking the tree is the stat calls.  If FTS_NOSTAT is
+ * set and it's a physical walk (so that symbolic links can't be directories),
+ * we can do things quickly.  First, if it's a 4.4BSD file system, the type
+ * of the file is in the directory entry.  Otherwise, we assume that the number
+ * of subdirectories in a node is equal to the number of links to the parent.
+ * The former skips all stat calls.  The latter skips stat calls in any leaf
+ * directories and for any files after the subdirectories in the directory have
+ * been found, cutting the stat calls by about 2/3.
+ */
+static FTSENT *
+fts_build(sp, type)
+	FTS *sp;
+	int type;
+{
+	struct dirent *dp;
+	FTSENT *p, *head;
+	int nitems;
+	FTSENT *cur, *tail;
+	DIR *dirp;
+	void *oldaddr;
+	size_t dnamlen;
+	int cderrno, descend, len, level, maxlen, nlinks, oflag, saved_errno,
+	    nostat, doadjust;
+	char *cp;
+
+	/* Set current node pointer. */
+	cur = sp->fts_cur;
+
+	/*
+	 * Open the directory for reading.  If this fails, we're done.
+	 * If being called from fts_read, set the fts_info field.
+	 */
+#ifdef FTS_WHITEOUT
+	if (ISSET(FTS_WHITEOUT))
+		oflag = DTF_NODUP | DTF_REWIND;
+	else
+		oflag = DTF_HIDEW | DTF_NODUP | DTF_REWIND;
+#else
+#define __opendir2(path, flag) opendir(path)
+#endif
+	if ((dirp = __opendir2(cur->fts_accpath, oflag)) == NULL) {
+		if (type == BREAD) {
+			cur->fts_info = FTS_DNR;
+			cur->fts_errno = errno;
+		}
+		return (NULL);
+	}
+
+	/*
+	 * Nlinks is the number of possible entries of type directory in the
+	 * directory if we're cheating on stat calls, 0 if we're not doing
+	 * any stat calls at all, -1 if we're doing stats on everything.
+	 */
+	if (type == BNAMES) {
+		nlinks = 0;
+		/* Be quiet about nostat, GCC. */
+		nostat = 0;
+	} else if (ISSET(FTS_NOSTAT) && ISSET(FTS_PHYSICAL)) {
+		if (fts_ufslinks(sp, cur))
+			nlinks = cur->fts_nlink - (ISSET(FTS_SEEDOT) ? 0 : 2);
+		else
+			nlinks = -1;
+		nostat = 1;
+	} else {
+		nlinks = -1;
+		nostat = 0;
+	}
+
+#ifdef notdef
+	(void)printf("nlinks == %d (cur: %d)\n", nlinks, cur->fts_nlink);
+	(void)printf("NOSTAT %d PHYSICAL %d SEEDOT %d\n",
+	    ISSET(FTS_NOSTAT), ISSET(FTS_PHYSICAL), ISSET(FTS_SEEDOT));
+#endif
+	/*
+	 * If we're going to need to stat anything or we want to descend
+	 * and stay in the directory, chdir.  If this fails we keep going,
+	 * but set a flag so we don't chdir after the post-order visit.
+	 * We won't be able to stat anything, but we can still return the
+	 * names themselves.  Note, that since fts_read won't be able to
+	 * chdir into the directory, it will have to return different path
+	 * names than before, i.e. "a/b" instead of "b".  Since the node
+	 * has already been visited in pre-order, have to wait until the
+	 * post-order visit to return the error.  There is a special case
+	 * here, if there was nothing to stat then it's not an error to
+	 * not be able to stat.  This is all fairly nasty.  If a program
+	 * needed sorted entries or stat information, they had better be
+	 * checking FTS_NS on the returned nodes.
+	 */
+	cderrno = 0;
+	if (nlinks || type == BREAD) {
+		if (fts_safe_changedir(sp, cur, dirfd(dirp), NULL)) {
+			if (nlinks && type == BREAD)
+				cur->fts_errno = errno;
+			cur->fts_flags |= FTS_DONTCHDIR;
+			descend = 0;
+			cderrno = errno;
+		} else
+			descend = 1;
+	} else
+		descend = 0;
+
+	/*
+	 * Figure out the max file name length that can be stored in the
+	 * current path -- the inner loop allocates more path as necessary.
+	 * We really wouldn't have to do the maxlen calculations here, we
+	 * could do them in fts_read before returning the path, but it's a
+	 * lot easier here since the length is part of the dirent structure.
+	 *
+	 * If not changing directories set a pointer so that can just append
+	 * each new name into the path.
+	 */
+	len = NAPPEND(cur);
+	if (ISSET(FTS_NOCHDIR)) {
+		cp = sp->fts_path + len;
+		*cp++ = '/';
+	} else {
+		/* GCC, you're too verbose. */
+		cp = NULL;
+	}
+	len++;
+	maxlen = sp->fts_pathlen - len;
+
+	level = cur->fts_level + 1;
+
+	/* Read the directory, attaching each entry to the `link' pointer. */
+	doadjust = 0;
+	for (head = tail = NULL, nitems = 0; dirp && (dp = readdir(dirp));) {
+		dnamlen = dp->d_namlen;
+		if (!ISSET(FTS_SEEDOT) && ISDOT(dp->d_name))
+			continue;
+
+		if ((p = fts_alloc(sp, dp->d_name, (int)dnamlen)) == NULL)
+			goto mem1;
+		if (dnamlen >= maxlen) {	/* include space for NUL */
+			oldaddr = sp->fts_path;
+			if (fts_palloc(sp, dnamlen + len + 1)) {
+				/*
+				 * No more memory for path or structures.  Save
+				 * errno, free up the current structure and the
+				 * structures already allocated.
+				 */
+mem1:				saved_errno = errno;
+				if (p)
+					free(p);
+				fts_lfree(head);
+				(void)closedir(dirp);
+				cur->fts_info = FTS_ERR;
+				SET(FTS_STOP);
+				errno = saved_errno;
+				return (NULL);
+			}
+			/* Did realloc() change the pointer? */
+			if (oldaddr != sp->fts_path) {
+				doadjust = 1;
+				if (ISSET(FTS_NOCHDIR))
+					cp = sp->fts_path + len;
+			}
+			maxlen = sp->fts_pathlen - len;
+		}
+
+		if (len + dnamlen >= USHRT_MAX) {
+			/*
+			 * In an FTSENT, fts_pathlen is a u_short so it is
+			 * possible to wraparound here.  If we do, free up
+			 * the current structure and the structures already
+			 * allocated, then error out with ENAMETOOLONG.
+			 */
+			free(p);
+			fts_lfree(head);
+			(void)closedir(dirp);
+			cur->fts_info = FTS_ERR;
+			SET(FTS_STOP);
+			errno = ENAMETOOLONG;
+			return (NULL);
+		}
+		p->fts_level = level;
+		p->fts_parent = sp->fts_cur;
+		p->fts_pathlen = len + dnamlen;
+
+#ifdef FTS_WHITEOUT
+		if (dp->d_type == DT_WHT)
+			p->fts_flags |= FTS_ISW;
+#endif
+
+		if (cderrno) {
+			if (nlinks) {
+				p->fts_info = FTS_NS;
+				p->fts_errno = cderrno;
+			} else
+				p->fts_info = FTS_NSOK;
+			p->fts_accpath = cur->fts_accpath;
+		} else if (nlinks == 0
+#ifdef DT_DIR
+		    || (nostat &&
+		    dp->d_type != DT_DIR && dp->d_type != DT_UNKNOWN)
+#endif
+		    ) {
+			p->fts_accpath =
+			    ISSET(FTS_NOCHDIR) ? p->fts_path : p->fts_name;
+			p->fts_info = FTS_NSOK;
+		} else {
+			/* Build a file name for fts_stat to stat. */
+			if (ISSET(FTS_NOCHDIR)) {
+				p->fts_accpath = p->fts_path;
+				memmove(cp, p->fts_name, p->fts_namelen + 1);
+			} else
+				p->fts_accpath = p->fts_name;
+			/* Stat it. */
+			p->fts_info = fts_stat(sp, p, 0);
+
+			/* Decrement link count if applicable. */
+			if (nlinks > 0 && (p->fts_info == FTS_D ||
+			    p->fts_info == FTS_DC || p->fts_info == FTS_DOT))
+				--nlinks;
+		}
+
+		/* We walk in directory order so "ls -f" doesn't get upset. */
+		p->fts_link = NULL;
+		if (head == NULL)
+			head = tail = p;
+		else {
+			tail->fts_link = p;
+			tail = p;
+		}
+		++nitems;
+	}
+	if (dirp)
+		(void)closedir(dirp);
+
+	/*
+	 * If realloc() changed the address of the path, adjust the
+	 * addresses for the rest of the tree and the dir list.
+	 */
+	if (doadjust)
+		fts_padjust(sp, head);
+
+	/*
+	 * If not changing directories, reset the path back to original
+	 * state.
+	 */
+	if (ISSET(FTS_NOCHDIR)) {
+		if (len == sp->fts_pathlen || nitems == 0)
+			--cp;
+		*cp = '\0';
+	}
+
+	/*
+	 * If descended after called from fts_children or after called from
+	 * fts_read and nothing found, get back.  At the root level we use
+	 * the saved fd; if one of fts_open()'s arguments is a relative path
+	 * to an empty directory, we wind up here with no other way back.  If
+	 * can't get back, we're done.
+	 */
+	if (descend && (type == BCHILD || !nitems) &&
+	    (cur->fts_level == FTS_ROOTLEVEL ?
+	    FCHDIR(sp, sp->fts_rfd) :
+	    fts_safe_changedir(sp, cur->fts_parent, -1, ".."))) {
+		cur->fts_info = FTS_ERR;
+		SET(FTS_STOP);
+		return (NULL);
+	}
+
+	/* If didn't find anything, return NULL. */
+	if (!nitems) {
+		if (type == BREAD)
+			cur->fts_info = FTS_DP;
+		return (NULL);
+	}
+
+	/* Sort the entries. */
+	if (sp->fts_compar && nitems > 1)
+		head = fts_sort(sp, head, nitems);
+	return (head);
+}
+
+static u_short
+fts_stat(sp, p, follow)
+	FTS *sp;
+	FTSENT *p;
+	int follow;
+{
+	FTSENT *t;
+	dev_t dev;
+	ino_t ino;
+	struct stat *sbp, sb;
+	int saved_errno;
+
+	/* If user needs stat info, stat buffer already allocated. */
+	sbp = ISSET(FTS_NOSTAT) ? &sb : p->fts_statp;
+
+#ifdef FTS_WHITEOUT
+	/* Check for whiteout. */
+	if (p->fts_flags & FTS_ISW) {
+		if (sbp != &sb) {
+			memset(sbp, '\0', sizeof(*sbp));
+			sbp->st_mode = S_IFWHT;
+		}
+		return (FTS_W);
+	}
+#endif
+
+	/*
+	 * If doing a logical walk, or application requested FTS_FOLLOW, do
+	 * a stat(2).  If that fails, check for a non-existent symlink.  If
+	 * fail, set the errno from the stat call.
+	 */
+	if (ISSET(FTS_LOGICAL) || follow) {
+		if (stat(p->fts_accpath, sbp)) {
+			saved_errno = errno;
+			if (!lstat(p->fts_accpath, sbp)) {
+				errno = 0;
+				return (FTS_SLNONE);
+			}
+			p->fts_errno = saved_errno;
+			goto err;
+		}
+	} else if (lstat(p->fts_accpath, sbp)) {
+		p->fts_errno = errno;
+err:		memset(sbp, 0, sizeof(struct stat));
+		return (FTS_NS);
+	}
+
+	if (S_ISDIR(sbp->st_mode)) {
+		/*
+		 * Set the device/inode.  Used to find cycles and check for
+		 * crossing mount points.  Also remember the link count, used
+		 * in fts_build to limit the number of stat calls.  It is
+		 * understood that these fields are only referenced if fts_info
+		 * is set to FTS_D.
+		 */
+		dev = p->fts_dev = sbp->st_dev;
+		ino = p->fts_ino = sbp->st_ino;
+		p->fts_nlink = sbp->st_nlink;
+
+		if (ISDOT(p->fts_name))
+			return (FTS_DOT);
+
+		/*
+		 * Cycle detection is done by brute force when the directory
+		 * is first encountered.  If the tree gets deep enough or the
+		 * number of symbolic links to directories is high enough,
+		 * something faster might be worthwhile.
+		 */
+		for (t = p->fts_parent;
+		    t->fts_level >= FTS_ROOTLEVEL; t = t->fts_parent)
+			if (ino == t->fts_ino && dev == t->fts_dev) {
+				p->fts_cycle = t;
+				return (FTS_DC);
+			}
+		return (FTS_D);
+	}
+	if (S_ISLNK(sbp->st_mode))
+		return (FTS_SL);
+	if (S_ISREG(sbp->st_mode))
+		return (FTS_F);
+	return (FTS_DEFAULT);
+}
+
+/*
+ * The comparison function takes pointers to pointers to FTSENT structures.
+ * Qsort wants a comparison function that takes pointers to void.
+ * (Both with appropriate levels of const-poisoning, of course!)
+ * Use a trampoline function to deal with the difference.
+ */
+static int
+fts_compar(const void *a, const void *b)
+{
+	FTS *parent;
+
+	parent = (*(const FTSENT * const *)a)->fts_fts;
+	return (*parent->fts_compar)(a, b);
+}
+
+static FTSENT *
+fts_sort(sp, head, nitems)
+	FTS *sp;
+	FTSENT *head;
+	int nitems;
+{
+	FTSENT **ap, *p;
+
+	/*
+	 * Construct an array of pointers to the structures and call qsort(3).
+	 * Reassemble the array in the order returned by qsort.  If unable to
+	 * sort for memory reasons, return the directory entries in their
+	 * current order.  Allocate enough space for the current needs plus
+	 * 40 so don't realloc one entry at a time.
+	 */
+	if (nitems > sp->fts_nitems) {
+		sp->fts_nitems = nitems + 40;
+		if ((sp->fts_array = reallocf(sp->fts_array,
+		    sp->fts_nitems * sizeof(FTSENT *))) == NULL) {
+			sp->fts_nitems = 0;
+			return (head);
+		}
+	}
+	for (ap = sp->fts_array, p = head; p; p = p->fts_link)
+		*ap++ = p;
+	qsort(sp->fts_array, nitems, sizeof(FTSENT *), fts_compar);
+	for (head = *(ap = sp->fts_array); --nitems; ++ap)
+		ap[0]->fts_link = ap[1];
+	ap[0]->fts_link = NULL;
+	return (head);
+}
+
+static FTSENT *
+fts_alloc(sp, name, namelen)
+	FTS *sp;
+	char *name;
+	int namelen;
+{
+	FTSENT *p;
+	size_t len;
+
+	struct ftsent_withstat {
+		FTSENT	ent;
+		struct	stat statbuf;
+	};
+
+	/*
+	 * The file name is a variable length array and no stat structure is
+	 * necessary if the user has set the nostat bit.  Allocate the FTSENT
+	 * structure, the file name and the stat structure in one chunk, but
+	 * be careful that the stat structure is reasonably aligned.
+	 */
+	if (ISSET(FTS_NOSTAT))
+		len = sizeof(FTSENT) + namelen + 1;
+	else
+		len = sizeof(struct ftsent_withstat) + namelen + 1;
+
+	if ((p = malloc(len)) == NULL)
+		return (NULL);
+
+	if (ISSET(FTS_NOSTAT)) {
+		p->fts_name = (char *)(p + 1);
+		p->fts_statp = NULL;
+	} else {
+		p->fts_name = (char *)((struct ftsent_withstat *)p + 1);
+		p->fts_statp = &((struct ftsent_withstat *)p)->statbuf;
+	}
+
+	/* Copy the name and guarantee NUL termination. */
+	memcpy(p->fts_name, name, namelen);
+	p->fts_name[namelen] = '\0';
+	p->fts_namelen = namelen;
+	p->fts_path = sp->fts_path;
+	p->fts_errno = 0;
+	p->fts_flags = 0;
+	p->fts_instr = FTS_NOINSTR;
+	p->fts_number = 0;
+	p->fts_pointer = NULL;
+	p->fts_fts = sp;
+	return (p);
+}
+
+static void
+fts_lfree(head)
+	FTSENT *head;
+{
+	FTSENT *p;
+
+	/* Free a linked list of structures. */
+	while ((p = head)) {
+		head = head->fts_link;
+		free(p);
+	}
+}
+
+/*
+ * Allow essentially unlimited paths; find, rm, ls should all work on any tree.
+ * Most systems will allow creation of paths much longer than MAXPATHLEN, even
+ * though the kernel won't resolve them.  Add the size (not just what's needed)
+ * plus 256 bytes so don't realloc the path 2 bytes at a time.
+ */
+static int
+fts_palloc(sp, more)
+	FTS *sp;
+	size_t more;
+{
+
+	sp->fts_pathlen += more + 256;
+	/*
+	 * Check for possible wraparound.  In an FTS, fts_pathlen is
+	 * a signed int but in an FTSENT it is an unsigned short.
+	 * We limit fts_pathlen to USHRT_MAX to be safe in both cases.
+	 */
+	if (sp->fts_pathlen < 0 || sp->fts_pathlen >= USHRT_MAX) {
+		if (sp->fts_path)
+			free(sp->fts_path);
+		sp->fts_path = NULL;
+		errno = ENAMETOOLONG;
+		return (1);
+	}
+	sp->fts_path = reallocf(sp->fts_path, sp->fts_pathlen);
+	return (sp->fts_path == NULL);
+}
+
+/*
+ * When the path is realloc'd, have to fix all of the pointers in structures
+ * already returned.
+ */
+static void
+fts_padjust(sp, head)
+	FTS *sp;
+	FTSENT *head;
+{
+	FTSENT *p;
+	char *addr = sp->fts_path;
+
+#define	ADJUST(p) do {							\
+	if ((p)->fts_accpath != (p)->fts_name) {			\
+		(p)->fts_accpath =					\
+		    (char *)addr + ((p)->fts_accpath - (p)->fts_path);	\
+	}								\
+	(p)->fts_path = addr;						\
+} while (0)
+	/* Adjust the current set of children. */
+	for (p = sp->fts_child; p; p = p->fts_link)
+		ADJUST(p);
+
+	/* Adjust the rest of the tree, including the current level. */
+	for (p = head; p->fts_level >= FTS_ROOTLEVEL;) {
+		ADJUST(p);
+		p = p->fts_link ? p->fts_link : p->fts_parent;
+	}
+}
+
+static size_t
+fts_maxarglen(argv)
+	char * const *argv;
+{
+	size_t len, max;
+
+	for (max = 0; *argv; ++argv)
+		if ((len = strlen(*argv)) > max)
+			max = len;
+	return (max + 1);
+}
+
+/*
+ * Change to dir specified by fd or p->fts_accpath without getting
+ * tricked by someone changing the world out from underneath us.
+ * Assumes p->fts_dev and p->fts_ino are filled in.
+ */
+static int
+fts_safe_changedir(sp, p, fd, path)
+	FTS *sp;
+	FTSENT *p;
+	int fd;
+	char *path;
+{
+	int ret, oerrno, newfd;
+	struct stat sb;
+
+	newfd = fd;
+	if (ISSET(FTS_NOCHDIR))
+		return (0);
+	if (fd < 0 && (newfd = _open(path, O_RDONLY, 0)) < 0)
+		return (-1);
+	if (_fstat(newfd, &sb)) {
+		ret = -1;
+		goto bail;
+	}
+	if (p->fts_dev != sb.st_dev || p->fts_ino != sb.st_ino) {
+		errno = ENOENT;		/* disinformation */
+		ret = -1;
+		goto bail;
+	}
+	ret = fchdir(newfd);
+bail:
+	oerrno = errno;
+	if (fd < 0)
+		(void)_close(newfd);
+	errno = oerrno;
+	return (ret);
+}
+
+/*
+ * Check if the filesystem for "ent" has UFS-style links.
+ */
+static int
+fts_ufslinks(FTS *sp, const FTSENT *ent)
+{
+	struct _fts_private *priv;
+	const char **cpp;
+
+	priv = (struct _fts_private *)sp;
+	/*
+	 * If this node's device is different from the previous, grab
+	 * the filesystem information, and decide on the reliability
+	 * of the link information from this filesystem for stat(2)
+	 * avoidance.
+	 */
+	if (priv->ftsp_dev != ent->fts_dev) {
+		if (statfs(ent->fts_path, &priv->ftsp_statfs) != -1) {
+			priv->ftsp_dev = ent->fts_dev;
+			priv->ftsp_linksreliable = 0;
+			for (cpp = ufslike_filesystems; *cpp; cpp++) {
+				if (strcmp(priv->ftsp_statfs.f_fstypename,
+				    *cpp) == 0) {
+					priv->ftsp_linksreliable = 1;
+					break;
+				}
+			}
+		} else {
+			priv->ftsp_linksreliable = 0;
+		}
+	}
+	return (priv->ftsp_linksreliable);
+}
Index: assert.c
===================================================================
RCS file: /home/cvs/src/lib/libc/gen/assert.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -L lib/libc/gen/assert.c -L lib/libc/gen/assert.c -u -r1.2 -r1.3
--- lib/libc/gen/assert.c
+++ lib/libc/gen/assert.c
@@ -27,17 +27,21 @@
  * SUCH DAMAGE.
  */
 
-/* static char sccsid[] = "@(#)assert.c	8.1 (Berkeley) 6/4/93"; */
+#if defined(LIBC_SCCS) && !defined(lint)
+static char sccsid[] = "@(#)assert.c	8.1 (Berkeley) 6/4/93";
+#endif /* LIBC_SCCS and not lint */
 #include <sys/cdefs.h>
-/*__FBSDID("$FreeBSD: src/lib/libc/gen/assert.c,v 1.7 2002/02/01 00:57:29 obrien Exp $"); */
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: src/lib/libc/gen/assert.c,v 1.8 2007/01/09 00:27:53 imp Exp $");
 
 #include <assert.h>
 #include <stdio.h>
 #include <stdlib.h>
 
 void
-__assert(const char *func, const char *file, int line, const char *failedexpr)
+__assert(func, file, line, failedexpr)
+	const char *func, *file;
+	int line;
+	const char *failedexpr;
 {
 	if (func == NULL)
 		(void)fprintf(stderr,
Index: exec.c
===================================================================
RCS file: /home/cvs/src/lib/libc/gen/exec.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -L lib/libc/gen/exec.c -L lib/libc/gen/exec.c -u -r1.2 -r1.3
--- lib/libc/gen/exec.c
+++ lib/libc/gen/exec.c
@@ -27,10 +27,11 @@
  * SUCH DAMAGE.
  */
 
-/* static char sccsid[] = "@(#)exec.c	8.1 (Berkeley) 6/4/93"; */
+#if defined(LIBC_SCCS) && !defined(lint)
+static char sccsid[] = "@(#)exec.c	8.1 (Berkeley) 6/4/93";
+#endif /* LIBC_SCCS and not lint */
 #include <sys/cdefs.h>
-/*__FBSDID("$FreeBSD: src/lib/libc/gen/exec.c,v 1.22 2003/07/01 12:30:03 bde Exp $");*/
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: src/lib/libc/gen/exec.c,v 1.23 2007/01/09 00:27:53 imp Exp $");
 
 #include "namespace.h"
 #include <sys/param.h>
Index: getloadavg.3
===================================================================
RCS file: /home/cvs/src/lib/libc/gen/getloadavg.3,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L lib/libc/gen/getloadavg.3 -L lib/libc/gen/getloadavg.3 -u -r1.1.1.1 -r1.2
--- lib/libc/gen/getloadavg.3
+++ lib/libc/gen/getloadavg.3
@@ -9,10 +9,6 @@
 .\" 2. Redistributions in binary form must reproduce the above copyright
 .\"    notice, this list of conditions and the following disclaimer in the
 .\"    documentation and/or other materials provided with the distribution.
-.\" 3. All advertising materials mentioning features or use of this software
-.\"    must display the following acknowledgement:
-.\"	This product includes software developed by the University of
-.\"	California, Berkeley and its contributors.
 .\" 4. Neither the name of the University nor the names of its contributors
 .\"    may be used to endorse or promote products derived from this software
 .\"    without specific prior written permission.
@@ -30,7 +26,7 @@
 .\" SUCH DAMAGE.
 .\"
 .\"     @(#)getloadavg.3	8.1 (Berkeley) 6/4/93
-.\" $FreeBSD: src/lib/libc/gen/getloadavg.3,v 1.8 2001/10/01 16:08:51 ru Exp $
+.\" $FreeBSD: src/lib/libc/gen/getloadavg.3,v 1.9 2007/01/09 00:27:54 imp Exp $
 .\"
 .Dd June 4, 1993
 .Dt GETLOADAVG 3
Index: getbsize.c
===================================================================
RCS file: /home/cvs/src/lib/libc/gen/getbsize.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L lib/libc/gen/getbsize.c -L lib/libc/gen/getbsize.c -u -r1.1.1.1 -r1.2
--- lib/libc/gen/getbsize.c
+++ lib/libc/gen/getbsize.c
@@ -10,10 +10,6 @@
  * 2. Redistributions in binary form must reproduce the above copyright
  *    notice, this list of conditions and the following disclaimer in the
  *    documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- *    must display the following acknowledgement:
- *	This product includes software developed by the University of
- *	California, Berkeley and its contributors.
  * 4. Neither the name of the University nor the names of its contributors
  *    may be used to endorse or promote products derived from this software
  *    without specific prior written permission.
@@ -35,7 +31,7 @@
 static char sccsid[] = "@(#)getbsize.c	8.1 (Berkeley) 6/4/93";
 #endif /* LIBC_SCCS and not lint */
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/gen/getbsize.c,v 1.7 2002/12/30 19:04:06 obrien Exp $");
+__FBSDID("$FreeBSD: src/lib/libc/gen/getbsize.c,v 1.8 2007/01/09 00:27:53 imp Exp $");
 
 #include <err.h>
 #include <stdio.h>
Index: getlogin.c
===================================================================
RCS file: /home/cvs/src/lib/libc/gen/getlogin.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L lib/libc/gen/getlogin.c -L lib/libc/gen/getlogin.c -u -r1.1.1.1 -r1.2
--- lib/libc/gen/getlogin.c
+++ lib/libc/gen/getlogin.c
@@ -10,10 +10,6 @@
  * 2. Redistributions in binary form must reproduce the above copyright
  *    notice, this list of conditions and the following disclaimer in the
  *    documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- *    must display the following acknowledgement:
- *	This product includes software developed by the University of
- *	California, Berkeley and its contributors.
  * 4. Neither the name of the University nor the names of its contributors
  *    may be used to endorse or promote products derived from this software
  *    without specific prior written permission.
@@ -35,7 +31,7 @@
 static char sccsid[] = "@(#)getlogin.c	8.1 (Berkeley) 6/4/93";
 #endif /* LIBC_SCCS and not lint */
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/gen/getlogin.c,v 1.9 2003/10/29 10:45:01 tjr Exp $");
+__FBSDID("$FreeBSD: src/lib/libc/gen/getlogin.c,v 1.10 2007/01/09 00:27:54 imp Exp $");
 
 #include <sys/param.h>
 #include <errno.h>
Index: nice.c
===================================================================
RCS file: /home/cvs/src/lib/libc/gen/nice.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L lib/libc/gen/nice.c -L lib/libc/gen/nice.c -u -r1.1.1.1 -r1.2
--- lib/libc/gen/nice.c
+++ lib/libc/gen/nice.c
@@ -10,10 +10,6 @@
  * 2. Redistributions in binary form must reproduce the above copyright
  *    notice, this list of conditions and the following disclaimer in the
  *    documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- *    must display the following acknowledgement:
- *	This product includes software developed by the University of
- *	California, Berkeley and its contributors.
  * 4. Neither the name of the University nor the names of its contributors
  *    may be used to endorse or promote products derived from this software
  *    without specific prior written permission.
@@ -35,7 +31,7 @@
 static char sccsid[] = "@(#)nice.c	8.1 (Berkeley) 6/4/93";
 #endif /* LIBC_SCCS and not lint */
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/gen/nice.c,v 1.3 2002/03/22 21:52:05 obrien Exp $");
+__FBSDID("$FreeBSD: src/lib/libc/gen/nice.c,v 1.4 2007/01/09 00:27:54 imp Exp $");
 
 #include <sys/types.h>
 #include <sys/time.h>
Index: tcsetpgrp.3
===================================================================
RCS file: /home/cvs/src/lib/libc/gen/tcsetpgrp.3,v
retrieving revision 1.2
retrieving revision 1.3
diff -L lib/libc/gen/tcsetpgrp.3 -L lib/libc/gen/tcsetpgrp.3 -u -r1.2 -r1.3
--- lib/libc/gen/tcsetpgrp.3
+++ lib/libc/gen/tcsetpgrp.3
@@ -26,7 +26,7 @@
 .\" SUCH DAMAGE.
 .\"
 .\"	@(#)tcsetpgrp.3	8.1 (Berkeley) 6/4/93
-.\" $FreeBSD: src/lib/libc/gen/tcsetpgrp.3,v 1.9 2001/10/01 16:08:51 ru Exp $
+.\" $FreeBSD: src/lib/libc/gen/tcsetpgrp.3,v 1.10 2007/01/09 00:27:55 imp Exp $
 .\"
 .Dd June 4, 1993
 .Dt TCSETPGRP 3
Index: getcap.c
===================================================================
RCS file: /home/cvs/src/lib/libc/gen/getcap.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L lib/libc/gen/getcap.c -L lib/libc/gen/getcap.c -u -r1.1.1.1 -r1.2
--- lib/libc/gen/getcap.c
+++ lib/libc/gen/getcap.c
@@ -13,10 +13,6 @@
  * 2. Redistributions in binary form must reproduce the above copyright
  *    notice, this list of conditions and the following disclaimer in the
  *    documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- *    must display the following acknowledgement:
- *	This product includes software developed by the University of
- *	California, Berkeley and its contributors.
  * 4. Neither the name of the University nor the names of its contributors
  *    may be used to endorse or promote products derived from this software
  *    without specific prior written permission.
@@ -38,7 +34,7 @@
 static char sccsid[] = "@(#)getcap.c	8.3 (Berkeley) 3/25/94";
 #endif /* LIBC_SCCS and not lint */
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/gen/getcap.c,v 1.19 2003/01/02 10:19:43 thomas Exp $");
+__FBSDID("$FreeBSD: src/lib/libc/gen/getcap.c,v 1.20 2007/01/09 00:27:53 imp Exp $");
 
 #include "namespace.h"
 #include <sys/types.h>
Index: pw_scan.h
===================================================================
RCS file: /home/cvs/src/lib/libc/gen/pw_scan.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L lib/libc/gen/pw_scan.h -L lib/libc/gen/pw_scan.h -u -r1.1.1.1 -r1.2
--- lib/libc/gen/pw_scan.h
+++ lib/libc/gen/pw_scan.h
@@ -10,10 +10,6 @@
  * 2. Redistributions in binary form must reproduce the above copyright
  *    notice, this list of conditions and the following disclaimer in the
  *    documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- *    must display the following acknowledgement:
- *	This product includes software developed by the University of
- *	California, Berkeley and its contributors.
  * 4. Neither the name of the University nor the names of its contributors
  *    may be used to endorse or promote products derived from this software
  *    without specific prior written permission.
@@ -31,7 +27,7 @@
  * SUCH DAMAGE.
  *
  *	@(#)pw_scan.h	8.1 (Berkeley) 4/1/94
- * $FreeBSD: src/lib/libc/gen/pw_scan.h,v 1.6 2002/03/22 23:41:42 obrien Exp $
+ * $FreeBSD: src/lib/libc/gen/pw_scan.h,v 1.7 2007/01/09 00:27:55 imp Exp $
  */
 
 #define _PWSCAN_MASTER 0x01
Index: getpagesize.c
===================================================================
RCS file: /home/cvs/src/lib/libc/gen/getpagesize.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L lib/libc/gen/getpagesize.c -L lib/libc/gen/getpagesize.c -u -r1.1.1.1 -r1.2
--- lib/libc/gen/getpagesize.c
+++ lib/libc/gen/getpagesize.c
@@ -10,10 +10,6 @@
  * 2. Redistributions in binary form must reproduce the above copyright
  *    notice, this list of conditions and the following disclaimer in the
  *    documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- *    must display the following acknowledgement:
- *	This product includes software developed by the University of
- *	California, Berkeley and its contributors.
  * 4. Neither the name of the University nor the names of its contributors
  *    may be used to endorse or promote products derived from this software
  *    without specific prior written permission.
@@ -35,11 +31,13 @@
 static char sccsid[] = "@(#)getpagesize.c	8.1 (Berkeley) 6/4/93";
 #endif /* LIBC_SCCS and not lint */
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/gen/getpagesize.c,v 1.4 2002/02/01 00:57:29 obrien Exp $");
+__FBSDID("$FreeBSD: src/lib/libc/gen/getpagesize.c,v 1.6 2007/01/09 00:27:54 imp Exp $");
 
 #include <sys/param.h>
 #include <sys/sysctl.h>
 
+#include <unistd.h>
+
 /*
  * This is unlikely to change over the running time of any
  * program, so we cache the result to save some syscalls.
Index: uname.3
===================================================================
RCS file: /home/cvs/src/lib/libc/gen/uname.3,v
retrieving revision 1.2
retrieving revision 1.3
diff -L lib/libc/gen/uname.3 -L lib/libc/gen/uname.3 -u -r1.2 -r1.3
--- lib/libc/gen/uname.3
+++ lib/libc/gen/uname.3
@@ -26,9 +26,9 @@
 .\" SUCH DAMAGE.
 .\"
 .\"	@(#)uname.3	8.1 (Berkeley) 1/4/94
-.\" $FreeBSD: src/lib/libc/gen/uname.3,v 1.12 2003/09/08 19:57:14 ru Exp $
+.\" $FreeBSD: src/lib/libc/gen/uname.3,v 1.14 2007/01/09 00:27:56 imp Exp $
 .\"
-.Dd January 4, 1994
+.Dd December 2, 2005
 .Dt UNAME 3
 .Os
 .Sh NAME
@@ -68,6 +68,33 @@
 .El
 .Sh RETURN VALUES
 .Rv -std uname
+.Sh ENVIRONMENT
+.Bl -tag -width ".Ev UNAME_s"
+.It Ev UNAME_s
+If the environment variable
+.Ev UNAME_s
+is set, it will override the
+.Va sysname
+member.
+.It Ev UNAME_r
+If the environment variable
+.Ev UNAME_r
+is set, it will override the
+.Va release
+member.
+.It Ev UNAME_v
+If the environment variable
+.Ev UNAME_v
+is set, it will override the
+.Va version
+member.
+.It Ev UNAME_m
+If the environment variable
+.Ev UNAME_m
+is set, it will override the
+.Va machine
+member.
+.El
 .Sh ERRORS
 The
 .Fn uname
Index: getgrent.3
===================================================================
RCS file: /home/cvs/src/lib/libc/gen/getgrent.3,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L lib/libc/gen/getgrent.3 -L lib/libc/gen/getgrent.3 -u -r1.1.1.1 -r1.2
--- lib/libc/gen/getgrent.3
+++ lib/libc/gen/getgrent.3
@@ -9,10 +9,6 @@
 .\" 2. Redistributions in binary form must reproduce the above copyright
 .\"    notice, this list of conditions and the following disclaimer in the
 .\"    documentation and/or other materials provided with the distribution.
-.\" 3. All advertising materials mentioning features or use of this software
-.\"    must display the following acknowledgement:
-.\"	This product includes software developed by the University of
-.\"	California, Berkeley and its contributors.
 .\" 4. Neither the name of the University nor the names of its contributors
 .\"    may be used to endorse or promote products derived from this software
 .\"    without specific prior written permission.
@@ -30,7 +26,7 @@
 .\" SUCH DAMAGE.
 .\"
 .\"     From: @(#)getgrent.3	8.2 (Berkeley) 4/19/94
-.\" $FreeBSD: src/lib/libc/gen/getgrent.3,v 1.27 2005/02/13 22:25:12 ru Exp $
+.\" $FreeBSD: src/lib/libc/gen/getgrent.3,v 1.28 2007/01/09 00:27:53 imp Exp $
 .\"
 .Dd April 16, 2003
 .Dt GETGRENT 3
Index: sigsetops.3
===================================================================
RCS file: /home/cvs/src/lib/libc/gen/sigsetops.3,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L lib/libc/gen/sigsetops.3 -L lib/libc/gen/sigsetops.3 -u -r1.1.1.1 -r1.2
--- lib/libc/gen/sigsetops.3
+++ lib/libc/gen/sigsetops.3
@@ -9,10 +9,6 @@
 .\" 2. Redistributions in binary form must reproduce the above copyright
 .\"    notice, this list of conditions and the following disclaimer in the
 .\"    documentation and/or other materials provided with the distribution.
-.\" 3. All advertising materials mentioning features or use of this software
-.\"    must display the following acknowledgement:
-.\"	This product includes software developed by the University of
-.\"	California, Berkeley and its contributors.
 .\" 4. Neither the name of the University nor the names of its contributors
 .\"    may be used to endorse or promote products derived from this software
 .\"    without specific prior written permission.
@@ -30,7 +26,7 @@
 .\" SUCH DAMAGE.
 .\"
 .\"     @(#)sigsetops.3	8.1 (Berkeley) 6/4/93
-.\" $FreeBSD: src/lib/libc/gen/sigsetops.3,v 1.9 2004/12/16 20:27:55 maxim Exp $
+.\" $FreeBSD: src/lib/libc/gen/sigsetops.3,v 1.10 2007/01/09 00:27:55 imp Exp $
 .\"
 .Dd December 16, 2004
 .Dt SIGSETOPS 3
Index: tcgetpgrp.3
===================================================================
RCS file: /home/cvs/src/lib/libc/gen/tcgetpgrp.3,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L lib/libc/gen/tcgetpgrp.3 -L lib/libc/gen/tcgetpgrp.3 -u -r1.1.1.1 -r1.2
--- lib/libc/gen/tcgetpgrp.3
+++ lib/libc/gen/tcgetpgrp.3
@@ -9,10 +9,6 @@
 .\" 2. Redistributions in binary form must reproduce the above copyright
 .\"    notice, this list of conditions and the following disclaimer in the
 .\"    documentation and/or other materials provided with the distribution.
-.\" 3. All advertising materials mentioning features or use of this software
-.\"    must display the following acknowledgement:
-.\"	This product includes software developed by the University of
-.\"	California, Berkeley and its contributors.
 .\" 4. Neither the name of the University nor the names of its contributors
 .\"    may be used to endorse or promote products derived from this software
 .\"    without specific prior written permission.
@@ -30,7 +26,7 @@
 .\" SUCH DAMAGE.
 .\"
 .\"	@(#)tcgetpgrp.3	8.1 (Berkeley) 6/4/93
-.\" $FreeBSD: src/lib/libc/gen/tcgetpgrp.3,v 1.8 2001/10/01 16:08:51 ru Exp $
+.\" $FreeBSD: src/lib/libc/gen/tcgetpgrp.3,v 1.9 2007/01/09 00:27:55 imp Exp $
 .\"
 .Dd June 4, 1993
 .Dt TCGETPGRP 3
Index: getosreldate.3
===================================================================
RCS file: /home/cvs/src/lib/libc/gen/getosreldate.3,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L lib/libc/gen/getosreldate.3 -L lib/libc/gen/getosreldate.3 -u -r1.1.1.1 -r1.2
--- lib/libc/gen/getosreldate.3
+++ lib/libc/gen/getosreldate.3
@@ -22,9 +22,9 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.\" $FreeBSD: src/lib/libc/gen/getosreldate.3,v 1.2 2003/02/24 22:55:33 ru Exp $
+.\" $FreeBSD: src/lib/libc/gen/getosreldate.3,v 1.3 2005/12/03 05:11:07 ambrisko Exp $
 .\"
-.Dd January 30, 2003
+.Dd December 2, 2005
 .Dt GETOSRELDATE 3
 .Os
 .Sh NAME
@@ -55,6 +55,15 @@
 otherwise the value \-1 is returned and the global variable
 .Va errno
 is set to indicate the error.
+.Sh ENVIRONMENT
+.Bl -tag -width ".Ev OSVERSION"
+.It Ev OSVERSION
+If the environment variable
+.Ev OSVERSION
+is set, it will override the
+.Fn getosreldate
+return value.
+.El
 .Sh EXAMPLES
 An example can be found in
 .Pa /usr/share/examples/FreeBSD_version .
Index: Makefile.inc
===================================================================
RCS file: /home/cvs/src/lib/libc/gen/Makefile.inc,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L lib/libc/gen/Makefile.inc -L lib/libc/gen/Makefile.inc -u -r1.1.1.1 -r1.2
--- lib/libc/gen/Makefile.inc
+++ lib/libc/gen/Makefile.inc
@@ -1,10 +1,12 @@
 #	@(#)Makefile.inc	8.6 (Berkeley) 5/4/95
-# $FreeBSD: src/lib/libc/gen/Makefile.inc,v 1.121.2.1 2005/12/05 19:59:20 jhb Exp $
+# $FreeBSD: src/lib/libc/gen/Makefile.inc,v 1.128 2007/09/28 02:22:56 scf Exp $
+# $MidnightBSD$
 
 # machine-independent gen sources
 .PATH: ${.CURDIR}/${MACHINE_ARCH}/gen ${.CURDIR}/gen
 
-SRCS+=  __xuname.c _pthread_stubs.c _rand48.c _spinlock_stub.c _thread_init.c \
+SRCS+=  __getosreldate.c __xuname.c \
+	_pthread_stubs.c _rand48.c _spinlock_stub.c _thread_init.c \
 	alarm.c arc4random.c assert.c basename.c check_utility_compat.c \
 	clock.c closedir.c confstr.c \
 	crypt.c ctermid.c daemon.c devname.c dirname.c disklabel.c \
@@ -14,7 +16,7 @@
 	getbootfile.c getbsize.c \
 	getcap.c getcwd.c getdomainname.c getgrent.c getgrouplist.c \
 	gethostname.c getloadavg.c getlogin.c getmntinfo.c getnetgrent.c \
-	getobjformat.c getosreldate.c getpagesize.c \
+	getosreldate.c getpagesize.c \
 	getpeereid.c getprogname.c getpwent.c getttyent.c \
 	getusershell.c getvfsbyname.c glob.c \
 	initgroups.c isatty.c isinf.c isnan.c jrand48.c lcong48.c \
@@ -33,6 +35,8 @@
 	usleep.c utime.c valloc.c vis.c wait.c wait3.c waitpid.c \
 	wordexp.c
 
+SYM_MAPS+=${.CURDIR}/gen/Symbol.map
+
 # machine-dependent gen sources
 .if exists(${.CURDIR}/${MACHINE_ARCH}/gen/Makefile.inc)
 .include "${.CURDIR}/${MACHINE_ARCH}/gen/Makefile.inc"
@@ -47,7 +51,7 @@
 	getbootfile.3 getbsize.3 getcap.3 getcontext.3 getcwd.3 \
 	getdiskbyname.3 getdomainname.3 getfsent.3 \
 	getgrent.3 getgrouplist.3 gethostname.3 getloadavg.3 \
-	getmntinfo.3 getnetgrent.3 getobjformat.3 getosreldate.3 \
+	getmntinfo.3 getnetgrent.3 getosreldate.3 \
 	getpagesize.3 getpass.3 getpeereid.3 getprogname.3 getpwent.3 \
 	getttyent.3 getusershell.3 getvfsbyname.3 \
 	glob.3 initgroups.3 isgreater.3 ldexp.3 lockf.3 makecontext.3 \
@@ -66,6 +70,7 @@
 
 MLINKS+=arc4random.3 arc4random_addrandom.3 arc4random.3 arc4random_stir.3
 MLINKS+=ctermid.3 ctermid_r.3
+MLINKS+=devname.3 devname_r.3
 MLINKS+=directory.3 closedir.3 directory.3 dirfd.3 directory.3 opendir.3 \
 	directory.3 readdir.3 directory.3 readdir_r.3 directory.3 rewinddir.3 \
 	directory.3 seekdir.3 directory.3 telldir.3
@@ -81,7 +86,8 @@
 	fpclassify.3 isnormal.3
 MLINKS+=frexp.3 frexpf.3 frexp.3 frexpl.3
 MLINKS+=fts.3 fts_children.3 fts.3 fts_close.3 fts.3 fts_open.3 \
-	fts.3 fts_read.3 fts.3 fts_set.3
+	fts.3 fts_read.3 fts.3 fts_set.3 fts.3 fts_set_clientptr.3 \
+	fts.3 fts_get_clientptr.3 fts.3 fts_get_stream.3
 MLINKS+=ftw.3 nftw.3
 MLINKS+=getcap.3 cgetcap.3 getcap.3 cgetclose.3 getcap.3 cgetent.3 \
 	getcap.3 cgetfirst.3 getcap.3 cgetmatch.3 getcap.3 cgetnext.3 \
@@ -94,7 +100,8 @@
 	getfsent.3 getfstype.3 getfsent.3 setfsent.3 \
 	getfsent.3 setfstab.3 getfsent.3 getfstab.3
 MLINKS+=getgrent.3 endgrent.3 getgrent.3 getgrgid.3 getgrent.3 getgrnam.3 \
-	getgrent.3 setgrent.3 getgrent.3 setgroupent.3
+	getgrent.3 setgrent.3 getgrent.3 setgroupent.3 \
+	getgrent.3 getgrent_r.3 getgrent.3 getgrnam_r.3 getgrent.3 getgrgid_r.3
 MLINKS+=gethostname.3 sethostname.3
 MLINKS+=getnetgrent.3 endnetgrent.3 getnetgrent.3 innetgr.3 \
 	getnetgrent.3 setnetgrent.3
Index: alarm.3
===================================================================
RCS file: /home/cvs/src/lib/libc/gen/alarm.3,v
retrieving revision 1.2
retrieving revision 1.3
diff -L lib/libc/gen/alarm.3 -L lib/libc/gen/alarm.3 -u -r1.2 -r1.3
--- lib/libc/gen/alarm.3
+++ lib/libc/gen/alarm.3
@@ -26,8 +26,7 @@
 .\" SUCH DAMAGE.
 .\"
 .\"     @(#)alarm.3	8.2 (Berkeley) 4/19/94
-.\" $FreeBSD: src/lib/libc/gen/alarm.3,v 1.16 2002/12/18 13:33:02 ru Exp $
-.\" $MidnightBSD$
+.\" $FreeBSD: src/lib/libc/gen/alarm.3,v 1.17 2007/01/09 00:27:52 imp Exp $
 .\"
 .Dd April 19, 1994
 .Dt ALARM 3
Index: timezone.c
===================================================================
RCS file: /home/cvs/src/lib/libc/gen/timezone.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -L lib/libc/gen/timezone.c -L lib/libc/gen/timezone.c -u -r1.2 -r1.3
--- lib/libc/gen/timezone.c
+++ lib/libc/gen/timezone.c
@@ -31,7 +31,7 @@
 static char sccsid[] = "@(#)timezone.c	8.1 (Berkeley) 6/4/93";
 #endif /* LIBC_SCCS and not lint */
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/gen/timezone.c,v 1.5 2002/02/01 01:08:48 obrien Exp $");
+__FBSDID("$FreeBSD: src/lib/libc/gen/timezone.c,v 1.6 2007/01/09 00:27:55 imp Exp $");
 
 #include <sys/types.h>
 #include <sys/time.h>
--- lib/libc/gen/getobjformat.3
+++ /dev/null
@@ -1,135 +0,0 @@
-.\" Copyright (c) 1998 John D. Polstra
-.\" All rights reserved.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\"    notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\"    notice, this list of conditions and the following disclaimer in the
-.\"    documentation and/or other materials provided with the distribution.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\" $FreeBSD: src/lib/libc/gen/getobjformat.3,v 1.10 2004/07/02 23:52:10 ru Exp $
-.\"
-.Dd September 7, 1998
-.Dt GETOBJFORMAT 3
-.Os
-.Sh NAME
-.Nm getobjformat
-.Nd get preferred object file format
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In objformat.h
-.Ft int
-.Fn getobjformat "char *buf" "size_t bufsize" "int *argcp" "char **argv"
-.Sh DESCRIPTION
-The
-.Fn getobjformat
-function
-queries several sources to determine the preferred object file
-format, and copies its name into a buffer provided by the caller.
-.Pp
-The object file format is determined as follows.
-If
-.Va argv
-is
-.No non- Ns Ev NULL
-and an explicit command line argument such as
-.Fl aout
-or
-.Fl elf
-is present, then that determines the object file format.
-.Pp
-Otherwise, if the variable
-.Ev OBJFORMAT
-is set in the environment, the object file format is taken from its
-value.
-.Pp
-Otherwise, if the file
-.Pa /etc/objformat
-is readable and contains a line of the form
-.Ql OBJFORMAT=xxx ,
-the object file format is taken from there.
-.Pp
-Otherwise, a built-in system default object file format is returned.
-.Pp
-.Va buf
-points to a user-supplied buffer into which the name of the object
-file format is copied.
-.Va bufsize
-gives the size of the buffer in bytes.
-The string placed in
-.Va buf
-is always null-terminated.
-It is an error if the buffer is too
-small to hold the null-terminated name.
-.Pp
-.Va argv
-points to a
-.Dv NULL Ns -terminated
-argument vector to be scanned for object
-format options.
-.Va argv
-may be
-.Dv NULL ,
-in which case the argument vector is not scanned.
-.Pp
-If
-.Va argcp
-is non-NULL, any object format options are deleted from the
-argument vector, and the updated argument count is stored into
-the integer referenced by
-.Va argcp .
-If
-.Va argcp
-is
-.Dv NULL ,
-the argument vector is left unchanged.
-.Sh RETURN VALUES
-On success,
-.Fn getobjformat
-returns the length of the object file format name, not counting the
-null terminator.
-If the supplied buffer is too small to hold the object file format
-and its null terminator,
-.Fn getobjformat
-returns -1.
-In that case, the contents of the buffer and argument
-vector supplied by the caller are indeterminate.
-.Sh ENVIRONMENT
-.Bl -tag -width OBJFORMAT
-.It Ev OBJFORMAT
-If the environment variable
-.Ev OBJFORMAT
-is set, it overrides the default object file format.
-.Ev OBJFORMAT takes precedence over
-.Pa /etc/objformat .
-.El
-.Sh FILES
-.Bl -tag -width /etc/objformat -compact
-.It Pa /etc/objformat
-If present, specifies the object file format to use.
-Syntax is
-.Ql OBJFORMAT=xxx .
-.El
-.Sh SEE ALSO
-.Xr objformat 1
-.Sh HISTORY
-The
-.Fn getobjformat
-function first appeared in
-.Fx 3.0 .
Index: tzset.3
===================================================================
RCS file: /home/cvs/src/lib/libc/gen/tzset.3,v
retrieving revision 1.2
retrieving revision 1.3
diff -L lib/libc/gen/tzset.3 -L lib/libc/gen/tzset.3 -u -r1.2 -r1.3
--- lib/libc/gen/tzset.3
+++ lib/libc/gen/tzset.3
@@ -29,7 +29,7 @@
 .\" SUCH DAMAGE.
 .\"
 .\"	@(#)tzset.3	8.2 (Berkeley) 11/17/93
-.\" $FreeBSD: src/lib/libc/gen/tzset.3,v 1.15 2004/07/03 22:30:08 ru Exp $
+.\" $FreeBSD: src/lib/libc/gen/tzset.3,v 1.16 2007/01/09 00:27:56 imp Exp $
 .\"
 .Dd November 17, 1993
 .Dt TZSET 3


More information about the Midnightbsd-cvs mailing list