Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 5 Jul 2007 00:28:14 GMT
From:      Peter Wemm <peter@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 122893 for review
Message-ID:  <200707050028.l650SECf057764@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=122893

Change 122893 by peter@peter_daintree on 2007/07/05 00:28:03

	IFC @122891 (conflicting with myself)

Affected files ...

.. //depot/projects/hammer/ObsoleteFiles.inc#30 integrate
.. //depot/projects/hammer/UPDATING#104 integrate
.. //depot/projects/hammer/bin/df/df.c#24 integrate
.. //depot/projects/hammer/bin/sh/var.c#13 integrate
.. //depot/projects/hammer/include/stdlib.h#16 integrate
.. //depot/projects/hammer/lib/libc/amd64/SYS.h#9 integrate
.. //depot/projects/hammer/lib/libc/amd64/sys/Makefile.inc#9 integrate
.. //depot/projects/hammer/lib/libc/arm/SYS.h#5 integrate
.. //depot/projects/hammer/lib/libc/arm/sys/Makefile.inc#4 integrate
.. //depot/projects/hammer/lib/libc/gen/Makefile.inc#29 integrate
.. //depot/projects/hammer/lib/libc/i386/SYS.h#6 integrate
.. //depot/projects/hammer/lib/libc/i386/sys/Makefile.inc#9 integrate
.. //depot/projects/hammer/lib/libc/ia64/SYS.h#3 integrate
.. //depot/projects/hammer/lib/libc/ia64/sys/Makefile.inc#4 integrate
.. //depot/projects/hammer/lib/libc/include/libc_private.h#15 integrate
.. //depot/projects/hammer/lib/libc/net/sourcefilter.c#2 integrate
.. //depot/projects/hammer/lib/libc/powerpc/sys/Makefile.inc#4 integrate
.. //depot/projects/hammer/lib/libc/sparc64/SYS.h#4 integrate
.. //depot/projects/hammer/lib/libc/sparc64/sys/Makefile.inc#8 integrate
.. //depot/projects/hammer/lib/libc/stdlib/Makefile.inc#17 integrate
.. //depot/projects/hammer/lib/libc/stdlib/getenv.3#10 integrate
.. //depot/projects/hammer/lib/libc/stdlib/getenv.c#4 integrate
.. //depot/projects/hammer/lib/libc/stdlib/putenv.c#4 delete
.. //depot/projects/hammer/lib/libc/stdlib/setenv.c#4 delete
.. //depot/projects/hammer/lib/libc/sys/Makefile.inc#28 integrate
.. //depot/projects/hammer/lib/libc/sys/ftruncate.c#9 integrate
.. //depot/projects/hammer/lib/libc/sys/lseek.c#9 integrate
.. //depot/projects/hammer/lib/libc/sys/mmap.c#10 integrate
.. //depot/projects/hammer/lib/libc/sys/pread.c#9 integrate
.. //depot/projects/hammer/lib/libc/sys/pwrite.c#9 integrate
.. //depot/projects/hammer/lib/libc/sys/truncate.c#9 integrate
.. //depot/projects/hammer/libexec/pppoed/pppoed.c#5 integrate
.. //depot/projects/hammer/sys/amd64/conf/NOTES#101 integrate
.. //depot/projects/hammer/sys/amd64/linux32/linux32_machdep.c#19 integrate
.. //depot/projects/hammer/sys/compat/freebsd32/freebsd32_misc.c#50 integrate
.. //depot/projects/hammer/sys/compat/freebsd32/freebsd32_proto.h#47 integrate
.. //depot/projects/hammer/sys/compat/freebsd32/freebsd32_syscall.h#44 integrate
.. //depot/projects/hammer/sys/compat/freebsd32/freebsd32_syscalls.c#44 integrate
.. //depot/projects/hammer/sys/compat/freebsd32/freebsd32_sysent.c#44 integrate
.. //depot/projects/hammer/sys/compat/freebsd32/syscalls.master#49 integrate
.. //depot/projects/hammer/sys/compat/linux/linux_file.c#23 integrate
.. //depot/projects/hammer/sys/conf/files#154 integrate
.. //depot/projects/hammer/sys/conf/options#109 integrate
.. //depot/projects/hammer/sys/conf/options.amd64#44 integrate
.. //depot/projects/hammer/sys/conf/options.i386#49 integrate
.. //depot/projects/hammer/sys/conf/options.pc98#45 integrate
.. //depot/projects/hammer/sys/dev/sound/pcm/dsp.c#33 integrate
.. //depot/projects/hammer/sys/i386/conf/NOTES#91 integrate
.. //depot/projects/hammer/sys/i386/linux/linux_machdep.c#26 integrate
.. //depot/projects/hammer/sys/i4b/driver/i4b_ing.c#11 integrate
.. //depot/projects/hammer/sys/i4b/driver/i4b_ipr.c#19 integrate
.. //depot/projects/hammer/sys/i4b/driver/i4b_isppp.c#15 integrate
.. //depot/projects/hammer/sys/kern/init_sysent.c#61 integrate
.. //depot/projects/hammer/sys/kern/kern_conf.c#45 integrate
.. //depot/projects/hammer/sys/kern/makesyscalls.sh#11 integrate
.. //depot/projects/hammer/sys/kern/subr_unit.c#7 integrate
.. //depot/projects/hammer/sys/kern/sys_generic.c#34 integrate
.. //depot/projects/hammer/sys/kern/syscalls.c#59 integrate
.. //depot/projects/hammer/sys/kern/syscalls.master#60 integrate
.. //depot/projects/hammer/sys/kern/systrace_args.c#5 integrate
.. //depot/projects/hammer/sys/kern/vfs_syscalls.c#72 integrate
.. //depot/projects/hammer/sys/netinet6/esp_output.c#8 delete
.. //depot/projects/hammer/sys/pc98/conf/NOTES#60 integrate
.. //depot/projects/hammer/sys/sys/param.h#90 integrate
.. //depot/projects/hammer/sys/sys/syscall.h#58 integrate
.. //depot/projects/hammer/sys/sys/syscall.mk#58 integrate
.. //depot/projects/hammer/sys/sys/sysproto.h#59 integrate
.. //depot/projects/hammer/sys/sys/systm.h#48 integrate
.. //depot/projects/hammer/sys/vm/vm_mmap.c#45 integrate
.. //depot/projects/hammer/tools/regression/environ/Makefile#1 branch
.. //depot/projects/hammer/tools/regression/environ/Makefile.envctl#1 branch
.. //depot/projects/hammer/tools/regression/environ/Makefile.retention#1 branch
.. //depot/projects/hammer/tools/regression/environ/Makefile.timings#1 branch
.. //depot/projects/hammer/tools/regression/environ/envctl.c#1 branch
.. //depot/projects/hammer/tools/regression/environ/envtest.t#1 branch
.. //depot/projects/hammer/tools/regression/environ/retention.c#1 branch
.. //depot/projects/hammer/tools/regression/environ/timings.c#1 branch
.. //depot/projects/hammer/tools/regression/usr.bin/sed/regress.icase1.out#1 branch
.. //depot/projects/hammer/tools/regression/usr.bin/sed/regress.icase2.out#1 branch
.. //depot/projects/hammer/tools/regression/usr.bin/sed/regress.sh#8 integrate
.. //depot/projects/hammer/usr.bin/du/du.c#14 integrate
.. //depot/projects/hammer/usr.bin/env/env.c#6 integrate
.. //depot/projects/hammer/usr.bin/kdump/kdump.c#19 integrate
.. //depot/projects/hammer/usr.bin/limits/limits.c#5 integrate
.. //depot/projects/hammer/usr.bin/login/login.c#12 integrate
.. //depot/projects/hammer/usr.bin/sed/compile.c#7 integrate
.. //depot/projects/hammer/usr.bin/sed/defs.h#4 integrate
.. //depot/projects/hammer/usr.bin/sed/sed.1#15 integrate
.. //depot/projects/hammer/usr.bin/su/su.c#19 integrate
.. //depot/projects/hammer/usr.sbin/i4b/man/Makefile#2 integrate
.. //depot/projects/hammer/usr.sbin/pstat/pstat.c#18 integrate
.. //depot/projects/hammer/usr.sbin/sade/main.c#4 integrate
.. //depot/projects/hammer/usr.sbin/sade/variable.c#4 integrate
.. //depot/projects/hammer/usr.sbin/sysinstall/main.c#9 integrate
.. //depot/projects/hammer/usr.sbin/sysinstall/variable.c#6 integrate

