[Zrouter-src-freebsd] ZRouter.org: push to FreeBSD HEAD tree

zrouter-src-freebsd at zrouter.org zrouter-src-freebsd at zrouter.org
Fri Mar 2 15:38:03 UTC 2012


details:   http://zrouter.org/hg/FreeBSD/head//rev/e7a32ba57044
changeset: 362:e7a32ba57044
user:      ray at terran.dlink.ua
date:      Fri Mar 02 16:56:52 2012 +0200
description:
Update to FreeBSD-HEAD @232391

diffstat:

 head/bin/csh/Makefile   |   8 ++--
 head/bin/csh/config.h   |  83 ++++++++++++++++++++++++++++++++++--------------
 head/bin/csh/config_p.h |   5 +--
 head/bin/sh/eval.c      |  11 +++++-
 head/bin/sh/exec.c      |  22 +++++++-----
 head/bin/sh/jobs.c      |  51 +++++++++++++++++++++++++++++-
 head/bin/sh/jobs.h      |   3 +-
 head/bin/sh/var.c       |   9 +++-
 head/bin/sh/var.h       |   4 +-
 9 files changed, 148 insertions(+), 48 deletions(-)

diffs (497 lines):

diff -r 17241e798bc0 -r e7a32ba57044 head/bin/csh/Makefile
--- a/head/bin/csh/Makefile	Fri Mar 02 16:56:20 2012 +0200
+++ b/head/bin/csh/Makefile	Fri Mar 02 16:56:52 2012 +0200
@@ -1,4 +1,4 @@
-# $FreeBSD$
+# $FreeBSD: head/bin/csh/Makefile 231990 2012-02-22 03:36:15Z mp $
 #	@(#)Makefile	8.1 (Berkeley) 5/31/93
 #
 # C Shell with process control; VM/UNIX VAX Makefile
@@ -18,7 +18,7 @@
 DFLAGS= -D_PATH_TCSHELL='"/bin/${PROG}"'
 .endif
 CFLAGS+= -I. -I${.CURDIR} -I${TCSHDIR} ${DFLAGS}
-WARNS?=	0
+WARNS?=	1
 SRCS=	sh.c sh.dir.c sh.dol.c sh.err.c sh.exec.c sh.char.c \
 	sh.exp.c sh.file.c sh.func.c sh.glob.c sh.hist.c sh.init.c \
 	sh.lex.c sh.misc.c sh.parse.c sh.print.c sh.proc.c sh.sem.c \
