Date: Fri, 19 Jul 2002 16:47:36 -0700 (PDT) From: Peter Wemm <peter@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 14486 for review Message-ID: <200207192347.g6JNla0v069962@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://people.freebsd.org/~peter/p4db/chv.cgi?CH=14486 Change 14486 by peter@peter_daintree on 2002/07/19 16:47:21 IFC @14485 Affected files ... .. //depot/projects/ia64/MAINTAINERS#13 integrate .. //depot/projects/ia64/bin/sh/cd.c#6 integrate .. //depot/projects/ia64/bin/sh/error.c#6 integrate .. //depot/projects/ia64/bin/sh/error.h#3 integrate .. //depot/projects/ia64/bin/sh/exec.c#6 integrate .. //depot/projects/ia64/bin/sh/jobs.c#9 integrate .. //depot/projects/ia64/bin/sh/jobs.h#4 integrate .. //depot/projects/ia64/bin/sh/redir.c#5 integrate .. //depot/projects/ia64/bin/sh/shell.h#3 integrate .. //depot/projects/ia64/bin/sh/trap.c#4 integrate .. //depot/projects/ia64/contrib/groff/tmac/doc-common#4 integrate .. //depot/projects/ia64/etc/Makefile#14 integrate .. //depot/projects/ia64/etc/defaults/pccard.conf#10 integrate .. //depot/projects/ia64/etc/defaults/rc.conf#14 integrate .. //depot/projects/ia64/etc/isdn/Makefile#2 integrate .. //depot/projects/ia64/etc/mail/Makefile#10 integrate .. //depot/projects/ia64/etc/periodic/Makefile.inc#2 integrate .. //depot/projects/ia64/etc/periodic/daily/Makefile#2 integrate .. //depot/projects/ia64/etc/periodic/monthly/Makefile#2 integrate .. //depot/projects/ia64/etc/periodic/security/Makefile#2 integrate .. //depot/projects/ia64/etc/periodic/weekly/Makefile#2 integrate .. //depot/projects/ia64/etc/rc.network6#6 integrate .. //depot/projects/ia64/etc/sendmail/Makefile#8 integrate .. //depot/projects/ia64/games/battlestar/Makefile#2 integrate .. //depot/projects/ia64/games/canfield/canfield/Makefile#2 integrate .. //depot/projects/ia64/games/cribbage/Makefile#3 integrate .. //depot/projects/ia64/games/hack/Makefile#3 integrate .. //depot/projects/ia64/games/larn/Makefile#3 integrate .. //depot/projects/ia64/games/robots/Makefile#2 integrate .. //depot/projects/ia64/games/rogue/Makefile#2 integrate .. //depot/projects/ia64/games/sail/Makefile#2 integrate .. //depot/projects/ia64/games/snake/snake/Makefile#2 integrate .. //depot/projects/ia64/gnu/lib/libdialog/Makefile#3 integrate .. //depot/projects/ia64/gnu/usr.bin/groff/contrib/mm/Makefile#4 integrate .. //depot/projects/ia64/gnu/usr.bin/groff/font/Makefile.dev#2 integrate .. //depot/projects/ia64/gnu/usr.bin/groff/src/utils/indxbib/Makefile#5 integrate .. //depot/projects/ia64/gnu/usr.bin/groff/tmac/Makefile#2 integrate .. //depot/projects/ia64/gnu/usr.bin/groff/tmac/mdoc.local#8 integrate .. //depot/projects/ia64/gnu/usr.bin/rcs/rcsfreeze/Makefile#2 integrate .. //depot/projects/ia64/gnu/usr.bin/send-pr/Makefile#2 integrate .. //depot/projects/ia64/kerberosIV/share/info/Makefile#2 integrate .. //depot/projects/ia64/lib/libalias/alias_db.c#5 integrate .. //depot/projects/ia64/lib/libncurses/Makefile#5 integrate .. //depot/projects/ia64/release/doc/en_US.ISO8859-1/relnotes/common/new.sgml#34 integrate .. //depot/projects/ia64/sbin/mount_msdosfs/Makefile#4 integrate .. //depot/projects/ia64/share/colldef/Makefile#7 integrate .. //depot/projects/ia64/share/examples/Makefile#4 integrate .. //depot/projects/ia64/share/examples/etc/make.conf#15 integrate .. //depot/projects/ia64/share/examples/isdn/i4brunppp/Makefile#2 integrate .. //depot/projects/ia64/share/info/Makefile#3 integrate .. //depot/projects/ia64/share/man/man5/make.conf.5#15 integrate .. //depot/projects/ia64/share/mk/bsd.lib.mk#15 integrate .. //depot/projects/ia64/share/sendmail/Makefile#2 integrate .. //depot/projects/ia64/share/skel/Makefile#2 integrate .. //depot/projects/ia64/share/syscons/fonts/Makefile#3 integrate .. //depot/projects/ia64/share/syscons/keymaps/Makefile#4 integrate .. //depot/projects/ia64/share/zoneinfo/Makefile#2 integrate .. //depot/projects/ia64/sys/alpha/alpha/pmap.c#12 integrate .. //depot/projects/ia64/sys/boot/ofw/libofw/elf_freebsd.c#4 integrate .. //depot/projects/ia64/sys/boot/ofw/libofw/ofw_copy.c#2 integrate .. //depot/projects/ia64/sys/boot/ofw/libofw/ofw_disk.c#4 integrate .. //depot/projects/ia64/sys/boot/ofw/libofw/ofw_memory.c#2 integrate .. //depot/projects/ia64/sys/boot/ofw/libofw/openfirm.c#3 integrate .. //depot/projects/ia64/sys/boot/ofw/libofw/openfirm.h#3 integrate .. //depot/projects/ia64/sys/boot/pc98/Makefile#3 integrate .. //depot/projects/ia64/sys/conf/files.sparc64#15 integrate .. //depot/projects/ia64/sys/conf/kern.post.mk#14 integrate .. //depot/projects/ia64/sys/dev/ata/ata-dma.c#15 integrate .. //depot/projects/ia64/sys/dev/ata/ata-pci.c#14 integrate .. //depot/projects/ia64/sys/i386/i386/identcpu.c#5 integrate .. //depot/projects/ia64/sys/i386/i386/machdep.c#21 integrate .. //depot/projects/ia64/sys/i386/i386/pmap.c#14 integrate .. //depot/projects/ia64/sys/i386/include/atomic.h#5 integrate .. //depot/projects/ia64/sys/i386/include/cputypes.h#2 integrate .. //depot/projects/ia64/sys/i386/include/md_var.h#6 integrate .. //depot/projects/ia64/sys/i386/pci/pci_bus.c#5 integrate .. //depot/projects/ia64/sys/kern/subr_eventhandler.c#4 integrate .. //depot/projects/ia64/sys/kern/tty.c#16 integrate .. //depot/projects/ia64/sys/kern/vfs_bio.c#17 integrate .. //depot/projects/ia64/sys/kern/vfs_mount.c#2 integrate .. //depot/projects/ia64/sys/kern/vfs_subr.c#16 integrate .. //depot/projects/ia64/sys/netinet/tcp_input.c#17 integrate .. //depot/projects/ia64/sys/netinet/tcp_subr.c#15 integrate .. //depot/projects/ia64/sys/netinet/tcp_timer.c#6 integrate .. //depot/projects/ia64/sys/netinet/tcp_timer.h#4 integrate .. //depot/projects/ia64/sys/netinet/tcp_var.h#6 integrate .. //depot/projects/ia64/sys/netinet6/esp_input.c#5 integrate .. //depot/projects/ia64/sys/pc98/i386/machdep.c#19 integrate .. //depot/projects/ia64/sys/pccard/pcic.c#9 integrate .. //depot/projects/ia64/sys/pccard/pcic_pci.c#9 integrate .. //depot/projects/ia64/sys/pci/uhci_pci.c#5 integrate .. //depot/projects/ia64/sys/powerpc/powerpc/pmap.c#13 integrate .. //depot/projects/ia64/sys/sys/buf.h#10 integrate .. //depot/projects/ia64/sys/sys/vnode.h#14 integrate .. //depot/projects/ia64/sys/ufs/ffs/ffs_alloc.c#10 integrate .. //depot/projects/ia64/sys/ufs/ffs/ffs_balloc.c#5 integrate .. //depot/projects/ia64/sys/ufs/ffs/ffs_extern.h#7 integrate .. //depot/projects/ia64/sys/ufs/ffs/ffs_inode.c#7 integrate .. //depot/projects/ia64/sys/ufs/ffs/ffs_softdep.c#12 integrate .. //depot/projects/ia64/sys/ufs/ffs/ffs_softdep_stub.c#5 integrate .. //depot/projects/ia64/sys/ufs/ffs/softdep.h#4 integrate .. //depot/projects/ia64/sys/ufs/ufs/ufs_bmap.c#6 integrate .. //depot/projects/ia64/sys/ufs/ufs/ufs_extern.h#9 integrate .. //depot/projects/ia64/sys/ufs/ufs/ufs_inode.c#6 integrate .. //depot/projects/ia64/sys/ufs/ufs/ufs_lookup.c#6 integrate .. //depot/projects/ia64/sys/ufs/ufs/ufs_readwrite.c#10 integrate .. //depot/projects/ia64/sys/ufs/ufs/ufs_vnops.c#14 integrate .. //depot/projects/ia64/sys/vm/uma.h#8 integrate .. //depot/projects/ia64/sys/vm/vm_map.c#27 integrate .. //depot/projects/ia64/sys/vm/vm_page.c#13 integrate .. //depot/projects/ia64/sys/vm/vm_page.h#8 integrate .. //depot/projects/ia64/sys/vm/vm_pageq.c#5 integrate .. //depot/projects/ia64/sys/vm/vm_zeroidle.c#5 integrate .. //depot/projects/ia64/tools/tools/kernxref/kernxref.sh#3 integrate .. //depot/projects/ia64/usr.bin/calendar/Makefile#8 integrate .. //depot/projects/ia64/usr.bin/doscmd/cmos.c#3 integrate .. //depot/projects/ia64/usr.bin/doscmd/cwd.c#6 integrate .. //depot/projects/ia64/usr.bin/doscmd/cwd.h#3 integrate .. //depot/projects/ia64/usr.bin/doscmd/dispatch.h#2 integrate .. //depot/projects/ia64/usr.bin/doscmd/dos.h#3 integrate .. //depot/projects/ia64/usr.bin/doscmd/int13.c#4 integrate .. //depot/projects/ia64/usr.bin/doscmd/int1a.c#3 integrate .. //depot/projects/ia64/usr.bin/doscmd/port.c#4 integrate .. //depot/projects/ia64/usr.bin/doscmd/register.h#2 integrate .. //depot/projects/ia64/usr.bin/doscmd/trace.c#4 integrate .. //depot/projects/ia64/usr.bin/hexdump/display.c#8 integrate .. //depot/projects/ia64/usr.bin/locate/locate/Makefile#2 integrate .. //depot/projects/ia64/usr.bin/mail/Makefile#4 integrate .. //depot/projects/ia64/usr.bin/netstat/inet.c#3 integrate .. //depot/projects/ia64/usr.bin/sed/process.c#10 integrate .. //depot/projects/ia64/usr.bin/tip/tip/tip.1#4 integrate .. //depot/projects/ia64/usr.bin/truss/alpha-fbsd.c#3 integrate .. //depot/projects/ia64/usr.bin/truss/i386-fbsd.c#2 integrate .. //depot/projects/ia64/usr.bin/truss/i386-linux.c#4 integrate .. //depot/projects/ia64/usr.bin/truss/main.c#5 integrate .. //depot/projects/ia64/usr.bin/vi/Makefile#5 integrate .. //depot/projects/ia64/usr.bin/xlint/common/lint.h#2 integrate .. //depot/projects/ia64/usr.bin/xlint/common/param.h#2 integrate .. //depot/projects/ia64/usr.bin/xlint/lint1/err.c#3 integrate .. //depot/projects/ia64/usr.bin/xlint/lint1/mem1.c#3 integrate .. //depot/projects/ia64/usr.bin/xlint/xlint/lint.1#5 integrate .. //depot/projects/ia64/usr.bin/xlint/xlint/xlint.c#9 integrate .. //depot/projects/ia64/usr.sbin/kldxref/ef.c#8 integrate .. //depot/projects/ia64/usr.sbin/mountd/exports.5#2 integrate .. //depot/projects/ia64/usr.sbin/mountd/mountd.c#2 integrate .. //depot/projects/ia64/usr.sbin/pcvt/keycap/Makefile#2 integrate .. //depot/projects/ia64/usr.sbin/ppp/tcp.c#5 integrate .. //depot/projects/ia64/usr.sbin/ppp/udp.c#5 integrate .. //depot/projects/ia64/usr.sbin/rpc.yppasswdd/Makefile#3 integrate .. //depot/projects/ia64/usr.sbin/ypserv/Makefile#3 integrate Differences ... ==== //depot/projects/ia64/MAINTAINERS#13 (text+ko) ==== @@ -1,4 +1,4 @@ -$FreeBSD: src/MAINTAINERS,v 1.45 2002/07/10 14:51:48 joerg Exp $ +$FreeBSD: src/MAINTAINERS,v 1.46 2002/07/18 12:12:15 ru Exp $ subsystem login notes ----------------------------- @@ -65,6 +65,8 @@ nvi peter Try not to break it. libz peter Try not to break it. pppd/chat peter Try not to break it. +groff ru Recommends pre-commit review. +natd(8) ru Recommends pre-commit review. share/mk ru Recommends pre-commit review. ipfw ipfw Pre-commit review preferred. send to ipfw@freebsd.org xten imp Looking after it, don't remove, don't break it. ==== //depot/projects/ia64/bin/sh/cd.c#6 (text+ko) ==== @@ -40,7 +40,7 @@ #endif #endif /* not lint */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/bin/sh/cd.c,v 1.27 2002/06/30 05:15:03 obrien Exp $"); +__FBSDID("$FreeBSD: src/bin/sh/cd.c,v 1.28 2002/07/19 08:09:04 tjr Exp $"); #include <sys/types.h> #include <sys/stat.h> @@ -369,20 +369,6 @@ if (curdir) return curdir; - /* - * Things are a bit complicated here; we could have just used - * getcwd, but traditionally getcwd is implemented using popen - * to /bin/pwd. This creates a problem for us, since we cannot - * keep track of the job if it is being ran behind our backs. - * So we re-implement getcwd(), and we suppress interrupts - * throughout the process. This is not completely safe, since - * the user can still break out of it by killing the pwd program. - * We still try to use getcwd for systems that we know have a - * c implementation of getcwd, that does not open a pipe to - * /bin/pwd. - */ -#if defined(__NetBSD__) || defined(__FreeBSD__) || defined(__SVR4) - if (getcwd(buf, sizeof(buf)) == NULL) { char *pwd = getenv("PWD"); struct stat stdot, stpwd; @@ -397,47 +383,6 @@ return NULL; } curdir = savestr(buf); -#else - { - char *p; - int i; - int status; - struct job *jp; - int pip[2]; - INTOFF; - if (pipe(pip) < 0) - error("Pipe call failed: %s", strerror(errno)); - jp = makejob((union node *)NULL, 1); - if (forkshell(jp, (union node *)NULL, FORK_NOJOB) == 0) { - (void) close(pip[0]); - if (pip[1] != 1) { - close(1); - copyfd(pip[1], 1); - close(pip[1]); - } - (void) execl("/bin/pwd", "pwd", (char *)0); - error("Cannot exec /bin/pwd"); - } - (void) close(pip[1]); - pip[1] = -1; - p = buf; - while ((i = read(pip[0], p, buf + MAXPWD - p)) > 0 - || (i == -1 && errno == EINTR)) { - if (i > 0) - p += i; - } - (void) close(pip[0]); - pip[0] = -1; - status = waitforjob(jp); - if (status != 0) - error((char *)0); - if (i < 0 || p == buf || p[-1] != '\n') - error("pwd command failed"); - p[-1] = '\0'; - } - curdir = savestr(buf); - INTON; -#endif return curdir; } ==== //depot/projects/ia64/bin/sh/error.c#6 (text+ko) ==== @@ -40,7 +40,7 @@ #endif #endif /* not lint */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/bin/sh/error.c,v 1.21 2002/06/30 05:15:03 obrien Exp $"); +__FBSDID("$FreeBSD: src/bin/sh/error.c,v 1.22 2002/07/19 08:09:04 tjr Exp $"); /* * Errors and exceptions. @@ -221,9 +221,6 @@ { ENXIO, ALL, "no such device or address" }, { EROFS, ALL, "read-only filesystem" }, { ETXTBSY, ALL, "text busy" }, -#ifdef SYSV - { EAGAIN, E_EXEC, "not enough memory" }, -#endif { ENOMEM, ALL, "not enough memory" }, #ifdef ENOLINK { ENOLINK, ALL, "remote access failed" }, ==== //depot/projects/ia64/bin/sh/error.h#3 (text+ko) ==== @@ -34,7 +34,7 @@ * SUCH DAMAGE. * * @(#)error.h 8.2 (Berkeley) 5/4/95 - * $FreeBSD: src/bin/sh/error.h,v 1.14 2002/02/02 06:50:46 imp Exp $ + * $FreeBSD: src/bin/sh/error.h,v 1.15 2002/07/19 08:09:04 tjr Exp $ */ /* @@ -101,7 +101,5 @@ * so we use _setjmp instead. */ -#ifdef BSD #define setjmp(jmploc) _setjmp(jmploc) #define longjmp(jmploc, val) _longjmp(jmploc, val) -#endif ==== //depot/projects/ia64/bin/sh/exec.c#6 (text+ko) ==== @@ -40,7 +40,7 @@ #endif #endif /* not lint */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/bin/sh/exec.c,v 1.19 2002/06/30 05:15:03 obrien Exp $"); +__FBSDID("$FreeBSD: src/bin/sh/exec.c,v 1.20 2002/07/19 08:09:04 tjr Exp $"); #include <sys/types.h> #include <sys/stat.h> @@ -100,9 +100,6 @@ STATIC void tryexec(char *, char **, char **); -#ifndef BSD -STATIC void execinterp(char **, char **); -#endif STATIC void printentry(struct tblentry *, int); STATIC struct tblentry *cmdlookup(char *, int); STATIC void delete_cmd_entry(void); @@ -155,30 +152,13 @@ tryexec(char *cmd, char **argv, char **envp) { int e; -#ifndef BSD - char *p; -#endif -#ifdef SYSV - do { - execve(cmd, argv, envp); - } while (errno == EINTR); -#else execve(cmd, argv, envp); -#endif e = errno; if (e == ENOEXEC) { initshellproc(); setinputfile(cmd, 0); commandname = arg0 = savestr(argv[0]); -#ifndef BSD - pgetc(); pungetc(); /* fill up input buffer */ - p = parsenextc; - if (parsenleft > 2 && p[0] == '#' && p[1] == '!') { - argv[0] = cmd; - execinterp(argv, envp); - } -#endif setparam(argv + 1); exraise(EXSHELLPROC); /*NOTREACHED*/ @@ -186,86 +166,7 @@ errno = e; } - -#ifndef BSD /* - * Execute an interpreter introduced by "#!", for systems where this - * feature has not been built into the kernel. If the interpreter is - * the shell, return (effectively ignoring the "#!"). If the execution - * of the interpreter fails, exit. - * - * This code peeks inside the input buffer in order to avoid actually - * reading any input. It would benefit from a rewrite. - */ - -#define NEWARGS 5 - -STATIC void -execinterp(char **argv, char **envp) -{ - int n; - char *inp; - char *outp; - char c; - char *p; - char **ap; - char *newargs[NEWARGS]; - int i; - char **ap2; - char **new; - - n = parsenleft - 2; - inp = parsenextc + 2; - ap = newargs; - for (;;) { - while (--n >= 0 && (*inp == ' ' || *inp == '\t')) - inp++; - if (n < 0) - goto bad; - if ((c = *inp++) == '\n') - break; - if (ap == &newargs[NEWARGS]) -bad: error("Bad #! line"); - STARTSTACKSTR(outp); - do { - STPUTC(c, outp); - } while (--n >= 0 && (c = *inp++) != ' ' && c != '\t' && c != '\n'); - STPUTC('\0', outp); - n++, inp--; - *ap++ = grabstackstr(outp); - } - if (ap == newargs + 1) { /* if no args, maybe no exec is needed */ - p = newargs[0]; - for (;;) { - if (equal(p, "sh") || equal(p, "ash")) { - return; - } - while (*p != '/') { - if (*p == '\0') - goto break2; - p++; - } - p++; - } -break2:; - } - i = (char *)ap - (char *)newargs; /* size in bytes */ - if (i == 0) - error("Bad #! line"); - for (ap2 = argv ; *ap2++ != NULL ; ); - new = ckmalloc(i + ((char *)ap2 - (char *)argv)); - ap = newargs, ap2 = new; - while ((i -= sizeof (char **)) >= 0) - *ap2++ = *ap++; - ap = argv; - while (*ap2++ = *ap++); - shellexec(new, envp, pathval(), 0); -} -#endif - - - -/* * Do a path search. The variable path (passed by reference) should be * set to the start of the path before the first call; padvance will update * this value as it proceeds. Successive calls to padvance will return @@ -478,11 +379,7 @@ TRACE(("searchexec \"%s\": no change\n", name)); goto success; } - while (stat(fullname, &statb) < 0) { -#ifdef SYSV - if (errno == EINTR) - continue; -#endif + if (stat(fullname, &statb) < 0) { if (errno != ENOENT && errno != ENOTDIR) e = errno; goto loop; ==== //depot/projects/ia64/bin/sh/jobs.c#9 (text+ko) ==== @@ -40,7 +40,7 @@ #endif #endif /* not lint */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/bin/sh/jobs.c,v 1.50 2002/07/11 06:42:11 tjr Exp $"); +__FBSDID("$FreeBSD: src/bin/sh/jobs.c,v 1.53 2002/07/19 08:09:04 tjr Exp $"); #include <fcntl.h> #include <signal.h> @@ -49,12 +49,10 @@ #include <unistd.h> #include <stdlib.h> #include <sys/param.h> -#ifdef BSD #include <sys/wait.h> #include <sys/time.h> #include <sys/resource.h> #include <paths.h> -#endif #include <sys/ioctl.h> #include "shell.h" @@ -83,7 +81,7 @@ MKINIT pid_t backgndpid = -1; /* pid of last background process */ #if JOBS struct job *jobmru; /* most recently used job list */ -int initialpgrp; /* pgrp of shell on invocation */ +pid_t initialpgrp; /* pgrp of shell on invocation */ #endif int in_waitcmd = 0; /* are we in waitcmd()? */ int in_dowait = 0; /* are we in dowait()? */ @@ -95,11 +93,8 @@ #endif STATIC void freejob(struct job *); STATIC struct job *getjob(char *); -STATIC int dowait(int, struct job *); -#if SYSV -STATIC int onsigchild(void); -#endif -STATIC int waitproc(int, int *); +STATIC pid_t dowait(int, struct job *); +STATIC pid_t waitproc(int, int *); STATIC void cmdtxt(union node *); STATIC void cmdputs(char *); #if JOBS @@ -112,10 +107,6 @@ /* * Turn job control on and off. - * - * Note: This code assumes that the third arg to ioctl is a character - * pointer, which is true on Berkeley systems but not System V. Since - * System V doesn't have job control yet, this isn't a problem now. */ MKINIT int jobctl; @@ -196,7 +187,7 @@ fgcmd(int argc __unused, char **argv) { struct job *jp; - int pgrp; + pid_t pgrp; int status; jp = getjob(argv[1]); @@ -208,6 +199,7 @@ pgrp = jp->ps[0].pid; tcsetpgrp(ttyfd, pgrp); restartjob(jp); + jp->foreground = 1; INTOFF; status = waitforjob(jp, (int *)NULL); INTON; @@ -228,6 +220,7 @@ if (jp->state == JOBDONE) continue; restartjob(jp); + jp->foreground = 0; fmtstr(s, 64, "[%d] ", jp - jobtab + 1); out1str(s); out1str(jp->ps[0].cmd); @@ -313,7 +306,7 @@ #endif for (ps = jp->ps ; ; ps++) { /* for each process */ if (sformat) { - out1fmt("%d\n", ps->pid); + out1fmt("%d\n", (int)ps->pid); goto skip; } if (!lformat && ps != jp->ps && pid == 0) @@ -333,7 +326,7 @@ out1str(s); col = strlen(s); if (lformat) { - fmtstr(s, 64, "%d ", ps->pid); + fmtstr(s, 64, "%d ", (int)ps->pid); out1str(s); col += strlen(s); } @@ -498,7 +491,7 @@ jp = getjob(argv[1]); for (i = 0 ; i < jp->nprocs ; ) { - out1fmt("%d", jp->ps[i].pid); + out1fmt("%d", (int)jp->ps[i].pid); out1c(++i < jp->nprocs? ' ' : '\n'); } return 0; @@ -515,7 +508,7 @@ { int jobno; struct job *found, *jp; - int pid; + pid_t pid; int i; if (name == NULL) { @@ -569,7 +562,7 @@ return found; } } else if (is_number(name)) { - pid = number(name); + pid = (pid_t)number(name); for (jp = jobtab, i = njobs ; --i >= 0 ; jp++) { if (jp->used && jp->nprocs > 0 && jp->ps[jp->nprocs - 1].pid == pid) @@ -633,6 +626,7 @@ jp->used = 1; jp->changed = 0; jp->nprocs = 0; + jp->foreground = 0; #if JOBS jp->jobctl = jobctl; jp->next = NULL; @@ -723,11 +717,11 @@ * in a pipeline). */ -int +pid_t forkshell(struct job *jp, union node *n, int mode) { - int pid; - int pgrp; + pid_t pid; + pid_t pgrp; TRACE(("forkshell(%%%d, 0x%lx, %d) called\n", jp - jobtab, (long)n, mode)); @@ -743,7 +737,7 @@ int wasroot; int i; - TRACE(("Child shell %d\n", getpid())); + TRACE(("Child shell %d\n", (int)getpid())); wasroot = rootshell; rootshell = 0; for (i = njobs, p = jobtab ; --i >= 0 ; p++) @@ -813,12 +807,13 @@ ps->cmd = nullstr; if (iflag && rootshell && n) ps->cmd = commandtext(n); + jp->foreground = mode == FORK_FG; #if JOBS setcurjob(jp); #endif } INTON; - TRACE(("In parent shell: child = %d\n", pid)); + TRACE(("In parent shell: child = %d\n", (int)pid)); return pid; } @@ -847,7 +842,7 @@ waitforjob(struct job *jp, int *origstatus) { #if JOBS - int mypgrp = getpgrp(); + pid_t mypgrp = getpgrp(); #endif int status; int st; @@ -895,10 +890,10 @@ * Wait for a process to terminate. */ -STATIC int +STATIC pid_t dowait(int block, struct job *job) { - int pid; + pid_t pid; int status; struct procstat *sp; struct job *jp; @@ -906,12 +901,13 @@ int done; int stopped; int sig; + int i; in_dowait++; TRACE(("dowait(%d) called\n", block)); do { pid = waitproc(block, &status); - TRACE(("wait returns %d, status=%d\n", pid, status)); + TRACE(("wait returns %d, status=%d\n", (int)pid, status)); } while ((pid == -1 && errno == EINTR && breakwaitcmd == 0) || (WIFSTOPPED(status) && !iflag)); in_dowait--; @@ -932,7 +928,8 @@ continue; if (sp->pid == pid) { TRACE(("Changing status of proc %d from 0x%x to 0x%x\n", - pid, sp->status, status)); + (int)pid, sp->status, + status)); sp->status = status; thisjob = jp; } @@ -967,8 +964,24 @@ else sig = WTERMSIG(status); } - if (sig != 0 && sig != SIGINT && sig != SIGPIPE) - showjob(thisjob, pid, 0, 1); + if (sig != 0 && sig != SIGINT && sig != SIGPIPE) { + if (jp->foreground) { +#if JOBS + if (WIFSTOPPED(status)) + i = WSTOPSIG(status); + else +#endif + i = WTERMSIG(status); + if ((i & 0x7F) < NSIG && sys_siglist[i & 0x7F]) + out1str(sys_siglist[i & 0x7F]); + else + out1fmt("Signal %d", i & 0x7F); + if (WCOREDUMP(status)) + out1str(" (core dumped)"); + out1c('\n'); + } else + showjob(thisjob, pid, 0, 1); + } } else { TRACE(("Not printing status, rootshell=%d, job=0x%x\n", rootshell, job)); if (thisjob) @@ -983,44 +996,10 @@ * Do a wait system call. If job control is compiled in, we accept * stopped processes. If block is zero, we return a value of zero * rather than blocking. - * - * System V doesn't have a non-blocking wait system call. It does - * have a SIGCLD signal that is sent to a process when one of it's - * children dies. The obvious way to use SIGCLD would be to install - * a handler for SIGCLD which simply bumped a counter when a SIGCLD - * was received, and have waitproc bump another counter when it got - * the status of a process. Waitproc would then know that a wait - * system call would not block if the two counters were different. - * This approach doesn't work because if a process has children that - * have not been waited for, System V will send it a SIGCLD when it - * installs a signal handler for SIGCLD. What this means is that when - * a child exits, the shell will be sent SIGCLD signals continuously - * until is runs out of stack space, unless it does a wait call before - * restoring the signal handler. The code below takes advantage of - * this (mis)feature by installing a signal handler for SIGCLD and - * then checking to see whether it was called. If there are any - * children to be waited for, it will be. - * - * If neither SYSV nor BSD is defined, we don't implement nonblocking - * waits at all. In this case, the user will not be informed when - * a background process until the next time she runs a real program - * (as opposed to running a builtin command or just typing return), - * and the jobs command may give out of date information. */ - -#ifdef SYSV -STATIC sig_atomic_t gotsigchild; - -STATIC int onsigchild() { - gotsigchild = 1; -} -#endif - - -STATIC int +STATIC pid_t waitproc(int block, int *status) { -#ifdef BSD int flags; #if JOBS @@ -1031,24 +1010,6 @@ if (block == 0) flags |= WNOHANG; return wait3(status, flags, (struct rusage *)NULL); -#else -#ifdef SYSV - int (*save)(); - - if (block == 0) { - gotsigchild = 0; - save = signal(SIGCLD, onsigchild); - signal(SIGCLD, save); - if (gotsigchild == 0) - return 0; - } - return wait(status); -#else - if (block == 0) - return 0; - return wait(status); -#endif -#endif } /* ==== //depot/projects/ia64/bin/sh/jobs.h#4 (text+ko) ==== @@ -34,7 +34,7 @@ * SUCH DAMAGE. * * @(#)jobs.h 8.2 (Berkeley) 5/4/95 - * $FreeBSD: src/bin/sh/jobs.h,v 1.15 2002/05/31 14:04:23 tjr Exp $ + * $FreeBSD: src/bin/sh/jobs.h,v 1.17 2002/07/18 10:22:42 tjr Exp $ */ /* Mode argument to forkshell. Don't change FORK_FG or FORK_BG. */ @@ -67,10 +67,11 @@ struct procstat ps0; /* status of process */ struct procstat *ps; /* status or processes when more than one */ short nprocs; /* number of processes */ - short pgrp; /* process group of this job */ + pid_t pgrp; /* process group of this job */ char state; /* true if job is finished */ char used; /* true if this entry is in used */ char changed; /* true if status has changed */ + char foreground; /* true if running in the foreground */ #if JOBS char jobctl; /* job running under job control */ struct job *next; /* job used after this one */ @@ -91,7 +92,7 @@ int waitcmd(int, char **); int jobidcmd(int, char **); struct job *makejob(union node *, int); -int forkshell(struct job *, union node *, int); +pid_t forkshell(struct job *, union node *, int); int waitforjob(struct job *, int *); int stoppedjobs(void); char *commandtext(union node *); ==== //depot/projects/ia64/bin/sh/redir.c#5 (text+ko) ==== @@ -40,7 +40,7 @@ #endif #endif /* not lint */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/bin/sh/redir.c,v 1.20 2002/07/09 08:55:46 tjr Exp $"); +__FBSDID("$FreeBSD: src/bin/sh/redir.c,v 1.21 2002/07/18 12:24:35 tjr Exp $"); #include <sys/types.h> #include <sys/stat.h> @@ -73,7 +73,7 @@ MKINIT struct redirtab { struct redirtab *next; - short renamed[10]; + int renamed[10]; }; ==== //depot/projects/ia64/bin/sh/shell.h#3 (text+ko) ==== @@ -34,15 +34,12 @@ * SUCH DAMAGE. * * @(#)shell.h 8.2 (Berkeley) 5/4/95 - * $FreeBSD: src/bin/sh/shell.h,v 1.13 2002/02/18 06:08:23 imp Exp $ + * $FreeBSD: src/bin/sh/shell.h,v 1.14 2002/07/19 08:09:04 tjr Exp $ */ /* * The follow should be set to reflect the type of system you have: * JOBS -> 1 if you have Berkeley job control, 0 otherwise. - * SHORTNAMES -> 1 if your linker cannot handle long names. - * define BSD if you are running 4.2 BSD or later. - * define SYSV if you are running under System V. * define DEBUG=1 to compile in debugging (set global "debug" to turn on) * define DEBUG=2 to compile in and turn on debugging. * @@ -52,9 +49,6 @@ #define JOBS 1 -#ifndef BSD -#define BSD 1 -#endif /* #define DEBUG 1 */ typedef void *pointer; ==== //depot/projects/ia64/bin/sh/trap.c#4 (text+ko) ==== @@ -40,7 +40,7 @@ #endif #endif /* not lint */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/bin/sh/trap.c,v 1.22 2002/06/30 05:15:04 obrien Exp $"); +__FBSDID("$FreeBSD: src/bin/sh/trap.c,v 1.23 2002/07/19 08:09:04 tjr Exp $"); #include <signal.h> #include <unistd.h> @@ -281,10 +281,8 @@ } *t = action; sig = signal(signo, sigact); -#ifdef BSD if (sig != SIG_ERR && action == S_CATCH) siginterrupt(signo, 1); -#endif } @@ -340,9 +338,6 @@ onsig(int signo) { -#ifndef BSD - signal(signo, onsig); -#endif if (signo == SIGINT && trap[SIGINT] == NULL) { onint(); return; ==== //depot/projects/ia64/contrib/groff/tmac/doc-common#4 (text+ko) ==== @@ -30,7 +30,7 @@ .\" SUCH DAMAGE. .\" .\" @(#)doc-common 8.1 (Berkeley) 06/08/93 -.\" $FreeBSD: src/contrib/groff/tmac/doc-common,v 1.53 2002/06/18 00:41:46 dougb Exp $ +.\" $FreeBSD: src/contrib/groff/tmac/doc-common,v 1.56 2002/07/18 09:32:11 ru Exp $ .\" .\" %beginstrip% . @@ -419,7 +419,6 @@ .ds doc-operating-system-FreeBSD-4.3 4.3 .ds doc-operating-system-FreeBSD-4.4 4.4 .ds doc-operating-system-FreeBSD-4.5 4.5 -.ds doc-operating-system-FreeBSD-4.6 4.6 .ds doc-operating-system-FreeBSD-5.0 5.0 . .de Os ==== //depot/projects/ia64/etc/Makefile#14 (text+ko) ==== @@ -1,5 +1,5 @@ # from: @(#)Makefile 5.11 (Berkeley) 5/21/91 -# $FreeBSD: src/etc/Makefile,v 1.289 2002/07/05 13:47:29 ru Exp $ +# $FreeBSD: src/etc/Makefile,v 1.290 2002/07/18 12:07:44 ru Exp $ .if !defined(NO_SENDMAIL) SUBDIR= sendmail @@ -69,14 +69,14 @@ distribution: cd ${.CURDIR}; \ - ${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 644 \ + ${INSTALL} ${COPY} -o ${BINOWN} -g ${BINGRP} -m 644 \ ${BIN1} ${DESTDIR}/etc; \ - ${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 755 \ + ${INSTALL} ${COPY} -o ${BINOWN} -g ${BINGRP} -m 755 \ ${BIN2} ${DESTDIR}/etc; \ - ${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 600 \ + ${INSTALL} ${COPY} -o ${BINOWN} -g ${BINGRP} -m 600 \ master.passwd nsmb.conf opieaccess ${DESTDIR}/etc; \ pwd_mkdb -p -d ${DESTDIR}/etc ${DESTDIR}/etc/master.passwd - cd ${.CURDIR}/defaults; ${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 644 \ + cd ${.CURDIR}/defaults; ${INSTALL} ${COPY} -o ${BINOWN} -g ${BINGRP} -m 644 \ ${DEFAULTS} ${DESTDIR}/etc/defaults cd ${.CURDIR}/periodic; ${MAKE} install cd ${.CURDIR}/rc.d; ${MAKE} install @@ -92,73 +92,73 @@ .endif .if exists(${.CURDIR}/../crypto) && !defined(NO_OPENSSL) .if !defined(NO_OPENSSH) - cd ${.CURDIR}; ${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 644 \ + cd ${.CURDIR}; ${INSTALL} ${COPY} -o ${BINOWN} -g ${BINGRP} -m 644 \ ${SSH} ${DESTDIR}/etc/ssh .endif - cd ${.CURDIR}; ${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 644 \ + cd ${.CURDIR}; ${INSTALL} ${COPY} -o ${BINOWN} -g ${BINGRP} -m 644 \ ${SSL} ${DESTDIR}/etc/ssl .endif .if !defined(NO_MAKEDEV_INSTALL) - cd ${.CURDIR}; ${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 555 \ + cd ${.CURDIR}; ${INSTALL} ${COPY} -o ${BINOWN} -g ${BINGRP} -m 555 \ MAKEDEV.local MAKEDEV ${DESTDIR}/dev .if !defined(NO_MAKEDEV_RUN) cd ${DESTDIR}/dev; sh MAKEDEV all .endif .endif cd ${.CURDIR}/root; \ - ${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 644 \ + ${INSTALL} ${COPY} -o ${BINOWN} -g ${BINGRP} -m 644 \ dot.cshrc ${DESTDIR}/root/.cshrc; \ - ${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 644 \ + ${INSTALL} ${COPY} -o ${BINOWN} -g ${BINGRP} -m 644 \ dot.klogin ${DESTDIR}/root/.klogin; \ - ${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 644 \ + ${INSTALL} ${COPY} -o ${BINOWN} -g ${BINGRP} -m 644 \ dot.login ${DESTDIR}/root/.login; \ - ${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 644 \ + ${INSTALL} ${COPY} -o ${BINOWN} -g ${BINGRP} -m 644 \ dot.profile ${DESTDIR}/root/.profile; \ rm -f ${DESTDIR}/.cshrc ${DESTDIR}/.profile; \ ln ${DESTDIR}/root/.cshrc ${DESTDIR}/.cshrc; \ ln ${DESTDIR}/root/.profile ${DESTDIR}/.profile - cd ${.CURDIR}/mtree; ${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 444 \ + cd ${.CURDIR}/mtree; ${INSTALL} ${COPY} -o ${BINOWN} -g ${BINGRP} -m 444 \ ${MTREE} ${DESTDIR}/etc/mtree - cd ${.CURDIR}/namedb; ${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 644 \ + cd ${.CURDIR}/namedb; ${INSTALL} ${COPY} -o ${BINOWN} -g ${BINGRP} -m 644 \ ${NAMEDB} ${DESTDIR}/etc/namedb - cd ${.CURDIR}/ppp; ${INSTALL} -c -o root -g ${BINGRP} -m 600 \ + cd ${.CURDIR}/ppp; ${INSTALL} ${COPY} -o root -g ${BINGRP} -m 600 \ ${PPPCNF} ${DESTDIR}/etc/ppp - cd ${.CURDIR}/mail; ${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 644 \ + cd ${.CURDIR}/mail; ${INSTALL} ${COPY} -o ${BINOWN} -g ${BINGRP} -m 644 \ ${ETCMAIL} ${DESTDIR}/etc/mail @if [ -d ${DESTDIR}/etc/mail -a -f ${DESTDIR}/etc/mail/aliases -a \ ! -f ${DESTDIR}/etc/aliases ]; then \ set -x; \ ln -s mail/aliases ${DESTDIR}/etc/aliases; \ fi - ${INSTALL} -c -o ${BINOWN} -g operator -m 664 /dev/null \ + ${INSTALL} ${COPY} -o ${BINOWN} -g operator -m 664 /dev/null \ ${DESTDIR}/etc/dumpdates - ${INSTALL} -c -o nobody -g ${BINGRP} -m 644 /dev/null \ + ${INSTALL} ${COPY} -o nobody -g ${BINGRP} -m 644 /dev/null \ ${DESTDIR}/var/db/locate.database - ${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 600 /dev/null \ >>> TRUNCATED FOR MAIL (1000 lines) <<< To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe p4-projects" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200207192347.g6JNla0v069962>