Differences ...

==== //depot/projects/hammer/ObsoleteFiles.inc#30 (text+ko) ====

@@ -1,5 +1,5 @@
 #
-# $FreeBSD: src/ObsoleteFiles.inc,v 1.102 2007/07/03 13:06:45 mlaier Exp $
+# $FreeBSD: src/ObsoleteFiles.inc,v 1.103 2007/07/04 16:21:27 bz Exp $
 #
 # This file lists old files (OLD_FILES), libraries (OLD_LIBS) and
 # directories (OLD_DIRS) which should get removed at an update. Recently
@@ -14,6 +14,12 @@
 # The file is partitioned: OLD_FILES first, then OLD_LIBS and OLD_DIRS last.
 #
 
+# 20070704: I4B 'modules' temporary disconnected
+.if ${TARGET_ARCH} == "i386"
+OLD_FILES+=usr/share/man/man4/i4bing.4.gz
+OLD_FILES+=usr/share/man/man4/i4bipr.4.gz
+OLD_FILES+=usr/share/man/man4/i4bisppp.4.gz
+.endif
 # 20070703: pf 4.1 import
 OLD_FILES+=usr/libexec/ftp-proxy
 # 20070701: KAME IPSec removal

==== //depot/projects/hammer/UPDATING#104 (text+ko) ====

@@ -21,6 +21,11 @@
 	developers choose to disable these features on build machines
 	to maximize performance.
 
+20070704:
+        The new IPsec code is now compiled in using the IPSEC option.  The
+	IPSEC option now requires "device crypto" be defined in your kernel
+	configuration.  The FAST_IPSEC kernel option is now deprecated.
+
 20070702:
 	The packet filter (pf) code has been updated to OpenBSD 4.1 Please
 	note the changed syntax - keep state is now on by default.  Also