@@ -116,10 +116,10 @@
 	${CC} -o gethost ${LDFLAGS} ${CFLAGS:C/-DHAVE_ICONV//} \
 	    ${TCSHDIR}/gethost.c
 
-tc.defs.c: gethost ${.CURDIR}/host.defs
+tc.defs.c: gethost ${TCSHDIR}/host.defs
 	@rm -f ${.TARGET}
 	@echo "/* Do not edit this file, make creates it */" > ${.TARGET}
-	./gethost ${.CURDIR}/host.defs >> ${.TARGET}
+	./gethost ${TCSHDIR}/host.defs >> ${.TARGET}
 
 ed.defns.h: ed.defns.c
 	@rm -f ${.TARGET}
diff -r 17241e798bc0 -r e7a32ba57044 head/bin/csh/config.h
--- a/head/bin/csh/config.h	Fri Mar 02 16:56:20 2012 +0200
+++ b/head/bin/csh/config.h	Fri Mar 02 16:56:52 2012 +0200
@@ -1,5 +1,5 @@
-/* $FreeBSD$ */
-/* config.h.  Generated by configure.  */
+/* $FreeBSD: head/bin/csh/config.h 231990 2012-02-22 03:36:15Z mp $ */
+/* config.h.  Generated from config.h.in by configure.  */
 /* config.h.in.  Generated from configure.in by autoheader.  */
 
 /* Define to the type of elements in the array set by `getgroups'. Usually
@@ -12,9 +12,6 @@
 /* Define to 1 if you have the <auth.h> header file. */
 /* #undef HAVE_AUTH_H */
 
-/* Define to 1 if you have the `catgets' function. */
-#define HAVE_CATGETS 1
-
 /* Define to 1 if you have the <crypt.h> header file. */
 /* #undef HAVE_CRYPT_H */
 
@@ -41,6 +38,9 @@
 /* Define to 1 if you have the `dup2' function. */
 #define HAVE_DUP2 1
 
+/* Define to 1 if you have the <features.h> header file. */
+/* #undef HAVE_FEATURES_H */
+
 /* Define to 1 if you have the `getauthid' function. */
 /* #undef HAVE_GETAUTHID */
 
@@ -54,9 +54,12 @@
 #define HAVE_GETPWENT 1
 
 /* Define to 1 if you have the `getutent' function. */
-#define HAVE_GETUTENT 1
+/* #undef HAVE_GETUTENT */
 
-/* Define if you have the iconv() function. */
+/* Define to 1 if you have the `getutxent' function. */
+#define HAVE_GETUTXENT 1
+
+/* Define if you have the iconv() function and it works. */
 /* #undef HAVE_ICONV */
 
 /* Define to 1 if you have the <inttypes.h> header file. */
@@ -65,6 +68,9 @@
 /* Define to 1 if the system has the type `long long'. */
 #define HAVE_LONG_LONG 1
 
+/* Define to 1 if you have the `mallinfo' function. */
+/* #undef HAVE_MALLINFO */
+
 /* Define to 1 if mbrtowc and mbstate_t are properly declared. */
 #define HAVE_MBRTOWC 1
 
@@ -77,6 +83,9 @@
 /* Define to 1 if you have the `memset' function. */
 #define HAVE_MEMSET 1
 
+/* Define to 1 if you have the `mkstemp' function. */
+#define HAVE_MKSTEMP 1
+
 /* Define to 1 if you have the <ndir.h> header file, and it defines `DIR'. */
 /* #undef HAVE_NDIR_H */
 
@@ -86,6 +95,9 @@
 /* Define to 1 if you have the `nl_langinfo' function. */
 #define HAVE_NL_LANGINFO 1
 
+/* Define to 1 if you have the <paths.h> header file. */
+#define HAVE_PATHS_H 1
+
 /* Define to 1 if you have the `sbrk' function. */
 #define HAVE_SBRK 1
 
@@ -120,22 +132,34 @@
 /* Define to 1 if you have the `strstr' function. */
 #define HAVE_STRSTR 1
 
-/* Define to 1 if `d_ino' is member of `struct dirent'. */
+/* Define to 1 if `d_ino' is a member of `struct dirent'. */
 #define HAVE_STRUCT_DIRENT_D_INO 1
 
-/* Define to 1 if `ss_family' is member of `struct sockaddr_storage'. */
+/* Define to 1 if `ss_family' is a member of `struct sockaddr_storage'. */
 #define HAVE_STRUCT_SOCKADDR_STORAGE_SS_FAMILY 1
 
-/* Define to 1 if `ut_host' is member of `struct utmp'. */
+/* Define to 1 if `ut_host' is a member of `struct utmpx'. */
+#define HAVE_STRUCT_UTMPX_UT_HOST 1
+
+/* Define to 1 if `ut_tv' is a member of `struct utmpx'. */
+#define HAVE_STRUCT_UTMPX_UT_TV 1
+
+/* Define to 1 if `ut_user' is a member of `struct utmpx'. */
+#define HAVE_STRUCT_UTMPX_UT_USER 1
+
+/* Define to 1 if `ut_xtime' is a member of `struct utmpx'. */
+/* #undef HAVE_STRUCT_UTMPX_UT_XTIME */
+
+/* Define to 1 if `ut_host' is a member of `struct utmp'. */
 #define HAVE_STRUCT_UTMP_UT_HOST 1
 
-/* Define to 1 if `ut_tv' is member of `struct utmp'. */
+/* Define to 1 if `ut_tv' is a member of `struct utmp'. */
 #define HAVE_STRUCT_UTMP_UT_TV 1
 
-/* Define to 1 if `ut_user' is member of `struct utmp'. */
+/* Define to 1 if `ut_user' is a member of `struct utmp'. */
 #define HAVE_STRUCT_UTMP_UT_USER 1
 
-/* Define to 1 if `ut_xtime' is member of `struct utmp'. */
+/* Define to 1 if `ut_xtime' is a member of `struct utmp'. */
 /* #undef HAVE_STRUCT_UTMP_UT_XTIME */
 
 /* Define to 1 if you have the `sysconf' function. */
@@ -179,25 +203,31 @@
 /* Support NLS. */
 #define NLS 1
 
+/* Support NLS catalogs. */
+#define NLS_CATALOGS 1
+
 /* Define to the address where bug reports for this package should be sent. */
-#define PACKAGE_BUGREPORT ""
+#define PACKAGE_BUGREPORT "http://bugs.gw.com/"
 
 /* Define to the full name of this package. */
-#define PACKAGE_NAME ""
+#define PACKAGE_NAME "tcsh"
 
 /* Define to the full name and version of this package. */
-#define PACKAGE_STRING ""
+#define PACKAGE_STRING "tcsh 6.18.01"
 
 /* Define to the one symbol short name of this package. */
-#define PACKAGE_TARNAME ""
+#define PACKAGE_TARNAME "tcsh"
+
+/* Define to the home page for this package. */
+#define PACKAGE_URL ""
 
 /* Define to the version of this package. */
-#define PACKAGE_VERSION ""
+#define PACKAGE_VERSION "6.18.01"
 
 /* Define to 1 if the `setpgrp' function takes no argument. */
 /* #undef SETPGRP_VOID */
 
-/* The size of a `wchar_t', as computed by sizeof. */
+/* The size of `wchar_t', as computed by sizeof. */
 #define SIZEOF_WCHAR_T 4
 
 /* Define to 1 if the `S_IS*' macros in <sys/stat.h> do not work properly. */
@@ -206,6 +236,11 @@
 /* Define to 1 if you have the ANSI C header files. */
 #define STDC_HEADERS 1
 
+/* Define for Solaris 2.5.1 so the uint32_t typedef from <sys/synch.h>,
+   <pthread.h>, or <semaphore.h> is not used. If the typedef were allowed, the
+   #define below would cause a syntax error. */
+/* #undef _UINT32_T */
+
 /* Define to empty if `const' does not conform to ANSI C. */
 /* #undef const */
 
@@ -215,7 +250,7 @@
 /* Define to `int' if <sys/types.h> does not define. */
 /* #undef mode_t */
 
-/* Define to `unsigned' if <sys/types.h> does not define. */
+/* Define to `unsigned int' if <sys/types.h> does not define. */
 /* #undef size_t */
 
 /* Define to `int' if neither <sys/types.h> nor <sys/socket.h> define. */
@@ -227,6 +262,10 @@
 /* Define to `int' if <sys/types.h> doesn't define. */
 /* #undef uid_t */
 
+/* Define to the type of an unsigned integer type of width exactly 32 bits if
+   such a type exists and the standard includes do not define it. */
+/* #undef uint32_t */
+
 /* Define to empty if the keyword `volatile' does not work. Warning: valid
    code using `volatile' can become incorrect without. Disable with care. */
 /* #undef volatile */
@@ -234,9 +273,5 @@
 #include "config_p.h"
 #include "config_f.h"
 
-#ifndef NO_NLS_CATALOGS
-#define NLS_CATALOGS
-#endif
-
 /* Work around a vendor issue where config_f.h is #undef'ing this setting */
 #define SYSMALLOC
diff -r 17241e798bc0 -r e7a32ba57044 head/bin/csh/config_p.h
--- a/head/bin/csh/config_p.h	Fri Mar 02 16:56:20 2012 +0200
+++ b/head/bin/csh/config_p.h	Fri Mar 02 16:56:52 2012 +0200
@@ -1,4 +1,4 @@
-/* $FreeBSD$ */
+/* $FreeBSD: head/bin/csh/config_p.h 231990 2012-02-22 03:36:15Z mp $ */
 /*
  * config.h -- configure various defines for tcsh
  *
@@ -106,9 +106,6 @@
 
 #elif defined(__APPLE__)
 # define SYSMALLOC
-
-#else
-# define NLS_CATALOGS
 #endif
 
 #endif /* _h_config */
diff -r 17241e798bc0 -r e7a32ba57044 head/bin/sh/eval.c
--- a/head/bin/sh/eval.c	Fri Mar 02 16:56:20 2012 +0200
+++ b/head/bin/sh/eval.c	Fri Mar 02 16:56:52 2012 +0200
@@ -36,7 +36,7 @@
 #endif
 #endif /* not lint */
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: head/bin/sh/eval.c 230463 2012-01-22 14:00:33Z jilles $");
+__FBSDID("$FreeBSD: head/bin/sh/eval.c 230998 2012-02-04 23:12:14Z jilles $");
 
 #include <paths.h>
 #include <signal.h>
@@ -921,6 +921,15 @@
 			if (pipe(pip) < 0)
 				error("Pipe call failed: %s", strerror(errno));
 		}
