From owner-svn-src-projects@FreeBSD.ORG Sun Nov 29 17:25:33 2009 Return-Path: <owner-svn-src-projects@FreeBSD.ORG> Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4771D1065676; Sun, 29 Nov 2009 17:25:33 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 35EC48FC1E; Sun, 29 Nov 2009 17:25:33 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nATHPXjp002253; Sun, 29 Nov 2009 17:25:33 GMT (envelope-from nwhitehorn@svn.freebsd.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nATHPX3q002250; Sun, 29 Nov 2009 17:25:33 GMT (envelope-from nwhitehorn@svn.freebsd.org) Message-Id: <200911291725.nATHPX3q002250@svn.freebsd.org> From: Nathan Whitehorn <nwhitehorn@FreeBSD.org> Date: Sun, 29 Nov 2009 17:25:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r199900 - in projects/ppc64/sys/powerpc: aim powerpc X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" <svn-src-projects.freebsd.org> List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-projects>, <mailto:svn-src-projects-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-projects> List-Post: <mailto:svn-src-projects@freebsd.org> List-Help: <mailto:svn-src-projects-request@freebsd.org?subject=help> List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-projects>, <mailto:svn-src-projects-request@freebsd.org?subject=subscribe> X-List-Received-Date: Sun, 29 Nov 2009 17:25:33 -0000 Author: nwhitehorn Date: Sun Nov 29 17:25:32 2009 New Revision: 199900 URL: http://svn.freebsd.org/changeset/base/199900 Log: Add TLS support for 64-bit binaries and move both TLS setting and syscall returns to powerpc/exec_machdep.c, which is meant to handle userland ABI details. Modified: projects/ppc64/sys/powerpc/aim/vm_machdep.c projects/ppc64/sys/powerpc/powerpc/exec_machdep.c Modified: projects/ppc64/sys/powerpc/aim/vm_machdep.c ============================================================================== --- projects/ppc64/sys/powerpc/aim/vm_machdep.c Sun Nov 29 10:53:34 2009 (r199899) +++ projects/ppc64/sys/powerpc/aim/vm_machdep.c Sun Nov 29 17:25:32 2009 (r199900) @@ -81,7 +81,6 @@ #include <sys/kernel.h> #include <sys/mbuf.h> #include <sys/sf_buf.h> -#include <sys/syscall.h> #include <sys/sysctl.h> #include <sys/sysent.h> #include <sys/unistd.h> @@ -438,60 +437,6 @@ cpu_thread_swapout(struct thread *td) } void -cpu_set_syscall_retval(struct thread *td, int error) -{ - struct proc *p; - struct trapframe *tf; - int fixup; - - if (error == EJUSTRETURN) - return; - - p = td->td_proc; - tf = td->td_frame; - - if (tf->fixreg[0] == SYS___syscall && - (p->p_sysent->sv_flags & SV_ILP32)) { - int code = tf->fixreg[FIRSTARG + 1]; - if (p->p_sysent->sv_mask) - code &= p->p_sysent->sv_mask; - fixup = (code != SYS_freebsd6_lseek && code != SYS_lseek) ? - 1 : 0; - } else - fixup = 0; - - switch (error) { - case 0: - if (fixup) { - /* - * 64-bit return, 32-bit syscall. Fixup byte order - */ - tf->fixreg[FIRSTARG] = 0; - tf->fixreg[FIRSTARG + 1] = td->td_retval[0]; - } else { - tf->fixreg[FIRSTARG] = td->td_retval[0]; - tf->fixreg[FIRSTARG + 1] = td->td_retval[1]; - } - tf->cr &= ~0x10000000; /* XXX: Magic number */ - break; - case ERESTART: - /* - * Set user's pc back to redo the system call. - */ - tf->srr0 -= 4; - break; - default: - if (p->p_sysent->sv_errsize) { - error = (error < p->p_sysent->sv_errsize) ? - p->p_sysent->sv_errtbl[error] : -1; - } - tf->fixreg[FIRSTARG] = error; - tf->cr |= 0x10000000; /* XXX: Magic number */ - break; - } -} - -void cpu_set_upcall(struct thread *td, struct thread *td0) { struct pcb *pcb2; @@ -555,10 +500,3 @@ cpu_set_upcall_kse(struct thread *td, vo td->td_retval[1] = 0; } -int -cpu_set_user_tls(struct thread *td, void *tls_base) -{ - - td->td_frame->fixreg[2] = (register_t)tls_base + 0x7008; - return (0); -} Modified: projects/ppc64/sys/powerpc/powerpc/exec_machdep.c ============================================================================== --- projects/ppc64/sys/powerpc/powerpc/exec_machdep.c Sun Nov 29 10:53:34 2009 (r199899) +++ projects/ppc64/sys/powerpc/powerpc/exec_machdep.c Sun Nov 29 17:25:32 2009 (r199900) @@ -75,6 +75,7 @@ __FBSDID("$FreeBSD: projects/ppc64/sys/p #include <sys/malloc.h> #include <sys/mutex.h> #include <sys/signalvar.h> +#include <sys/syscall.h> #include <sys/sysent.h> #include <sys/sysproto.h> #include <sys/ucontext.h> @@ -845,3 +846,68 @@ freebsd32_swapcontext(struct thread *td, #endif +void +cpu_set_syscall_retval(struct thread *td, int error) +{ + struct proc *p; + struct trapframe *tf; + int fixup; + + if (error == EJUSTRETURN) + return; + + p = td->td_proc; + tf = td->td_frame; + + if (tf->fixreg[0] == SYS___syscall && + (p->p_sysent->sv_flags & SV_ILP32)) { + int code = tf->fixreg[FIRSTARG + 1]; + if (p->p_sysent->sv_mask) + code &= p->p_sysent->sv_mask; + fixup = (code != SYS_freebsd6_lseek && code != SYS_lseek) ? + 1 : 0; + } else + fixup = 0; + + switch (error) { + case 0: + if (fixup) { + /* + * 64-bit return, 32-bit syscall. Fixup byte order + */ + tf->fixreg[FIRSTARG] = 0; + tf->fixreg[FIRSTARG + 1] = td->td_retval[0]; + } else { + tf->fixreg[FIRSTARG] = td->td_retval[0]; + tf->fixreg[FIRSTARG + 1] = td->td_retval[1]; + } + tf->cr &= ~0x10000000; /* XXX: Magic number */ + break; + case ERESTART: + /* + * Set user's pc back to redo the system call. + */ + tf->srr0 -= 4; + break; + default: + if (p->p_sysent->sv_errsize) { + error = (error < p->p_sysent->sv_errsize) ? + p->p_sysent->sv_errtbl[error] : -1; + } + tf->fixreg[FIRSTARG] = error; + tf->cr |= 0x10000000; /* XXX: Magic number */ + break; + } +} + +int +cpu_set_user_tls(struct thread *td, void *tls_base) +{ + + if (td->td_proc->p_sysent->sv_flags & SV_LP64) + td->td_frame->fixreg[13] = (register_t)tls_base + 0x8000; + else + td->td_frame->fixreg[2] = (register_t)tls_base + 0x7008; + return (0); +} + From owner-svn-src-projects@FreeBSD.ORG Sun Nov 29 17:44:45 2009 Return-Path: <owner-svn-src-projects@FreeBSD.ORG> Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E558D1065679; Sun, 29 Nov 2009 17:44:45 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D03DC8FC0A; Sun, 29 Nov 2009 17:44:45 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nATHijcw002811; Sun, 29 Nov 2009 17:44:45 GMT (envelope-from nwhitehorn@svn.freebsd.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nATHijJ6002781; Sun, 29 Nov 2009 17:44:45 GMT (envelope-from nwhitehorn@svn.freebsd.org) Message-Id: <200911291744.nATHijJ6002781@svn.freebsd.org> From: Nathan Whitehorn <nwhitehorn@FreeBSD.org> Date: Sun, 29 Nov 2009 17:44:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r199903 - in projects/ppc64: bin/sh contrib/telnet/telnet crypto/openssh games/factor include lib/libc/compat-43 lib/libc/gen lib/libc/net lib/libc/rpc lib/libc/stdio lib/libc/yp lib/li... X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" <svn-src-projects.freebsd.org> List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-projects>, <mailto:svn-src-projects-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-projects> List-Post: <mailto:svn-src-projects@freebsd.org> List-Help: <mailto:svn-src-projects-request@freebsd.org?subject=help> List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-projects>, <mailto:svn-src-projects-request@freebsd.org?subject=subscribe> X-List-Received-Date: Sun, 29 Nov 2009 17:44:46 -0000 Author: nwhitehorn Date: Sun Nov 29 17:44:44 2009 New Revision: 199903 URL: http://svn.freebsd.org/changeset/base/199903 Log: IFC Added: projects/ppc64/include/termios.h - copied unchanged from r199901, head/include/termios.h projects/ppc64/sys/boot/i386/libi386/spinconsole.c - copied unchanged from r199901, head/sys/boot/i386/libi386/spinconsole.c projects/ppc64/sys/boot/i386/zfsloader/ - copied from r199901, head/sys/boot/i386/zfsloader/ projects/ppc64/sys/sys/_termios.h - copied unchanged from r199901, head/sys/sys/_termios.h projects/ppc64/tools/regression/bin/sh/builtins/fc1.0 - copied unchanged from r199901, head/tools/regression/bin/sh/builtins/fc1.0 projects/ppc64/tools/regression/bin/sh/builtins/trap3.0 - copied unchanged from r199901, head/tools/regression/bin/sh/builtins/trap3.0 Deleted: projects/ppc64/sys/dev/ata/ata-usb.c projects/ppc64/sys/modules/ata/atausb/ Modified: projects/ppc64/bin/sh/error.c projects/ppc64/bin/sh/error.h projects/ppc64/bin/sh/eval.c projects/ppc64/bin/sh/input.c projects/ppc64/bin/sh/input.h projects/ppc64/bin/sh/parser.c projects/ppc64/bin/sh/redir.c projects/ppc64/bin/sh/trap.c projects/ppc64/bin/sh/var.c projects/ppc64/contrib/telnet/telnet/externs.h projects/ppc64/crypto/openssh/sshd.c projects/ppc64/games/factor/factor.c projects/ppc64/include/Makefile projects/ppc64/include/signal.h projects/ppc64/lib/libc/compat-43/Makefile.inc projects/ppc64/lib/libc/compat-43/Symbol.map projects/ppc64/lib/libc/compat-43/sigcompat.c projects/ppc64/lib/libc/compat-43/sigpause.2 projects/ppc64/lib/libc/gen/exec.c projects/ppc64/lib/libc/gen/fts.3 projects/ppc64/lib/libc/gen/fts.c projects/ppc64/lib/libc/gen/getcap.c projects/ppc64/lib/libc/gen/getusershell.c projects/ppc64/lib/libc/gen/wordexp.c projects/ppc64/lib/libc/net/sctp_send.3 projects/ppc64/lib/libc/net/sctp_sendmsg.3 projects/ppc64/lib/libc/rpc/clnt_raw.c projects/ppc64/lib/libc/rpc/getnetconfig.c projects/ppc64/lib/libc/rpc/getrpcent.c projects/ppc64/lib/libc/rpc/key_call.c projects/ppc64/lib/libc/rpc/svc_raw.c projects/ppc64/lib/libc/stdio/fgetws.c projects/ppc64/lib/libc/stdio/fvwrite.c projects/ppc64/lib/libc/stdio/vfwprintf.c projects/ppc64/lib/libc/stdio/xprintf_time.c projects/ppc64/lib/libc/yp/yplib.c projects/ppc64/lib/libfetch/ftp.c projects/ppc64/lib/libtacplus/taclib.c projects/ppc64/lib/libutil/pw_util.c projects/ppc64/libexec/rtld-elf/rtld.c projects/ppc64/libexec/rtld-elf/rtld.h projects/ppc64/sbin/atacontrol/atacontrol.c projects/ppc64/sbin/camcontrol/camcontrol.8 projects/ppc64/sbin/camcontrol/camcontrol.c projects/ppc64/sbin/ifconfig/ifconfig.c projects/ppc64/share/man/man4/ada.4 projects/ppc64/share/man/man4/ata.4 projects/ppc64/share/man/man4/mfi.4 projects/ppc64/share/man/man4/sctp.4 projects/ppc64/share/misc/bsd-family-tree projects/ppc64/sys/amd64/amd64/bpf_jit_machdep.c projects/ppc64/sys/amd64/amd64/bpf_jit_machdep.h projects/ppc64/sys/amd64/amd64/trap.c projects/ppc64/sys/arm/arm/trap.c projects/ppc64/sys/boot/Makefile projects/ppc64/sys/boot/forth/loader.conf.5 projects/ppc64/sys/boot/i386/Makefile projects/ppc64/sys/boot/i386/libi386/Makefile projects/ppc64/sys/boot/i386/libi386/elf32_freebsd.c projects/ppc64/sys/boot/i386/libi386/elf64_freebsd.c projects/ppc64/sys/boot/i386/libi386/vidconsole.c projects/ppc64/sys/boot/i386/loader/Makefile projects/ppc64/sys/boot/i386/loader/conf.c projects/ppc64/sys/boot/i386/zfsboot/zfsboot.c projects/ppc64/sys/cam/ata/ata_all.c projects/ppc64/sys/cam/ata/ata_all.h projects/ppc64/sys/cam/ata/ata_pmp.c projects/ppc64/sys/cam/ata/ata_xpt.c projects/ppc64/sys/cam/cam_ccb.h projects/ppc64/sys/cam/cam_xpt.c projects/ppc64/sys/compat/svr4/svr4_termios.c projects/ppc64/sys/conf/files projects/ppc64/sys/dev/adb/adb.h projects/ppc64/sys/dev/adb/adb_bus.c projects/ppc64/sys/dev/adb/adb_mouse.c projects/ppc64/sys/dev/ahci/ahci.c projects/ppc64/sys/dev/ahci/ahci.h projects/ppc64/sys/dev/an/if_an.c projects/ppc64/sys/dev/an/if_an_isa.c projects/ppc64/sys/dev/an/if_an_pccard.c projects/ppc64/sys/dev/an/if_an_pci.c projects/ppc64/sys/dev/an/if_anreg.h projects/ppc64/sys/dev/ata/ata-all.c projects/ppc64/sys/dev/ata/ata-disk.c projects/ppc64/sys/dev/ata/chipsets/ata-intel.c projects/ppc64/sys/dev/bge/if_bge.c projects/ppc64/sys/dev/bge/if_bgereg.h projects/ppc64/sys/dev/cxgb/ulp/tom/cxgb_vm.c projects/ppc64/sys/dev/fe/if_fe_pccard.c projects/ppc64/sys/dev/hwpmc/hwpmc_logging.c projects/ppc64/sys/dev/pci/pci.c projects/ppc64/sys/dev/siis/siis.c projects/ppc64/sys/dev/siis/siis.h projects/ppc64/sys/dev/sound/pci/hda/hdac.c projects/ppc64/sys/dev/sound/usb/uaudio.c projects/ppc64/sys/dev/syscons/sysmouse.c projects/ppc64/sys/dev/uart/uart_core.c projects/ppc64/sys/dev/uart/uart_tty.c projects/ppc64/sys/dev/usb/controller/at91dci.c projects/ppc64/sys/dev/usb/controller/atmegadci.c projects/ppc64/sys/dev/usb/controller/avr32dci.c projects/ppc64/sys/dev/usb/controller/ehci.c projects/ppc64/sys/dev/usb/controller/musb_otg.c projects/ppc64/sys/dev/usb/controller/musb_otg.h projects/ppc64/sys/dev/usb/controller/ohci.c projects/ppc64/sys/dev/usb/controller/uhci.c projects/ppc64/sys/dev/usb/controller/uhci_pci.c projects/ppc64/sys/dev/usb/controller/uhcireg.h projects/ppc64/sys/dev/usb/controller/usb_controller.c projects/ppc64/sys/dev/usb/controller/uss820dci.c projects/ppc64/sys/dev/usb/input/atp.c projects/ppc64/sys/dev/usb/input/ukbd.c projects/ppc64/sys/dev/usb/net/if_aue.c projects/ppc64/sys/dev/usb/net/if_axe.c projects/ppc64/sys/dev/usb/net/if_cdce.c projects/ppc64/sys/dev/usb/net/if_cue.c projects/ppc64/sys/dev/usb/net/if_kue.c projects/ppc64/sys/dev/usb/net/if_rue.c projects/ppc64/sys/dev/usb/net/if_udav.c projects/ppc64/sys/dev/usb/serial/u3g.c projects/ppc64/sys/dev/usb/serial/uark.c projects/ppc64/sys/dev/usb/serial/ubser.c projects/ppc64/sys/dev/usb/serial/ucycom.c projects/ppc64/sys/dev/usb/serial/ufoma.c projects/ppc64/sys/dev/usb/serial/uftdi.c projects/ppc64/sys/dev/usb/serial/ugensa.c projects/ppc64/sys/dev/usb/serial/umct.c projects/ppc64/sys/dev/usb/serial/umodem.c projects/ppc64/sys/dev/usb/serial/uplcom.c projects/ppc64/sys/dev/usb/serial/usb_serial.h projects/ppc64/sys/dev/usb/storage/umass.c projects/ppc64/sys/dev/usb/template/usb_template.c projects/ppc64/sys/dev/usb/usb_busdma.c projects/ppc64/sys/dev/usb/usb_core.h projects/ppc64/sys/dev/usb/usb_debug.c projects/ppc64/sys/dev/usb/usb_debug.h projects/ppc64/sys/dev/usb/usb_dev.c projects/ppc64/sys/dev/usb/usb_device.c projects/ppc64/sys/dev/usb/usb_generic.c projects/ppc64/sys/dev/usb/usb_hid.c projects/ppc64/sys/dev/usb/usb_hub.c projects/ppc64/sys/dev/usb/usb_hub.h projects/ppc64/sys/dev/usb/usb_msctest.c projects/ppc64/sys/dev/usb/usb_process.c projects/ppc64/sys/dev/usb/usb_request.c projects/ppc64/sys/dev/usb/usb_transfer.c projects/ppc64/sys/dev/usb/usbdi.h projects/ppc64/sys/dev/usb/wlan/if_upgt.c projects/ppc64/sys/dev/xen/blkfront/blkfront.c projects/ppc64/sys/dev/xen/console/console.c projects/ppc64/sys/fs/nfsserver/nfs_nfsdport.c projects/ppc64/sys/geom/label/g_label.c projects/ppc64/sys/geom/label/g_label.h projects/ppc64/sys/geom/label/g_label_ext2fs.c projects/ppc64/sys/geom/label/g_label_gpt.c projects/ppc64/sys/geom/label/g_label_iso9660.c projects/ppc64/sys/geom/label/g_label_msdosfs.c projects/ppc64/sys/geom/label/g_label_ntfs.c projects/ppc64/sys/geom/label/g_label_reiserfs.c projects/ppc64/sys/geom/label/g_label_ufs.c projects/ppc64/sys/i386/i386/bpf_jit_machdep.c projects/ppc64/sys/i386/i386/bpf_jit_machdep.h projects/ppc64/sys/i386/i386/trap.c projects/ppc64/sys/i386/xen/exception.s projects/ppc64/sys/i386/xen/pmap.c projects/ppc64/sys/ia64/ia64/interrupt.c projects/ppc64/sys/ia64/ia64/machdep.c projects/ppc64/sys/ia64/ia64/trap.c projects/ppc64/sys/ia64/include/param.h projects/ppc64/sys/ia64/include/pcpu.h projects/ppc64/sys/kern/sched_ule.c projects/ppc64/sys/kern/sys_process.c projects/ppc64/sys/mips/adm5120/if_admsw.c projects/ppc64/sys/mips/adm5120/if_admswvar.h projects/ppc64/sys/mips/mips/trap.c projects/ppc64/sys/netinet/sctp_constants.h projects/ppc64/sys/netipsec/ipsec_mbuf.c projects/ppc64/sys/netipsec/xform_ipcomp.c projects/ppc64/sys/opencrypto/crypto.c projects/ppc64/sys/opencrypto/deflate.c projects/ppc64/sys/opencrypto/deflate.h projects/ppc64/sys/powerpc/aim/machdep.c projects/ppc64/sys/powerpc/aim/ofw_machdep.c projects/ppc64/sys/powerpc/aim/trap.c projects/ppc64/sys/powerpc/booke/machdep.c projects/ppc64/sys/powerpc/booke/trap.c projects/ppc64/sys/powerpc/include/cpu.h projects/ppc64/sys/powerpc/include/md_var.h projects/ppc64/sys/powerpc/powerpc/cpu.c projects/ppc64/sys/sparc64/sparc64/trap.c projects/ppc64/sys/sun4v/sun4v/trap.c projects/ppc64/sys/sys/ata.h projects/ppc64/sys/sys/elf_common.h projects/ppc64/sys/sys/param.h projects/ppc64/sys/sys/sdt.h projects/ppc64/sys/sys/signal.h projects/ppc64/sys/sys/signalvar.h projects/ppc64/sys/sys/termios.h projects/ppc64/sys/sys/tty.h projects/ppc64/sys/vm/vm.h projects/ppc64/sys/vm/vm_fault.c projects/ppc64/sys/vm/vm_map.c projects/ppc64/sys/vm/vm_map.h projects/ppc64/tools/regression/bpf/bpf_filter/tests/test0084.h projects/ppc64/tools/tools/tinybsd/tinybsd projects/ppc64/usr.bin/gcore/Makefile projects/ppc64/usr.bin/gcore/elfcore.c projects/ppc64/usr.bin/gcore/gcore.1 projects/ppc64/usr.bin/gcore/gcore.c projects/ppc64/usr.bin/ldd/ldd.1 projects/ppc64/usr.bin/netstat/if.c projects/ppc64/usr.bin/perror/perror.c projects/ppc64/usr.bin/unifdef/unifdef.1 projects/ppc64/usr.bin/unifdef/unifdef.c projects/ppc64/usr.bin/unifdef/unifdefall.sh projects/ppc64/usr.bin/w/w.c projects/ppc64/usr.sbin/cron/cron/cron.c projects/ppc64/usr.sbin/inetd/inetd.c projects/ppc64/usr.sbin/jail/jail.8 projects/ppc64/usr.sbin/syslogd/syslogd.c Directory Properties: projects/ppc64/ (props changed) projects/ppc64/sys/ (props changed) projects/ppc64/sys/dev/xen/xenpci/ (props changed) Modified: projects/ppc64/bin/sh/error.c ============================================================================== --- projects/ppc64/bin/sh/error.c Sun Nov 29 17:35:31 2009 (r199902) +++ projects/ppc64/bin/sh/error.c Sun Nov 29 17:44:44 2009 (r199903) @@ -73,11 +73,15 @@ static void exverror(int, const char *, * Called to raise an exception. Since C doesn't include exceptions, we * just do a longjmp to the exception handler. The type of exception is * stored in the global variable "exception". + * + * Interrupts are disabled; they should be reenabled when the exception is + * caught. */ void exraise(int e) { + INTOFF; if (handler == NULL) abort(); exception = e; @@ -138,8 +142,15 @@ onint(void) static void exverror(int cond, const char *msg, va_list ap) { - CLEAR_PENDING_INT; - INTOFF; + /* + * An interrupt trumps an error. Certain places catch error + * exceptions or transform them to a plain nonzero exit code + * in child processes, and if an error exception can be handled, + * an interrupt can be handled as well. + * + * exraise() will disable interrupts for the exception handler. + */ + FORCEINTON; #ifdef DEBUG if (msg) Modified: projects/ppc64/bin/sh/error.h ============================================================================== --- projects/ppc64/bin/sh/error.h Sun Nov 29 17:35:31 2009 (r199902) +++ projects/ppc64/bin/sh/error.h Sun Nov 29 17:44:44 2009 (r199903) @@ -72,6 +72,8 @@ extern volatile sig_atomic_t intpending; #define INTOFF suppressint++ #define INTON { if (--suppressint == 0 && intpending) onint(); } +#define is_int_on() suppressint +#define SETINTON(s) suppressint = (s) #define FORCEINTON {suppressint = 0; if (intpending) onint();} #define CLEAR_PENDING_INT intpending = 0 #define int_pending() intpending Modified: projects/ppc64/bin/sh/eval.c ============================================================================== --- projects/ppc64/bin/sh/eval.c Sun Nov 29 17:35:31 2009 (r199902) +++ projects/ppc64/bin/sh/eval.c Sun Nov 29 17:44:44 2009 (r199903) @@ -593,6 +593,7 @@ evalcommand(union node *cmd, int flags, char *savecmdname; struct shparam saveparam; struct localvar *savelocalvars; + struct parsefile *savetopfile; volatile int e; char *lastarg; int realstatus; @@ -781,7 +782,6 @@ evalcommand(union node *cmd, int flags, savelocalvars = localvars; localvars = NULL; reffunc(cmdentry.u.func); - INTON; savehandler = handler; if (setjmp(jmploc.loc)) { if (exception == EXSHELLPROC) @@ -797,6 +797,7 @@ evalcommand(union node *cmd, int flags, longjmp(handler->loc, 1); } handler = &jmploc; + INTON; for (sp = varlist.list ; sp ; sp = sp->next) mklocal(sp->text); funcnest++; @@ -833,6 +834,7 @@ evalcommand(union node *cmd, int flags, mode |= REDIR_BACKQ; } savecmdname = commandname; + savetopfile = getcurrentfile(); cmdenviron = varlist.list; e = -1; savehandler = handler; @@ -867,6 +869,7 @@ cmddone: if ((e != EXERROR && e != EXEXEC) || cmdentry.special) exraise(e); + popfilesupto(savetopfile); FORCEINTON; } if (cmdentry.u.index != EXECCMD) Modified: projects/ppc64/bin/sh/input.c ============================================================================== --- projects/ppc64/bin/sh/input.c Sun Nov 29 17:35:31 2009 (r199902) +++ projects/ppc64/bin/sh/input.c Sun Nov 29 17:44:44 2009 (r199903) @@ -509,6 +509,32 @@ popfile(void) /* + * Return current file (to go back to it later using popfilesupto()). + */ + +struct parsefile * +getcurrentfile(void) +{ + return parsefile; +} + + +/* + * Pop files until the given file is on top again. Useful for regular + * builtins that read shell commands from files or strings. + * If the given file is not an active file, an error is raised. + */ + +void +popfilesupto(struct parsefile *file) +{ + while (parsefile != file && parsefile != &basepf) + popfile(); + if (parsefile != file) + error("popfilesupto() misused"); +} + +/* * Return to top level. */ Modified: projects/ppc64/bin/sh/input.h ============================================================================== --- projects/ppc64/bin/sh/input.h Sun Nov 29 17:35:31 2009 (r199902) +++ projects/ppc64/bin/sh/input.h Sun Nov 29 17:44:44 2009 (r199903) @@ -45,6 +45,8 @@ extern int parsenleft; /* number of cha extern char *parsenextc; /* next character in input buffer */ extern int init_editline; /* 0 == not setup, 1 == OK, -1 == failed */ +struct parsefile; + char *pfgets(char *, int); int pgetc(void); int preadbuffer(void); @@ -56,6 +58,8 @@ void setinputfile(char *, int); void setinputfd(int, int); void setinputstring(char *, int); void popfile(void); +struct parsefile *getcurrentfile(void); +void popfilesupto(struct parsefile *); void popallfiles(void); void closescript(void); Modified: projects/ppc64/bin/sh/parser.c ============================================================================== --- projects/ppc64/bin/sh/parser.c Sun Nov 29 17:35:31 2009 (r199902) +++ projects/ppc64/bin/sh/parser.c Sun Nov 29 17:44:44 2009 (r199903) @@ -1312,6 +1312,7 @@ parsebackq: { int saveprompt; const int bq_startlinno = plinno; + str = NULL; if (setjmp(jmploc.loc)) { if (str) ckfree(str); @@ -1323,7 +1324,6 @@ parsebackq: { longjmp(handler->loc, 1); } INTOFF; - str = NULL; savelen = out - stackblock(); if (savelen > 0) { str = ckmalloc(savelen); Modified: projects/ppc64/bin/sh/redir.c ============================================================================== --- projects/ppc64/bin/sh/redir.c Sun Nov 29 17:35:31 2009 (r199902) +++ projects/ppc64/bin/sh/redir.c Sun Nov 29 17:44:44 2009 (r199903) @@ -166,8 +166,11 @@ openredirect(union node *redir, char mem /* * We suppress interrupts so that we won't leave open file - * descriptors around. This may not be such a good idea because - * an open of a device or a fifo can block indefinitely. + * descriptors around. Because the signal handler remains + * installed and we do not use system call restart, interrupts + * will still abort blocking opens such as fifos (they will fail + * with EINTR). There is, however, a race condition if an interrupt + * arrives after INTOFF and before open blocks. */ INTOFF; memory[fd] = 0; Modified: projects/ppc64/bin/sh/trap.c ============================================================================== --- projects/ppc64/bin/sh/trap.c Sun Nov 29 17:35:31 2009 (r199902) +++ projects/ppc64/bin/sh/trap.c Sun Nov 29 17:44:44 2009 (r199903) @@ -149,6 +149,7 @@ trapcmd(int argc, char **argv) { char *action; int signo; + int errors = 0; if (argc <= 1) { for (signo = 0 ; signo < sys_nsig ; signo++) { @@ -183,8 +184,10 @@ trapcmd(int argc, char **argv) } } while (*argv) { - if ((signo = sigstring_to_signum(*argv)) == -1) - error("bad signal %s", *argv); + if ((signo = sigstring_to_signum(*argv)) == -1) { + out2fmt_flush("trap: bad signal %s\n", *argv); + errors = 1; + } INTOFF; if (action) action = savestr(action); @@ -196,7 +199,7 @@ trapcmd(int argc, char **argv) INTON; argv++; } - return 0; + return errors; } Modified: projects/ppc64/bin/sh/var.c ============================================================================== --- projects/ppc64/bin/sh/var.c Sun Nov 29 17:35:31 2009 (r199902) +++ projects/ppc64/bin/sh/var.c Sun Nov 29 17:44:44 2009 (r199903) @@ -195,7 +195,9 @@ setvarsafe(char *name, char *val, int fl struct jmploc jmploc; struct jmploc *const savehandler = handler; int err = 0; + int inton; + inton = is_int_on(); if (setjmp(jmploc.loc)) err = 1; else { @@ -203,6 +205,7 @@ setvarsafe(char *name, char *val, int fl setvar(name, val, flags); } handler = savehandler; + SETINTON(inton); return err; } Modified: projects/ppc64/contrib/telnet/telnet/externs.h ============================================================================== --- projects/ppc64/contrib/telnet/telnet/externs.h Sun Nov 29 17:35:31 2009 (r199902) +++ projects/ppc64/contrib/telnet/telnet/externs.h Sun Nov 29 17:44:44 2009 (r199903) @@ -57,7 +57,7 @@ #include <errno.h> #ifdef USE_TERMIO # ifndef VINTR -# include <sys/termios.h> +# include <termios.h> # endif # define termio termios #endif Modified: projects/ppc64/crypto/openssh/sshd.c ============================================================================== --- projects/ppc64/crypto/openssh/sshd.c Sun Nov 29 17:35:31 2009 (r199902) +++ projects/ppc64/crypto/openssh/sshd.c Sun Nov 29 17:44:44 2009 (r199903) @@ -47,6 +47,7 @@ __RCSID("$FreeBSD$"); #include <sys/types.h> #include <sys/ioctl.h> +#include <sys/mman.h> #include <sys/socket.h> #ifdef HAVE_SYS_STAT_H # include <sys/stat.h> @@ -1293,6 +1294,10 @@ main(int ac, char **av) /* Initialize configuration options to their default values. */ initialize_server_options(&options); + /* Avoid killing the process in high-pressure swapping environments. */ + if (madvise(NULL, 0, MADV_PROTECT) != 0) + debug("madvise(): %.200s", strerror(errno)); + /* Parse command-line arguments. */ while ((opt = getopt(ac, av, "f:p:b:k:h:g:u:o:C:dDeiqrtQRT46")) != -1) { switch (opt) { Modified: projects/ppc64/games/factor/factor.c ============================================================================== --- projects/ppc64/games/factor/factor.c Sun Nov 29 17:35:31 2009 (r199902) +++ projects/ppc64/games/factor/factor.c Sun Nov 29 17:44:44 2009 (r199903) @@ -13,11 +13,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 the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors + * 3. 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,18 +31,20 @@ */ #ifndef lint -static const char copyright[] = -"@(#) Copyright (c) 1989, 1993\n\ - The Regents of the University of California. All rights reserved.\n"; -#endif /* not lint */ - -#ifndef lint -#if 0 -static char sccsid[] = "@(#)factor.c 8.4 (Berkeley) 5/4/95"; -__RCSID("$NetBSD: factor.c,v 1.13 2002/06/18 23:07:36 simonb Exp $"); +#include <sys/cdefs.h> +#ifdef __COPYRIGHT +__COPYRIGHT("@(#) Copyright (c) 1989, 1993\ + The Regents of the University of California. All rights reserved."); +#endif +#ifdef __SCCSID +__SCCSID("@(#)factor.c 8.4 (Berkeley) 5/4/95"); +#endif +#ifdef __RCSID +__RCSID("$NetBSD: factor.c,v 1.19 2009/08/12 05:54:31 dholland Exp $"); +#endif +#ifdef __FBSDID +__FBSDID("$FreeBSD$"); #endif -static const char rcsid[] = - "$FreeBSD$"; #endif /* not lint */ /* @@ -63,7 +61,7 @@ static const char rcsid[] = * * number: factor1 factor1 factor2 factor3 factor3 factor3 ... * - * where factor1 < factor2 < factor3 < ... + * where factor1 <= factor2 <= factor3 <= ... * * If no args are given, the list of numbers are read from stdin. */ @@ -214,7 +212,9 @@ pr_fact(BIGNUM *val) bnfact = BN_new(); BN_set_word(bnfact, *(fact - 1)); BN_sqr(bnfact, bnfact, ctx); - if (BN_cmp(bnfact, val) > 0) + if (BN_cmp(bnfact, val) > 0 || + BN_is_prime(val, PRIME_CHECKS, + NULL, NULL, NULL) == 1) pr_print(val); else pollard_pminus1(val); @@ -257,22 +257,28 @@ usage(void) #ifdef HAVE_OPENSSL -/* pollard rho, algorithm from Jim Gillogly, May 2000 */ +/* pollard p-1, algorithm from Jim Gillogly, May 2000 */ static void pollard_pminus1(BIGNUM *val) { - BIGNUM *base, *num, *i, *x; + BIGNUM *base, *rbase, *num, *i, *x; base = BN_new(); + rbase = BN_new(); num = BN_new(); i = BN_new(); x = BN_new(); + BN_set_word(rbase, 1); +newbase: + BN_add_word(rbase, 1); BN_set_word(i, 2); - BN_set_word(base, 2); + BN_copy(base, rbase); for (;;) { BN_mod_exp(base, base, i, val, ctx); + if (BN_is_one(base)) + goto newbase; BN_copy(x, base); BN_sub_word(x, 1); Modified: projects/ppc64/include/Makefile ============================================================================== --- projects/ppc64/include/Makefile Sun Nov 29 17:35:31 2009 (r199902) +++ projects/ppc64/include/Makefile Sun Nov 29 17:44:44 2009 (r199903) @@ -21,7 +21,7 @@ INCS= a.out.h ar.h assert.h bitstring.h res_update.h resolv.h runetype.h search.h setjmp.h \ signal.h spawn.h stab.h \ stdbool.h stddef.h stdio.h stdlib.h string.h stringlist.h \ - strings.h sysexits.h tar.h tgmath.h \ + strings.h sysexits.h tar.h termios.h tgmath.h \ time.h timeconv.h timers.h ttyent.h \ ulimit.h unistd.h utime.h utmp.h uuid.h varargs.h vis.h wchar.h \ wctype.h wordexp.h @@ -31,7 +31,7 @@ MHDRS= float.h floatingpoint.h stdarg.h PHDRS= sched.h semaphore.h _semaphore.h LHDRS= aio.h errno.h fcntl.h linker_set.h poll.h stdint.h syslog.h \ - termios.h ucontext.h + ucontext.h LDIRS= bsm cam geom net net80211 netatalk netgraph netinet netinet6 \ netipsec ${_netipx} netnatm ${_netncp} netsmb \ Modified: projects/ppc64/include/signal.h ============================================================================== --- projects/ppc64/include/signal.h Sun Nov 29 17:35:31 2009 (r199902) +++ projects/ppc64/include/signal.h Sun Nov 29 17:44:44 2009 (r199903) @@ -99,7 +99,12 @@ int sigwaitinfo(const sigset_t * __restr #if __XSI_VISIBLE int killpg(__pid_t, int); int sigaltstack(const stack_t * __restrict, stack_t * __restrict); -int sigpause(int); +int sighold(int sig); +int sigignore(int sig); +int sigpause(int sigmask); +int sigrelse(int sig); +void (*sigset(int sig, void (*disp)(int)))(int); +int xsi_sigpause(int sig); #endif #if __XSI_VISIBLE >= 600 Copied: projects/ppc64/include/termios.h (from r199901, head/include/termios.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ projects/ppc64/include/termios.h Sun Nov 29 17:44:44 2009 (r199903, copy of r199901, head/include/termios.h) @@ -0,0 +1,100 @@ +/*- + * Copyright (c) 1988, 1989, 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. + * + * @(#)termios.h 8.3 (Berkeley) 3/28/94 + * $FreeBSD$ + */ + +#ifndef _TERMIOS_H_ +#define _TERMIOS_H_ + +#include <sys/cdefs.h> +#include <sys/_termios.h> +#include <sys/_types.h> + +#ifndef _PID_T_DECLARED +typedef __pid_t pid_t; +#define _PID_T_DECLARED +#endif + +#ifndef _POSIX_SOURCE +#define OXTABS TAB3 +#define MDMBUF CCAR_OFLOW +#endif + +#ifndef _POSIX_SOURCE +#define CCEQ(val, c) ((c) == (val) && (val) != _POSIX_VDISABLE) +#endif + +/* + * Commands passed to tcsetattr() for setting the termios structure. + */ +#define TCSANOW 0 /* make change immediate */ +#define TCSADRAIN 1 /* drain output, then change */ +#define TCSAFLUSH 2 /* drain output, flush input */ +#ifndef _POSIX_SOURCE +#define TCSASOFT 0x10 /* flag - don't alter h.w. state */ +#endif + +#define TCIFLUSH 1 +#define TCOFLUSH 2 +#define TCIOFLUSH 3 +#define TCOOFF 1 +#define TCOON 2 +#define TCIOFF 3 +#define TCION 4 + +__BEGIN_DECLS +speed_t cfgetispeed(const struct termios *); +speed_t cfgetospeed(const struct termios *); +int cfsetispeed(struct termios *, speed_t); +int cfsetospeed(struct termios *, speed_t); +int tcgetattr(int, struct termios *); +int tcsetattr(int, int, const struct termios *); +int tcdrain(int); +int tcflow(int, int); +int tcflush(int, int); +int tcsendbreak(int, int); + +#if __POSIX_VISIBLE >= 200112 || __BSD_VISIBLE +pid_t tcgetsid(int); +#endif +#if __BSD_VISIBLE +int tcsetsid(int, pid_t); + +void cfmakeraw(struct termios *); +int cfsetspeed(struct termios *, speed_t); +#endif +__END_DECLS + +#endif /* !_TERMIOS_H_ */ + +#ifndef _POSIX_SOURCE +#include <sys/ttycom.h> +#include <sys/ttydefaults.h> +#endif Modified: projects/ppc64/lib/libc/compat-43/Makefile.inc ============================================================================== --- projects/ppc64/lib/libc/compat-43/Makefile.inc Sun Nov 29 17:35:31 2009 (r199902) +++ projects/ppc64/lib/libc/compat-43/Makefile.inc Sun Nov 29 17:44:44 2009 (r199903) @@ -13,6 +13,11 @@ MAN+= creat.2 killpg.2 sigpause.2 sigset MAN+= gethostid.3 setruid.3 MLINKS+=gethostid.3 sethostid.3 +MLINKS+=sigpause.2 sighold.2 +MLINKS+=sigpause.2 sigignore.2 +MLINKS+=sigpause.2 sigrelse.2 +MLINKS+=sigpause.2 sigset.2 +MLINKS+=sigpause.2 xsi_sigpause.2 MLINKS+=setruid.3 setrgid.3 MLINKS+=sigsetmask.2 sigblock.2 Modified: projects/ppc64/lib/libc/compat-43/Symbol.map ============================================================================== --- projects/ppc64/lib/libc/compat-43/Symbol.map Sun Nov 29 17:35:31 2009 (r199902) +++ projects/ppc64/lib/libc/compat-43/Symbol.map Sun Nov 29 17:44:44 2009 (r199903) @@ -17,6 +17,14 @@ FBSD_1.0 { sigvec; }; +FBSD_1.2 { + sighold; + sigignore; + sigrelse; + sigset; + xsi_sigpause; +}; + FBSDprivate_1.0 { __creat; _creat; Modified: projects/ppc64/lib/libc/compat-43/sigcompat.c ============================================================================== --- projects/ppc64/lib/libc/compat-43/sigcompat.c Sun Nov 29 17:35:31 2009 (r199902) +++ projects/ppc64/lib/libc/compat-43/sigcompat.c Sun Nov 29 17:44:44 2009 (r199903) @@ -36,6 +36,7 @@ __FBSDID("$FreeBSD$"); #include "namespace.h" #include <sys/param.h> #include <signal.h> +#include <string.h> #include "un-namespace.h" #include "libc_private.h" @@ -97,8 +98,7 @@ sigblock(mask) } int -sigpause(mask) - int mask; +sigpause(int mask) { sigset_t set; @@ -106,3 +106,84 @@ sigpause(mask) set.__bits[0] = mask; return (_sigsuspend(&set)); } + +int +xsi_sigpause(int sig) +{ + sigset_t set; + + sigemptyset(&set); + sigaddset(&set, sig); + return (_sigsuspend(&set)); +} + +int +sighold(int sig) +{ + sigset_t set; + + sigemptyset(&set); + sigaddset(&set, sig); + return (_sigprocmask(SIG_BLOCK, &set, NULL)); +} + +int +sigignore(int sig) +{ + struct sigaction sa; + + bzero(&sa, sizeof(sa)); + sa.sa_handler = SIG_IGN; + return (_sigaction(sig, &sa, NULL)); +} + +int +sigrelse(int sig) +{ + sigset_t set; + + sigemptyset(&set); + sigaddset(&set, sig); + return (_sigprocmask(SIG_UNBLOCK, &set, NULL)); +} + +void +(*sigset(int sig, void (*disp)(int)))(int) +{ + sigset_t set, pset; + struct sigaction sa, psa; + int error; + + sigemptyset(&set); + sigaddset(&set, sig); + error = _sigprocmask(SIG_BLOCK, NULL, &pset); + if (error == -1) + return (SIG_ERR); + if ((__sighandler_t *)disp == SIG_HOLD) { + error = _sigprocmask(SIG_BLOCK, &set, &pset); + if (error == -1) + return (SIG_ERR); + if (sigismember(&pset, sig)) + return (SIG_HOLD); + else { + error = _sigaction(sig, NULL, &psa); + if (error == -1) + return (SIG_ERR); + return (psa.sa_handler); + } + } else { + error = _sigprocmask(SIG_UNBLOCK, &set, &pset); + if (error == -1) + return (SIG_ERR); + } + + bzero(&sa, sizeof(sa)); + sa.sa_handler = disp; + error = _sigaction(sig, &sa, &psa); + if (error == -1) + return (SIG_ERR); + if (sigismember(&pset, sig)) + return (SIG_HOLD); + else + return (psa.sa_handler); +} Modified: projects/ppc64/lib/libc/compat-43/sigpause.2 ============================================================================== --- projects/ppc64/lib/libc/compat-43/sigpause.2 Sun Nov 29 17:35:31 2009 (r199902) +++ projects/ppc64/lib/libc/compat-43/sigpause.2 Sun Nov 29 17:44:44 2009 (r199903) @@ -28,21 +28,118 @@ .\" @(#)sigpause.2 8.1 (Berkeley) 6/2/93 .\" $FreeBSD$ .\" +.\" Part of the content of the man page was derived from +.\" The Open Group Base Specifications Issue 7 +.\" IEEE Std 1003.1-2008 +.\" .Dd June 2, 1993 .Dt SIGPAUSE 2 .Os .Sh NAME -.Nm sigpause -.Nd atomically release blocked signals and wait for interrupt +.Nm sighold , +.Nm sigignore , +.Nm sigpause , +.Nm sigrelse , +.Nm sigset +.Nd legacy interface for signal management .Sh LIBRARY .Lb libc .Sh SYNOPSIS .In signal.h .Ft int +.Fn sighold "int sig" +.Ft int +.Fn sigignore "int sig" +.Ft int +.Fn xsi_sigpause "int sigmask" +.Ft int +.Fn sigrelse "int sig" +.Ft void (*)(int) +.Fn sigset "int" "void (*disp)(int)" +.Ft int .Fn sigpause "int sigmask" .Sh DESCRIPTION .Sy This interface is made obsolete by -.Xr sigsuspend 2 . +.Xr sigsuspend 2 +.Sy and +.Xr sigaction 2 +.Pp +The +.Fn sigset +function modifies signal dispositions. +The +.Fa sig +argument specifies the signal, which may be any signal except +.Dv SIGKILL +and +.Dv SIGSTOP . +The +.Fa disp +argument specifies the signal's disposition, +which may be +.Dv SIG_DFL , +.Dv SIG_IGN , +or the address of a signal handler. +If +.Fn sigset +is used, and +.Fa disp +is the address of a signal handler, the +system adds +.Fa sig +to the signal mask of the calling process before executing the signal +handler; when the signal handler returns, the system restores the +signal mask of the calling process to its state prior to the delivery +of the signal. +In addition, if +.Fn sigset +is used, and +.Fa disp +is equal to +.Dv SIG_HOLD , +.Fa sig +is added to the signal +mask of the calling process and +.Fa sig 's +disposition remains unchanged. +If +.Fn sigset +is used, and +.Fa disp +is not equal to +.Dv SIG_HOLD , +.Fa sig +is removed from the signal mask of the calling process. +.Pp +The +.Fn sighold +function adds +.Fa sig +to the signal mask of the calling process. +.Pp +The +.Fn sigrelse +function removes +.Fa sig +from the signal mask of the calling process. +.Pp +The +.Fn sigignore +function sets the disposition of +.Fa sig +to +.Dv SIG_IGN . +.Pp +The +.Fn xsi_sigpause +function removes +.Fa sig +from the signal mask of the calling process and suspend the calling process +until a signal is received. +The +.Fn xsi_sigpause +function restores the signal mask of the process to its original state before +returning. .Pp The .Fn sigpause @@ -57,13 +154,47 @@ The argument is usually 0 to indicate that no signals are to be blocked. +.Sh RETURN VALUES The .Fn sigpause -function -always terminates by being interrupted, returning -1 with +and +.Fn xsi_sigpause +functions +always terminate by being interrupted, returning -1 with .Va errno set to -.Er EINTR +.Er EINTR . +.Pp +Upon successful completion, +.Fn sigset +returns +.Dv SIG_HOLD +if the signal had been blocked and the signal's previous disposition if +it had not been blocked. +Otherwise, +.Dv SIG_ERR is returned and +.Va errno +set to indicate the error. +.Pp +For all other functions, upon successful completion, 0 is returned. +Otherwise, -1 is returned and +.Va errno +is set to indicate the error: +.Bl -tag -width Er +.It Bq Er EINVAL +The +.Fa sig +argument +is not a valid signal number. +.It Bq Er EINVAL +For +.Fn sigset +and +.Fn sigignore +functions, an attempt was made to catch or ignore +.Dv SIGKILL +or +.Dv SIGSTOP . .Sh SEE ALSO .Xr kill 2 , .Xr sigaction 2 , @@ -85,9 +216,26 @@ and was copied from there into the .Pq Tn XSI option of .St -p1003.1-2001 . +.Fx +implements it under the name +.Fn xsi_sigpause . +The +.Fn sighold , +.Fn sigignore , +.Fn sigrelse +and +.Fn sigset +functions are implemented for compatibility with +.Sy System V +and +.Sy XSI +interfaces. .Sh HISTORY The .Fn sigpause function appeared in .Bx 4.2 and has been deprecated. +All other functions appeared in +.Fx 9.0 +and were deprecated before being implemented. Modified: projects/ppc64/lib/libc/gen/exec.c ============================================================================== --- projects/ppc64/lib/libc/gen/exec.c Sun Nov 29 17:35:31 2009 (r199902) +++ projects/ppc64/lib/libc/gen/exec.c Sun Nov 29 17:44:44 2009 (r199903) @@ -209,7 +209,7 @@ execvPe(name, path, argv, envp) bcopy(name, buf + lp + 1, ln); buf[lp + ln + 1] = '\0'; -retry: (void)_execve(bp, argv, environ); +retry: (void)_execve(bp, argv, envp); switch (errno) { case E2BIG: goto done; @@ -228,7 +228,7 @@ retry: (void)_execve(bp, argv, environ) memp[0] = "sh"; memp[1] = bp; bcopy(argv + 1, memp + 2, cnt * sizeof(char *)); - (void)_execve(_PATH_BSHELL, memp, environ); + (void)_execve(_PATH_BSHELL, memp, envp); goto done; case ENOMEM: goto done; Modified: projects/ppc64/lib/libc/gen/fts.3 ============================================================================== --- projects/ppc64/lib/libc/gen/fts.3 Sun Nov 29 17:35:31 2009 (r199902) +++ projects/ppc64/lib/libc/gen/fts.3 Sun Nov 29 17:44:44 2009 (r199903) @@ -28,7 +28,7 @@ .\" @(#)fts.3 8.5 (Berkeley) 4/16/94 .\" $FreeBSD$ .\" -.Dd October 5, 2009 +.Dd November 25, 2009 .Dt FTS 3 .Os .Sh NAME @@ -198,10 +198,9 @@ A directory being visited in post-order. The contents of the .Vt FTSENT structure will be unchanged from when -it was returned in pre-order, i.e., with the +the directory was visited in pre-order, except for the .Fa fts_info -field set to -.Dv FTS_D . +field. .It Dv FTS_ERR This is an error return, and the .Fa fts_errno Modified: projects/ppc64/lib/libc/gen/fts.c ============================================================================== --- projects/ppc64/lib/libc/gen/fts.c Sun Nov 29 17:35:31 2009 (r199902) +++ projects/ppc64/lib/libc/gen/fts.c Sun Nov 29 17:44:44 2009 (r199903) @@ -842,11 +842,8 @@ mem1: saved_errno = errno; * 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 (ISSET(FTS_NOCHDIR)) + sp->fts_path[cur->fts_pathlen] = '\0'; /* * If descended after called from fts_children or after called from Modified: projects/ppc64/lib/libc/gen/getcap.c ============================================================================== --- projects/ppc64/lib/libc/gen/getcap.c Sun Nov 29 17:35:31 2009 (r199902) +++ projects/ppc64/lib/libc/gen/getcap.c Sun Nov 29 17:44:44 2009 (r199903) @@ -647,7 +647,7 @@ int cgetnext(char **bp, char **db_array) { size_t len; - int done, hadreaderr, i, savederrno, status; + int done, hadreaderr, savederrno, status; char *cp, *line, *rp, *np, buf[BSIZE], nbuf[BSIZE]; u_int dummy; @@ -658,7 +658,7 @@ cgetnext(char **bp, char **db_array) (void)cgetclose(); return (-1); } - for(;;) { + for (;;) { if (toprec && !gottoprec) { gottoprec = 1; line = toprec; @@ -709,7 +709,6 @@ cgetnext(char **bp, char **db_array) /* * Line points to a name line. */ - i = 0; done = 0; np = nbuf; for (;;) { Modified: projects/ppc64/lib/libc/gen/getusershell.c ============================================================================== --- projects/ppc64/lib/libc/gen/getusershell.c Sun Nov 29 17:35:31 2009 (r199902) +++ projects/ppc64/lib/libc/gen/getusershell.c Sun Nov 29 17:44:44 2009 (r199903) @@ -124,7 +124,7 @@ _local_initshells(rv, cb_data, ap) if ((fp = fopen(_PATH_SHELLS, "r")) == NULL) return NS_UNAVAIL; - sp = cp = line; + cp = line; while (fgets(cp, MAXPATHLEN + 1, fp) != NULL) { while (*cp != '#' && *cp != '/' && *cp != '\0') cp++; Modified: projects/ppc64/lib/libc/gen/wordexp.c ============================================================================== --- projects/ppc64/lib/libc/gen/wordexp.c Sun Nov 29 17:35:31 2009 (r199902) +++ projects/ppc64/lib/libc/gen/wordexp.c Sun Nov 29 17:44:44 2009 (r199903) @@ -320,7 +320,7 @@ we_check(const char *words, int flags) if (c == '\0' || level != 0) return (WRDE_SYNTAX); } else - c = *--words; + --words; break; default: break; Modified: projects/ppc64/lib/libc/net/sctp_send.3 ============================================================================== --- projects/ppc64/lib/libc/net/sctp_send.3 Sun Nov 29 17:35:31 2009 (r199902) +++ projects/ppc64/lib/libc/net/sctp_send.3 Sun Nov 29 17:44:44 2009 (r199903) @@ -111,7 +111,7 @@ The argument is an opaque 32 bit value that is passed transparently through the stack to the peer endpoint. It will be available on reception of a message (see -.Xr sctp_recvmsg 2 ) . +.Xr sctp_recvmsg 3 ) . Note that the stack passes this value without regard to byte order. .Pp Modified: projects/ppc64/lib/libc/net/sctp_sendmsg.3 ============================================================================== --- projects/ppc64/lib/libc/net/sctp_sendmsg.3 Sun Nov 29 17:35:31 2009 (r199902) +++ projects/ppc64/lib/libc/net/sctp_sendmsg.3 Sun Nov 29 17:44:44 2009 (r199903) @@ -103,13 +103,13 @@ is set to the message is not transmitted. .Pp No indication of failure to deliver is implicit in a -.Xr sctp_sendmsg 2 +.Xr sctp_sendmsg 3 call. Locally detected errors are indicated by a return value of -1. .Pp If no space is available at the socket to hold the message to be transmitted, then -.Xr sctp_sendmsg 2 +.Xr sctp_sendmsg 3 normally blocks, unless the socket has been placed in non-blocking I/O mode. The @@ -123,7 +123,7 @@ argument is an opaque 32 bit value that through the stack to the peer endpoint. It will be available on reception of a message (see -.Xr sctp_recvmsg 2 ) . +.Xr sctp_recvmsg 3 ) . Note that the stack passes this value without regard to byte order. .Pp Modified: projects/ppc64/lib/libc/rpc/clnt_raw.c ============================================================================== --- projects/ppc64/lib/libc/rpc/clnt_raw.c Sun Nov 29 17:35:31 2009 (r199902) +++ projects/ppc64/lib/libc/rpc/clnt_raw.c Sun Nov 29 17:44:44 2009 (r199903) @@ -92,13 +92,13 @@ clnt_raw_create(prog, vers) rpcprog_t prog; rpcvers_t vers; { - struct clntraw_private *clp = clntraw_private; + struct clntraw_private *clp; struct rpc_msg call_msg; - XDR *xdrs = &clp->xdr_stream; - CLIENT *client = &clp->client_object; + XDR *xdrs; + CLIENT *client; *** DIFF OUTPUT TRUNCATED AT 1000 LINES ***