@@ -877,4 +882,4 @@
 Contact Warner Losh if you have any questions about your use of
 this document.
 
-$FreeBSD: src/UPDATING,v 1.500 2007/07/03 13:06:44 mlaier Exp $
+$FreeBSD: src/UPDATING,v 1.501 2007/07/04 21:47:23 gnn Exp $

==== //depot/projects/hammer/bin/df/df.c#24 (text+ko) ====

@@ -44,7 +44,7 @@
 #endif /* not lint */
 #endif
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/bin/df/df.c,v 1.70 2007/05/01 16:02:44 ache Exp $");
+__FBSDID("$FreeBSD: src/bin/df/df.c,v 1.71 2007/07/04 00:00:37 scf Exp $");
 
 #include <sys/param.h>
 #include <sys/stat.h>
@@ -131,14 +131,14 @@
 			 */
 			if (kflag)
 				break;
-			putenv("BLOCKSIZE=512");
+			setenv("BLOCKSIZE", "512", 1);
 			hflag = 0;
 			break;
 		case 'c':
 			cflag = 1;
 			break;
 		case 'g':
-			putenv("BLOCKSIZE=1g");
+			setenv("BLOCKSIZE", "1g", 1);
 			hflag = 0;
 			break;
 		case 'H':
@@ -152,7 +152,7 @@
 			break;
 		case 'k':
 			kflag++;
-			putenv("BLOCKSIZE=1024");
+			setenv("BLOCKSIZE", "1024", 1);
 			hflag = 0;
 			break;
 		case 'l':
@@ -162,7 +162,7 @@
 			lflag = 1;
 			break;
 		case 'm':
-			putenv("BLOCKSIZE=1m");
+			setenv("BLOCKSIZE", "1m", 1);
 			hflag = 0;
 			break;
 		case 'n':

==== //depot/projects/hammer/bin/sh/var.c#13 (text+ko) ====

@@ -36,7 +36,7 @@
 #endif
 #endif /* not lint */
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/bin/sh/var.c,v 1.35 2007/05/01 16:02:43 ache Exp $");
+__FBSDID("$FreeBSD: src/bin/sh/var.c,v 1.36 2007/07/04 00:00:38 scf Exp $");
 
 #include <unistd.h>
 #include <stdlib.h>