+		if (cmdentry.cmdtype == CMDNORMAL &&
+		    cmd->ncmd.redirect == NULL &&
+		    varlist.list == NULL &&
+		    (mode == FORK_FG || mode == FORK_NOJOB) &&
+		    !disvforkset() && !iflag && !mflag) {
+			vforkexecshell(jp, argv, environment(), path,
+			    cmdentry.u.index, flags & EV_BACKCMD ? pip : NULL);
+			goto parent;
+		}
 		if (forkshell(jp, cmd, mode) != 0)
 			goto parent;	/* at end of routine */
 		if (flags & EV_BACKCMD) {
diff -r 17241e798bc0 -r e7a32ba57044 head/bin/sh/exec.c
--- a/head/bin/sh/exec.c	Fri Mar 02 16:56:20 2012 +0200
+++ b/head/bin/sh/exec.c	Fri Mar 02 16:56:52 2012 +0200
@@ -36,7 +36,7 @@
 #endif
 #endif /* not lint */
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: head/bin/sh/exec.c 230530 2012-01-25 08:42:19Z charnier $");
+__FBSDID("$FreeBSD: head/bin/sh/exec.c 231535 2012-02-11 21:06:45Z jilles $");
 
 #include <sys/types.h>
 #include <sys/stat.h>
@@ -231,7 +231,9 @@
 	int verbose;
 	struct cmdentry entry;
 	char *name;
+	int errors;
 
+	errors = 0;
 	verbose = 0;
 	while ((c = nextopt("rv")) != '\0') {
 		if (c == 'r') {
@@ -254,19 +256,21 @@
 		 && cmdp->cmdtype == CMDNORMAL)
 			delete_cmd_entry();
 		find_command(name, &entry, DO_ERR, pathval());
-		if (verbose) {
-			if (entry.cmdtype != CMDUNKNOWN) {	/* if no error msg */
-				cmdp = cmdlookup(name, 0);
-				if (cmdp != NULL)
-					printentry(cmdp, verbose);
-				else
-					outfmt(out2, "%s: not found\n", name);
+		if (entry.cmdtype == CMDUNKNOWN)
+			errors = 1;
+		else if (verbose) {
+			cmdp = cmdlookup(name, 0);
+			if (cmdp != NULL)
+				printentry(cmdp, verbose);
+			else {
+				outfmt(out2, "%s: not found\n", name);
+				errors = 1;
 			}
 			flushall();
 		}
 		argptr++;
 	}
-	return 0;
+	return errors;
 }
 
 
diff -r 17241e798bc0 -r e7a32ba57044 head/bin/sh/jobs.c
--- a/head/bin/sh/jobs.c	Fri Mar 02 16:56:20 2012 +0200
+++ b/head/bin/sh/jobs.c	Fri Mar 02 16:56:52 2012 +0200
@@ -36,7 +36,7 @@
 #endif
 #endif /* not lint */
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: head/bin/sh/jobs.c 230530 2012-01-25 08:42:19Z charnier $");
+__FBSDID("$FreeBSD: head/bin/sh/jobs.c 230998 2012-02-04 23:12:14Z jilles $");
 
 #include <sys/ioctl.h>
 #include <sys/param.h>
@@ -57,6 +57,7 @@
 #undef CEOF			/* syntax.h redefines this */
 #endif
 #include "redir.h"
+#include "exec.h"
 #include "show.h"
 #include "main.h"
 #include "parser.h"
@@ -885,6 +886,54 @@
 }
 
 
+pid_t
+vforkexecshell(struct job *jp, char **argv, char **envp, const char *path, int idx, int pip[2])
+{
+	pid_t pid;
+	struct jmploc jmploc;
+	struct jmploc *savehandler;
+
+	TRACE(("vforkexecshell(%%%td, %p, %d) called\n", jp - jobtab, (void *)n,
+	    mode));
+	INTOFF;
+	flushall();
+	savehandler = handler;
+	pid = vfork();
+	if (pid == -1) {
+		TRACE(("Vfork failed, errno=%d\n", errno));
+		INTON;
+		error("Cannot fork: %s", strerror(errno));
+	}
+	if (pid == 0) {
+		TRACE(("Child shell %d\n", (int)getpid()));
+		if (setjmp(jmploc.loc))
+			_exit(exception == EXEXEC ? exerrno : 2);
+		if (pip != NULL) {
+			close(pip[0]);
+			if (pip[1] != 1) {
+				dup2(pip[1], 1);
+				close(pip[1]);
+			}
+		}
+		handler = &jmploc;
+		shellexec(argv, envp, path, idx);
+	}
+	handler = savehandler;
+	if (jp) {
+		struct procstat *ps = &jp->ps[jp->nprocs++];
+		ps->pid = pid;
+		ps->status = -1;
+		ps->cmd = nullstr;
+		jp->foreground = 1;
+#if JOBS
+		setcurjob(jp);
+#endif
+	}
+	INTON;
+	TRACE(("In parent shell:  child = %d\n", (int)pid));
+	return pid;
+}
+
 
 /*
  * Wait for job to finish.
diff -r 17241e798bc0 -r e7a32ba57044 head/bin/sh/jobs.h
--- a/head/bin/sh/jobs.h	Fri Mar 02 16:56:20 2012 +0200
+++ b/head/bin/sh/jobs.h	Fri Mar 02 16:56:52 2012 +0200
@@ -30,7 +30,7 @@
  * SUCH DAMAGE.
  *
  *	@(#)jobs.h	8.2 (Berkeley) 5/4/95
- * $FreeBSD: head/bin/sh/jobs.h 223060 2011-06-13 21:03:27Z jilles $
+ * $FreeBSD: head/bin/sh/jobs.h 230998 2012-02-04 23:12:14Z jilles $
  */
 
 /* Mode argument to forkshell.  Don't change FORK_FG or FORK_BG. */
@@ -91,6 +91,7 @@
 void showjobs(int, int);
 struct job *makejob(union node *, int);
 pid_t forkshell(struct job *, union node *, int);
+pid_t vforkexecshell(struct job *, char **, char **, const char *, int, int []);
 int waitforjob(struct job *, int *);
 int stoppedjobs(void);
 int backgndpidset(void);
diff -r 17241e798bc0 -r e7a32ba57044 head/bin/sh/var.c
--- a/head/bin/sh/var.c	Fri Mar 02 16:56:20 2012 +0200
+++ b/head/bin/sh/var.c	Fri Mar 02 16:56:52 2012 +0200
@@ -36,7 +36,7 @@
 #endif
 #endif /* not lint */
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: head/bin/sh/var.c 223183 2011-06-17 10:21:24Z jilles $");
+__FBSDID("$FreeBSD: head/bin/sh/var.c 231001 2012-02-04 23:29:07Z jilles $");
 
 #include <unistd.h>
 #include <stdlib.h>
@@ -94,6 +94,7 @@
 struct var vps4;
 struct var vvers;
 static struct var voptind;
+struct var vdisvfork;
 
 int forcelocal;
 
@@ -125,6 +126,8 @@
 #endif
 	{ &voptind,	0,				"OPTIND=1",
 	  getoptsreset },
+	{ &vdisvfork,	VUNSET,				"SH_DISABLE_VFORK=",
+	  NULL },
 	{ NULL,	0,				NULL,
 	  NULL }
 };