@@ -289,6 +289,7 @@
 setvareq(char *s, int flags)
 {
 	struct var *vp, **vpp;
+	char *p;
 	int len;
 
 	if (aflag)
@@ -319,7 +320,10 @@
 			if (vp == &vmpath || (vp == &vmail && ! mpathset()))
 				chkmail(1);
 			if ((vp->flags & VEXPORT) && localevar(s)) {
-				putenv(s);
+				p = strchr(s, '=');
+				*p = '\0';
+				(void) setenv(s, p + 1, 1);
+				*p = '=';
 				(void) setlocale(LC_ALL, "");
 			}
 			INTON;
@@ -335,7 +339,10 @@
 	INTOFF;
 	*vpp = vp;
 	if ((vp->flags & VEXPORT) && localevar(s)) {
-		putenv(s);
+		p = strchr(s, '=');
+		*p = '\0';
+		(void) setenv(s, p + 1, 1);
+		*p = '=';
 		(void) setlocale(LC_ALL, "");
 	}
 	INTON;
@@ -596,7 +603,10 @@
 
 						vp->flags |= flag;
 						if ((vp->flags & VEXPORT) && localevar(vp->text)) {
-							putenv(vp->text);
+							p = strchr(vp->text, '=');
+							*p = '\0';
+							(void) setenv(vp->text, p + 1, 1);
+							*p = '=';
 							(void) setlocale(LC_ALL, "");
 						}
 						goto found;

==== //depot/projects/hammer/include/stdlib.h#16 (text+ko) ====

@@ -31,7 +31,7 @@
  * SUCH DAMAGE.
  *
  *	@(#)stdlib.h	8.5 (Berkeley) 5/19/95
- * $FreeBSD: src/include/stdlib.h,v 1.64 2007/05/01 16:02:44 ache Exp $
+ * $FreeBSD: src/include/stdlib.h,v 1.65 2007/07/04 00:00:38 scf Exp $
  */
 
 #ifndef _STDLIB_H_
@@ -161,7 +161,7 @@
 int	 posix_memalign(void **, size_t, size_t); /* (ADV) */
 int	 rand_r(unsigned *);			/* (TSF) */
 int	 setenv(const char *, const char *, int);
-void	 unsetenv(const char *);
+int	 unsetenv(const char *);
 #endif
 
 /*
@@ -197,7 +197,7 @@
 long	 nrand48(unsigned short[3]);
 int	 posix_openpt(int);
 char	*ptsname(int);
-int	 putenv(const char *);
+int	 putenv(char *);
 long	 random(void);
 char	*realpath(const char *, char resolved_path[]);
 unsigned short

==== //depot/projects/hammer/lib/libc/amd64/SYS.h#9 (text+ko) ====

@@ -30,7 +30,7 @@
  * SUCH DAMAGE.
  *
  *	@(#)SYS.h	5.5 (Berkeley) 5/7/91
- * $FreeBSD: src/lib/libc/amd64/SYS.h,v 1.28 2007/01/09 00:27:48 imp Exp $
+ * $FreeBSD: src/lib/libc/amd64/SYS.h,v 1.29 2007/07/04 23:18:38 peter Exp $
  */
 
 #include <sys/syscall.h>

==== //depot/projects/hammer/lib/libc/amd64/sys/Makefile.inc#9 (text+ko) ====

@@ -1,5 +1,5 @@
 #	from: Makefile.inc,v 1.1 1993/09/03 19:04:23 jtc Exp
-# $FreeBSD: src/lib/libc/amd64/sys/Makefile.inc,v 1.29 2003/10/23 06:07:09 peter Exp $
+# $FreeBSD: src/lib/libc/amd64/sys/Makefile.inc,v 1.30 2007/07/04 23:23:00 peter Exp $
 
 SRCS+=	amd64_get_fsbase.c amd64_get_gsbase.c amd64_set_fsbase.c amd64_set_gsbase.c
 

==== //depot/projects/hammer/lib/libc/arm/SYS.h#5 (text+ko) ====

@@ -32,7 +32,7 @@
  * SUCH DAMAGE.
  *
  *	from: @(#)SYS.h	5.5 (Berkeley) 5/7/91
- * $FreeBSD: src/lib/libc/arm/SYS.h,v 1.3 2006/05/23 02:52:14 imp Exp $
+ * $FreeBSD: src/lib/libc/arm/SYS.h,v 1.5 2007/07/04 23:35:18 peter Exp $
  */
 
 #include <machine/asm.h>
@@ -63,8 +63,8 @@
 	ENTRY(__CONCAT(__sys_, x));					\
 	.weak _C_LABEL(__CONCAT(_,x));					\
 	.set _C_LABEL(__CONCAT(_,x)),_C_LABEL(__CONCAT(__sys_,x));	\
-	SYSTRAP(x)
-	bcs PIC_SYM(CERROR, PLT)
+	SYSTRAP(x)							\
+	bcs PIC_SYM(CERROR, PLT)					\
 	RET
 
 #define RSYSCALL(x)							\

==== //depot/projects/hammer/lib/libc/arm/sys/Makefile.inc#4 (text+ko) ====

@@ -1,4 +1,4 @@
-# $FreeBSD: src/lib/libc/arm/sys/Makefile.inc,v 1.2 2004/11/05 23:52:05 cognet Exp $
+# $FreeBSD: src/lib/libc/arm/sys/Makefile.inc,v 1.3 2007/07/04 23:23:00 peter Exp $
 
 MDASM= Ovfork.S brk.S cerror.S pipe.S ptrace.S sbrk.S shmat.S sigreturn.S syscall.S
 

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

@@ -1,5 +1,5 @@
 #	@(#)Makefile.inc	8.6 (Berkeley) 5/4/95
-# $FreeBSD: src/lib/libc/gen/Makefile.inc,v 1.126 2007/01/25 22:25:59 peter Exp $
+# $FreeBSD: src/lib/libc/gen/Makefile.inc,v 1.127 2007/07/04 23:27:38 peter Exp $
 
 # machine-independent gen sources
 .PATH: ${.CURDIR}/${MACHINE_ARCH}/gen ${.CURDIR}/gen

==== //depot/projects/hammer/lib/libc/i386/SYS.h#6 (text+ko) ====

@@ -30,7 +30,7 @@
  * SUCH DAMAGE.
  *
  *	@(#)SYS.h	5.5 (Berkeley) 5/7/91
- * $FreeBSD: src/lib/libc/i386/SYS.h,v 1.25 2007/01/09 00:27:58 imp Exp $
+ * $FreeBSD: src/lib/libc/i386/SYS.h,v 1.26 2007/07/04 23:18:38 peter Exp $
  */
 
 #include <sys/syscall.h>
@@ -43,7 +43,8 @@
 			.weak CNAME(__CONCAT(_,x));			\
 			.set CNAME(__CONCAT(_,x)),CNAME(__CONCAT(__sys_,x)); \
 			mov __CONCAT($SYS_,x),%eax; KERNCALL; jb 2b
-#define RSYSCALL(x)	SYSCALL(x); ret
+
+#define	RSYSCALL(x)	SYSCALL(x); ret
 
 #define	PSEUDO(x)	2: PIC_PROLOGUE; jmp PIC_PLT(HIDENAME(cerror)); \
 			ENTRY(__CONCAT(__sys_,x));			\

==== //depot/projects/hammer/lib/libc/i386/sys/Makefile.inc#9 (text+ko) ====

@@ -1,5 +1,5 @@
 #	from: Makefile.inc,v 1.1 1993/09/03 19:04:23 jtc Exp
-# $FreeBSD: src/lib/libc/i386/sys/Makefile.inc,v 1.31 2005/04/26 20:51:15 peter Exp $
+# $FreeBSD: src/lib/libc/i386/sys/Makefile.inc,v 1.32 2007/07/04 23:23:00 peter Exp $
 
 .if !defined(COMPAT_32BIT)
 SRCS+=	i386_clr_watch.c i386_get_ioperm.c \

==== //depot/projects/hammer/lib/libc/ia64/SYS.h#3 (text+ko) ====

@@ -26,7 +26,7 @@
  * any improvements or extensions that they make and grant Carnegie the
  * rights to redistribute these changes.
  *
- * $FreeBSD: src/lib/libc/ia64/SYS.h,v 1.4 2002/03/22 23:41:46 obrien Exp $
+ * $FreeBSD: src/lib/libc/ia64/SYS.h,v 1.5 2007/07/04 23:18:38 peter Exp $
  */
 
 #include <machine/asm.h>

==== //depot/projects/hammer/lib/libc/ia64/sys/Makefile.inc#4 (text+ko) ====

@@ -1,4 +1,4 @@
-# $FreeBSD: src/lib/libc/ia64/sys/Makefile.inc,v 1.8 2003/08/11 07:14:06 bms Exp $
+# $FreeBSD: src/lib/libc/ia64/sys/Makefile.inc,v 1.9 2007/07/04 23:23:00 peter Exp $
 
 MDASM+=	Ovfork.S brk.S cerror.S exect.S fork.S getcontext.S pipe.S ptrace.S \
 	sbrk.S setlogin.S sigreturn.S swapcontext.S

==== //depot/projects/hammer/lib/libc/include/libc_private.h#15 (text+ko) ====

@@ -26,7 +26,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $FreeBSD: src/lib/libc/include/libc_private.h,v 1.16 2007/01/12 07:31:30 imp Exp $
+ * $FreeBSD: src/lib/libc/include/libc_private.h,v 1.17 2007/07/04 23:27:38 peter Exp $
  *
  * Private definitions for libc, libc_r and libpthread.
  *

==== //depot/projects/hammer/lib/libc/net/sourcefilter.c#2 (text+ko) ====

@@ -28,7 +28,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/net/sourcefilter.c,v 1.2 2007/06/12 19:08:38 bms Exp $");
+__FBSDID("$FreeBSD: src/lib/libc/net/sourcefilter.c,v 1.3 2007/07/04 00:55:50 peter Exp $");
 
 #include "namespace.h"
 
@@ -326,7 +326,7 @@
 	memcpy(&msfr.msfr_group, &psu->ss, psu->ss.ss_len);
 	msfr.msfr_srcs = slist;		/* pointer */
 
-	return (setsockopt(s, level, optname, &msfr, sizeof(msfr)));
+	return (_setsockopt(s, level, optname, &msfr, sizeof(msfr)));
 }
 
 /*
@@ -394,7 +394,7 @@
 	 * of filter entries for the group in msfr.msfr_nsrcs.
 	 */
 	msfr.msfr_srcs = slist;
-	err = getsockopt(s, level, optname, &msfr, &optlen);
+	err = _getsockopt(s, level, optname, &msfr, &optlen);
 	if (err == 0) {
 		*numsrc = msfr.msfr_nsrcs;
 		*fmode = msfr.msfr_fmode;

==== //depot/projects/hammer/lib/libc/powerpc/sys/Makefile.inc#4 (text+ko) ====

@@ -1,4 +1,4 @@
-# $FreeBSD: src/lib/libc/powerpc/sys/Makefile.inc,v 1.2 2003/08/11 07:14:07 bms Exp $
+# $FreeBSD: src/lib/libc/powerpc/sys/Makefile.inc,v 1.3 2007/07/04 23:23:00 peter Exp $
 
 MDASM+=	brk.S cerror.S exect.S pipe.S ptrace.S sbrk.S setlogin.S
 

==== //depot/projects/hammer/lib/libc/sparc64/SYS.h#4 (text+ko) ====

@@ -31,7 +31,7 @@
  *
  *	@(#)SYS.h	5.5 (Berkeley) 5/7/91
  *	from: FreeBSD: src/lib/libc/i386/SYS.h,v 1.20 2001/01/29
- * $FreeBSD: src/lib/libc/sparc64/SYS.h,v 1.5 2007/01/09 00:28:04 imp Exp $
+ * $FreeBSD: src/lib/libc/sparc64/SYS.h,v 1.6 2007/07/04 23:18:38 peter Exp $
  */
 
 #include <sys/syscall.h>

==== //depot/projects/hammer/lib/libc/sparc64/sys/Makefile.inc#8 (text+ko) ====

@@ -1,4 +1,4 @@
-# $FreeBSD: src/lib/libc/sparc64/sys/Makefile.inc,v 1.10 2006/11/03 23:43:18 kmacy Exp $
+# $FreeBSD: src/lib/libc/sparc64/sys/Makefile.inc,v 1.11 2007/07/04 23:23:01 peter Exp $
 
 SRCS+=	__sparc_sigtramp_setup.c \
 	__sparc_utrap.c \

==== //depot/projects/hammer/lib/libc/stdlib/Makefile.inc#17 (text+ko) ====

@@ -1,5 +1,5 @@
 #	from @(#)Makefile.inc	8.3 (Berkeley) 2/4/95
-# $FreeBSD: src/lib/libc/stdlib/Makefile.inc,v 1.53 2006/03/28 22:16:04 jasone Exp $
+# $FreeBSD: src/lib/libc/stdlib/Makefile.inc,v 1.54 2007/07/04 00:00:39 scf Exp $
 
 # machine-independent stdlib sources
 .PATH: ${.CURDIR}/${MACHINE_ARCH}/stdlib ${.CURDIR}/stdlib
@@ -8,10 +8,10 @@
 	bsearch.c div.c exit.c getenv.c getopt.c getopt_long.c \
 	getsubopt.c grantpt.c hcreate.c heapsort.c imaxabs.c imaxdiv.c \
 	insque.c l64a.c labs.c ldiv.c llabs.c lldiv.c lsearch.c malloc.c \
-	merge.c putenv.c qsort.c qsort_r.c radixsort.c rand.c random.c \
-	reallocf.c realpath.c remque.c setenv.c strfmon.c strtoimax.c \
-	strtol.c strtoll.c strtoq.c strtoul.c strtonum.c strtoull.c strtoumax.c \
-	strtouq.c system.c tdelete.c tfind.c tsearch.c twalk.c
+	merge.c qsort.c qsort_r.c radixsort.c rand.c random.c \
+	reallocf.c realpath.c remque.c strfmon.c strtoimax.c \
+	strtol.c strtoll.c strtoq.c strtoul.c strtonum.c strtoull.c \
+        strtoumax.c strtouq.c system.c tdelete.c tfind.c tsearch.c twalk.c
 
 SYM_MAPS+= ${.CURDIR}/stdlib/Symbol.map
 

==== //depot/projects/hammer/lib/libc/stdlib/getenv.3#10 (text+ko) ====

@@ -30,9 +30,9 @@
 .\" SUCH DAMAGE.
 .\"
 .\"     @(#)getenv.3	8.2 (Berkeley) 12/11/93
-.\" $FreeBSD: src/lib/libc/stdlib/getenv.3,v 1.26 2007/05/01 16:02:41 ache Exp $
+.\" $FreeBSD: src/lib/libc/stdlib/getenv.3,v 1.27 2007/07/04 00:00:39 scf Exp $
 .\"
-.Dd October 12, 2006
+.Dd June 20, 2007
 .Dt GETENV 3
 .Os
 .Sh NAME
@@ -50,22 +50,13 @@
 .Ft int
 .Fn setenv "const char *name" "const char *value" "int overwrite"
 .Ft int
-.Fn putenv "const char *string"
-.Ft void
+.Fn putenv "char *string"
+.Ft int
 .Fn unsetenv "const char *name"
 .Sh DESCRIPTION
 These functions set, unset and fetch environment variables from the
 host
 .Em environment list .
-For compatibility with differing environment conventions,
-the given arguments
-.Fa name
-and
-.Fa value
-may be appended and prepended,
-respectively,
-with an equal sign
-.Dq Li \&= .
 .Pp
 The
 .Fn getenv
@@ -97,11 +88,18 @@
 .Pp
 The
 .Fn putenv
-function takes an argument of the form ``name=value'' and is
-equivalent to:
-.Bd -literal -offset indent
-setenv(name, value, 1);
-.Ed
+function takes an argument of the form ``name=value'' and
+puts it directly into the current environment,
+so altering the argument shall change the environment.
+If the variable
+.Fa name
+does not exist in the list,
+it is inserted with the given
+.Fa value .
+If the variable
+.Fa name
+does exist, it is reset to the given
+.Fa value .
 .Pp
 The
 .Fn unsetenv
@@ -121,15 +119,55 @@
 .Dv NULL
 is returned.
 .Pp
-.Rv -std setenv putenv
+.Rv -std setenv putenv unsetenv
 .Sh ERRORS
 .Bl -tag -width Er
+.It Bq Er EINVAL
+The function
+.Fn getenv ,
+.Fn setenv
+or
+.Fn unsetenv
+failed because the
+.Fa name
+is a
+.Dv NULL
+pointer, points to an empty string, or points to a string containing an
+.Dq Li \&=
+character.
+.Pp
+The function
+.Fn putenv
+failed because
+.Fa string
+is a
+.Dv NULL
+pointer,
+.Fa string is without an
+.Dq Li \&=
+character or
+.Dq Li \&=
+is the first character in
+.Fa string .
+This does not follow the
+.Tn POSIX
+specification.
 .It Bq Er ENOMEM
 The function
-.Fn setenv
+.Fn setenv ,
+.Fn unsetenv
 or
 .Fn putenv
 failed because they were unable to allocate memory for the environment.
+.It Bq Er EFAULT
+The functions
+.Fn setenv ,
+.Fn unsetenv
+or
+.Fn putenv
+failed to make a valid copy of the environment due to the environment being
+corrupt (i.e., a name without a value).  A warning will be output to stderr with
+information about the issue.
 .El
 .Sh SEE ALSO
 .Xr csh 1 ,
@@ -141,6 +179,13 @@
 .Fn getenv
 function conforms to
 .St -isoC .
+The
+.Fn setenv ,
+.Fn putenv
+and
+.Fn unsetenv
+functions conforms to
+.St -p1003.1-2001 .
 .Sh HISTORY
 The functions
 .Fn setenv
@@ -152,19 +197,30 @@
 .Fn putenv
 function appeared in
 .Bx 4.3 Reno .
+.Pp
+Until
+.Fx 7.0 ,
+.Fn putenv
+would make a copy of 
+.Fa string
+and insert it into the environment using
+.Fn setenv .
+This was changed to use
+.Fa string
+as the memory location of the ``name=value'' pair to follow the
+.Tn POSIX
+specification.
 .Sh BUGS
 Successive calls to
 .Fn setenv
-or
-.Fn putenv
-assigning a differently sized
+that assign a larger-sized
 .Fa value
-to the same
+than any previous value to the same
 .Fa name
 will result in a memory leak.
 The
 .Fx
-semantics for these functions
+semantics for this function
 (namely, that the contents of
 .Fa value
 are copied and that old values remain accessible indefinitely) make this

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

@@ -1,89 +1,568 @@
-/*
- * Copyright (c) 1987, 1993
- *	The Regents of the University of California.  All rights reserved.
+/*-
+ * Copyright (c) 2007 Sean C. Farley <scf@FreeBSD.org>
+ * 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.
+ *    notice, this list of conditions and the following disclaimer,
+ *    without modification, immediately at the beginning of the file.
  * 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.
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 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/types.h>
+#include <err.h>
+#include <errno.h>
+#include <stdbool.h>
+#include <stddef.h>
+#include <stdlib.h>
+#include <string.h>
+
 
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)getenv.c	8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/stdlib/getenv.c,v 1.8 2007/05/01 16:02:41 ache Exp $");
+__FBSDID("$FreeBSD: src/lib/libc/stdlib/getenv.c,v 1.9 2007/07/04 00:00:39 scf Exp $");
+
 
-#include <stdlib.h>
-#include <stddef.h>
-#include <string.h>
+/*
+ * Standard environ.  environ variable is exposed to entire process.
+ *
+ *	origEnviron:	Upon cleanup on unloading of library or failure, this
+ *			allows environ to return to as it was before.
+ *	environSize:	Number of variables environ can hold.  Can only
+ *			increase.
+ */
+extern char **environ;
+static char **origEnviron;
+static int environSize = 0;
 
-inline char *__findenv(const char *, int *);
+/*
+ * Array of environment variables built from environ.  Each element records:
+ *	name:		Pointer to name=value string
+ *	name length:	Length of name not counting '=' character
+ *	value:		Pointer to value within same string as name
+ *	value size:	Size (not length) of space for value not counting the
+ *			nul character
+ *	active state:	true/false value to signify whether variable is active.
+ *			Useful since multiple variables with the same name can
+ *			co-exist.  At most, one variable can be active at any
+ *			one time.
+ *	putenv:		Created from putenv() call.  This memory must not be
+ *			reused.
+ */
+static struct envVars {
+	size_t nameLen;
+	size_t valueSize;
+	char *name;
+	char *value;
+	bool active;
+	bool putenv;
+} *envVars = NULL;
 
 /*
- * __findenv --
- *	Returns pointer to value associated with name, if any, else NULL.
- *	Sets offset to be the offset of the name/value combination in the
- *	environmental array, for use by setenv(3) and unsetenv(3).
- *	Explicitly removes '=' in argument name.
+ * Environment array information.
  *
- *	This routine *should* be a static; don't use it.
+ *	envActive:	Number of active variables in array.
+ *	envVarsSize:	Size of array.
+ *	envVarsTotal:	Number of total variables in array (active or not).
+ */
+static int envActive = 0;
+static int envVarsSize = 0;
+static int envVarsTotal = 0;
+
+
+/* Deinitialization of new environment. */
+static void __attribute__ ((destructor)) __clean_env(void);
+
+
+/*
+ * Inline strlen() for performance.  Also, perform check for an equals sign.
+ * Cheaper here than peforming a strchr() later.
+ */
+static inline size_t
+__strleneq(const char *str)
+{
+	const char *s;
+
+	for (s = str; *s != '\0'; ++s)
+		if (*s == '=')
+			return (0);
+
+	return (s - str);
+}
+
+
+/*
+ * Comparison of an environment name=value to a name.
+ */
+static inline bool
+strncmpeq(const char *nameValue, const char *name, size_t nameLen)
+{
+	if (strncmp(nameValue, name, nameLen) == 0 && nameValue[nameLen] == '=')
+		return (true);
+
+	return (false);
+}
+
+
+/*
+ * Using environment, returns pointer to value associated with name, if any,
+ * else NULL.  If the onlyActive flag is set to true, only variables that are
+ * active are returned else all are.
+ */
+static inline char *
+__findenv(const char *name, size_t nameLen, int *envNdx, bool onlyActive)
+{
+	int ndx;
+
+	/*
+	 * Find environment variable from end of array (more likely to be
+	 * active).  A variable created by putenv is always active or it is not
+	 * tracked in the array.
+	 */
+	for (ndx = *envNdx; ndx >= 0; ndx--)
+		if (envVars[ndx].putenv) {
+			if (strncmpeq(envVars[ndx].name, name, nameLen)) {
+				*envNdx = ndx;
+				return (envVars[ndx].name + nameLen +
+				    sizeof ("=") - 1);
+			}
+		} else if ((!onlyActive || envVars[ndx].active) &&
+		    (envVars[ndx].nameLen == nameLen &&
+		    strncmpeq(envVars[ndx].name, name, nameLen))) {
+			*envNdx = ndx;
+			return (envVars[ndx].value);
+		}
+
+	return (NULL);
+}
+
+
+/*
+ * Using environ, returns pointer to value associated with name, if any, else
+ * NULL.  Used on the original environ passed into the program.
  */
-inline char *
-__findenv(name, offset)
-	const char *name;
-	int *offset;
+static char *
+__findenv_environ(const char *name, size_t nameLen)
 {
-	extern char **environ;
-	int len, i;
-	const char *np;
-	char **p, *cp;
+	int envNdx;
 
-	if (name == NULL || environ == NULL)
+	/* Check for non-existant environment. */
+	if (environ == NULL)
 		return (NULL);
-	for (np = name; *np && *np != '='; ++np)
-		continue;
-	len = np - name;
-	for (p = environ; (cp = *p) != NULL; ++p) {
-		for (np = name, i = len; i && *cp; i--)
-			if (*cp++ != *np++)
-				break;
-		if (i == 0 && *cp++ == '=') {
-			*offset = p - environ;
-			return (cp);
+
+	/* Find variable within environ. */
+	for (envNdx = 0; environ[envNdx] != NULL; envNdx++)
+		if (strncmpeq(environ[envNdx], name, nameLen))
+			return (&(environ[envNdx][nameLen + sizeof("=") - 1]));
+
+	return (NULL);
+}
+
+
+/*
+ * Using the environment, rebuild the environ array for use by other C library
+ * calls that depend upon it.
+ */
+static int
+__rebuild_environ(int newEnvironSize)
+{
+	char **tmpEnviron;
+	int envNdx;
+	int environNdx;
+	int tmpEnvironSize;
+
+	/* Resize environ. */
+	if (newEnvironSize > environSize) {
+		tmpEnvironSize = newEnvironSize * 2;
+		tmpEnviron = realloc(environ, sizeof (*environ) *
+		    (tmpEnvironSize + 1));
+		if (tmpEnviron == NULL)
+			return (-1);
+		environSize = tmpEnvironSize;
+		environ = tmpEnviron;
+	}
+	envActive = newEnvironSize;
+
+	/* Assign active variables to environ. */
+	for (envNdx = envVarsTotal - 1, environNdx = 0; envNdx >= 0; envNdx--)
+		if (envVars[envNdx].active)
+			environ[environNdx++] = envVars[envNdx].name;
+	environ[environNdx] = NULL;
+
+	return (0);
+}
+
+
+/*
+ * Enlarge new environment.
+ */
+static inline bool
+__enlarge_env(void)
+{
+	int newEnvVarsSize;
+	struct envVars *tmpEnvVars;
+
+	envVarsTotal++;
+	if (envVarsTotal > envVarsSize) {
+		newEnvVarsSize = envVarsTotal * 2;
+		tmpEnvVars = realloc(envVars, sizeof (*envVars) *
+		    newEnvVarsSize);
+		if (tmpEnvVars == NULL) {
+			envVarsTotal--;
+			return (false);
+		}
+		envVarsSize = newEnvVarsSize;
+		envVars = tmpEnvVars;
+	}
+
+	return (true);
+}
+
+
+/*
+ * Using environ, build an environment for use by standard C library calls.
+ */
+static int
+__build_env(void)
+{
+	char **env;
+	int activeNdx;
+	int envNdx;
+	int rtrnVal;
+	int savedErrno;
+	size_t nameLen;
+
+	/* Check for non-existant environment. */
+	if (environ == NULL)
+		return (0);
+	if (environ[0] == NULL)
+		goto SaveEnviron;
+
+	/* Count environment variables. */
+	for (env = environ, envVarsTotal = 0; *env != NULL; env++)
+		envVarsTotal++;
+	envVarsSize = envVarsTotal * 2;
+
+	/* Create new environment. */
+	envVars = calloc(1, sizeof (*envVars) * envVarsSize);
+	if (envVars == NULL)
+		goto Failure;
+
+	/* Copy environ values and keep track of them. */
+	for (envNdx = envVarsTotal - 1; envNdx >= 0; envNdx--) {
+		envVars[envNdx].putenv = false;
+		envVars[envNdx].name =
+		    strdup(environ[envVarsTotal - envNdx - 1]);
+		if (envVars[envNdx].name == NULL)
+			goto Failure;
+		envVars[envNdx].value = strchr(envVars[envNdx].name, '=');
+		if (envVars[envNdx].value != NULL) {
+			envVars[envNdx].value++;
+			envVars[envNdx].valueSize =
+			    strlen(envVars[envNdx].value);
+		} else {
+			warnx("environment corrupt; missing value for %s",
+			    envVars[envNdx].name);
+			errno = EFAULT;

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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200707050028.l650SECf057764>