@@ -600,7 +603,7 @@
 		}
 	}
 
-	INTON;
+	INTOFF;
 	vars = ckmalloc(n * sizeof(*vars));
 	i = 0;
 	for (vpp = vartab; vpp < vartab + VTABSIZE; vpp++) {
@@ -625,7 +628,7 @@
 		out1c('\n');
 	}
 	ckfree(vars);
-	INTOFF;
+	INTON;
 
 	return 0;
 }
diff -r 17241e798bc0 -r e7a32ba57044 head/bin/sh/var.h
--- a/head/bin/sh/var.h	Fri Mar 02 16:56:20 2012 +0200
+++ b/head/bin/sh/var.h	Fri Mar 02 16:56:52 2012 +0200
@@ -30,7 +30,7 @@
  * SUCH DAMAGE.
  *
  *	@(#)var.h	8.2 (Berkeley) 5/4/95
- * $FreeBSD: head/bin/sh/var.h 223060 2011-06-13 21:03:27Z jilles $
+ * $FreeBSD: head/bin/sh/var.h 230998 2012-02-04 23:12:14Z jilles $
  */
 
 /*
@@ -79,6 +79,7 @@
 extern struct var vps1;
 extern struct var vps2;
 extern struct var vps4;
+extern struct var vdisvfork;
 #ifndef NO_HISTORY
 extern struct var vhistsize;
 extern struct var vterm;
@@ -109,6 +110,7 @@
 #endif
 
 #define mpathset()	((vmpath.flags & VUNSET) == 0)
+#define disvforkset()	((vdisvfork.flags & VUNSET) == 0)
 
 void initvar(void);
 void setvar(const char *, const char *, int);


More information about the Zrouter-src-freebsd mailing list