CVS commit: src/sys/netinet
Module Name:src Committed By: christos Date: Sat Aug 27 09:05:55 UTC 2011 Modified Files: src/sys/netinet: if_arp.c Log Message: Add 3 logging sysctls for arp from freebsd: 1. log_movements: do you want to log the arp overwritten message or not? 2. log_wrong_iface: do you want to log when an arp arrives at the wrong interface? 3. log_permanent_modify: do you want to log when an arp message attempts to overwrite a static entry? I did not call the sysctls log_arp like FreeBSD does, because we already have an arp sysctl level. The default is on for all three of them. To generate a diff of this commit: cvs rdiff -u -r1.151 -r1.152 src/sys/netinet/if_arp.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/netinet/if_arp.c diff -u src/sys/netinet/if_arp.c:1.151 src/sys/netinet/if_arp.c:1.152 --- src/sys/netinet/if_arp.c:1.151 Tue May 3 12:00:29 2011 +++ src/sys/netinet/if_arp.c Sat Aug 27 05:05:54 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: if_arp.c,v 1.151 2011/05/03 16:00:29 dyoung Exp $ */ +/* $NetBSD: if_arp.c,v 1.152 2011/08/27 09:05:54 christos Exp $ */ /*- * Copyright (c) 1998, 2000, 2008 The NetBSD Foundation, Inc. @@ -68,7 +68,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: if_arp.c,v 1.151 2011/05/03 16:00:29 dyoung Exp $); +__KERNEL_RCSID(0, $NetBSD: if_arp.c,v 1.152 2011/08/27 09:05:54 christos Exp $); #include opt_ddb.h #include opt_inet.h @@ -191,6 +191,10 @@ static int arp_drainwanted; +static int log_movements = 1; +static int log_permanent_modify = 1; +static int log_wrong_iface = 1; + /* * this should be elsewhere. */ @@ -1085,6 +1089,8 @@ memcmp(ar_sha(ah), CLLADDR(sdl), sdl-sdl_alen)) { if (rt-rt_flags RTF_STATIC) { ARP_STATINC(ARP_STAT_RCVOVERPERM); +if (!log_permanent_modify) + goto out; log(LOG_INFO, %s tried to overwrite permanent arp info for %s\n, @@ -1093,6 +1099,8 @@ goto out; } else if (rt-rt_ifp != ifp) { ARP_STATINC(ARP_STAT_RCVOVERINT); +if (!log_wrong_iface) + goto out; log(LOG_INFO, %s on %s tried to overwrite arp info for %s on %s\n, @@ -1102,10 +1110,12 @@ goto out; } else { ARP_STATINC(ARP_STAT_RCVOVER); -log(LOG_INFO, -arp info overwritten for %s by %s\n, -in_fmtaddr(isaddr), -lla_snprintf(ar_sha(ah), ah-ar_hln)); +if (log_movements) + log(LOG_INFO, arp info overwritten + for %s by %s\n, + in_fmtaddr(isaddr), + lla_snprintf(ar_sha(ah), + ah-ar_hln)); } } /* @@ -1641,21 +1651,21 @@ sysctl_createv(clog, 0, NULL, NULL, CTLFLAG_PERMANENT|CTLFLAG_READWRITE, CTLTYPE_INT, prune, - SYSCTL_DESCR(ARP cache pruning interval), + SYSCTL_DESCR(ARP cache pruning interval in seconds), NULL, 0, arpt_prune, 0, CTL_NET,PF_INET, node-sysctl_num, CTL_CREATE, CTL_EOL); sysctl_createv(clog, 0, NULL, NULL, CTLFLAG_PERMANENT|CTLFLAG_READWRITE, CTLTYPE_INT, keep, - SYSCTL_DESCR(Valid ARP entry lifetime), + SYSCTL_DESCR(Valid ARP entry lifetime in seconds), NULL, 0, arpt_keep, 0, CTL_NET,PF_INET, node-sysctl_num, CTL_CREATE, CTL_EOL); sysctl_createv(clog, 0, NULL, NULL, CTLFLAG_PERMANENT|CTLFLAG_READWRITE, CTLTYPE_INT, down, - SYSCTL_DESCR(Failed ARP entry lifetime), + SYSCTL_DESCR(Failed ARP entry lifetime in seconds), NULL, 0, arpt_down, 0, CTL_NET,PF_INET, node-sysctl_num, CTL_CREATE, CTL_EOL); @@ -1672,6 +1682,30 @@ SYSCTL_DESCR(ARP statistics), sysctl_net_inet_arp_stats, 0, NULL, 0, CTL_NET,PF_INET, node-sysctl_num, CTL_CREATE, CTL_EOL); + + sysctl_createv(clog, 0, NULL, NULL, + CTLFLAG_PERMANENT|CTLFLAG_READWRITE, + CTLTYPE_INT, log_movements, + SYSCTL_DESCR(log ARP replies from MACs different than + the one in the cache), + NULL, 0, log_movements, 0, + CTL_NET,PF_INET, node-sysctl_num, CTL_CREATE, CTL_EOL); + + sysctl_createv(clog, 0, NULL, NULL, + CTLFLAG_PERMANENT|CTLFLAG_READWRITE, + CTLTYPE_INT, log_permanent_modify, + SYSCTL_DESCR(log ARP replies from MACs different than + the one in the permanent arp entry), + NULL, 0, log_permanent_modify, 0, + CTL_NET,PF_INET, node-sysctl_num, CTL_CREATE, CTL_EOL); + + sysctl_createv(clog, 0, NULL, NULL, + CTLFLAG_PERMANENT|CTLFLAG_READWRITE, + CTLTYPE_INT, log_wrong_iface, + SYSCTL_DESCR(log ARP packets arriving on the wrong + interface), + NULL, 0, log_wrong_iface, 0, + CTL_NET,PF_INET, node-sysctl_num, CTL_CREATE, CTL_EOL); } #endif /* INET */
CVS commit: src/share/man/man7
Module Name:src Committed By: christos Date: Sat Aug 27 09:06:59 UTC 2011 Modified Files: src/share/man/man7: sysctl.7 Log Message: add new arp logging sysctls To generate a diff of this commit: cvs rdiff -u -r1.64 -r1.65 src/share/man/man7/sysctl.7 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/share/man/man7/sysctl.7 diff -u src/share/man/man7/sysctl.7:1.64 src/share/man/man7/sysctl.7:1.65 --- src/share/man/man7/sysctl.7:1.64 Thu Jun 23 16:55:08 2011 +++ src/share/man/man7/sysctl.7 Sat Aug 27 05:06:58 2011 @@ -1,4 +1,4 @@ -.\ $NetBSD: sysctl.7,v 1.64 2011/06/23 20:55:08 wiz Exp $ +.\ $NetBSD: sysctl.7,v 1.65 2011/08/27 09:06:58 christos Exp $ .\ .\ Copyright (c) 1993 .\ The Regents of the University of California. All rights reserved. @@ -29,7 +29,7 @@ .\ .\ @(#)sysctl.3 8.4 (Berkeley) 5/9/95 .\ -.Dd March 18, 2011 +.Dd August 27, 2011 .Dt SYSCTL 7 .Os .Sh NAME @@ -1164,6 +1164,9 @@ .It Sy Protocol name Variable name Type Changeable .It arp down integer yes .It arp keep integer yes +.It arp log_movements integer yes +.It arp log_permanent_modify integer yes +.It arp log_wrong_iface integer yes .It arp prune integer yes .It arp refresh integer yes .It carp allow integer yes
CVS commit: src/sys
Module Name:src Committed By: christos Date: Sat Aug 27 09:11:53 UTC 2011 Modified Files: src/sys/kern: sysv_shm.c src/sys/uvm: uvm_extern.h uvm_object.c Log Message: Add an optional pglist argument to uvm_obj_wirepages, to be filled with the list of pages that were wired. To generate a diff of this commit: cvs rdiff -u -r1.121 -r1.122 src/sys/kern/sysv_shm.c cvs rdiff -u -r1.174 -r1.175 src/sys/uvm/uvm_extern.h cvs rdiff -u -r1.10 -r1.11 src/sys/uvm/uvm_object.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/kern/sysv_shm.c diff -u src/sys/kern/sysv_shm.c:1.121 src/sys/kern/sysv_shm.c:1.122 --- src/sys/kern/sysv_shm.c:1.121 Sat Jul 30 02:19:02 2011 +++ src/sys/kern/sysv_shm.c Sat Aug 27 05:11:52 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: sysv_shm.c,v 1.121 2011/07/30 06:19:02 uebayasi Exp $ */ +/* $NetBSD: sysv_shm.c,v 1.122 2011/08/27 09:11:52 christos Exp $ */ /*- * Copyright (c) 1999, 2007 The NetBSD Foundation, Inc. @@ -61,7 +61,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: sysv_shm.c,v 1.121 2011/07/30 06:19:02 uebayasi Exp $); +__KERNEL_RCSID(0, $NetBSD: sysv_shm.c,v 1.122 2011/08/27 09:11:52 christos Exp $); #define SYSVSHM @@ -268,7 +268,7 @@ (shmseg-shm_perm.mode SHMSEG_WIRED) == 0) { /* Wire the object and map, then tag it */ error = uvm_obj_wirepages(shmseg-_shm_internal, - 0, size); + 0, size, NULL); if (error) return EIO; error = uvm_map_pageable(p-p_vmspace-vm_map, @@ -734,7 +734,7 @@ shmseg-_shm_internal = uao_create(size, 0); if (lockmem) { /* Wire the pages and tag it */ - error = uvm_obj_wirepages(shmseg-_shm_internal, 0, size); + error = uvm_obj_wirepages(shmseg-_shm_internal, 0, size, NULL); if (error) { uao_detach(shmseg-_shm_internal); mutex_enter(shm_lock); Index: src/sys/uvm/uvm_extern.h diff -u src/sys/uvm/uvm_extern.h:1.174 src/sys/uvm/uvm_extern.h:1.175 --- src/sys/uvm/uvm_extern.h:1.174 Thu Jun 16 05:21:03 2011 +++ src/sys/uvm/uvm_extern.h Sat Aug 27 05:11:53 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: uvm_extern.h,v 1.174 2011/06/16 09:21:03 hannken Exp $ */ +/* $NetBSD: uvm_extern.h,v 1.175 2011/08/27 09:11:53 christos Exp $ */ /* * Copyright (c) 1997 Charles D. Cranor and Washington University. @@ -706,7 +706,8 @@ const struct uvm_pagerops *, bool, u_int); void uvm_obj_setlock(struct uvm_object *, kmutex_t *); void uvm_obj_destroy(struct uvm_object *, bool); -int uvm_obj_wirepages(struct uvm_object *, off_t, off_t); +int uvm_obj_wirepages(struct uvm_object *, off_t, off_t, + struct pglist *); void uvm_obj_unwirepages(struct uvm_object *, off_t, off_t); /* uvm_page.c */ Index: src/sys/uvm/uvm_object.c diff -u src/sys/uvm/uvm_object.c:1.10 src/sys/uvm/uvm_object.c:1.11 --- src/sys/uvm/uvm_object.c:1.10 Sat Jun 18 17:14:43 2011 +++ src/sys/uvm/uvm_object.c Sat Aug 27 05:11:53 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: uvm_object.c,v 1.10 2011/06/18 21:14:43 rmind Exp $ */ +/* $NetBSD: uvm_object.c,v 1.11 2011/08/27 09:11:53 christos Exp $ */ /* * Copyright (c) 2006, 2010 The NetBSD Foundation, Inc. @@ -37,7 +37,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: uvm_object.c,v 1.10 2011/06/18 21:14:43 rmind Exp $); +__KERNEL_RCSID(0, $NetBSD: uvm_object.c,v 1.11 2011/08/27 09:11:53 christos Exp $); #include opt_ddb.h @@ -123,7 +123,8 @@ * = caller must pass page-aligned start and end values */ int -uvm_obj_wirepages(struct uvm_object *uobj, off_t start, off_t end) +uvm_obj_wirepages(struct uvm_object *uobj, off_t start, off_t end, +struct pglist *list) { int i, npages, error; struct vm_page *pgs[FETCH_PAGECOUNT], *pg = NULL; @@ -177,6 +178,8 @@ mutex_enter(uvm_pageqlock); for (i = 0; i npages; i++) { uvm_pagewire(pgs[i]); + if (list != NULL) +TAILQ_INSERT_TAIL(list, pgs[i], pageq.queue); } mutex_exit(uvm_pageqlock);
CVS commit: src/sys/arch/i386/conf
Module Name:src Committed By: mbalmer Date: Sat Aug 27 09:28:56 UTC 2011 Modified Files: src/sys/arch/i386/conf: GENERIC Log Message: Enable some gpio devices. To generate a diff of this commit: cvs rdiff -u -r1.1048 -r1.1049 src/sys/arch/i386/conf/GENERIC Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/i386/conf/GENERIC diff -u src/sys/arch/i386/conf/GENERIC:1.1048 src/sys/arch/i386/conf/GENERIC:1.1049 --- src/sys/arch/i386/conf/GENERIC:1.1048 Thu Aug 18 20:55:20 2011 +++ src/sys/arch/i386/conf/GENERIC Sat Aug 27 09:28:55 2011 @@ -1,4 +1,4 @@ -# $NetBSD: GENERIC,v 1.1048 2011/08/18 20:55:20 jakllsch Exp $ +# $NetBSD: GENERIC,v 1.1049 2011/08/27 09:28:55 mbalmer Exp $ # # GENERIC machine description file # @@ -22,7 +22,7 @@ options INCLUDE_CONFIG_FILE # embed config file in kernel binary -#ident GENERIC-$Revision: 1.1048 $ +#ident GENERIC-$Revision: 1.1049 $ maxusers 64 # estimated number of users @@ -456,7 +456,7 @@ gcscpcib* at pci? dev ? function ? # AMD CS5535/CS5536 PCI-ISA w/ gpio* at gcscpcib? # timecounter, watchdog and GPIO #piixpcib* at pci? dev ? function ? # Intel PIIX4 PCI-ISA w/ SpeedStep -#gscpcib* at pci? dev ? function ? # NS Geode PCI-ISA w/ GPIO support +gscpcib* at pci? dev ? function ? # NS Geode SC1100 PCI-ISA w/ GPIO viapcib* at pci? dev ? function ? # VIA VT8235 PCI-ISA w/ SMBus support iic* at viapcib? rdcpcib* at pci? dev ? function ? # RDC Vortex86/PMX-1000 PCI-ISA w/ @@ -706,16 +706,20 @@ dpti* at iop? tid 0 # DPT/Adaptec control interface # GPIO devices -#gpio* at gscpcib? +gpio* at gscpcib? #gpio* at gpiosim? # 1-Wire support #gpioow* at gpio? offset ? mask ? # 1-wire bitbanging via gpio -#gpioow* at gpio? -#onewire* at gpioow? +gpioow* at gpio? +onewire* at gpioow? # 1-Wire devices -#owtemp* at onewire? # Temperature sensors +owtemp* at onewire? # Temperature sensors + +# i2c support +gpioiic* at gpio? +iic* at gpioiic? # Keylock support #gpiolock* at gpio?
CVS commit: src/sys/arch
Module Name:src Committed By: christos Date: Sat Aug 27 09:32:12 UTC 2011 Modified Files: src/sys/arch/i386/eisa: eisa_machdep.c src/sys/arch/i386/mca: mca_machdep.c src/sys/arch/x86/isa: isa_machdep.c src/sys/arch/x86/pci: pci_machdep.c src/sys/arch/xen/xen: isa_machdep.c xpci_xenbus.c Log Message: use c99 struct initializers To generate a diff of this commit: cvs rdiff -u -r1.35 -r1.36 src/sys/arch/i386/eisa/eisa_machdep.c cvs rdiff -u -r1.41 -r1.42 src/sys/arch/i386/mca/mca_machdep.c cvs rdiff -u -r1.28 -r1.29 src/sys/arch/x86/isa/isa_machdep.c cvs rdiff -u -r1.45 -r1.46 src/sys/arch/x86/pci/pci_machdep.c cvs rdiff -u -r1.24 -r1.25 src/sys/arch/xen/xen/isa_machdep.c cvs rdiff -u -r1.6 -r1.7 src/sys/arch/xen/xen/xpci_xenbus.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/i386/eisa/eisa_machdep.c diff -u src/sys/arch/i386/eisa/eisa_machdep.c:1.35 src/sys/arch/i386/eisa/eisa_machdep.c:1.36 --- src/sys/arch/i386/eisa/eisa_machdep.c:1.35 Fri Jul 1 14:14:15 2011 +++ src/sys/arch/i386/eisa/eisa_machdep.c Sat Aug 27 05:32:12 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: eisa_machdep.c,v 1.35 2011/07/01 18:14:15 dyoung Exp $ */ +/* $NetBSD: eisa_machdep.c,v 1.36 2011/08/27 09:32:12 christos Exp $ */ /*- * Copyright (c) 1997, 1998 The NetBSD Foundation, Inc. @@ -65,7 +65,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: eisa_machdep.c,v 1.35 2011/07/01 18:14:15 dyoung Exp $); +__KERNEL_RCSID(0, $NetBSD: eisa_machdep.c,v 1.36 2011/08/27 09:32:12 christos Exp $); #include ioapic.h @@ -93,26 +93,29 @@ * of these funcions. */ struct x86_bus_dma_tag eisa_bus_dma_tag = { - 0, /* _tag_needs_free */ - 0, /* _bounce_thresh */ - 0, /* _bounce_alloc_lo */ - 0, /* _bounce_alloc_hi */ - NULL, /* _may_bounce */ - _bus_dmamap_create, - _bus_dmamap_destroy, - _bus_dmamap_load, - _bus_dmamap_load_mbuf, - _bus_dmamap_load_uio, - _bus_dmamap_load_raw, - _bus_dmamap_unload, - NULL, /* _dmamap_sync */ - _bus_dmamem_alloc, - _bus_dmamem_free, - _bus_dmamem_map, - _bus_dmamem_unmap, - _bus_dmamem_mmap, - _bus_dmatag_subregion, - _bus_dmatag_destroy, + ._tag_needs_free = 0, + ._bounce_thresh = 0, + ._bounce_alloc_lo = 0, + ._bounce_alloc_hi = 0, + ._may_bounce = NULL, + + ._dmamap_create = _bus_dmamap_create, + ._dmamap_destroy = _bus_dmamap_destroy, + ._dmamap_load = _bus_dmamap_load, + ._dmamap_load_mbuf = _bus_dmamap_load_mbuf, + ._dmamap_load_uio = _bus_dmamap_load_uio, + ._dmamap_load_raw = _bus_dmamap_load_raw, + ._dmamap_unload = _bus_dmamap_unload, + ._dmamap_sync = NULL, + + ._dmamem_alloc = _bus_dmamem_alloc, + ._dmamem_free = _bus_dmamem_free, + ._dmamem_map = _bus_dmamem_map, + ._dmamem_unmap = _bus_dmamem_unmap, + ._dmamem_mmap = _bus_dmamem_mmap, + + ._dmatag_subregion = _bus_dmatag_subregion, + ._dmatag_destroy = _bus_dmatag_destroy, }; void Index: src/sys/arch/i386/mca/mca_machdep.c diff -u src/sys/arch/i386/mca/mca_machdep.c:1.41 src/sys/arch/i386/mca/mca_machdep.c:1.42 --- src/sys/arch/i386/mca/mca_machdep.c:1.41 Fri Jul 1 14:14:15 2011 +++ src/sys/arch/i386/mca/mca_machdep.c Sat Aug 27 05:32:12 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: mca_machdep.c,v 1.41 2011/07/01 18:14:15 dyoung Exp $ */ +/* $NetBSD: mca_machdep.c,v 1.42 2011/08/27 09:32:12 christos Exp $ */ /*- * Copyright (c) 2000, 2001 The NetBSD Foundation, Inc. @@ -36,7 +36,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: mca_machdep.c,v 1.41 2011/07/01 18:14:15 dyoung Exp $); +__KERNEL_RCSID(0, $NetBSD: mca_machdep.c,v 1.42 2011/08/27 09:32:12 christos Exp $); #include sys/types.h #include sys/param.h @@ -101,26 +101,29 @@ #define MCA_DMA_BOUNCE_THRESHOLD (16 * 1024 * 1024) struct x86_bus_dma_tag mca_bus_dma_tag = { - 0, - MCA_DMA_BOUNCE_THRESHOLD, /* _bounce_thresh */ - 0, /* _bounce_alloc_lo */ - MCA_DMA_BOUNCE_THRESHOLD, /* _bounce_alloc_hi */ - NULL, /* _may_bounce */ - _bus_dmamap_create, - _bus_dmamap_destroy, - _bus_dmamap_load, - _bus_dmamap_load_mbuf, - _bus_dmamap_load_uio, - _bus_dmamap_load_raw, - _bus_dmamap_unload, - _bus_dmamap_sync, - _bus_dmamem_alloc, - _bus_dmamem_free, - _bus_dmamem_map, - _bus_dmamem_unmap, - _bus_dmamem_mmap, - _bus_dmatag_subregion, - _bus_dmatag_destroy, + ._tag_needs_free = 0, + ._bounce_thresh = MCA_DMA_BOUNCE_THRESHOLD, + ._bounce_alloc_lo = 0, + ._bounce_alloc_hi = MCA_DMA_BOUNCE_THRESHOLD, + ._may_bounce = NULL, + + ._dmamap_create = _bus_dmamap_create, + ._dmamap_destroy = _bus_dmamap_destroy, + ._dmamap_load = _bus_dmamap_load, + ._dmamap_load_mbuf = _bus_dmamap_load_mbuf, + ._dmamap_load_uio = _bus_dmamap_load_uio, + ._dmamap_load_raw = _bus_dmamap_load_raw, + ._dmamap_unload = _bus_dmamap_unload, + ._dmamap_sync = _bus_dmamap_sync, + + ._dmamem_alloc = _bus_dmamem_alloc, + ._dmamem_free = _bus_dmamem_free, + ._dmamem_map = _bus_dmamem_map, + ._dmamem_unmap =
CVS commit: src/sys
Module Name:src Committed By: bouyer Date: Sat Aug 27 12:47:49 UTC 2011 Modified Files: src/sys/arch/i386/conf: files.i386 Added Files: src/sys/arch/i386/pci: gcscpcib_pci.c src/sys/dev/ic: gcscpcib.c gcscpcibreg.h gcscpcibvar.h Removed Files: src/sys/arch/i386/pci: gcscpcib.c gcscpcibreg.h Log Message: Split gcscpcib into MI part, and MD pci attachement which is also in charge of attaching the MD pcib device. Will be used by the upcoming evbmips loongson support. To generate a diff of this commit: cvs rdiff -u -r1.360 -r1.361 src/sys/arch/i386/conf/files.i386 cvs rdiff -u -r1.8 -r0 src/sys/arch/i386/pci/gcscpcib.c cvs rdiff -u -r0 -r1.1 src/sys/arch/i386/pci/gcscpcib_pci.c cvs rdiff -u -r1.1 -r0 src/sys/arch/i386/pci/gcscpcibreg.h cvs rdiff -u -r0 -r1.1 src/sys/dev/ic/gcscpcib.c src/sys/dev/ic/gcscpcibreg.h \ src/sys/dev/ic/gcscpcibvar.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/i386/conf/files.i386 diff -u src/sys/arch/i386/conf/files.i386:1.360 src/sys/arch/i386/conf/files.i386:1.361 --- src/sys/arch/i386/conf/files.i386:1.360 Sun Jun 12 03:35:41 2011 +++ src/sys/arch/i386/conf/files.i386 Sat Aug 27 12:47:49 2011 @@ -1,4 +1,4 @@ -# $NetBSD: files.i386,v 1.360 2011/06/12 03:35:41 rmind Exp $ +# $NetBSD: files.i386,v 1.361 2011/08/27 12:47:49 bouyer Exp $ # # new style config file for i386 architecture # @@ -213,8 +213,9 @@ # AMD Geode CS5535/CS5536 PCI-ISA bridge device gcscpcib: isabus, sysmon_wdog, gpiobus -attach gcscpcib at pci -file arch/i386/pci/gcscpcib.c gcscpcib +attach gcscpcib at pci with gcscpcib_pci +file arch/i386/pci/gcscpcib_pci.c gcscpcib_pci +file dev/ic/gcscpcib.c gcscpcib device piixpcib: isabus, bioscall attach piixpcib at pci Added files: Index: src/sys/arch/i386/pci/gcscpcib_pci.c diff -u /dev/null src/sys/arch/i386/pci/gcscpcib_pci.c:1.1 --- /dev/null Sat Aug 27 12:47:49 2011 +++ src/sys/arch/i386/pci/gcscpcib_pci.c Sat Aug 27 12:47:49 2011 @@ -0,0 +1,108 @@ +/* $NetBSD: gcscpcib_pci.c,v 1.1 2011/08/27 12:47:49 bouyer Exp $ */ +/* $OpenBSD: gcscpcib.c,v 1.6 2007/11/17 17:02:47 mbalmer Exp $ */ + +/* + * Copyright (c) 2008 Yojiro UO y...@nui.org + * Copyright (c) 2007 Marc Balmer mbal...@openbsd.org + * Copyright (c) 2007 Michael Shalayeff + * All rights reserved. + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED AS IS AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER IN + * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT + * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +/* + * AMD CS5535/CS5536 series LPC bridge also containing timer, watchdog and GPIO. + * machine-dependent attachement. + */ +#include sys/cdefs.h +__KERNEL_RCSID(0, $NetBSD: gcscpcib_pci.c,v 1.1 2011/08/27 12:47:49 bouyer Exp $); + + +#include sys/param.h +#include sys/systm.h +#include sys/device.h +#include sys/gpio.h +#include sys/timetc.h +#include sys/wdog.h + +#include sys/bus.h + +#include dev/pci/pcireg.h +#include dev/pci/pcivar.h +#include dev/pci/pcidevs.h + +#include dev/gpio/gpiovar.h +#include dev/sysmon/sysmonvar.h +#include dev/ic/gcscpcibreg.h +#include dev/ic/gcscpcibvar.h + +#include machine/cpufunc.h +#include x86/pci/pcibvar.h + +struct gcscpcib_pci_softc { +/* we call pcibattach() which assumes softc starts like this: */ + struct pcib_softc sc_pcib; + /* MI gcscpcib datas */ + struct gcscpcib_softc sc_gcscpcib; +}; + +static int gcscpcib_pci_match(device_t, cfdata_t, void *); +static void gcscpcib_pci_attach(device_t, device_t, void *); + +CFATTACH_DECL_NEW(gcscpcib_pci, sizeof(struct gcscpcib_pci_softc), +gcscpcib_pci_match, gcscpcib_pci_attach, NULL, NULL); + + +static int +gcscpcib_pci_match(device_t parent, cfdata_t match, void *aux) +{ + struct pci_attach_args *pa = aux; + + if (PCI_CLASS(pa-pa_class) != PCI_CLASS_BRIDGE || + PCI_SUBCLASS(pa-pa_class) != PCI_SUBCLASS_BRIDGE_ISA) + return 0; + + switch (PCI_PRODUCT(pa-pa_id)) { + case PCI_PRODUCT_NS_CS5535_ISA: + case PCI_PRODUCT_AMD_CS5536_PCIB: + return 2; /* supersede pcib(4) */ + } + + return 0; +} + +static void +gcscpcib_pci_attach(device_t parent, device_t self, void *aux) +{ + struct gcscpcib_pci_softc *sc = device_private(self); + struct pci_attach_args *pa = (struct pci_attach_args *)aux; + + sc-sc_pcib.sc_pc = pa-pa_pc; + sc-sc_pcib.sc_tag = pa-pa_tag; + /* Attach the PCI-ISA bridge
CVS commit: src/bin/date
Module Name:src Committed By: joerg Date: Sat Aug 27 12:55:09 UTC 2011 Modified Files: src/bin/date: date.c Log Message: Annotate dead functions To generate a diff of this commit: cvs rdiff -u -r1.59 -r1.60 src/bin/date/date.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/bin/date/date.c diff -u src/bin/date/date.c:1.59 src/bin/date/date.c:1.60 --- src/bin/date/date.c:1.59 Sat Jan 29 02:16:52 2011 +++ src/bin/date/date.c Sat Aug 27 12:55:09 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: date.c,v 1.59 2011/01/29 02:16:52 christos Exp $ */ +/* $NetBSD: date.c,v 1.60 2011/08/27 12:55:09 joerg Exp $ */ /* * Copyright (c) 1985, 1987, 1988, 1993 @@ -40,7 +40,7 @@ #if 0 static char sccsid[] = @(#)date.c 8.2 (Berkeley) 4/28/95; #else -__RCSID($NetBSD: date.c,v 1.59 2011/01/29 02:16:52 christos Exp $); +__RCSID($NetBSD: date.c,v 1.60 2011/08/27 12:55:09 joerg Exp $); #endif #endif /* not lint */ @@ -66,11 +66,11 @@ static time_t tval; static int aflag, jflag, rflag, nflag; -static void badformat(void); -static void badtime(void); -static void badvalue(const char *); +__dead static void badformat(void); +__dead static void badtime(void); +__dead static void badvalue(const char *); static void setthetime(const char *); -static void usage(void) __attribute__((__noreturn__)); +__dead static void usage(void); int main(int argc, char *argv[])
CVS commit: src/sys/arch/mips/bonito
Module Name:src Committed By: bouyer Date: Sat Aug 27 12:59:17 UTC 2011 Modified Files: src/sys/arch/mips/bonito: bonito_pci.c bonitoreg.h bonitovar.h Log Message: Loongson2f support: - make the 'struct bonito_config' const, so that it can be in kernel text instead of data. - Add a bc_attach_hook to struct bonito_config, to be used as pc_attach_hook if not NULL. - Add some LS2-specific register defines (LS2f uses a modified bonito64). To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.10 src/sys/arch/mips/bonito/bonito_pci.c cvs rdiff -u -r1.6 -r1.7 src/sys/arch/mips/bonito/bonitoreg.h cvs rdiff -u -r1.4 -r1.5 src/sys/arch/mips/bonito/bonitovar.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/mips/bonito/bonito_pci.c diff -u src/sys/arch/mips/bonito/bonito_pci.c:1.9 src/sys/arch/mips/bonito/bonito_pci.c:1.10 --- src/sys/arch/mips/bonito/bonito_pci.c:1.9 Sun Jul 10 23:13:22 2011 +++ src/sys/arch/mips/bonito/bonito_pci.c Sat Aug 27 12:59:16 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: bonito_pci.c,v 1.9 2011/07/10 23:13:22 matt Exp $ */ +/* $NetBSD: bonito_pci.c,v 1.10 2011/08/27 12:59:16 bouyer Exp $ */ /*- * Copyright (c) 2001 The NetBSD Foundation, Inc. @@ -35,7 +35,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: bonito_pci.c,v 1.9 2011/07/10 23:13:22 matt Exp $); +__KERNEL_RCSID(0, $NetBSD: bonito_pci.c,v 1.10 2011/08/27 12:59:16 bouyer Exp $); #include sys/param.h #include sys/bus.h @@ -66,11 +66,14 @@ void bonito_conf_write(void *, pcitag_t, int, pcireg_t); void -bonito_pci_init(pci_chipset_tag_t pc, struct bonito_config *bc) +bonito_pci_init(pci_chipset_tag_t pc, const struct bonito_config *bc) { - pc-pc_conf_v = bc; - pc-pc_attach_hook = bonito_attach_hook; + pc-pc_conf_v = __UNCONST(bc); + if (bc-bc_attach_hook != NULL) + pc-pc_attach_hook = bc-bc_attach_hook; + else + pc-pc_attach_hook = bonito_attach_hook; pc-pc_bus_maxdevs = bonito_bus_maxdevs; pc-pc_make_tag = bonito_make_tag; pc-pc_decompose_tag = bonito_decompose_tag; Index: src/sys/arch/mips/bonito/bonitoreg.h diff -u src/sys/arch/mips/bonito/bonitoreg.h:1.6 src/sys/arch/mips/bonito/bonitoreg.h:1.7 --- src/sys/arch/mips/bonito/bonitoreg.h:1.6 Sat Dec 24 20:07:19 2005 +++ src/sys/arch/mips/bonito/bonitoreg.h Sat Aug 27 12:59:17 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: bonitoreg.h,v 1.6 2005/12/24 20:07:19 perry Exp $ */ +/* $NetBSD: bonitoreg.h,v 1.7 2011/08/27 12:59:17 bouyer Exp $ */ /* * Bonito Register Map @@ -22,7 +22,14 @@ #define BONITO(x) (BONITO_REG_BASE + (x)) + +#ifdef _LP64 +#define REGVAL(x) *((volatile u_int32_t *)MIPS_PHYS_TO_XKPHYS_UNCACHED(x)) +#define REGVAL8(x) *((volatile u_int8_t *)MIPS_PHYS_TO_XKPHYS_UNCACHED(x)) +#else #define REGVAL(x) *((volatile u_int32_t *) MIPS_PHYS_TO_KSEG1(x)) +#define REGVAL8(x) *((volatile u_int8_t *)MIPS_PHYS_TO_KSEG1(x)) +#endif #define BONITO_BOOT_BASE 0x1fc0 #define BONITO_BOOT_SIZE 0x0010 @@ -48,7 +55,11 @@ #define BONITO_PCIHI_BASE 0x2000 #define BONITO_PCIHI_SIZE 0x2000 #define BONITO_PCIHI_TOP (BONITO_PCIHI_BASE+BONITO_PCIHI_SIZE-1) +#define LS2F_PCIHI_BASE 0x4000UL +#define LS2F_PCIHI_SIZE 0x4000UL +#define LS2F_PCIHI_TOP (LS2F_PCIHI_BASE+LS2F_PCIHI_SIZE-1) #define BONITO_PCIIO_BASE 0x1fd0 +#define BONITO_PCIIO_LEGACY 0x4000UL #define BONITO_PCIIO_SIZE 0x0010 #define BONITO_PCIIO_TOP (BONITO_PCIIO_BASE+BONITO_PCIIO_SIZE-1) #define BONITO_PCICFG_BASE 0x1fe8 @@ -409,4 +420,105 @@ #define BONITO_TIMERCFG BONITO(BONITO_REGBASE + 0x60) + +/* + * Bonito interrupt assignments + */ + +/* + * Loongson 2F assignments + */ + +#define LOONGSON_INTR_GPIO0 0 +#define LOONGSON_INTR_GPIO1 1 +#define LOONGSON_INTR_GPIO2 2 +#define LOONGSON_INTR_GPIO3 3 + +/* pci interrupts */ +#define LOONGSON_INTR_PCIA 4 +#define LOONGSON_INTR_PCIB 5 +#define LOONGSON_INTR_PCIC 6 +#define LOONGSON_INTR_PCID 7 + +#define LOONGSON_INTR_PCI_PARERR 8 +#define LOONGSON_INTR_PCI_SYSERR 9 +#define LOONGSON_INTR_DRAM_PARERR 10 + +/* non-PCI interrupts */ +#define LOONGSON_INTR_INT0 11 +#define LOONGSON_INTR_INT1 12 +#define LOONGSON_INTR_INT2 13 +#define LOONGSON_INTR_INT3 14 + +#define LOONGSON_INTRMASK_GPIO0 0x0001 /* can't interrupt */ +#define LOONGSON_INTRMASK_GPIO1 0x0002 +#define LOONGSON_INTRMASK_GPIO2 0x0004 +#define LOONGSON_INTRMASK_GPIO3 0x0008 + +#define LOONGSON_INTRMASK_GPIO 0x000f + +/* pci interrupts */ +#define LOONGSON_INTRMASK_PCIA 0x0010 +#define LOONGSON_INTRMASK_PCIB 0x0020 +#define LOONGSON_INTRMASK_PCIC 0x0040 +#define LOONGSON_INTRMASK_PCID 0x0080 + +#define LOONGSON_INTRMASK_PCI_PARERR 0x0100 +#define LOONGSON_INTRMASK_PCI_SYSERR 0x0200 +#define LOONGSON_INTRMASK_DRAM_PARERR 0x0400 + +/* non-PCI interrupts */ +#define LOONGSON_INTRMASK_INT0 0x0800 +#define
CVS commit: src/external/gpl3/binutils/dist
Module Name:src Committed By: bouyer Date: Sat Aug 27 13:19:39 UTC 2011 Modified Files: src/external/gpl3/binutils/dist/gas/config: tc-mips.c src/external/gpl3/binutils/dist/gas/doc: c-mips.texi src/external/gpl3/binutils/dist/include/opcode: mips.h src/external/gpl3/binutils/dist/opcodes: mips-opc.c Log Message: Add a fix-loongson2f-btb option to gas, from OpenBSD. This works around a bug in the branch prediction logic of the CPU which can cause a hard hang. The existing fix-loongson2f-jump works around the same bug, but by 'fixing' the jump target to be within the same 256MB region as the kernel. This will (silently) cause a jump to the wrong address if the jump is intentionally to some other region (e.g. a call to pmon). fix-loongson2f-btb instead works around the issue by adding an explicit flush of the branch target buffer (via a write to a cop0 register) before every jump register instruction. To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/external/gpl3/binutils/dist/gas/config/tc-mips.c cvs rdiff -u -r1.3 -r1.4 src/external/gpl3/binutils/dist/gas/doc/c-mips.texi cvs rdiff -u -r1.3 -r1.4 \ src/external/gpl3/binutils/dist/include/opcode/mips.h cvs rdiff -u -r1.5 -r1.6 src/external/gpl3/binutils/dist/opcodes/mips-opc.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/external/gpl3/binutils/dist/gas/config/tc-mips.c diff -u src/external/gpl3/binutils/dist/gas/config/tc-mips.c:1.5 src/external/gpl3/binutils/dist/gas/config/tc-mips.c:1.6 --- src/external/gpl3/binutils/dist/gas/config/tc-mips.c:1.5 Thu Aug 18 06:32:35 2011 +++ src/external/gpl3/binutils/dist/gas/config/tc-mips.c Sat Aug 27 13:19:39 2011 @@ -778,6 +778,8 @@ efficient expansion. */ static int mips_relax_branch; + +static int mips_fix_loongson2f_btb; /* The expansion of many macros depends on the type of symbol that they refer to. For example, when generating position-dependent code, @@ -1051,6 +1053,7 @@ static void mips16_macro_build (expressionS *, const char *, const char *, va_list); static void load_register (int, expressionS *, int); +static void macro_build (expressionS *, const char *, const char *, ...); static void macro_start (void); static void macro_end (void); static void macro (struct mips_cl_insn * ip); @@ -3584,6 +3587,41 @@ r[i] = (bfd_reloc_code_real_type) va_arg (*args, int); } +/* Fix jump through register issue on loongson2f processor for kernel code: + force a BTB clear before the jump to prevent it from being incorrectly + prefetched by the branch prediction engine. */ + +static void +macro_build_jrpatch (expressionS *ep, unsigned int sreg) +{ + if (!mips_fix_loongson2f_btb) +return; + + if (sreg == ZERO || sreg == KT0 || sreg == KT1 || sreg == AT) +return; + + if (!mips_opts.at) +{ + as_warn (_(unable to apply loongson2f BTB workaround when .set noat)); + return; +} + + /* li $at, COP_0_BTB_CLEAR | COP_0_RAS_DISABLE */ + ep-X_op = O_constant; + ep-X_add_number = 3; + macro_build (ep, ori, t,r,i, AT, ZERO, BFD_RELOC_LO16); + + /* dmtc0 $at, COP_0_DIAG */ + macro_build (NULL, dmtc0, t,G, AT, 22); + + /* Hide these two instructions to avoid getting a ``macro expanded into + multiple instructions'' warning. */ + if (mips_relax.sequence != 2) +mips_macro_warning.sizes[0] -= 2 * 4; + if (mips_relax.sequence != 1) +mips_macro_warning.sizes[1] -= 2 * 4; +} + /* Build an instruction created by a macro expansion. This is passed a pointer to the count of instructions created so far, an expression, the name of the instruction to build, an operand format @@ -3985,6 +4023,7 @@ frag_grow (8); f = frag_more (0); } + macro_build_jrpatch (ep, PIC_CALL_REG); macro_build (NULL, jalr, d,s, RA, PIC_CALL_REG); if (HAVE_NEWABI) fix_new_exp (frag_now, f - frag_now-fr_literal, @@ -6167,6 +6206,26 @@ /* AT is not used, just return */ return; +case M_JR_S: + macro_build_jrpatch (expr1, sreg); + macro_build (NULL, jr, s, sreg); + return; /* didn't modify $at */ + +case M_J_S: + macro_build_jrpatch (expr1, sreg); + macro_build (NULL, j, s, sreg); + return; /* didn't modify $at */ + +case M_JALR_S: + macro_build_jrpatch (expr1, sreg); + macro_build (NULL, jalr, s, sreg); + return; /* didn't modify $at */ + +case M_JALR_DS: + macro_build_jrpatch (expr1, sreg); + macro_build (NULL, jalr, d,s, dreg, sreg); + return; /* didn't modify $at */ + case M_J_A: /* The j instruction may not be used in PIC code, since it requires an absolute address. We convert it to a b @@ -6185,12 +6244,16 @@ /* Fall through. */ case M_JAL_2: if (mips_pic == NO_PIC) - macro_build (NULL, jalr, d,s, dreg, sreg); + { + macro_build_jrpatch (expr1, sreg); +
CVS commit: src
Module Name:src Committed By: bouyer Date: Sat Aug 27 13:23:52 UTC 2011 Modified Files: src/common/lib/libc/arch/mips/atomic: atomic_add.S atomic_and.S atomic_dec.S atomic_inc.S atomic_or.S atomic_swap.S src/common/lib/libc/arch/mips/string: bcopy.S src/sys/arch/mips/include: cpuregs.h src/sys/arch/mips/mips: lock_stubs_ras.S mipsX_subr.S mips_fixup.c Log Message: loongson2f support: - Add some loongson2 definitions to cpuregs.h, from OpenBSD - Make sure that the at register is useable before every jump register instruction (exept when register is k0 or k1) because -mfix-loongson2f-btb needs the at register for its workaround - add code to mips_fixup.c to handle the instructions added by -mfix-loongson2f-btb - Add a ls2-specific tlb miss handler: it doesn't have separate handler for the xtlbmiss exeption. - Fixes for some #ifdef MIPS3_LOONGSON2 assembly code (using the wrong register) To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/common/lib/libc/arch/mips/atomic/atomic_add.S \ src/common/lib/libc/arch/mips/atomic/atomic_and.S \ src/common/lib/libc/arch/mips/atomic/atomic_dec.S \ src/common/lib/libc/arch/mips/atomic/atomic_inc.S \ src/common/lib/libc/arch/mips/atomic/atomic_or.S \ src/common/lib/libc/arch/mips/atomic/atomic_swap.S cvs rdiff -u -r1.3 -r1.4 src/common/lib/libc/arch/mips/string/bcopy.S cvs rdiff -u -r1.85 -r1.86 src/sys/arch/mips/include/cpuregs.h cvs rdiff -u -r1.3 -r1.4 src/sys/arch/mips/mips/lock_stubs_ras.S cvs rdiff -u -r1.53 -r1.54 src/sys/arch/mips/mips/mipsX_subr.S cvs rdiff -u -r1.8 -r1.9 src/sys/arch/mips/mips/mips_fixup.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/common/lib/libc/arch/mips/atomic/atomic_add.S diff -u src/common/lib/libc/arch/mips/atomic/atomic_add.S:1.2 src/common/lib/libc/arch/mips/atomic/atomic_add.S:1.3 --- src/common/lib/libc/arch/mips/atomic/atomic_add.S:1.2 Mon Dec 14 00:38:59 2009 +++ src/common/lib/libc/arch/mips/atomic/atomic_add.S Sat Aug 27 13:23:52 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: atomic_add.S,v 1.2 2009/12/14 00:38:59 matt Exp $ */ +/* $NetBSD: atomic_add.S,v 1.3 2011/08/27 13:23:52 bouyer Exp $ */ /*- * Copyright (c) 2008 The NetBSD Foundation, Inc. @@ -30,12 +30,21 @@ #include machine/asm.h #include atomic_op_asm.h -RCSID($NetBSD: atomic_add.S,v 1.2 2009/12/14 00:38:59 matt Exp $) +RCSID($NetBSD: atomic_add.S,v 1.3 2011/08/27 13:23:52 bouyer Exp $) .text - .set noat .set noreorder +#ifdef _KERNEL_OPT +#include opt_cputype.h +#ifndef MIPS3_LOONGSON2F + .set noat + .set nomacro +#endif +#else /* _KERNEL_OPT */ + .set noat .set nomacro +#endif /* _KERNEL_OPT */ + LEAF(_atomic_add_32) 1: INT_LL t0, 0(a0) Index: src/common/lib/libc/arch/mips/atomic/atomic_and.S diff -u src/common/lib/libc/arch/mips/atomic/atomic_and.S:1.2 src/common/lib/libc/arch/mips/atomic/atomic_and.S:1.3 --- src/common/lib/libc/arch/mips/atomic/atomic_and.S:1.2 Mon Dec 14 00:38:59 2009 +++ src/common/lib/libc/arch/mips/atomic/atomic_and.S Sat Aug 27 13:23:52 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: atomic_and.S,v 1.2 2009/12/14 00:38:59 matt Exp $ */ +/* $NetBSD: atomic_and.S,v 1.3 2011/08/27 13:23:52 bouyer Exp $ */ /*- * Copyright (c) 2008 The NetBSD Foundation, Inc. @@ -30,12 +30,21 @@ #include machine/asm.h #include atomic_op_asm.h -RCSID($NetBSD: atomic_and.S,v 1.2 2009/12/14 00:38:59 matt Exp $) +RCSID($NetBSD: atomic_and.S,v 1.3 2011/08/27 13:23:52 bouyer Exp $) .text - .set noat .set noreorder +#ifdef _KERNEL_OPT +#include opt_cputype.h +#ifndef MIPS3_LOONGSON2F + .set noat + .set nomacro +#endif +#else /* _KERNEL_OPT */ + .set noat .set nomacro +#endif /* _KERNEL_OPT */ + LEAF(_atomic_and_32) 1: INT_LL t0, 0(a0) Index: src/common/lib/libc/arch/mips/atomic/atomic_dec.S diff -u src/common/lib/libc/arch/mips/atomic/atomic_dec.S:1.2 src/common/lib/libc/arch/mips/atomic/atomic_dec.S:1.3 --- src/common/lib/libc/arch/mips/atomic/atomic_dec.S:1.2 Mon Dec 14 00:39:00 2009 +++ src/common/lib/libc/arch/mips/atomic/atomic_dec.S Sat Aug 27 13:23:52 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: atomic_dec.S,v 1.2 2009/12/14 00:39:00 matt Exp $ */ +/* $NetBSD: atomic_dec.S,v 1.3 2011/08/27 13:23:52 bouyer Exp $ */ /*- * Copyright (c) 2008 The NetBSD Foundation, Inc. @@ -30,12 +30,20 @@ #include machine/asm.h #include atomic_op_asm.h -RCSID($NetBSD: atomic_dec.S,v 1.2 2009/12/14 00:39:00 matt Exp $) +RCSID($NetBSD: atomic_dec.S,v 1.3 2011/08/27 13:23:52 bouyer Exp $) .text - .set noat .set noreorder +#ifdef _KERNEL_OPT +#include opt_cputype.h +#ifndef MIPS3_LOONGSON2F + .set noat + .set nomacro +#endif +#else /* _KERNEL_OPT */ + .set noat .set nomacro +#endif /* _KERNEL_OPT */ LEAF(_atomic_dec_32) 1: INT_LL t0, 0(a0) Index: src/common/lib/libc/arch/mips/atomic/atomic_inc.S diff -u src/common/lib/libc/arch/mips/atomic/atomic_inc.S:1.2
CVS commit: src/sys/dev/pci
Module Name:src Committed By: bouyer Date: Sat Aug 27 13:28:37 UTC 2011 Modified Files: src/sys/dev/pci: files.pci Added Files: src/sys/dev/pci: sisfb.c sisfb.h Log Message: Add a basic driver for the SIS315 Pro frame buffer found on some loogson2-based systems, from OpenBSD. At this time it can only map the framebuffer and attaches wscons, using whatever resolution was configured by the firmware. It doens't support any accelaration or mode change. To generate a diff of this commit: cvs rdiff -u -r1.346 -r1.347 src/sys/dev/pci/files.pci cvs rdiff -u -r0 -r1.1 src/sys/dev/pci/sisfb.c src/sys/dev/pci/sisfb.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/pci/files.pci diff -u src/sys/dev/pci/files.pci:1.346 src/sys/dev/pci/files.pci:1.347 --- src/sys/dev/pci/files.pci:1.346 Wed Aug 24 20:27:35 2011 +++ src/sys/dev/pci/files.pci Sat Aug 27 13:28:37 2011 @@ -1,4 +1,4 @@ -# $NetBSD: files.pci,v 1.346 2011/08/24 20:27:35 dyoung Exp $ +# $NetBSD: files.pci,v 1.347 2011/08/27 13:28:37 bouyer Exp $ # # Config file and device description for machine-independent PCI code. # Included by ports that need it. Requires that the SCSI files be @@ -1080,3 +1080,7 @@ attach pwdog at pci file dev/pci/pwdog.c pwdog +# SIS 315 Pro frame buffer +device sisfb: wsemuldisplaydev, rasops8, rasops15, rasops16, rasops32, vcons +attach sisfb at pci +filedev/pci/sisfb.c sisfb needs-flag Added files: Index: src/sys/dev/pci/sisfb.c diff -u /dev/null src/sys/dev/pci/sisfb.c:1.1 --- /dev/null Sat Aug 27 13:28:37 2011 +++ src/sys/dev/pci/sisfb.c Sat Aug 27 13:28:37 2011 @@ -0,0 +1,755 @@ +/* $OpenBSD: sisfb.c,v 1.2 2010/12/26 15:40:59 miod Exp $ */ + +/* + * Copyright (c) 2010 Miodrag Vallat. + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED AS IS AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +/* + * Minimalistic driver for the SIS315 Pro frame buffer found on the + * Lemote Fuloong 2F systems. + * Does not support accelaration, mode change, secondary output, or + * anything fancy. + */ + +#include sys/cdefs.h +__KERNEL_RCSID(0, $NetBSD: sisfb.c,v 1.1 2011/08/27 13:28:37 bouyer Exp $); + +#include sys/param.h +#include sys/systm.h +#include sys/device.h +#include sys/bus.h + +#include uvm/uvm_extern.h + +#include dev/pci/pcireg.h +#include dev/pci/pcivar.h +#include dev/pci/pcidevs.h +#include dev/pci/pciio.h + +#include dev/videomode/videomode.h + +#include dev/wscons/wsdisplayvar.h +#include dev/wscons/wsconsio.h +#include dev/wsfont/wsfont.h +#include dev/rasops/rasops.h +#include dev/wscons/wsdisplay_vconsvar.h +#include dev/pci/wsdisplay_pci.h + +#include dev/i2c/i2cvar.h + +#include dev/pci/sisfb.h + +struct sisfb_softc; + +/* minimal frame buffer information, suitable for early console */ + +struct sisfb { + struct sisfb_softc *sc; + uint8_t cmap[256 * 3]; + + bus_space_tag_t fbt; + bus_space_handle_t fbh; + + bus_space_tag_t mmiot; + bus_space_handle_t mmioh; + + bus_space_tag_t iot; + bus_space_handle_t ioh; + + struct vcons_screen vcs; + struct wsscreen_descr wsd; + + int fb_depth; + int fb_width; + int fb_height; + int fb_stride; + void *fb_addr; +}; + +struct sisfb_softc { + device_t sc_dev; + struct sisfb *sc_fb; + struct sisfb sc_fb_store; + + struct vcons_data vd; + struct wsscreen_list sc_wsl; + const struct wsscreen_descr *sc_scrlist[1]; + int sc_nscr; + int sc_mode; +}; + +int sisfb_match(device_t, cfdata_t, void *); +void sisfb_attach(device_t, device_t, void *); + +CFATTACH_DECL_NEW(sisfb, sizeof(struct sisfb_softc), +sisfb_match, sisfb_attach, NULL, NULL); + + +int sisfb_alloc_screen(void *, const struct wsscreen_descr *, void **, int *, + int *, long *); +void sisfb_free_screen(void *, void *); +int sisfb_ioctl(void *, void *, u_long, void *, int, struct lwp *); +int sisfb_show_screen(void *, void *, int, void (*)(void *, int, int), + void *); +paddr_t sisfb_mmap(void *, void *, off_t, int); +void sisfb_init_screen(void *, struct vcons_screen *, int, long *); + + +struct wsdisplay_accessops sisfb_accessops = { + sisfb_ioctl, + sisfb_mmap, + sisfb_alloc_screen, + sisfb_free_screen, + sisfb_show_screen, + NULL, /* load_font */ + NULL, /* poolc */ + NULL /* scroll */ +}; + +int
CVS commit: src/sys/arch
Module Name:src Committed By: bouyer Date: Sat Aug 27 13:34:29 UTC 2011 Modified Files: src/sys/arch/evbmips/conf: files.evbmips Added Files: src/sys/arch/mips/pmon: pmon.c pmon.h pmon32.S Log Message: Add pmon (firmware used by loongson2-based systems and maybe others) support, from OpenBSD. This includes code to call back pmon routines from a 64bit kernel, as well code to read pmon arguments and variables. To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/sys/arch/evbmips/conf/files.evbmips cvs rdiff -u -r0 -r1.1 src/sys/arch/mips/pmon/pmon.c \ src/sys/arch/mips/pmon/pmon.h src/sys/arch/mips/pmon/pmon32.S Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/evbmips/conf/files.evbmips diff -u src/sys/arch/evbmips/conf/files.evbmips:1.6 src/sys/arch/evbmips/conf/files.evbmips:1.7 --- src/sys/arch/evbmips/conf/files.evbmips:1.6 Tue Mar 20 08:52:01 2007 +++ src/sys/arch/evbmips/conf/files.evbmips Sat Aug 27 13:34:29 2011 @@ -1,4 +1,4 @@ -# $NetBSD: files.evbmips,v 1.6 2007/03/20 08:52:01 dyoung Exp $ +# $NetBSD: files.evbmips,v 1.7 2011/08/27 13:34:29 bouyer Exp $ # maxpartitions must be the first item in files.${ARCH} maxpartitions 16 @@ -20,4 +20,9 @@ # Console glue. file dev/cons.c +# PMON suport +defflag PMON +file arch/mips/pmon/pmon.c pmon +file arch/mips/pmon/pmon32.S pmon + include arch/evbmips/conf/majors.evbmips Added files: Index: src/sys/arch/mips/pmon/pmon.c diff -u /dev/null src/sys/arch/mips/pmon/pmon.c:1.1 --- /dev/null Sat Aug 27 13:34:29 2011 +++ src/sys/arch/mips/pmon/pmon.c Sat Aug 27 13:34:29 2011 @@ -0,0 +1,99 @@ +/* $OpenBSD: pmon.c,v 1.4 2010/02/16 21:29:54 miod Exp $ */ + +/* + * Copyright (c) 2009 Miodrag Vallat. + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED AS IS AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#include sys/param.h +#include sys/systm.h +#include sys/proc.h + +#include machine/cpu.h +#include mips/pmon/pmon.h + +int pmon_argc; +int32_t *pmon_argv; +int32_t *pmon_envp; + +void +pmon_init(int32_t argc, int32_t argv, int32_t envp, int32_t callvec) +{ + pmon_callvec = callvec; + + pmon_argc = argc; + /* sign extend pointers */ + pmon_argv = (int32_t *)(vaddr_t)argv; + pmon_envp = (int32_t *)(vaddr_t)envp; +} + +const char * +pmon_getarg(const int argno) +{ + if (argno 0 || argno = pmon_argc) + return NULL; + + return (const char *)(vaddr_t)pmon_argv[argno]; +} + +const char * +pmon_getenv(const char *var) +{ + int32_t *envptr = pmon_envp; + const char *envstr; + size_t varlen; + + if (envptr == NULL) + return NULL; + + varlen = strlen(var); + while (*envptr != 0) { + envstr = (const char *)(vaddr_t)*envptr; + /* + * There is a PMON2000 bug, at least on Lemote Yeeloong, + * which causes it to override part of the environment + * pointers array with the environment data itself. + * + * This only happens on cold boot, and if the BSD kernel + * is loaded without symbols (i.e. no option -k passed + * to the boot command). + * + * Until a suitable workaround is found or the bug is + * fixed, ignore broken environment information and + * tell the user (in case this prevents us from finding + * important information). + */ + if ((vaddr_t)envstr (vaddr_t)MIPS_KSEG1_START || + (vaddr_t)envstr = (vaddr_t)MIPS_KSEG2_START) { + printf(WARNING! CORRUPTED ENVIRONMENT!\n); + printf(Unable to search for %s.\n, var); +#ifdef _STANDALONE + printf(If boot fails, power-cycle the machine.\n); +#else + printf(If the kernel fails to identify the system + type, please boot it again with `-k' option.\n); +#endif + + /* terminate environment for further calls */ + *envptr = 0; + break; + } + if (strncmp(envstr, var, varlen) == 0 + envstr[varlen] == '=') + return envstr + varlen + 1; + envptr++; + } + + return NULL; +} Index: src/sys/arch/mips/pmon/pmon.h diff -u /dev/null src/sys/arch/mips/pmon/pmon.h:1.1 --- /dev/null Sat Aug 27 13:34:29 2011 +++ src/sys/arch/mips/pmon/pmon.h Sat Aug 27 13:34:29 2011 @@ -0,0 +1,52 @@ +/* $OpenBSD: pmon.h,v 1.2 2010/02/14 22:39:33 miod Exp $ */ + +/* + * Copyright (c) 2009 Miodrag Vallat. + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee
CVS commit: src/distrib/evbmips/instkernel/ramdisk
Module Name:src Committed By: bouyer Date: Sat Aug 27 14:30:33 UTC 2011 Modified Files: src/distrib/evbmips/instkernel/ramdisk: list Log Message: Add fdisk and ext2fs tools, pmon-based platforms needs them. To generate a diff of this commit: cvs rdiff -u -r1.16 -r1.17 src/distrib/evbmips/instkernel/ramdisk/list Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/distrib/evbmips/instkernel/ramdisk/list diff -u src/distrib/evbmips/instkernel/ramdisk/list:1.16 src/distrib/evbmips/instkernel/ramdisk/list:1.17 --- src/distrib/evbmips/instkernel/ramdisk/list:1.16 Sun Jul 3 23:11:32 2011 +++ src/distrib/evbmips/instkernel/ramdisk/list Sat Aug 27 14:30:33 2011 @@ -1,4 +1,4 @@ -# $NetBSD: list,v 1.16 2011/07/03 23:11:32 tron Exp $ +# $NetBSD: list,v 1.17 2011/08/27 14:30:33 bouyer Exp $ SRCDIRS bin sbin external/bsd/less/bin usr.bin usr.sbin @@ -22,18 +22,22 @@ PROG sbin/chown bin/chgrp PROG sbin/disklabel +PROG sbin/fdisk PROG sbin/fsck +PROG sbin/fsck_ext2fs PROG sbin/fsck_ffs PROG sbin/ifconfig PROG sbin/init PROG sbin/mknod PROG sbin/mount PROG sbin/mount_cd9660 +PROG sbin/mount_ext2fs PROG sbin/mount_ffs PROG sbin/mount_kernfs PROG sbin/mount_msdos PROG sbin/mount_nfs PROG sbin/newfs sbin/mount_mfs +PROG sbin/newfs_ext2fs PROG sbin/ping PROG sbin/reboot sbin/halt PROG sbin/restore sbin/rrestore
CVS commit: src/libexec/fingerd
Module Name:src Committed By: joerg Date: Sat Aug 27 15:08:58 UTC 2011 Modified Files: src/libexec/fingerd: fingerd.c Log Message: Rename err() to avoid overlap with libc. Mark it dead. To generate a diff of this commit: cvs rdiff -u -r1.25 -r1.26 src/libexec/fingerd/fingerd.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/libexec/fingerd/fingerd.c diff -u src/libexec/fingerd/fingerd.c:1.25 src/libexec/fingerd/fingerd.c:1.26 --- src/libexec/fingerd/fingerd.c:1.25 Sat Mar 14 13:59:28 2009 +++ src/libexec/fingerd/fingerd.c Sat Aug 27 15:08:58 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: fingerd.c,v 1.25 2009/03/14 13:59:28 lukem Exp $ */ +/* $NetBSD: fingerd.c,v 1.26 2011/08/27 15:08:58 joerg Exp $ */ /* * Copyright (c) 1983, 1993 @@ -39,7 +39,7 @@ #if 0 static char sccsid[] = from: @(#)fingerd.c 8.1 (Berkeley) 6/4/93; #else -__RCSID($NetBSD: fingerd.c,v 1.25 2009/03/14 13:59:28 lukem Exp $); +__RCSID($NetBSD: fingerd.c,v 1.26 2011/08/27 15:08:58 joerg Exp $); #endif #endif /* not lint */ @@ -58,8 +58,7 @@ #include string.h #include pathnames.h -void err(const char *, ...); -int main(int, char *[]); +__dead static void my_err(const char *, ...); int main(int argc, char *argv[]) @@ -117,17 +116,17 @@ break; case '?': default: - err(illegal option -- %c, optopt); + my_err(illegal option -- %c, optopt); } if (ac = ENTRIES) - err(Too many options provided); + my_err(Too many options provided); } if (logging) { sval = sizeof(ss); if (getpeername(0, (struct sockaddr *)ss, sval) 0) - err(getpeername: %s, strerror(errno)); + my_err(getpeername: %s, strerror(errno)); (void)getnameinfo((struct sockaddr *)ss, sval, hostbuf, sizeof(hostbuf), NULL, 0, 0); lp = hostbuf; @@ -150,7 +149,7 @@ } if (ac = ENTRIES) - err(Too many options provided); + my_err(Too many options provided); av[ac++] = __UNCONST(--); comp = av[1]; for (lp = line, ap = av[ac]; ac ENTRIES;) { @@ -195,7 +194,7 @@ } if (pipe(p) 0) - err(pipe: %s, strerror(errno)); + my_err(pipe: %s, strerror(errno)); switch(fork()) { case 0: @@ -205,14 +204,14 @@ (void) close(p[1]); } execv(prog, comp); - err(execv: %s: %s, prog, strerror(errno)); + my_err(execv: %s: %s, prog, strerror(errno)); _exit(1); case -1: - err(fork: %s, strerror(errno)); + my_err(fork: %s, strerror(errno)); } (void) close(p[1]); if (!(fp = fdopen(p[0], r))) - err(fdopen: %s, strerror(errno)); + my_err(fdopen: %s, strerror(errno)); while ((ch = getc(fp)) != EOF) { if (ch == '\n') putchar('\r'); @@ -221,8 +220,8 @@ exit(0); } -void -err(const char *fmt, ...) +static void +my_err(const char *fmt, ...) { va_list ap;
CVS commit: src/sys/fs/tmpfs
Module Name:src Committed By: hannken Date: Sat Aug 27 15:32:28 UTC 2011 Modified Files: src/sys/fs/tmpfs: tmpfs_subr.c tmpfs_vnops.c Log Message: Finish and enable whiteout support for tmpfs: - Enable VOP tmpfs_whiteout(). - Support ISWHITEOUT in tmpfs_alloc_file(). - Support DOWHITEOUT in tmpfs_remove() and tmpfs_rmdir(). - Make rmdir on a directory containing whiteouts working. Should fix PR #35112 (tmpfs doesn't play well with unionfs). To generate a diff of this commit: cvs rdiff -u -r1.76 -r1.77 src/sys/fs/tmpfs/tmpfs_subr.c cvs rdiff -u -r1.89 -r1.90 src/sys/fs/tmpfs/tmpfs_vnops.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/fs/tmpfs/tmpfs_subr.c diff -u src/sys/fs/tmpfs/tmpfs_subr.c:1.76 src/sys/fs/tmpfs/tmpfs_subr.c:1.77 --- src/sys/fs/tmpfs/tmpfs_subr.c:1.76 Thu Jun 30 00:37:07 2011 +++ src/sys/fs/tmpfs/tmpfs_subr.c Sat Aug 27 15:32:28 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: tmpfs_subr.c,v 1.76 2011/06/30 00:37:07 enami Exp $ */ +/* $NetBSD: tmpfs_subr.c,v 1.77 2011/08/27 15:32:28 hannken Exp $ */ /* * Copyright (c) 2005-2011 The NetBSD Foundation, Inc. @@ -74,7 +74,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: tmpfs_subr.c,v 1.76 2011/06/30 00:37:07 enami Exp $); +__KERNEL_RCSID(0, $NetBSD: tmpfs_subr.c,v 1.77 2011/08/27 15:32:28 hannken Exp $); #include sys/param.h #include sys/dirent.h @@ -343,7 +343,7 @@ { tmpfs_mount_t *tmp = VFS_TO_TMPFS(dvp-v_mount); tmpfs_node_t *dnode = VP_TO_TMPFS_DIR(dvp), *node; - tmpfs_dirent_t *de; + tmpfs_dirent_t *de, *wde; int error; KASSERT(VOP_ISLOCKED(dvp)); @@ -381,8 +381,20 @@ goto out; } + /* Remove whiteout before adding the new entry. */ + if (cnp-cn_flags ISWHITEOUT) { + wde = tmpfs_dir_lookup(dnode, cnp); + KASSERT(wde != NULL wde-td_node == TMPFS_NODE_WHITEOUT); + tmpfs_dir_detach(dvp, wde); + tmpfs_free_dirent(tmp, wde); + } + /* Associate inode and attach the entry into the directory. */ tmpfs_dir_attach(dvp, de, node); + + /* Make node opaque if requested. */ + if (cnp-cn_flags ISWHITEOUT) + node-tn_flags |= UF_OPAQUE; out: vput(dvp); return error; @@ -444,8 +456,8 @@ KASSERT(VOP_ISLOCKED(dvp)); /* Associate directory entry and the inode. */ + de-td_node = node; if (node != TMPFS_NODE_WHITEOUT) { - de-td_node = node; KASSERT(node-tn_links LINK_MAX); node-tn_links++; Index: src/sys/fs/tmpfs/tmpfs_vnops.c diff -u src/sys/fs/tmpfs/tmpfs_vnops.c:1.89 src/sys/fs/tmpfs/tmpfs_vnops.c:1.90 --- src/sys/fs/tmpfs/tmpfs_vnops.c:1.89 Thu Aug 18 21:42:18 2011 +++ src/sys/fs/tmpfs/tmpfs_vnops.c Sat Aug 27 15:32:28 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: tmpfs_vnops.c,v 1.89 2011/08/18 21:42:18 riastradh Exp $ */ +/* $NetBSD: tmpfs_vnops.c,v 1.90 2011/08/27 15:32:28 hannken Exp $ */ /* * Copyright (c) 2005, 2006, 2007 The NetBSD Foundation, Inc. @@ -35,7 +35,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: tmpfs_vnops.c,v 1.89 2011/08/18 21:42:18 riastradh Exp $); +__KERNEL_RCSID(0, $NetBSD: tmpfs_vnops.c,v 1.90 2011/08/27 15:32:28 hannken Exp $); #include sys/param.h #include sys/dirent.h @@ -103,9 +103,7 @@ { vop_bwrite_desc, tmpfs_bwrite }, { vop_getpages_desc, tmpfs_getpages }, { vop_putpages_desc, tmpfs_putpages }, -#if TMPFS_WHITEOUT { vop_whiteout_desc, tmpfs_whiteout }, -#endif { NULL, NULL } }; @@ -713,11 +711,15 @@ /* * Remove the entry from the directory (drops the link count) and - * destroy it. Note: the inode referred by it will not be destroyed + * destroy it or replace it with a whiteout. + * Note: the inode referred by it will not be destroyed * until the vnode is reclaimed/recycled. */ tmpfs_dir_detach(dvp, de); - tmpfs_free_dirent(VFS_TO_TMPFS(vp-v_mount), de); + if (ap-a_cnp-cn_flags DOWHITEOUT) + tmpfs_dir_attach(dvp, de, TMPFS_NODE_WHITEOUT); + else + tmpfs_free_dirent(VFS_TO_TMPFS(vp-v_mount), de); error = 0; out: /* Drop the references and unlock the vnodes. */ @@ -2103,12 +2105,19 @@ KASSERT(node-tn_spec.tn_dir.tn_parent == dnode); /* - * Directories with more than two entries ('.' and '..') cannot - * be removed. + * Directories with more than two non-whiteout + * entries ('.' and '..') cannot be removed. */ if (node-tn_size 0) { - error = ENOTEMPTY; - goto out; + KASSERT(error == 0); + TAILQ_FOREACH(de, node-tn_spec.tn_dir.tn_dir, td_entries) { + if (de-td_node != TMPFS_NODE_WHITEOUT) { +error = ENOTEMPTY; +break; + } + } + if (error) + goto out; } /* Lookup the directory entry (check the cached hint first). */ @@ -2136,10 +2145,22 @@ cache_purge(dvp); /* - * Destroy the directory entry. Note: the inode referred by it - * will not be destroyed until the vnode is reclaimed. + * Destroy the directory entry or replace it with a whiteout. + * Note: the inode referred by it will not be destroyed + * until the vnode is reclaimed.
CVS commit: src/libexec/httpd
Module Name:src Committed By: joerg Date: Sat Aug 27 15:33:59 UTC 2011 Modified Files: src/libexec/httpd: bozohttpd.c bozohttpd.h daemon-bozo.c main.c ssl-bozo.c Log Message: Don't check for __attribute__ being defined, it won't. Check for GCC 3.x or compatible and define BOZO_PRINTFLIKE / BOZO_DEAD. Fix fallout. To generate a diff of this commit: cvs rdiff -u -r1.27 -r1.28 src/libexec/httpd/bozohttpd.c cvs rdiff -u -r1.18 -r1.19 src/libexec/httpd/bozohttpd.h cvs rdiff -u -r1.13 -r1.14 src/libexec/httpd/daemon-bozo.c cvs rdiff -u -r1.2 -r1.3 src/libexec/httpd/main.c cvs rdiff -u -r1.11 -r1.12 src/libexec/httpd/ssl-bozo.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/libexec/httpd/bozohttpd.c diff -u src/libexec/httpd/bozohttpd.c:1.27 src/libexec/httpd/bozohttpd.c:1.28 --- src/libexec/httpd/bozohttpd.c:1.27 Tue Mar 29 07:22:31 2011 +++ src/libexec/httpd/bozohttpd.c Sat Aug 27 15:33:59 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: bozohttpd.c,v 1.27 2011/03/29 07:22:31 jmmv Exp $ */ +/* $NetBSD: bozohttpd.c,v 1.28 2011/08/27 15:33:59 joerg Exp $ */ /* $eterna: bozohttpd.c,v 1.176 2010/09/20 22:26:28 mrg Exp $ */ @@ -154,10 +154,6 @@ #include time.h #include unistd.h -#ifndef __attribute__ -#define __attribute__(x) -#endif /* __attribute__ */ - #include bozohttpd.h #ifndef MAX_WAIT_TIME @@ -1412,9 +1408,10 @@ request-hr_first_byte_pos = 0; request-hr_last_byte_pos = sb.st_size - 1; } - debug((httpd, DEBUG_FAT, have_range %d first_pos %qd last_pos %qd, + debug((httpd, DEBUG_FAT, have_range %d first_pos %lld last_pos %lld, request-hr_have_range, - request-hr_first_byte_pos, request-hr_last_byte_pos)); + (long long)request-hr_first_byte_pos, + (long long)request-hr_last_byte_pos)); if (request-hr_have_range) bozo_printf(httpd, %s 206 Partial Content\r\n, request-hr_proto); @@ -1848,7 +1845,7 @@ } httpd-getln_buffer[len] = '\0'; - debug((httpd, DEBUG_OBESE, bozodgetln returns: ``%s'' with len %d, + debug((httpd, DEBUG_OBESE, bozodgetln returns: ``%s'' with len %zd, httpd-getln_buffer, len)); *lenp = len; return httpd-getln_buffer; Index: src/libexec/httpd/bozohttpd.h diff -u src/libexec/httpd/bozohttpd.h:1.18 src/libexec/httpd/bozohttpd.h:1.19 --- src/libexec/httpd/bozohttpd.h:1.18 Tue Mar 29 07:22:31 2011 +++ src/libexec/httpd/bozohttpd.h Sat Aug 27 15:33:59 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: bozohttpd.h,v 1.18 2011/03/29 07:22:31 jmmv Exp $ */ +/* $NetBSD: bozohttpd.h,v 1.19 2011/08/27 15:33:59 joerg Exp $ */ /* $eterna: bozohttpd.h,v 1.37 2010/09/20 22:26:28 mrg Exp $ */ @@ -172,11 +172,16 @@ #define debug(x) #endif /* NO_DEBUG */ +#if defined(__GNUC__) __GNUC__ = 3 +#define BOZO_PRINTFLIKE(x,y) __attribute__((__format__(__printf__, x,y))) +#define BOZO_DEAD __attribute__((__noreturn__)) +#endif + void bozo_warn(bozohttpd_t *, const char *, ...) - __attribute__((__format__(__printf__, 2, 3))); + BOZO_PRINTFLIKE(2, 3); void bozo_err(bozohttpd_t *, int, const char *, ...) - __attribute__((__format__(__printf__, 3, 4))) - __attribute__((__noreturn__)); + BOZO_PRINTFLIKE(3, 4) + BOZO_DEAD; int bozo_http_error(bozohttpd_t *, int, bozo_httpreq_t *, const char *); int bozo_check_special_files(bozo_httpreq_t *, const char *); Index: src/libexec/httpd/daemon-bozo.c diff -u src/libexec/httpd/daemon-bozo.c:1.13 src/libexec/httpd/daemon-bozo.c:1.14 --- src/libexec/httpd/daemon-bozo.c:1.13 Tue Mar 29 07:22:31 2011 +++ src/libexec/httpd/daemon-bozo.c Sat Aug 27 15:33:59 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: daemon-bozo.c,v 1.13 2011/03/29 07:22:31 jmmv Exp $ */ +/* $NetBSD: daemon-bozo.c,v 1.14 2011/08/27 15:33:59 joerg Exp $ */ /* $eterna: daemon-bozo.c,v 1.22 2010/06/21 06:45:45 mrg Exp $ */ @@ -77,7 +77,7 @@ /* Signal handler to exit in a controlled manner. This ensures that * any atexit(3) handlers are properly executed. */ /* ARGSUSED */ -static void +BOZO_DEAD static void controlled_exit(int signo) { Index: src/libexec/httpd/main.c diff -u src/libexec/httpd/main.c:1.2 src/libexec/httpd/main.c:1.3 --- src/libexec/httpd/main.c:1.2 Tue Mar 29 07:22:31 2011 +++ src/libexec/httpd/main.c Sat Aug 27 15:33:59 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: main.c,v 1.2 2011/03/29 07:22:31 jmmv Exp $ */ +/* $NetBSD: main.c,v 1.3 2011/08/27 15:33:59 joerg Exp $ */ /* $eterna: main.c,v 1.4 2010/07/11 00:34:28 mrg Exp $ */ /* from: eterna: bozohttpd.c,v 1.159 2009/05/23 02:14:30 mrg Exp */ @@ -47,10 +47,6 @@ #include time.h #include unistd.h -#ifndef __attribute__ -#define __attribute__(x) -#endif /* __attribute__ */ - #include bozohttpd.h /* variables and functions */ @@ -59,7 +55,7 @@ #endif /* print a usage message, and then exit */ -static void +BOZO_DEAD static void usage(bozohttpd_t *httpd, char *progname) { bozo_warn(httpd, usage: %s [options] slashdir [virtualhostname], Index:
CVS commit: src/libexec/mail.local
Module Name:src Committed By: joerg Date: Sat Aug 27 15:40:31 UTC 2011 Modified Files: src/libexec/mail.local: mail.local.c Log Message: De-__P. staticfy. Use __dead, __printflike. To generate a diff of this commit: cvs rdiff -u -r1.25 -r1.26 src/libexec/mail.local/mail.local.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/libexec/mail.local/mail.local.c diff -u src/libexec/mail.local/mail.local.c:1.25 src/libexec/mail.local/mail.local.c:1.26 --- src/libexec/mail.local/mail.local.c:1.25 Sun Jul 20 01:09:07 2008 +++ src/libexec/mail.local/mail.local.c Sat Aug 27 15:40:31 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: mail.local.c,v 1.25 2008/07/20 01:09:07 lukem Exp $ */ +/* $NetBSD: mail.local.c,v 1.26 2011/08/27 15:40:31 joerg Exp $ */ /*- * Copyright (c) 1990, 1993, 1994 @@ -36,7 +36,7 @@ #if 0 static char sccsid[] = @(#)mail.local.c 8.22 (Berkeley) 6/21/95; #else -__RCSID($NetBSD: mail.local.c,v 1.25 2008/07/20 01:09:07 lukem Exp $); +__RCSID($NetBSD: mail.local.c,v 1.26 2011/08/27 15:40:31 joerg Exp $); #endif #endif /* not lint */ @@ -62,20 +62,15 @@ #include pathnames.h -int deliver __P((int, char *, int)); -void logerr __P((int, const char *, ...)) - __attribute__((__format__(__printf__, 2, 3))); -void logwarn __P((const char *, ...)) - __attribute__((__format__(__printf__, 1, 2))); -void notifybiff __P((char *)); -int store __P((const char *)); -void usage __P((void)); -int main __P((int, char **)); +static int deliver(int, char *, int); +__dead static void logerr(int, const char *, ...) __printflike(2, 3); +static void logwarn(const char *, ...) __printflike(1, 2); +static void notifybiff(char *); +static int store(const char *); +__dead static void usage(void); int -main(argc, argv) - int argc; - char **argv; +main(int argc, char *argv[]) { struct passwd *pw; int ch, fd, eval, lockfile = 0; @@ -132,9 +127,8 @@ exit (eval); } -int -store(from) - const char *from; +static int +store(const char *from) { FILE *fp = NULL; /* XXX gcc */ time_t tval; @@ -180,11 +174,8 @@ return(fd); } -int -deliver(fd, name, lockfile) - int fd; - char *name; - int lockfile; +static int +deliver(int fd, char *name, int lockfile) { struct stat sb; struct passwd pwres, *pw; @@ -281,8 +272,7 @@ } void -notifybiff(msg) - char *msg; +notifybiff(char *msg) { static struct sockaddr_in addr; static int f = -1; @@ -313,13 +303,13 @@ logwarn(sendto biff: %s, strerror(errno)); } -void -usage() +static void +usage(void) { logerr(EX_USAGE, usage: mail.local [-l] [-f from] user ...); } -void +static void logerr(int status, const char *fmt, ...) { va_list ap; @@ -330,10 +320,9 @@ exit(status); /* NOTREACHED */ - return; } -void +static void logwarn(const char *fmt, ...) { va_list ap;
CVS commit: [jym-xensuspend] src/sys/arch/xen
Module Name:src Committed By: jym Date: Sat Aug 27 15:44:09 UTC 2011 Modified Files: src/sys/arch/xen/include [jym-xensuspend]: xen.h src/sys/arch/xen/x86 [jym-xensuspend]: hypervisor_machdep.c Log Message: Further sync with HEAD. To generate a diff of this commit: cvs rdiff -u -r1.30.8.5 -r1.30.8.6 src/sys/arch/xen/include/xen.h cvs rdiff -u -r1.11.8.8 -r1.11.8.9 src/sys/arch/xen/x86/hypervisor_machdep.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/xen/include/xen.h diff -u src/sys/arch/xen/include/xen.h:1.30.8.5 src/sys/arch/xen/include/xen.h:1.30.8.6 --- src/sys/arch/xen/include/xen.h:1.30.8.5 Mon May 2 22:49:58 2011 +++ src/sys/arch/xen/include/xen.h Sat Aug 27 15:44:09 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: xen.h,v 1.30.8.5 2011/05/02 22:49:58 jym Exp $ */ +/* $NetBSD: xen.h,v 1.30.8.6 2011/08/27 15:44:09 jym Exp $ */ /* * @@ -76,6 +76,8 @@ void sysctl_xen_sleepstate_setup(void); #if defined(XENDEBUG) || 1 /* XXX */ +#include sys/stdarg.h + void printk(const char *, ...); void vprintk(const char *, _BSD_VA_LIST_); #endif Index: src/sys/arch/xen/x86/hypervisor_machdep.c diff -u src/sys/arch/xen/x86/hypervisor_machdep.c:1.11.8.8 src/sys/arch/xen/x86/hypervisor_machdep.c:1.11.8.9 --- src/sys/arch/xen/x86/hypervisor_machdep.c:1.11.8.8 Sat May 7 17:39:47 2011 +++ src/sys/arch/xen/x86/hypervisor_machdep.c Sat Aug 27 15:44:09 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: hypervisor_machdep.c,v 1.11.8.8 2011/05/07 17:39:47 jym Exp $ */ +/* $NetBSD: hypervisor_machdep.c,v 1.11.8.9 2011/08/27 15:44:09 jym Exp $ */ /* * @@ -54,7 +54,7 @@ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: hypervisor_machdep.c,v 1.11.8.8 2011/05/07 17:39:47 jym Exp $); +__KERNEL_RCSID(0, $NetBSD: hypervisor_machdep.c,v 1.11.8.9 2011/08/27 15:44:09 jym Exp $); #include sys/param.h #include sys/systm.h @@ -86,13 +86,79 @@ // #define PORT_DEBUG 4 // #define EARLY_DEBUG_EVENT +/* callback function type */ +typedef void (*iterate_func_t)(struct cpu_info *, unsigned int, + unsigned int, unsigned int, void *); + +static inline void +evt_iterate_bits(struct cpu_info *ci, volatile unsigned long *pendingl1, + volatile unsigned long *pendingl2, + volatile unsigned long *mask, + iterate_func_t iterate_pending, void *iterate_args) +{ + + KASSERT(pendingl1 != NULL); + KASSERT(pendingl2 != NULL); + + unsigned long l1, l2; + unsigned int l1i, l2i, port; + + l1 = xen_atomic_xchg(pendingl1, 0); + while ((l1i = xen_ffs(l1)) != 0) { + l1i--; + l1 = ~(1UL l1i); + + l2 = pendingl2[l1i] (mask != NULL ? ~mask[l1i] : -1UL); + + if (mask != NULL) xen_atomic_setbits_l(mask[l1i], l2); + xen_atomic_clearbits_l(pendingl2[l1i], l2); + + while ((l2i = xen_ffs(l2)) != 0) { + l2i--; + l2 = ~(1UL l2i); + + port = (l1i LONG_SHIFT) + l2i; + + iterate_pending(ci, port, l1i, l2i, iterate_args); + } + } +} + +/* + * Set per-cpu pending information for outstanding events that + * cannot be processed now. + */ + +static inline void +evt_set_pending(struct cpu_info *ci, unsigned int port, unsigned int l1i, + unsigned int l2i, void *args) +{ + + KASSERT(args != NULL); + KASSERT(ci != NULL); + + int *ret = args; + + if (evtsource[port]) { + hypervisor_set_ipending(ci, evtsource[port]-ev_imask, + l1i, l2i); + evtsource[port]-ev_evcnt.ev_count++; + if (*ret == 0 ci-ci_ilevel + evtsource[port]-ev_maxlevel) + *ret = 1; + } +#ifdef DOM0OPS + else { + /* set pending event */ + xenevt_setipending(l1i, l2i); + } +#endif +} + int stipending(void); int stipending(void) { - unsigned long l1; - unsigned long l2; - unsigned int l1i, l2i, port; volatile shared_info_t *s = HYPERVISOR_shared_info; struct cpu_info *ci; volatile struct vcpu_info *vci; @@ -120,45 +186,16 @@ * we're only called after STIC, so we know that we'll have to * STI at the end */ + while (vci-evtchn_upcall_pending) { cli(); + vci-evtchn_upcall_pending = 0; - /* NB. No need for a barrier here -- XCHG is a barrier - * on x86. */ - l1 = xen_atomic_xchg(vci-evtchn_pending_sel, 0); - while ((l1i = xen_ffs(l1)) != 0) { - l1i--; - l1 = ~(1UL l1i); - - l2 = s-evtchn_pending[l1i] ~s-evtchn_mask[l1i]; - /* - * mask and clear event. More efficient than calling - * hypervisor_mask/clear_event for each event. - */ - xen_atomic_setbits_l(s-evtchn_mask[l1i], l2); - xen_atomic_clearbits_l(s-evtchn_pending[l1i], l2); - while ((l2i = xen_ffs(l2)) != 0) { -l2i--; -l2 = ~(1UL l2i); - -port = (l1i LONG_SHIFT) + l2i; -if (evtsource[port]) { - hypervisor_set_ipending( - evtsource[port]-ev_imask, - l1i, l2i); - evtsource[port]-ev_evcnt.ev_count++; - if (ret == 0 ci-ci_ilevel - evtsource[port]-ev_maxlevel) - ret = 1; -} -#ifdef DOM0OPS -else { - /* set pending event */ - xenevt_setipending(l1i,
CVS commit: src/libexec/rlogind
Module Name:src Committed By: joerg Date: Sat Aug 27 15:45:52 UTC 2011 Modified Files: src/libexec/rlogind: rlogind.c Log Message: ANSIfy. staticfy. Bail out on command line error. Use __dead. To generate a diff of this commit: cvs rdiff -u -r1.39 -r1.40 src/libexec/rlogind/rlogind.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/libexec/rlogind/rlogind.c diff -u src/libexec/rlogind/rlogind.c:1.39 src/libexec/rlogind/rlogind.c:1.40 --- src/libexec/rlogind/rlogind.c:1.39 Mon Mar 16 02:18:39 2009 +++ src/libexec/rlogind/rlogind.c Sat Aug 27 15:45:52 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: rlogind.c,v 1.39 2009/03/16 02:18:39 lukem Exp $ */ +/* $NetBSD: rlogind.c,v 1.40 2011/08/27 15:45:52 joerg Exp $ */ /* * Copyright (C) 1998 WIDE Project. @@ -69,7 +69,7 @@ #if 0 static char sccsid[] = @(#)rlogind.c 8.2 (Berkeley) 4/28/95; #else -__RCSID($NetBSD: rlogind.c,v 1.39 2009/03/16 02:18:39 lukem Exp $); +__RCSID($NetBSD: rlogind.c,v 1.40 2011/08/27 15:45:52 joerg Exp $); #endif #endif /* not lint */ @@ -113,41 +113,38 @@ #define OPTIONS alnL -char *env[2]; +static char *env[2]; #define NMAX 30 -char lusername[NMAX+1], rusername[NMAX+1]; +static char lusername[NMAX+1], rusername[NMAX+1]; static char term[64] = TERM=; #define ENVSIZE (sizeof(TERM=)-1) /* skip null for concatenation */ -int keepalive = 1; -int check_all = 0; -int log_success = 0; - -struct passwd *pwd; - -void doit __P((int, struct sockaddr_storage *)); -int control __P((int, char *, int)); -void protocol __P((int, int)); -void cleanup __P((int)); -void fatal __P((int, const char *, int)); -int do_rlogin __P((struct sockaddr *, char *)); -void getstr __P((char *, int, const char *)); -void setup_term __P((int)); +static int keepalive = 1; +static int check_all = 0; +static int log_success = 0; + +static struct passwd *pwd; + +__dead static void doit(int, struct sockaddr_storage *); +static int control(int, char *, int); +static void protocol(int, int); +__dead static void cleanup(int); +__dead static void fatal(int, const char *, int); +static int do_rlogin(struct sockaddr *, char *); +static void getstr(char *, int, const char *); +static void setup_term(int); #if 0 -int do_krb_login __P((union sockunion *)); +static int do_krb_login(union sockunion *); #endif -void usage __P((void)); -int local_domain __P((char *)); -char *topdomain __P((char *)); -int main __P((int, char *[])); +__dead static void usage(void); +static int local_domain(char *); +static char *topdomain(char *); extern int __check_rhosts_file; extern char *__rcmd_errstr; /* syslog hook from libc/net/rcmd.c */ extern char **environ; int -main(argc, argv) - int argc; - char *argv[]; +main(int argc, char *argv[]) { struct sockaddr_storage from; int ch, on; @@ -230,18 +227,14 @@ #endif } -int child; -int netf; -char line[MAXPATHLEN]; -int confirmed; - -struct winsize win = { 0, 0, 0, 0 }; +static int netf; +static char line[MAXPATHLEN]; +static int confirmed; +static struct winsize win = { 0, 0, 0, 0 }; -void -doit(f, fromp) - int f; - struct sockaddr_storage *fromp; +static void +doit(int f, struct sockaddr_storage *fromp) { int master, pid, on = 1; int authenticated = 0; @@ -421,19 +414,16 @@ cleanup(0); } -char magic[2] = { 0377, 0377 }; -char oobdata[] = {TIOCPKT_WINDOW}; +static char magic[2] = { 0377, 0377 }; +static char oobdata[] = {TIOCPKT_WINDOW}; /* * Handle a control request (signaled by magic being present) * in the data stream. For now, we are only willing to handle * window size changes. */ -int -control(pty, cp, n) - int pty; - char *cp; - int n; +static int +control(int pty, char *cp, int n) { struct winsize w; @@ -452,9 +442,8 @@ /* * rlogin protocol machine. */ -void -protocol(f, p) - int f, p; +static void +protocol(int f, int p) { char pibuf[1024+1], fibuf[1024], *pbp = NULL, *fbp = NULL; /* XXX gcc above */ @@ -571,9 +560,8 @@ } } -void -cleanup(signo) - int signo; +static void +cleanup(int signo) { char *p, c; @@ -598,11 +586,8 @@ exit(1); } -void -fatal(f, msg, syserr) - int f; - const char *msg; - int syserr; +static void +fatal(int f, const char *msg, int syserr) { int len; char buf[BUFSIZ], *bp, *ep; @@ -625,10 +610,8 @@ exit(1); } -int -do_rlogin(dest, host) - struct sockaddr *dest; - char *host; +static int +do_rlogin(struct sockaddr *dest, char *host) { int retval; @@ -661,11 +644,8 @@ return(retval); } -void -getstr(buf, cnt, errmsg) - char *buf; - int cnt; - const char *errmsg; +static void +getstr(char *buf, int cnt, const char *errmsg) { char c; @@ -679,9 +659,8 @@ } -void -setup_term(fd) - int fd; +static void +setup_term(int fd) { char *cp = index(term+ENVSIZE, '/'); char *speed; @@ -721,10 +700,11 @@ } -void -usage() +static void +usage(void) { syslog(LOG_ERR, usage: rlogind [-alnL]); +
CVS commit: src/libexec/rpc.rquotad
Module Name:src Committed By: joerg Date: Sat Aug 27 15:46:59 UTC 2011 Modified Files: src/libexec/rpc.rquotad: rquotad.c Log Message: staticfy. Use __dead. To generate a diff of this commit: cvs rdiff -u -r1.27 -r1.28 src/libexec/rpc.rquotad/rquotad.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/libexec/rpc.rquotad/rquotad.c diff -u src/libexec/rpc.rquotad/rquotad.c:1.27 src/libexec/rpc.rquotad/rquotad.c:1.28 --- src/libexec/rpc.rquotad/rquotad.c:1.27 Thu Mar 24 17:05:43 2011 +++ src/libexec/rpc.rquotad/rquotad.c Sat Aug 27 15:46:59 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: rquotad.c,v 1.27 2011/03/24 17:05:43 bouyer Exp $ */ +/* $NetBSD: rquotad.c,v 1.28 2011/08/27 15:46:59 joerg Exp $ */ /* * by Manuel Bouyer (bou...@ensta.fr). Public domain. @@ -6,7 +6,7 @@ #include sys/cdefs.h #ifndef lint -__RCSID($NetBSD: rquotad.c,v 1.27 2011/03/24 17:05:43 bouyer Exp $); +__RCSID($NetBSD: rquotad.c,v 1.28 2011/08/27 15:46:59 joerg Exp $); #endif #include sys/param.h @@ -35,13 +35,12 @@ #include rpcsvc/rquota.h #include arpa/inet.h -void rquota_service(struct svc_req *request, SVCXPRT *transp); -void ext_rquota_service(struct svc_req *request, SVCXPRT *transp); -void sendquota(struct svc_req *request, int vers, SVCXPRT *transp); -void cleanup(int); -int main(int, char *[]); +static void rquota_service(struct svc_req *request, SVCXPRT *transp); +static void ext_rquota_service(struct svc_req *request, SVCXPRT *transp); +static void sendquota(struct svc_req *request, int vers, SVCXPRT *transp); +__dead static void cleanup(int); -int from_inetd = 1; +static int from_inetd = 1; static uint32_t qlim2rqlim(uint64_t lim) @@ -52,7 +51,7 @@ return (lim + 1); } -void +static void cleanup(int dummy) { @@ -122,7 +121,7 @@ exit(1); } -void +static void rquota_service(struct svc_req *request, SVCXPRT *transp) { switch (request-rq_proc) { @@ -143,7 +142,7 @@ exit(0); } -void +static void ext_rquota_service(struct svc_req *request, SVCXPRT *transp) { switch (request-rq_proc) { @@ -165,7 +164,7 @@ } /* read quota for the specified id, and send it */ -void +static void sendquota(struct svc_req *request, int vers, SVCXPRT *transp) { struct getquota_args getq_args;
CVS commit: [jym-xensuspend] src/sys/arch/xen/include
Module Name:src Committed By: jym Date: Sat Aug 27 15:48:36 UTC 2011 Modified Files: src/sys/arch/xen/include [jym-xensuspend]: xen.h Log Message: (HEAD fix) _BSD_VA_LIST_ = va_list To generate a diff of this commit: cvs rdiff -u -r1.30.8.6 -r1.30.8.7 src/sys/arch/xen/include/xen.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/xen/include/xen.h diff -u src/sys/arch/xen/include/xen.h:1.30.8.6 src/sys/arch/xen/include/xen.h:1.30.8.7 --- src/sys/arch/xen/include/xen.h:1.30.8.6 Sat Aug 27 15:44:09 2011 +++ src/sys/arch/xen/include/xen.h Sat Aug 27 15:48:35 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: xen.h,v 1.30.8.6 2011/08/27 15:44:09 jym Exp $ */ +/* $NetBSD: xen.h,v 1.30.8.7 2011/08/27 15:48:35 jym Exp $ */ /* * @@ -79,7 +79,7 @@ #include sys/stdarg.h void printk(const char *, ...); -void vprintk(const char *, _BSD_VA_LIST_); +void vprintk(const char *, va_list); #endif #endif
CVS commit: [jym-xensuspend] src/sys/arch/xen
Module Name:src Committed By: jym Date: Sat Aug 27 15:56:48 UTC 2011 Modified Files: src/sys/arch/xen/include [jym-xensuspend]: shutdown_xenbus.h xen.h src/sys/arch/xen/x86 [jym-xensuspend]: hypervisor_machdep.c src/sys/arch/xen/xen [jym-xensuspend]: shutdown_xenbus.c xen_machdep.c Log Message: Rename the functions for suspend to reflect that Xen does not hijack the ACPI sleepstate sysctl(7) node anymore. Add a boolean value to mark that the save/suspend operation has been notified by dom0, so as to avoid possible errors where admin would like to schedule the domain for sleep without dom0 being prepared for that. Fail with EAGAIN in this case. Sprinkle some KNF. To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.3.34.1 src/sys/arch/xen/include/shutdown_xenbus.h cvs rdiff -u -r1.30.8.7 -r1.30.8.8 src/sys/arch/xen/include/xen.h cvs rdiff -u -r1.11.8.9 -r1.11.8.10 src/sys/arch/xen/x86/hypervisor_machdep.c cvs rdiff -u -r1.5.8.3 -r1.5.8.4 src/sys/arch/xen/xen/shutdown_xenbus.c cvs rdiff -u -r1.4.12.9 -r1.4.12.10 src/sys/arch/xen/xen/xen_machdep.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/xen/include/shutdown_xenbus.h diff -u src/sys/arch/xen/include/shutdown_xenbus.h:1.3 src/sys/arch/xen/include/shutdown_xenbus.h:1.3.34.1 --- src/sys/arch/xen/include/shutdown_xenbus.h:1.3 Wed Oct 17 19:58:29 2007 +++ src/sys/arch/xen/include/shutdown_xenbus.h Sat Aug 27 15:56:48 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: shutdown_xenbus.h,v 1.3 2007/10/17 19:58:29 garbled Exp $ */ +/* $NetBSD: shutdown_xenbus.h,v 1.3.34.1 2011/08/27 15:56:48 jym Exp $ */ /*- * Copyright (c)2006 YAMAMOTO Takashi, @@ -29,6 +29,9 @@ #ifndef _XEN_SHUTDOWN_XENBUS_H_ #define _XEN_SHUTDOWN_XENBUS_H_ +/* Whether dom0 ordered a suspend (true) or not (false) */ +bool xen_suspend_allow; + void shutdown_xenbus_setup(void); #endif /* _XEN_SHUTDOWN_XENBUS_H_ */ Index: src/sys/arch/xen/include/xen.h diff -u src/sys/arch/xen/include/xen.h:1.30.8.7 src/sys/arch/xen/include/xen.h:1.30.8.8 --- src/sys/arch/xen/include/xen.h:1.30.8.7 Sat Aug 27 15:48:35 2011 +++ src/sys/arch/xen/include/xen.h Sat Aug 27 15:56:48 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: xen.h,v 1.30.8.7 2011/08/27 15:48:35 jym Exp $ */ +/* $NetBSD: xen.h,v 1.30.8.8 2011/08/27 15:56:48 jym Exp $ */ /* * @@ -73,7 +73,7 @@ void idle_block(void); /* xen_machdep.c */ -void sysctl_xen_sleepstate_setup(void); +void sysctl_xen_suspend_setup(void); #if defined(XENDEBUG) || 1 /* XXX */ #include sys/stdarg.h Index: src/sys/arch/xen/x86/hypervisor_machdep.c diff -u src/sys/arch/xen/x86/hypervisor_machdep.c:1.11.8.9 src/sys/arch/xen/x86/hypervisor_machdep.c:1.11.8.10 --- src/sys/arch/xen/x86/hypervisor_machdep.c:1.11.8.9 Sat Aug 27 15:44:09 2011 +++ src/sys/arch/xen/x86/hypervisor_machdep.c Sat Aug 27 15:56:48 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: hypervisor_machdep.c,v 1.11.8.9 2011/08/27 15:44:09 jym Exp $ */ +/* $NetBSD: hypervisor_machdep.c,v 1.11.8.10 2011/08/27 15:56:48 jym Exp $ */ /* * @@ -54,7 +54,7 @@ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: hypervisor_machdep.c,v 1.11.8.9 2011/08/27 15:44:09 jym Exp $); +__KERNEL_RCSID(0, $NetBSD: hypervisor_machdep.c,v 1.11.8.10 2011/08/27 15:56:48 jym Exp $); #include sys/param.h #include sys/systm.h @@ -383,7 +383,7 @@ /* dom0 does not require the arch-dependent P2M translation table */ if (!xendomain_is_dom0()) { build_p2m_frame_list_list(); - sysctl_xen_sleepstate_setup(); + sysctl_xen_suspend_setup(); } } Index: src/sys/arch/xen/xen/shutdown_xenbus.c diff -u src/sys/arch/xen/xen/shutdown_xenbus.c:1.5.8.3 src/sys/arch/xen/xen/shutdown_xenbus.c:1.5.8.4 --- src/sys/arch/xen/xen/shutdown_xenbus.c:1.5.8.3 Sun Nov 1 21:43:28 2009 +++ src/sys/arch/xen/xen/shutdown_xenbus.c Sat Aug 27 15:56:48 2011 @@ -1,4 +1,4 @@ -/* $Id: shutdown_xenbus.c,v 1.5.8.3 2009/11/01 21:43:28 jym Exp $ */ +/* $Id: shutdown_xenbus.c,v 1.5.8.4 2011/08/27 15:56:48 jym Exp $ */ /*- * Copyright (c)2006 YAMAMOTO Takashi, @@ -56,7 +56,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: shutdown_xenbus.c,v 1.5.8.3 2009/11/01 21:43:28 jym Exp $); +__KERNEL_RCSID(0, $NetBSD: shutdown_xenbus.c,v 1.5.8.4 2011/08/27 15:56:48 jym Exp $); #include sys/param.h #include sys/malloc.h @@ -130,6 +130,7 @@ } else if (strcmp(reqstr, reboot) == 0) { sysmon_pswitch_event(xenbus_reset, PSWITCH_EVENT_PRESSED); } else if (strcmp(reqstr, suspend) == 0) { + xen_suspend_allow = true; sysmon_pswitch_event(xenbus_sleep, PSWITCH_EVENT_PRESSED); } else { printf(ignore shutdown request: %s\n, reqstr); @@ -145,6 +146,7 @@ void shutdown_xenbus_setup(void) { + xen_suspend_allow = false; if (sysmon_pswitch_register(xenbus_power) != 0 || sysmon_pswitch_register(xenbus_reset) != 0 || Index: src/sys/arch/xen/xen/xen_machdep.c diff -u src/sys/arch/xen/xen/xen_machdep.c:1.4.12.9
CVS commit: src/sbin/amrctl
Module Name:src Committed By: joerg Date: Sat Aug 27 16:05:28 UTC 2011 Modified Files: src/sbin/amrctl: amrctl.c Log Message: staticfy. Use __dead. To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/sbin/amrctl/amrctl.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sbin/amrctl/amrctl.c diff -u src/sbin/amrctl/amrctl.c:1.2 src/sbin/amrctl/amrctl.c:1.3 --- src/sbin/amrctl/amrctl.c:1.2 Mon Mar 16 11:18:10 2009 +++ src/sbin/amrctl/amrctl.c Sat Aug 27 16:05:27 2011 @@ -44,18 +44,18 @@ #define NATTEMPTS 5 #define SLEEPTIME 10 /* microseconds */ -int nattempts = NATTEMPTS; /* # of attempts before giving up */ -int sleeptime = SLEEPTIME; /* between attempts, in ms */ +static int nattempts = NATTEMPTS; /* # of attempts before giving up */ +static int sleeptime = SLEEPTIME; /* between attempts, in ms */ #define AMR_BUFSIZE 1024 -int enq_result = AMR_STATUS_FAILED; -char enq_buffer[AMR_BUFSIZE]; +static int enq_result = AMR_STATUS_FAILED; +static char enq_buffer[AMR_BUFSIZE]; #define AMR_MAX_NCTRLS 16 #define AMR_MAX_NSDEVS 16 -u_int8_t nschan = 0; +static u_int8_t nschan = 0; /* * Include lookup tables, and a function to match a code to a string. @@ -67,15 +67,15 @@ /* #define AMR_DEFINE_TABLES */ /* #include amr_tables.h */ -int amr_ioctl_enquiry(int, u_int8_t, u_int8_t, u_int8_t); -void usage(char *); -int describe_card(int, int, int); -char * describe_property(u_int8_t, char *); -const char * describe_state(int, u_int8_t); -void describe_battery(int, int, int, int, int); -void describe_one_volume(int, int, u_int32_t, u_int8_t, u_int8_t); -void describe_one_drive(int, int, u_int8_t); -void describe_drive(int, int, int, int, int); +static int amr_ioctl_enquiry(int, u_int8_t, u_int8_t, u_int8_t); +__dead static void usage(const char *); +static int describe_card(int, int, int); +static char * describe_property(u_int8_t, char *); +static const char * describe_state(int, u_int8_t); +static void describe_battery(int, int, int, int, int); +static void describe_one_volume(int, int, u_int32_t, u_int8_t, u_int8_t); +static void describe_one_drive(int, int, u_int8_t); +static void describe_drive(int, int, int, int, int); /* * Offsets in an amr_user_ioctl.au_cmd [] array See amrio.h @@ -151,7 +151,7 @@ #define NTAB(tab) (sizeof tab / sizeof tab [0]) -int +static int amr_ioctl_enquiry(int fd, u_int8_t cmd, u_int8_t cmdsub, u_int8_t cmdqual) { struct amr_user_ioctl am; @@ -184,8 +184,8 @@ return am.au_status; } -void -usage(char *prog) +static void +usage(const char *prog) { fprintf(stderr, usage: %s stat [-a num] [-b] [-c ctlr|-f dev] [-g] [-l vol]\n\t\t @@ -208,7 +208,7 @@ * Card description */ -int +static int describe_card(int fd, int verbosity, int globalparam) { struct amr_enquiry *ae; @@ -345,7 +345,7 @@ } -char * +static char * describe_property(u_int8_t prop, char *buffer) { size_t i; @@ -364,7 +364,7 @@ return buffer; } -const char * +static const char * describe_state(int verbosity, u_int8_t state) { size_t i; @@ -383,7 +383,7 @@ /** * Battery status */ -void +static void describe_battery(int fd, int verbosity, int fwint, int bflags, int globalparam) { u_int8_t batt_status; @@ -431,7 +431,7 @@ * Logical volumes */ -void +static void describe_one_volume(int ldrv, int verbosity, u_int32_t size, u_int8_t state, u_int8_t prop) { @@ -459,7 +459,7 @@ * Physical drives */ -void +static void describe_one_drive(int pdrv, int verbosity, u_int8_t state) { const char *statestr; @@ -475,7 +475,7 @@ } } -void +static void describe_drive(int verbosity, int fwint, int ldrv, int sbus, int sdev) { int drv, pdrv = -1;
CVS commit: src/sbin/apmlabel
Module Name:src Committed By: joerg Date: Sat Aug 27 16:10:51 UTC 2011 Modified Files: src/sbin/apmlabel: apmlabel.c Log Message: staticfy. Use __nodead To generate a diff of this commit: cvs rdiff -u -r1.1.1.1 -r1.2 src/sbin/apmlabel/apmlabel.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sbin/apmlabel/apmlabel.c diff -u src/sbin/apmlabel/apmlabel.c:1.1.1.1 src/sbin/apmlabel/apmlabel.c:1.2 --- src/sbin/apmlabel/apmlabel.c:1.1.1.1 Mon Mar 5 23:06:53 2007 +++ src/sbin/apmlabel/apmlabel.c Sat Aug 27 16:10:51 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: apmlabel.c,v 1.1.1.1 2007/03/05 23:06:53 dillo Exp $ */ +/* $NetBSD: apmlabel.c,v 1.2 2011/08/27 16:10:51 joerg Exp $ */ /* * Copyright (C) 1998 Wolfgang Solfrank. @@ -33,7 +33,7 @@ #include sys/cdefs.h #ifndef lint -__RCSID($NetBSD: apmlabel.c,v 1.1.1.1 2007/03/05 23:06:53 dillo Exp $); +__RCSID($NetBSD: apmlabel.c,v 1.2 2011/08/27 16:10:51 joerg Exp $); #endif /* not lint */ #include stdio.h @@ -55,17 +55,16 @@ #include dkcksum.h #include extern.h -int main(int, char **); -void usage(void); -void getlabel(int); -void setlabel(int, int); -int getparts(int, int); -struct apple_drvr_map *convert_drvr_map(unsigned char *); -struct apple_part_map_entry *convert_part_map_entry(unsigned char *); +__dead static void usage(void); +static void getlabel(int); +static void setlabel(int, int); +static int getparts(int, int); +static struct apple_drvr_map *convert_drvr_map(unsigned char *); +static struct apple_part_map_entry *convert_part_map_entry(unsigned char *); -struct disklabel label; +static struct disklabel label; -void +static void getlabel(int sd) { @@ -81,7 +80,7 @@ label.d_npartitions = getrawpartition() + 1; } -void +static void setlabel(int sd, int doraw) { int one = 1; @@ -98,7 +97,7 @@ } -int +static int getparts(int sd, int verbose) { unsigned char buf[DEV_BSIZE]; @@ -235,7 +234,7 @@ return (changed); } -struct apple_drvr_map * +static struct apple_drvr_map * convert_drvr_map(unsigned char *buf) { struct apple_drvr_map *drvr; @@ -259,7 +258,7 @@ return drvr; } -struct apple_part_map_entry * +static struct apple_part_map_entry * convert_part_map_entry(unsigned char *buf) { struct apple_part_map_entry *part; @@ -285,7 +284,7 @@ return part; } -void +static void usage(void) { fprintf(stderr, usage: %s [-fqrw] rawdisk\n,
CVS commit: src/sbin/atactl
Module Name:src Committed By: joerg Date: Sat Aug 27 16:12:54 UTC 2011 Modified Files: src/sbin/atactl: atactl.c Log Message: staticfy. Use __dead. To generate a diff of this commit: cvs rdiff -u -r1.59 -r1.60 src/sbin/atactl/atactl.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sbin/atactl/atactl.c diff -u src/sbin/atactl/atactl.c:1.59 src/sbin/atactl/atactl.c:1.60 --- src/sbin/atactl/atactl.c:1.59 Wed Jan 19 07:55:12 2011 +++ src/sbin/atactl/atactl.c Sat Aug 27 16:12:54 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: atactl.c,v 1.59 2011/01/19 07:55:12 nisimura Exp $ */ +/* $NetBSD: atactl.c,v 1.60 2011/08/27 16:12:54 joerg Exp $ */ /*- * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -35,7 +35,7 @@ #include sys/cdefs.h #ifndef lint -__RCSID($NetBSD: atactl.c,v 1.59 2011/01/19 07:55:12 nisimura Exp $); +__RCSID($NetBSD: atactl.c,v 1.60 2011/08/27 16:12:54 joerg Exp $); #endif @@ -100,38 +100,38 @@ const char *string; }; -void usage(void); -void ata_command(struct atareq *); -void print_bitinfo(const char *, const char *, u_int, struct bitinfo *); -void print_bitinfo2(const char *, const char *, u_int, u_int, struct bitinfo *); -void print_smart_status(void *, void *); -void print_error_entry(int, struct ata_smart_error *); -void print_selftest_entry(int, struct ata_smart_selftest *); - -void print_error(void *); -void print_selftest(void *); - -struct ataparams *getataparams(void); - -int is_smart(void); - -int fd;/* file descriptor for device */ -const char *dvname; /* device name */ -char dvname_store[MAXPATHLEN]; /* for opendisk(3) */ -const char *cmdname; /* command user issued */ -const char *argnames; /* helpstring: expected arguments */ - -void device_identify(int, char *[]); -void device_setidle(int, char *[]); -void device_idle(int, char *[]); -void device_apm(int, char *[]); -void device_checkpower(int, char *[]); -void device_smart(int, char *[]); -void device_security(int, char *[]); +__dead static void usage(void); +static void ata_command(struct atareq *); +static void print_bitinfo(const char *, const char *, u_int, struct bitinfo *); +static void print_bitinfo2(const char *, const char *, u_int, u_int, struct bitinfo *); +static void print_smart_status(void *, void *); +static void print_error_entry(int, struct ata_smart_error *); +static void print_selftest_entry(int, struct ata_smart_selftest *); + +static void print_error(void *); +static void print_selftest(void *); + +static struct ataparams *getataparams(void); + +static int is_smart(void); + +static int fd;/* file descriptor for device */ +static const char *dvname; /* device name */ +static char dvname_store[MAXPATHLEN]; /* for opendisk(3) */ +static const char *cmdname; /* command user issued */ +static const char *argnames; /* helpstring: expected arguments */ + +static void device_identify(int, char *[]); +static void device_setidle(int, char *[]); +static void device_idle(int, char *[]); +static void device_apm(int, char *[]); +static void device_checkpower(int, char *[]); +static void device_smart(int, char *[]); +static void device_security(int, char *[]); -void device_smart_temp(struct ata_smart_attr *, uint64_t); +static void device_smart_temp(struct ata_smart_attr *, uint64_t); -struct command device_commands[] = { +static struct command device_commands[] = { { identify, , device_identify }, { setidle, idle-timer, device_setidle }, { apm, disable|set #, device_apm }, @@ -146,9 +146,9 @@ { NULL, NULL, NULL }, }; -void bus_reset(int, char *[]); +static void bus_reset(int, char *[]); -struct command bus_commands[] = { +static struct command bus_commands[] = { { reset, , bus_reset }, { NULL, NULL, NULL }, }; @@ -158,7 +158,7 @@ * device identification. */ -struct bitinfo ata_caps[] = { +static struct bitinfo ata_caps[] = { { WDC_CAP_DMA, DMA }, { WDC_CAP_LBA, LBA }, { ATA_CAP_STBY, ATA standby timer values }, @@ -167,7 +167,7 @@ { 0, NULL }, }; -struct bitinfo ata_vers[] = { +static struct bitinfo ata_vers[] = { { WDC_VER_ATA1, ATA-1 }, { WDC_VER_ATA2, ATA-2 }, { WDC_VER_ATA3, ATA-3 }, @@ -178,7 +178,7 @@ { 0, NULL }, }; -struct bitinfo ata_cmd_set1[] = { +static struct bitinfo ata_cmd_set1[] = { { WDC_CMD1_NOP, NOP command }, { WDC_CMD1_RB, READ BUFFER command }, { WDC_CMD1_WB, WRITE BUFFER command }, @@ -196,7 +196,7 @@ { 0, NULL }, }; -struct bitinfo ata_cmd_set2[] = { +static struct bitinfo ata_cmd_set2[] = { { ATA_CMD2_FCE, FLUSH CACHE EXT command }, { WDC_CMD2_FC, FLUSH CACHE command }, { WDC_CMD2_DCO, Device Configuration Overlay feature set }, @@ -213,7 +213,7 @@ { 0, NULL }, }; -struct bitinfo ata_cmd_ext[] = { +static struct bitinfo ata_cmd_ext[] = { { ATA_CMDE_TLCONT, Time-limited R/W feature set R/W Continuous mode }, { ATA_CMDE_TL, Time-limited Read/Write }, { ATA_CMDE_URGW,
CVS commit: src/sys/arch/amd64
Module Name:src Committed By: christos Date: Sat Aug 27 16:23:44 UTC 2011 Modified Files: src/sys/arch/amd64/amd64: machdep.c src/sys/arch/amd64/include: pmap.h Log Message: Implement sparse dumps for amd64 (copied from i386). Disabled for now via sysctl. XXX: most of the code can be merged. To generate a diff of this commit: cvs rdiff -u -r1.164 -r1.165 src/sys/arch/amd64/amd64/machdep.c cvs rdiff -u -r1.25 -r1.26 src/sys/arch/amd64/include/pmap.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/amd64/amd64/machdep.c diff -u src/sys/arch/amd64/amd64/machdep.c:1.164 src/sys/arch/amd64/amd64/machdep.c:1.165 --- src/sys/arch/amd64/amd64/machdep.c:1.164 Thu Aug 11 14:11:17 2011 +++ src/sys/arch/amd64/amd64/machdep.c Sat Aug 27 12:23:44 2011 @@ -1,7 +1,7 @@ -/* $NetBSD: machdep.c,v 1.164 2011/08/11 18:11:17 cherry Exp $ */ +/* $NetBSD: machdep.c,v 1.165 2011/08/27 16:23:44 christos Exp $ */ /*- - * Copyright (c) 1996, 1997, 1998, 2000, 2006, 2007, 2008 + * Copyright (c) 1996, 1997, 1998, 2000, 2006, 2007, 2008, 2011 * The NetBSD Foundation, Inc. * All rights reserved. * @@ -9,6 +9,10 @@ * by Charles M. Hannum and by Jason R. Thorpe of the Numerical Aerospace * Simulation Facility, NASA Ames Research Center. * + * This code is derived from software contributed to The NetBSD Foundation + * by Coyote Point Systems, Inc. which was written under contract to Coyote + * Point by Jed Davis and Devon O'Dell. + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -107,7 +111,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: machdep.c,v 1.164 2011/08/11 18:11:17 cherry Exp $); +__KERNEL_RCSID(0, $NetBSD: machdep.c,v 1.165 2011/08/27 16:23:44 christos Exp $); /* #define XENDEBUG_LOW */ @@ -239,6 +243,25 @@ uint64_t dumpmem_high; int cpu_class; + +#ifndef NO_SPARSE_DUMP +int sparse_dump = 0; + +paddr_t max_paddr = 0; +unsigned char *sparse_dump_physmap; +#endif + +char *dump_headerbuf, *dump_headerbuf_ptr; +#define dump_headerbuf_size PAGE_SIZE +#define dump_headerbuf_end (dump_headerbuf + dump_headerbuf_size) +#define dump_headerbuf_avail (dump_headerbuf_end - dump_headerbuf_ptr) +daddr_t dump_header_blkno; + +size_t dump_nmemsegs; +size_t dump_npages; +size_t dump_header_size; +size_t dump_totalbytesleft; + vaddr_t msgbuf_vaddr; paddr_t msgbuf_paddr; @@ -290,8 +313,28 @@ int cpu_dump(void); int cpu_dumpsize(void); u_long cpu_dump_mempagecnt(void); -void dumpsys(void); void dodumpsys(void); +void dumpsys(void); + +void dump_misc_init(void); +void dump_seg_prep(void); +int dump_seg_iter(int (*)(paddr_t, paddr_t)); + +#ifndef NO_SPARSE_DUMP +void sparse_dump_reset(void); +void sparse_dump_mark(vaddr_t, vaddr_t, int); +void cpu_dump_prep_sparse(void); +#endif + +void dump_header_start(void); +int dump_header_flush(void); +int dump_header_addbytes(const void*, size_t); +int dump_header_addseg(paddr_t, paddr_t); +int dump_header_finish(void); + +int dump_seg_count_range(paddr_t, paddr_t); +int dumpsys_seg(paddr_t, paddr_t); + void init_x86_64(paddr_t); /* @@ -530,6 +573,14 @@ SYSCTL_DESCR(Whether the kernel uses PAE), NULL, 1, NULL, 0, CTL_MACHDEP, CTL_CREATE, CTL_EOL); +#ifndef NO_SPARSE_DUMP + /* XXXjld Does this really belong under machdep, and not e.g. kern? */ + sysctl_createv(clog, 0, NULL, NULL, + CTLFLAG_PERMANENT|CTLFLAG_READWRITE, + CTLTYPE_INT, sparse_dump, NULL, + NULL, 0, sparse_dump, 0, + CTL_MACHDEP, CTL_CREATE, CTL_EOL); +#endif } void @@ -746,6 +797,259 @@ * XXXfvdl share dumpcode. */ + /* + * Perform assorted dump-related initialization tasks. Assumes that + * the maximum physical memory address will not increase afterwards. + */ +void +dump_misc_init(void) +{ +#ifndef NO_SPARSE_DUMP + int i; +#endif + + if (dump_headerbuf != NULL) + return; /* already called */ + +#ifndef NO_SPARSE_DUMP + for (i = 0; i mem_cluster_cnt; ++i) { + paddr_t top = mem_clusters[i].start + mem_clusters[i].size; + if (max_paddr top) + max_paddr = top; + } +#ifdef DEBUG + printf(dump_misc_init: max_paddr = 0x%lx\n, + (unsigned long)max_paddr); +#endif + + sparse_dump_physmap = (void*)uvm_km_alloc(kernel_map, + roundup(max_paddr / (PAGE_SIZE * NBBY), PAGE_SIZE), + PAGE_SIZE, UVM_KMF_WIRED|UVM_KMF_ZERO); +#endif + dump_headerbuf = (void*)uvm_km_alloc(kernel_map, + dump_headerbuf_size, + PAGE_SIZE, UVM_KMF_WIRED|UVM_KMF_ZERO); + /* XXXjld should check for failure here, disable dumps if so. */ +} + +#ifndef NO_SPARSE_DUMP +/* + * Clear the set of pages to include in a sparse dump. + */ +void +sparse_dump_reset(void) +{ + memset(sparse_dump_physmap, 0, + roundup(max_paddr / (PAGE_SIZE * NBBY), PAGE_SIZE)); +} + +/* + * Include or exclude pages
CVS commit: src/sbin/ccdconfig
Module Name:src Committed By: joerg Date: Sat Aug 27 16:29:51 UTC 2011 Modified Files: src/sbin/ccdconfig: ccdconfig.c Log Message: static. __dead. To generate a diff of this commit: cvs rdiff -u -r1.50 -r1.51 src/sbin/ccdconfig/ccdconfig.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sbin/ccdconfig/ccdconfig.c diff -u src/sbin/ccdconfig/ccdconfig.c:1.50 src/sbin/ccdconfig/ccdconfig.c:1.51 --- src/sbin/ccdconfig/ccdconfig.c:1.50 Tue Jan 4 23:31:29 2011 +++ src/sbin/ccdconfig/ccdconfig.c Sat Aug 27 16:29:51 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: ccdconfig.c,v 1.50 2011/01/04 23:31:29 wiz Exp $ */ +/* $NetBSD: ccdconfig.c,v 1.51 2011/08/27 16:29:51 joerg Exp $ */ /*- * Copyright (c) 1996, 1997 The NetBSD Foundation, Inc. @@ -33,7 +33,7 @@ #ifndef lint __COPYRIGHT(@(#) Copyright (c) 1996, 1997\ The NetBSD Foundation, Inc. All rights reserved.); -__RCSID($NetBSD: ccdconfig.c,v 1.50 2011/01/04 23:31:29 wiz Exp $); +__RCSID($NetBSD: ccdconfig.c,v 1.51 2011/08/27 16:29:51 joerg Exp $); #endif #include sys/param.h @@ -68,7 +68,7 @@ static char *core; static char *kernel; -struct flagval { +static struct flagval { const char *fv_flag; int fv_val; } flagvaltab[] = { @@ -102,7 +102,7 @@ static int pathtounit(char *, int *); static void print_ccd_info(struct ccd_softc *, kvm_t *); static char *resolve_ccdname(char *); -static void usage(void); +__dead static void usage(void); int main(int argc, char *argv[])
CVS commit: src/sbin/dkctl
Module Name:src Committed By: joerg Date: Sat Aug 27 16:34:38 UTC 2011 Modified Files: src/sbin/dkctl: dkctl.c Log Message: staticfy. __dead. To generate a diff of this commit: cvs rdiff -u -r1.19 -r1.20 src/sbin/dkctl/dkctl.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sbin/dkctl/dkctl.c diff -u src/sbin/dkctl/dkctl.c:1.19 src/sbin/dkctl/dkctl.c:1.20 --- src/sbin/dkctl/dkctl.c:1.19 Sat Aug 6 16:34:40 2011 +++ src/sbin/dkctl/dkctl.c Sat Aug 27 16:34:38 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: dkctl.c,v 1.19 2011/08/06 16:34:40 dholland Exp $ */ +/* $NetBSD: dkctl.c,v 1.20 2011/08/27 16:34:38 joerg Exp $ */ /* * Copyright 2001 Wasabi Systems, Inc. @@ -41,7 +41,7 @@ #include sys/cdefs.h #ifndef lint -__RCSID($NetBSD: dkctl.c,v 1.19 2011/08/06 16:34:40 dholland Exp $); +__RCSID($NetBSD: dkctl.c,v 1.20 2011/08/27 16:34:38 joerg Exp $); #endif @@ -78,36 +78,32 @@ int open_flags; }; -struct command *lookup(const char *); -void usage(void); -void run(int, char *[]); -void showall(void); - -int fd;/* file descriptor for device */ -const char *dvname; /* device name */ -char dvname_store[MAXPATHLEN]; /* for opendisk(3) */ -const char *cmdname; /* command user issued */ - -int dkw_sort(const void *, const void *); -int yesno(const char *); - -void disk_getcache(int, char *[]); -void disk_setcache(int, char *[]); -void disk_synccache(int, char *[]); -void disk_keeplabel(int, char *[]); -void disk_badsectors(int, char *[]); - -void disk_addwedge(int, char *[]); -void disk_delwedge(int, char *[]); -void disk_getwedgeinfo(int, char *[]); -void disk_listwedges(int, char *[]); -void disk_strategy(int, char *[]); - -void disk_foreachwedges(int, char *[], void (*)(struct dkwedge_list *)); -void disk_listwedges_cb(struct dkwedge_list *); -void disk_getwedgeinfo_cb(struct dkwedge_info *); +static struct command *lookup(const char *); +__dead static void usage(void); +static void run(int, char *[]); +static void showall(void); + +static int fd;/* file descriptor for device */ +static const char *dvname; /* device name */ +static char dvname_store[MAXPATHLEN]; /* for opendisk(3) */ +static const char *cmdname; /* command user issued */ + +static int dkw_sort(const void *, const void *); +static int yesno(const char *); + +static void disk_getcache(int, char *[]); +static void disk_setcache(int, char *[]); +static void disk_synccache(int, char *[]); +static void disk_keeplabel(int, char *[]); +static void disk_badsectors(int, char *[]); + +static void disk_addwedge(int, char *[]); +static void disk_delwedge(int, char *[]); +static void disk_getwedgeinfo(int, char *[]); +static void disk_listwedges(int, char *[]); +static void disk_strategy(int, char *[]); -struct command commands[] = { +static struct command commands[] = { { getcache, , disk_getcache, @@ -186,7 +182,7 @@ exit(0); } -void +static void run(int argc, char *argv[]) { struct command *command; @@ -206,7 +202,7 @@ (void)close(fd); } -struct command * +static struct command * lookup(const char *name) { int i; @@ -221,7 +217,7 @@ return commands[i]; } -void +static void usage(void) { int i; @@ -239,7 +235,7 @@ exit(1); } -void +static void showall(void) { printf(strategy:\n); @@ -259,7 +255,7 @@ run(0, NULL); } -void +static void disk_strategy(int argc, char *argv[]) { struct disk_strategy odks; @@ -290,7 +286,7 @@ } } -void +static void disk_getcache(int argc, char *argv[]) { int bits; @@ -316,7 +312,7 @@ (bits DKCACHE_SAVE) ? : not ); } -void +static void disk_setcache(int argc, char *argv[]) { int bits; @@ -346,7 +342,7 @@ err(1, %s: setcache, dvname); } -void +static void disk_synccache(int argc, char *argv[]) { int force; @@ -371,7 +367,7 @@ err(1, %s: sync cache, dvname); } -void +static void disk_keeplabel(int argc, char *argv[]) { int keep; @@ -391,7 +387,7 @@ } -void +static void disk_badsectors(int argc, char *argv[]) { struct disk_badsectors *dbs, *dbs2, buffer[200]; @@ -539,7 +535,7 @@ } } -void +static void disk_addwedge(int argc, char *argv[]) { struct dkwedge_info dkw; @@ -588,7 +584,7 @@ } -void +static void disk_delwedge(int argc, char *argv[]) { struct dkwedge_info dkw; @@ -605,7 +601,7 @@ err(1, %s: delwedge, dvname); } -void +static void disk_getwedgeinfo(int argc, char *argv[]) { struct dkwedge_info dkw; @@ -622,7 +618,7 @@ dkw.dkw_devname, dkw.dkw_size, dkw.dkw_offset, dkw.dkw_ptype); } -void +static void disk_listwedges(int argc, char *argv[]) { struct dkwedge_info *dkw; @@ -670,7 +666,7 @@ } } -int +static int dkw_sort(const void *a, const void *b) { const struct dkwedge_info *dkwa = a, *dkwb = b; @@ -682,7 +678,7 @@ /* * return YES, NO or -1. */ -int +static int yesno(const char *p) {
CVS commit: src/sbin/resize_ffs
Module Name:src Committed By: christos Date: Sat Aug 27 16:34:57 UTC 2011 Modified Files: src/sbin/resize_ffs: resize_ffs.8 resize_ffs.c Log Message: PR/45301: Julian Fagir: make clear that the unit is sectors and fix a typo. While there, use errx, and sizeof(*var) instead of sizeof(type) To generate a diff of this commit: cvs rdiff -u -r1.10 -r1.11 src/sbin/resize_ffs/resize_ffs.8 cvs rdiff -u -r1.31 -r1.32 src/sbin/resize_ffs/resize_ffs.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sbin/resize_ffs/resize_ffs.8 diff -u src/sbin/resize_ffs/resize_ffs.8:1.10 src/sbin/resize_ffs/resize_ffs.8:1.11 --- src/sbin/resize_ffs/resize_ffs.8:1.10 Tue Jan 4 21:18:15 2011 +++ src/sbin/resize_ffs/resize_ffs.8 Sat Aug 27 12:34:57 2011 @@ -1,4 +1,4 @@ -.\ $NetBSD: resize_ffs.8,v 1.10 2011/01/05 02:18:15 riz Exp $ +.\ $NetBSD: resize_ffs.8,v 1.11 2011/08/27 16:34:57 christos Exp $ .\ .\ As its sole author, I explicitly place this man page in the public .\ domain. Anyone may use it in any way for any purpose (though I would @@ -24,8 +24,7 @@ .Nm resizes a file system. .Ar special -is the name of the raw disk device or file where the file system resides; -(Sectors are almost always 512 bytes, and +is the name of the raw disk device or file where the file system resides. .Nm can both grow and shrink file systems. When growing, the disk device @@ -60,6 +59,8 @@ .It Fl s Specify the file system size to which the file system should be resized. +The size is given as the count of disk sectors, usually 512 bytes. To see the +exact value, have a look at the disk specification or the disklabel. Mostly used to shrink file systems. .It Fl y Disable sanity questions made by Index: src/sbin/resize_ffs/resize_ffs.c diff -u src/sbin/resize_ffs/resize_ffs.c:1.31 src/sbin/resize_ffs/resize_ffs.c:1.32 --- src/sbin/resize_ffs/resize_ffs.c:1.31 Sun Aug 14 22:22:46 2011 +++ src/sbin/resize_ffs/resize_ffs.c Sat Aug 27 12:34:57 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: resize_ffs.c,v 1.31 2011/08/15 02:22:46 dholland Exp $ */ +/* $NetBSD: resize_ffs.c,v 1.32 2011/08/27 16:34:57 christos Exp $ */ /* From sources sent on February 17, 2003 */ /*- * As its sole author, I explicitly place this code in the public @@ -36,7 +36,7 @@ */ #include sys/cdefs.h -__RCSID($NetBSD: resize_ffs.c,v 1.31 2011/08/15 02:22:46 dholland Exp $); +__RCSID($NetBSD: resize_ffs.c,v 1.32 2011/08/27 16:34:57 christos Exp $); #include sys/disk.h #include sys/disklabel.h @@ -322,7 +322,7 @@ char *cgp; cgblksz = roundup(oldsb-fs_cgsize, oldsb-fs_fsize); - cgs = nfmalloc(oldsb-fs_ncg * sizeof(struct cg *), cg pointers); + cgs = nfmalloc(oldsb-fs_ncg * sizeof(*cgs), cg pointers); cgp = alloconce(oldsb-fs_ncg * cgblksz, cgs); cgflags = nfmalloc(oldsb-fs_ncg, cg flags); csums = nfmalloc(oldsb-fs_cssize, cg summary); @@ -611,7 +611,7 @@ if (is_ufs2 == 0) /* Write out the cleared inodes. */ writeat(fsbtodb(newsb, cgimin(newsb, cgn)), zinodes, - newsb-fs_ipg * sizeof(struct ufs1_dinode)); + newsb-fs_ipg * sizeof(*zinodes)); /* Dirty the cg. */ cgflags[cgn] |= CGF_DIRTY; } @@ -862,10 +862,8 @@ * on disk at this point; the csum info will be written to the * then-current fs_csaddr as part of the final flush. */ newloc = find_freespace(ntot); - if (newloc 0) { - printf(Sorry, no space available for new csums\n); - exit(EXIT_FAILURE); - } + if (newloc 0) + errx(EXIT_FAILURE, Sorry, no space available for new csums); for (i = 0, f = newsb-fs_csaddr, t = newloc; i ntot; i++, f++, t++) { if (i nold) { free_frag(f); @@ -926,16 +924,15 @@ /* Update the timestamp. */ newsb-fs_time = timestamp(); /* Allocate and clear the new-inode area, in case we add any cgs. */ - zinodes = alloconce(newsb-fs_ipg * sizeof(struct ufs1_dinode), -zeroed inodes); - memset(zinodes, 0, newsb-fs_ipg * sizeof(struct ufs1_dinode)); + zinodes = alloconce(newsb-fs_ipg * sizeof(*zinodes), zeroed inodes); + memset(zinodes, 0, newsb-fs_ipg * sizeof(*zinodes)); /* Update the size. */ newsb-fs_size = dbtofsb(newsb, newsize); /* Did we actually not grow? (This can happen if newsize is less than * a frag larger than the old size - unlikely, but no excuse to * misbehave if it happens.) */ if (newsb-fs_size == oldsb-fs_size) { - printf(New fs size %PRIu64 = odl fs size %PRIu64 + printf(New fs size %PRIu64 = old fs size %PRIu64 , not growing.\n, newsb-fs_size, oldsb-fs_size); return; } @@ -977,7 +974,7 @@ cgs. */ if (newsb-fs_ncg oldsb-fs_ncg) { char *cgp; - cgs = nfrealloc(cgs, newsb-fs_ncg * sizeof(struct cg *), + cgs = nfrealloc(cgs, newsb-fs_ncg * sizeof(*cgs), cg pointers); cgflags = nfrealloc(cgflags, newsb-fs_ncg, cg flags); memset(cgflags + oldsb-fs_ncg, 0, @@ -1228,7 +1225,7 @@
CVS commit: src/sbin/dkscan_bsdlabel
Module Name:src Committed By: joerg Date: Sat Aug 27 16:43:07 UTC 2011 Modified Files: src/sbin/dkscan_bsdlabel: dkscan_bsdlabel.c dkscan_util.h Log Message: Mark usage as static and dead. To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/sbin/dkscan_bsdlabel/dkscan_bsdlabel.c \ src/sbin/dkscan_bsdlabel/dkscan_util.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sbin/dkscan_bsdlabel/dkscan_bsdlabel.c diff -u src/sbin/dkscan_bsdlabel/dkscan_bsdlabel.c:1.2 src/sbin/dkscan_bsdlabel/dkscan_bsdlabel.c:1.3 --- src/sbin/dkscan_bsdlabel/dkscan_bsdlabel.c:1.2 Mon Apr 28 20:23:08 2008 +++ src/sbin/dkscan_bsdlabel/dkscan_bsdlabel.c Sat Aug 27 16:43:07 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: dkscan_bsdlabel.c,v 1.2 2008/04/28 20:23:08 martin Exp $ */ +/* $NetBSD: dkscan_bsdlabel.c,v 1.3 2011/08/27 16:43:07 joerg Exp $ */ /*- * Copyright (c) 2007 The NetBSD Foundation, Inc. @@ -43,6 +43,8 @@ #include dkwedge_bsdlabel.c +__dead static void usage(void); + int main(int argc, char **argv) { Index: src/sbin/dkscan_bsdlabel/dkscan_util.h diff -u src/sbin/dkscan_bsdlabel/dkscan_util.h:1.2 src/sbin/dkscan_bsdlabel/dkscan_util.h:1.3 --- src/sbin/dkscan_bsdlabel/dkscan_util.h:1.2 Mon Apr 28 20:23:08 2008 +++ src/sbin/dkscan_bsdlabel/dkscan_util.h Sat Aug 27 16:43:07 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: dkscan_util.h,v 1.2 2008/04/28 20:23:08 martin Exp $ */ +/* $NetBSD: dkscan_util.h,v 1.3 2011/08/27 16:43:07 joerg Exp $ */ /*- * Copyright (c) 2007 The NetBSD Foundation, Inc. @@ -39,8 +39,6 @@ int dkwedge_add(struct dkwedge_info *dkw); void aprint_error(const char *format, ...); void aprint_verbose(const char *format, ...); -void usage(void); - extern int verbose; /* are we verbose? */ extern int no_action; /* don't do anything, just print info */
CVS commit: src/sys/arch/mips/mips
Module Name:src Committed By: bouyer Date: Sat Aug 27 16:54:14 UTC 2011 Modified Files: src/sys/arch/mips/mips: mips_machdep.c Log Message: There are non-writable bits in MIPS_COP_0_TLB_HI between ASID and VPN, so mips3_cp0_tlb_entry_hi_probe() returns a value with some 0 in the low 12 bits. Thus the computed mips_vm_maxuser_address is wrong. Fix by oring PAGE_MASK to return value of mips3_cp0_tlb_entry_hi_probe(). To generate a diff of this commit: cvs rdiff -u -r1.247 -r1.248 src/sys/arch/mips/mips/mips_machdep.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/mips/mips/mips_machdep.c diff -u src/sys/arch/mips/mips/mips_machdep.c:1.247 src/sys/arch/mips/mips/mips_machdep.c:1.248 --- src/sys/arch/mips/mips/mips_machdep.c:1.247 Wed Aug 24 16:01:53 2011 +++ src/sys/arch/mips/mips/mips_machdep.c Sat Aug 27 16:54:14 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: mips_machdep.c,v 1.247 2011/08/24 16:01:53 matt Exp $ */ +/* $NetBSD: mips_machdep.c,v 1.248 2011/08/27 16:54:14 bouyer Exp $ */ /* * Copyright 2002 Wasabi Systems, Inc. @@ -112,7 +112,7 @@ #include sys/cdefs.h /* RCS ID Copyright macro defns */ -__KERNEL_RCSID(0, $NetBSD: mips_machdep.c,v 1.247 2011/08/24 16:01:53 matt Exp $); +__KERNEL_RCSID(0, $NetBSD: mips_machdep.c,v 1.248 2011/08/27 16:54:14 bouyer Exp $); #define __INTR_PRIVATE #include opt_cputype.h @@ -1358,6 +1358,7 @@ opts-mips3_tlb_pg_mask = mips3_cp0_tlb_page_mask_probe(); if (CPUIS64BITS) { opts-mips3_tlb_vpn_mask = mips3_cp0_tlb_entry_hi_probe(); + opts-mips3_tlb_vpn_mask |= PAGE_MASK; opts-mips3_tlb_vpn_mask = 2; opts-mips3_tlb_vpn_mask = 2; opts-mips3_tlb_pfn_mask = mips3_cp0_tlb_entry_lo_probe();
CVS commit: src/sys
Module Name:src Committed By: bouyer Date: Sat Aug 27 17:05:58 UTC 2011 Modified Files: src/sys/arch/evbmips/conf: LOONGSON src/sys/conf: files src/sys/dev/ata: ata_wdc.c src/sys/dev/ic: wdc.c Log Message: The loongon2f+cs5526+jmicron PATA-SATA bridge cause an interresting issue: 1) because the CS5536 is not associated with a x86 CPU, interrupts are not ack'ed as it expects so interrupts cannot configured as edge-triggered (as is expected for a PCIIDE in compat mode) 2) the PATA-SATA bridge ignores the WDC_IDS (interrupt disable bit) so the PATA IRQ line gets asserted when resetting or running some polled commands. It also wrongly asserts IRQ when the (nonexistent) slave device is selected 2) wouldn't be an issue with edge-triggered interrupt because we would get a spurious interrupt and continue operation, a new interrupt only shows up when the PATA IRQ line goes low and high again. But because of 1), we get an unclearable interrupt instead, and the system loops on the interrupt handler. To workaround this, introduce a WDC_NO_IDS compile option which runs all polled commands (including reset) at splbio() and without sleeps, so that the controller's interrupt is effectively disabled and won't be reenabled before the interrupt can be cleared. The conditions triggering this problem are speficic enough to handle this via a compile-time option; no need for a run-time (e.g. a config(9), device property or callback to disable interrupts) solution. To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/sys/arch/evbmips/conf/LOONGSON cvs rdiff -u -r1.1025 -r1.1026 src/sys/conf/files cvs rdiff -u -r1.93 -r1.94 src/sys/dev/ata/ata_wdc.c cvs rdiff -u -r1.262 -r1.263 src/sys/dev/ic/wdc.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/evbmips/conf/LOONGSON diff -u src/sys/arch/evbmips/conf/LOONGSON:1.1 src/sys/arch/evbmips/conf/LOONGSON:1.2 --- src/sys/arch/evbmips/conf/LOONGSON:1.1 Sat Aug 27 13:42:44 2011 +++ src/sys/arch/evbmips/conf/LOONGSON Sat Aug 27 17:05:57 2011 @@ -1,4 +1,4 @@ -# $NetBSD: LOONGSON,v 1.1 2011/08/27 13:42:44 bouyer Exp $ +# $NetBSD: LOONGSON,v 1.2 2011/08/27 17:05:57 bouyer Exp $ # # LOONGSON machine description file # @@ -22,7 +22,7 @@ options INCLUDE_CONFIG_FILE # embed config file in kernel binary -#ident GDIUM-$Revision: 1.1 $ +#ident GDIUM-$Revision: 1.2 $ maxusers 16 @@ -179,6 +179,7 @@ pciide* at pci? dev ? function ? flags 0x # GENERIC pciide driver viaide* at pci? dev ? function ? # VIA/AMD/Nvidia IDE controllers +options WDC_NO_IDS #workaround CS5536+JMH330 interrupt disable bug # ATA (IDE) bus support atabus* at ata? Index: src/sys/conf/files diff -u src/sys/conf/files:1.1025 src/sys/conf/files:1.1026 --- src/sys/conf/files:1.1025 Fri Aug 26 19:07:13 2011 +++ src/sys/conf/files Sat Aug 27 17:05:57 2011 @@ -1,4 +1,4 @@ -# $NetBSD: files,v 1.1025 2011/08/26 19:07:13 jmcneill Exp $ +# $NetBSD: files,v 1.1026 2011/08/27 17:05:57 bouyer Exp $ # @(#)files.newconf 7.5 (Berkeley) 5/10/93 version 20100430 @@ -946,6 +946,7 @@ device wdc: ata, wdc_common defflag opt_ata.h ATADEBUG +defflag opt_wdc.h WDC_NO_IDS device atabus: atapi,ata_hl attach atabus at ata Index: src/sys/dev/ata/ata_wdc.c diff -u src/sys/dev/ata/ata_wdc.c:1.93 src/sys/dev/ata/ata_wdc.c:1.94 --- src/sys/dev/ata/ata_wdc.c:1.93 Sun Mar 28 20:46:18 2010 +++ src/sys/dev/ata/ata_wdc.c Sat Aug 27 17:05:57 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: ata_wdc.c,v 1.93 2010/03/28 20:46:18 snj Exp $ */ +/* $NetBSD: ata_wdc.c,v 1.94 2011/08/27 17:05:57 bouyer Exp $ */ /* * Copyright (c) 1998, 2001, 2003 Manuel Bouyer. @@ -54,9 +54,10 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: ata_wdc.c,v 1.93 2010/03/28 20:46:18 snj Exp $); +__KERNEL_RCSID(0, $NetBSD: ata_wdc.c,v 1.94 2011/08/27 17:05:57 bouyer Exp $); #include opt_ata.h +#include opt_wdc.h #include sys/param.h #include sys/systm.h @@ -180,6 +181,11 @@ struct ata_drive_datas *drvp = chp-ch_drive[xfer-c_drive]; int wait_flags = (xfer-c_flags C_POLL) ? AT_POLL : 0; const char *errstring; +#ifdef WDC_NO_IDS + wait_flags = AT_POLL; +#else +#error NEED WDC_NO_IDS +#endif ATADEBUG_PRINT((wdc_ata_bio_start %s:%d:%d\n, device_xname(atac-atac_dev), chp-ch_channel, xfer-c_drive), Index: src/sys/dev/ic/wdc.c diff -u src/sys/dev/ic/wdc.c:1.262 src/sys/dev/ic/wdc.c:1.263 --- src/sys/dev/ic/wdc.c:1.262 Sat Aug 13 16:02:48 2011 +++ src/sys/dev/ic/wdc.c Sat Aug 27 17:05:58 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: wdc.c,v 1.262 2011/08/13 16:02:48 jakllsch Exp $ */ +/* $NetBSD: wdc.c,v 1.263 2011/08/27 17:05:58 bouyer Exp $ */ /* * Copyright (c) 1998, 2001, 2003 Manuel Bouyer. All rights reserved. @@ -58,9 +58,10 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: wdc.c,v 1.262 2011/08/13 16:02:48 jakllsch Exp $);
CVS commit: src/sys/dev/dm
Module Name:src Committed By: ahoka Date: Sat Aug 27 17:06:08 UTC 2011 Modified Files: src/sys/dev/dm: dm_target.c Log Message: Add a sanity check for missing functions in dmt To generate a diff of this commit: cvs rdiff -u -r1.15 -r1.16 src/sys/dev/dm/dm_target.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/dm/dm_target.c diff -u src/sys/dev/dm/dm_target.c:1.15 src/sys/dev/dm/dm_target.c:1.16 --- src/sys/dev/dm/dm_target.c:1.15 Thu Dec 23 14:58:13 2010 +++ src/sys/dev/dm/dm_target.c Sat Aug 27 17:06:08 2011 @@ -1,4 +1,4 @@ -/*$NetBSD: dm_target.c,v 1.15 2010/12/23 14:58:13 mlelstv Exp $ */ +/*$NetBSD: dm_target.c,v 1.16 2011/08/27 17:06:08 ahoka Exp $ */ /* * Copyright (c) 2008 The NetBSD Foundation, Inc. @@ -150,6 +150,16 @@ { dm_target_t *dmt; + /* Sanity check for any missing function */ + KASSERT(dmt-init != NULL); + KASSERT(dmt-status != NULL); + KASSERT(dmt-strategy != NULL); + KASSERT(dmt-deps != NULL); + KASSERT(dmt-destroy != NULL); + KASSERT(dmt-upcall != NULL); + KASSERT(dmt-sync != NULL); + KASSERT(dmt-secsize != NULL); + mutex_enter(dm_target_mutex); dmt = dm_target_lookup_name(dm_target-name);
CVS commit: src/sbin/dmctl
Module Name:src Committed By: joerg Date: Sat Aug 27 17:07:28 UTC 2011 Modified Files: src/sbin/dmctl: dmctl.c Log Message: static. dead. To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/sbin/dmctl/dmctl.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sbin/dmctl/dmctl.c diff -u src/sbin/dmctl/dmctl.c:1.2 src/sbin/dmctl/dmctl.c:1.3 --- src/sbin/dmctl/dmctl.c:1.2 Tue Feb 8 13:58:54 2011 +++ src/sbin/dmctl/dmctl.c Sat Aug 27 17:07:28 2011 @@ -66,9 +66,8 @@ int (*cmd_func)(int, char *[], libdm_task_t); }; -int fd; /* file descriptor for device */ -const char *dvname; /* device name */ -const char *cmdname; /* command user issued */ +static const char *dvname;/* device name */ +static const char *cmdname; /* command user issued */ static char * parse_stdin(char *); @@ -84,9 +83,9 @@ static int dmctl_list_devices(int, char *[], libdm_task_t); static int dmctl_table_reload(int, char *[], libdm_task_t); static int dmctl_table_status(int, char *[], libdm_task_t); -void usage(void); +__dead static void usage(void); -struct command commands[] = { +static struct command commands[] = { { version, Print driver and lib version., NULL, DMCTL_CMD_REQ_NODEVNAME, @@ -537,7 +536,7 @@ return 0; } -void +static void usage(void) { int i;
CVS commit: src/sys/dev/dm
Module Name:src Committed By: ahoka Date: Sat Aug 27 17:07:50 UTC 2011 Modified Files: src/sys/dev/dm: dm.h dm_ioctl.c Log Message: - add a function to get the inactive table's size - some whitespace fix from emacs... To generate a diff of this commit: cvs rdiff -u -r1.22 -r1.23 src/sys/dev/dm/dm.h cvs rdiff -u -r1.25 -r1.26 src/sys/dev/dm/dm_ioctl.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/dm/dm.h diff -u src/sys/dev/dm/dm.h:1.22 src/sys/dev/dm/dm.h:1.23 --- src/sys/dev/dm/dm.h:1.22 Thu Dec 23 20:07:13 2010 +++ src/sys/dev/dm/dm.h Sat Aug 27 17:07:49 2011 @@ -1,4 +1,4 @@ -/*$NetBSD: dm.h,v 1.22 2010/12/23 20:07:13 christos Exp $ */ +/*$NetBSD: dm.h,v 1.23 2011/08/27 17:07:49 ahoka Exp $ */ /* * Copyright (c) 2008 The NetBSD Foundation, Inc. @@ -88,7 +88,7 @@ typedef struct dm_table_head { /* Current active table is selected with this. */ - int cur_active_table; + int cur_active_table; struct dm_table tables[2]; kmutex_t table_mtx; @@ -121,7 +121,7 @@ * It points to SLIST of device tables and mirrored, snapshoted etc. devices. */ TAILQ_HEAD(dm_dev_head, dm_dev) dm_devs; - + typedef struct dm_dev { char name[DM_NAME_LEN]; char uuid[DM_UUID_LEN]; @@ -132,7 +132,7 @@ kmutex_t dev_mtx; /* mutex for generall device lock */ kcondvar_t dev_cv; /* cv for between ioctl synchronisation */ - + uint32_t event_nr; uint32_t ref_cnt; @@ -141,10 +141,10 @@ dm_table_head_t table_head; struct dm_dev_head upcalls; - + struct disk *diskp; kmutex_t diskp_mtx; - + TAILQ_ENTRY(dm_dev) next_upcall; /* LIST of mirrored, snapshoted devices. */ TAILQ_ENTRY(dm_dev) next_devlist; /* Major device list. */ @@ -152,7 +152,7 @@ /* Device types used for upcalls */ #define DM_ZERO_DEV(1 0) -#define DM_ERROR_DEV (1 1) +#define DM_ERROR_DEV (1 1) #define DM_LINEAR_DEV (1 2) #define DM_MIRROR_DEV (1 3) #define DM_STRIPE_DEV (1 4) @@ -160,15 +160,15 @@ #define DM_SNAPSHOT_ORIG_DEV (1 6) #define DM_SPARE_DEV (1 7) /* Set this device type only during dev remove ioctl. */ -#define DM_DELETING_DEV(1 8) +#define DM_DELETING_DEV(1 8) /* for zero, error : dm_target-target_config == NULL */ - + /* * Target config is initiated with target_init function. */ - + /* for linear : */ typedef struct target_linear_config { dm_pdev_t *pdev; @@ -214,7 +214,7 @@ dm_pdev_t *tsc_snap_dev; /* cow dev is set only for persistent snapshot devices */ dm_pdev_t *tsc_cow_dev; - + uint64_t tsc_chunk_size; uint32_t tsc_persistent_dev; } dm_target_snapshot_config_t; @@ -233,7 +233,7 @@ /* Destroy target_config area */ int (*destroy)(dm_table_entry_t *); - + int (*deps) (dm_table_entry_t *, prop_array_t); /* * Status routine is called to get params string, which is target @@ -245,10 +245,10 @@ int (*sync)(dm_table_entry_t *); int (*upcall)(dm_table_entry_t *, struct buf *); int (*secsize)(dm_table_entry_t *, unsigned *); - + uint32_t version[3]; int ref_cnt; - + TAILQ_ENTRY(dm_target) dm_target_next; } dm_target_t; @@ -315,7 +315,7 @@ int dm_target_linear_secsize(dm_table_entry_t *, unsigned *); /* Generic function used to convert char to string */ -uint64_t atoi(const char *); +uint64_t atoi(const char *); /* dm_target_stripe.c */ int dm_target_stripe_init(dm_dev_t *, void**, char *); @@ -333,6 +333,7 @@ int dm_table_destroy(dm_table_head_t *, uint8_t); uint64_t dm_table_size(dm_table_head_t *); +uint64_t dm_inactive_table_size(dm_table_head_t *); void dm_table_disksize(dm_table_head_t *, uint64_t *, unsigned *); dm_table_t * dm_table_get_entry(dm_table_head_t *, uint8_t); int dm_table_get_target_count(dm_table_head_t *, uint8_t); Index: src/sys/dev/dm/dm_ioctl.c diff -u src/sys/dev/dm/dm_ioctl.c:1.25 src/sys/dev/dm/dm_ioctl.c:1.26 --- src/sys/dev/dm/dm_ioctl.c:1.25 Tue May 24 15:23:41 2011 +++ src/sys/dev/dm/dm_ioctl.c Sat Aug 27 17:07:49 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: dm_ioctl.c,v 1.25 2011/05/24 15:23:41 joerg Exp $ */ +/* $NetBSD: dm_ioctl.c,v 1.26 2011/08/27 17:07:49 ahoka Exp $ */ /* * Copyright (c) 2008 The NetBSD Foundation, Inc. @@ -793,6 +793,7 @@ free(str, M_TEMP); dm_dev_unbusy(dmv); + dm_target_unbusy(target); return ret; } last_table = table_en;
CVS commit: src/sys/dev/dm
Module Name:src Committed By: ahoka Date: Sat Aug 27 17:09:10 UTC 2011 Modified Files: src/sys/dev/dm: dm_target_stripe.c Log Message: be consistent and define secsize here as well (though this seems unused?) some white' from emacs To generate a diff of this commit: cvs rdiff -u -r1.14 -r1.15 src/sys/dev/dm/dm_target_stripe.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/dm/dm_target_stripe.c diff -u src/sys/dev/dm/dm_target_stripe.c:1.14 src/sys/dev/dm/dm_target_stripe.c:1.15 --- src/sys/dev/dm/dm_target_stripe.c:1.14 Thu Jun 2 17:49:40 2011 +++ src/sys/dev/dm/dm_target_stripe.c Sat Aug 27 17:09:09 2011 @@ -1,4 +1,4 @@ -/*$NetBSD: dm_target_stripe.c,v 1.14 2011/06/02 17:49:40 haad Exp $*/ +/*$NetBSD: dm_target_stripe.c,v 1.15 2011/08/27 17:09:09 ahoka Exp $*/ /* * Copyright (c) 2009 The NetBSD Foundation, Inc. @@ -81,6 +81,7 @@ dmt-deps = dm_target_stripe_deps; dmt-destroy = dm_target_stripe_destroy; dmt-upcall = dm_target_stripe_upcall; + dmt-secsize = dm_target_stripe_secsize; r = dm_target_insert(dmt); @@ -156,7 +157,7 @@ tlc = kmem_alloc(sizeof(*tlc), KM_NOSLEEP); if ((tlc-pdev = dm_pdev_insert(argv[strpi])) == NULL) - return ENOENT; + return ENOENT; tlc-offset = atoi(argv[strpi+1]); /* Insert striping device to linked list. */ @@ -281,7 +282,7 @@ cmd, FREAD|FWRITE, kauth_cred_get())) != 0) return err; } - + return err; } @@ -344,7 +345,7 @@ } /* * Compute physical block size - * For a stripe target we chose the maximum sector size of all + * For a stripe target we chose the maximum sector size of all * stripe devices. For the supported power-of-2 sizes this is equivalent * to the least common multiple. */
CVS commit: src/sys/dev/dm
Module Name:src Committed By: ahoka Date: Sat Aug 27 17:10:05 UTC 2011 Modified Files: src/sys/dev/dm: dm_table.c Log Message: add function to get the inactive table size (for during target init) To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/sys/dev/dm/dm_table.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/dm/dm_table.c diff -u src/sys/dev/dm/dm_table.c:1.6 src/sys/dev/dm/dm_table.c:1.7 --- src/sys/dev/dm/dm_table.c:1.6 Thu Dec 23 14:58:13 2010 +++ src/sys/dev/dm/dm_table.c Sat Aug 27 17:10:05 2011 @@ -1,4 +1,4 @@ -/*$NetBSD: dm_table.c,v 1.6 2010/12/23 14:58:13 mlelstv Exp $ */ +/*$NetBSD: dm_table.c,v 1.7 2011/08/27 17:10:05 ahoka Exp $ */ /* * Copyright (c) 2008 The NetBSD Foundation, Inc. @@ -176,8 +176,8 @@ /* * Return length of active table in device. */ -uint64_t -dm_table_size(dm_table_head_t * head) +static inline uint64_t +dm_table_size_impl(dm_table_head_t * head, int table) { dm_table_t *tbl; dm_table_entry_t *table_en; @@ -186,7 +186,7 @@ length = 0; - id = dm_table_busy(head, DM_TABLE_ACTIVE); + id = dm_table_busy(head, table); /* Select active table */ tbl = head-tables[id]; @@ -202,6 +202,25 @@ return length; } + +/* + * Return length of active table in device. + */ +uint64_t +dm_table_size(dm_table_head_t * head) +{ + return dm_table_size_impl(head, DM_TABLE_ACTIVE); +} + +/* + * Return length of active table in device. + */ +uint64_t +dm_inactive_table_size(dm_table_head_t * head) +{ + return dm_table_size_impl(head, DM_TABLE_INACTIVE); +} + /* * Return combined disk geometry */
CVS commit: src/sbin/fdisk
Module Name:src Committed By: joerg Date: Sat Aug 27 17:16:01 UTC 2011 Modified Files: src/sbin/fdisk: fdisk.c Log Message: staticfy. __dead. To generate a diff of this commit: cvs rdiff -u -r1.131 -r1.132 src/sbin/fdisk/fdisk.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sbin/fdisk/fdisk.c diff -u src/sbin/fdisk/fdisk.c:1.131 src/sbin/fdisk/fdisk.c:1.132 --- src/sbin/fdisk/fdisk.c:1.131 Sun May 8 14:22:16 2011 +++ src/sbin/fdisk/fdisk.c Sat Aug 27 17:16:01 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: fdisk.c,v 1.131 2011/05/08 14:22:16 pgoyette Exp $ */ +/* $NetBSD: fdisk.c,v 1.132 2011/08/27 17:16:01 joerg Exp $ */ /* * Mach Operating System @@ -39,7 +39,7 @@ #include sys/cdefs.h #ifndef lint -__RCSID($NetBSD: fdisk.c,v 1.131 2011/05/08 14:22:16 pgoyette Exp $); +__RCSID($NetBSD: fdisk.c,v 1.132 2011/08/27 17:16:01 joerg Exp $); #endif /* not lint */ #define MBRPTYPENAMES @@ -140,14 +140,14 @@ #define LBUF 100 static char lbuf[LBUF]; -const char *disk = _PATH_DEFDISK; +static const char *disk = _PATH_DEFDISK; -struct disklabel disklabel; /* disk parameters */ +static struct disklabel disklabel; /* disk parameters */ -struct mbr_sector mboot; +static struct mbr_sector mboot; -const char *boot_dir = DEFAULT_BOOTDIR; -char *boot_path = 0; /* name of file we actually opened */ +static const char *boot_dir = DEFAULT_BOOTDIR; +static char *boot_path = NULL; /* name of file we actually opened */ #ifdef BOOTSEL #define BOOTSEL_OPTIONS B @@ -191,15 +191,15 @@ */ /* Disks reported geometry and overall size from device driver */ -unsigned int cylinders, sectors, heads; -daddr_t disksectors; +static unsigned int cylinders, sectors, heads; +static daddr_t disksectors; #define cylindersectors (heads * sectors) /* Geometry from the BIOS */ -unsigned int dos_cylinders; -unsigned int dos_heads; -unsigned int dos_sectors; -daddr_t dos_disksectors; +static unsigned int dos_cylinders; +static unsigned int dos_heads; +static unsigned int dos_sectors; +static daddr_t dos_disksectors; #define dos_cylindersectors (dos_heads * dos_sectors) #define dos_totalsectors (dos_heads * dos_sectors * dos_cylinders) @@ -212,96 +212,96 @@ #define MAXCYL 1024 /* Usual limit is 1023 */ #define MAXHEAD 256 /* Usual limit is 255 */ #define MAXSECTOR 63 -int partition = -1; +static int partition = -1; /* Alignment of partition, and offset if first sector unusable */ -unsigned int ptn_alignment; /* default dos_cylindersectors */ -unsigned int ptn_0_offset; /* default dos_sectors */ +static unsigned int ptn_alignment; /* default dos_cylindersectors */ +static unsigned int ptn_0_offset; /* default dos_sectors */ -int fd = -1, wfd = -1, *rfd = fd; -char *disk_file = NULL; -char *disk_type = NULL; - -int a_flag; /* set active partition */ -int i_flag; /* init bootcode */ -int u_flag; /* update partition data */ -int v_flag; /* more verbose */ -int sh_flag; /* Output data as shell defines */ -int f_flag; /* force --not interactive */ -int s_flag; /* set id,offset,size */ -int b_flag; /* Set cyl, heads, secs (as c/h/s) */ -int B_flag; /* Edit/install bootselect code */ -int E_flag; /* extended partition number */ -int b_cyl, b_head, b_sec; /* b_flag values. */ +static int fd = -1, wfd = -1, *rfd = fd; +static char *disk_file = NULL; +static char *disk_type = NULL; + +static int a_flag; /* set active partition */ +static int i_flag; /* init bootcode */ +static int u_flag; /* update partition data */ +static int v_flag; /* more verbose */ +static int sh_flag; /* Output data as shell defines */ +static int f_flag; /* force --not interactive */ +static int s_flag; /* set id,offset,size */ +static int b_flag; /* Set cyl, heads, secs (as c/h/s) */ +static int B_flag; /* Edit/install bootselect code */ +static int E_flag; /* extended partition number */ +static int b_cyl, b_head, b_sec; /* b_flag values. */ #if !HAVE_NBTOOL_CONFIG_H -int F_flag = 0; +static int F_flag = 0; #else /* Tool - force 'file' mode to avoid unsupported functions and ioctls */ -int F_flag = 1; +static int F_flag = 1; #endif -struct gpt_hdr gpt1, gpt2; /* GUID partition tables */ +static struct gpt_hdr gpt1, gpt2; /* GUID partition tables */ -struct mbr_sector bootcode[8192 / sizeof (struct mbr_sector)]; -int bootsize; /* actual size of bootcode */ -int boot_installed; /* 1 if we've copied code into the mbr */ +static struct mbr_sector bootcode[8192 / sizeof (struct mbr_sector)]; +static int bootsize; /* actual size of bootcode */ +static int boot_installed; /* 1 if we've copied code into the mbr */ #if (defined(__i386__) || defined(__x86_64__)) !HAVE_NBTOOL_CONFIG_H #define USE_DISKLIST -struct disklist *dl; +static struct disklist *dl; #endif #define KNOWN_SYSIDS (sizeof(mbr_ptypes)/sizeof(mbr_ptypes[0])) -void usage(void); -void print_s0(int); -void print_part(struct
CVS commit: src/sbin/fsck
Module Name:src Committed By: joerg Date: Sat Aug 27 17:34:44 UTC 2011 Modified Files: src/sbin/fsck: fsck.c fsutil.h Log Message: Use __dead and __printflike. To generate a diff of this commit: cvs rdiff -u -r1.49 -r1.50 src/sbin/fsck/fsck.c cvs rdiff -u -r1.17 -r1.18 src/sbin/fsck/fsutil.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sbin/fsck/fsck.c diff -u src/sbin/fsck/fsck.c:1.49 src/sbin/fsck/fsck.c:1.50 --- src/sbin/fsck/fsck.c:1.49 Wed Feb 24 13:56:07 2010 +++ src/sbin/fsck/fsck.c Sat Aug 27 17:34:44 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: fsck.c,v 1.49 2010/02/24 13:56:07 hannken Exp $ */ +/* $NetBSD: fsck.c,v 1.50 2011/08/27 17:34:44 joerg Exp $ */ /* * Copyright (c) 1996 Christos Zoulas. All rights reserved. @@ -36,7 +36,7 @@ #include sys/cdefs.h #ifndef lint -__RCSID($NetBSD: fsck.c,v 1.49 2010/02/24 13:56:07 hannken Exp $); +__RCSID($NetBSD: fsck.c,v 1.50 2011/08/27 17:34:44 joerg Exp $); #endif /* not lint */ #include sys/param.h @@ -89,7 +89,7 @@ static void catopt(char **, const char *); static void mangle(char *, int *, const char ** volatile *, int *); static const char *getfslab(const char *); -static void usage(void); +__dead static void usage(void); static void *isok(struct fstab *); int Index: src/sbin/fsck/fsutil.h diff -u src/sbin/fsck/fsutil.h:1.17 src/sbin/fsck/fsutil.h:1.18 --- src/sbin/fsck/fsutil.h:1.17 Thu Jun 9 21:23:29 2011 +++ src/sbin/fsck/fsutil.h Sat Aug 27 17:34:44 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: fsutil.h,v 1.17 2011/06/09 21:23:29 christos Exp $ */ +/* $NetBSD: fsutil.h,v 1.18 2011/08/27 17:34:44 joerg Exp $ */ /* * Copyright (c) 1996 Christos Zoulas. All rights reserved. @@ -27,18 +27,12 @@ #include stdarg.h #include signal.h -void errexit(const char *, ...) -__attribute__((__noreturn__,__format__(__printf__,1,2))); -void pfatal(const char *, ...) -__attribute__((__format__(__printf__,1,2))); -void pwarn(const char *, ...) -__attribute__((__format__(__printf__,1,2))); -void perr(const char *, ...) -__attribute__((__format__(__printf__,1,2))); -void panic(const char *, ...) -__attribute__((__noreturn__,__format__(__printf__,1,2))); -void vmsg(int, const char *, va_list) - __attribute__((__format__(__printf__,2,0))); +void errexit(const char *, ...) __printflike(1, 2) __dead; +void pfatal(const char *, ...) __printflike(1, 2); +void pwarn(const char *, ...) __printflike(1, 2); +void perr(const char *, ...) __printflike(1, 2); +void panic(const char *, ...) __printflike(1, 2) __dead; +void vmsg(int, const char *, va_list) __printflike(2, 0); const char *rawname(const char *); const char *unrawname(const char *); const char *blockcheck(const char *); @@ -60,6 +54,6 @@ void (*ckfinish)(int); volatile sig_atomic_t returntosingle; -void catch(int); +void catch(int) __dead; void catchquit(int); void voidquit(int);
CVS commit: src/sbin/fsirand
Module Name:src Committed By: joerg Date: Sat Aug 27 17:36:06 UTC 2011 Modified Files: src/sbin/fsirand: fsirand.c Log Message: static + __dead To generate a diff of this commit: cvs rdiff -u -r1.28 -r1.29 src/sbin/fsirand/fsirand.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sbin/fsirand/fsirand.c diff -u src/sbin/fsirand/fsirand.c:1.28 src/sbin/fsirand/fsirand.c:1.29 --- src/sbin/fsirand/fsirand.c:1.28 Mon Apr 28 20:23:08 2008 +++ src/sbin/fsirand/fsirand.c Sat Aug 27 17:36:05 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: fsirand.c,v 1.28 2008/04/28 20:23:08 martin Exp $ */ +/* $NetBSD: fsirand.c,v 1.29 2011/08/27 17:36:05 joerg Exp $ */ /*- * Copyright (c) 1997 The NetBSD Foundation, Inc. @@ -31,7 +31,7 @@ #include sys/cdefs.h #ifndef lint -__RCSID($NetBSD: fsirand.c,v 1.28 2008/04/28 20:23:08 martin Exp $); +__RCSID($NetBSD: fsirand.c,v 1.29 2011/08/27 17:36:05 joerg Exp $); #endif /* lint */ #include sys/param.h @@ -57,13 +57,13 @@ #include ufs/ffs/fs.h #include ufs/ffs/ffs_extern.h -static void usage(void); +__dead static void usage(void); static void getsblock(int, const char *, struct fs *); static void fixinodes(int, struct fs *, struct disklabel *, int, long); static void statussig(int); int needswap, ino, imax, is_ufs2; -time_t tstart; +static time_t tstart; static void usage(void) @@ -199,7 +199,7 @@ * statussig(): * display current status */ -void +static void statussig(int dummy) { char msgbuf[256];
CVS commit: src/sbin/gpt
Module Name:src Committed By: joerg Date: Sat Aug 27 17:38:16 UTC 2011 Modified Files: src/sbin/gpt: add.c biosboot.c create.c destroy.c gpt.c label.c migrate.c recover.c remove.c show.c Log Message: Use __dead To generate a diff of this commit: cvs rdiff -u -r1.10 -r1.11 src/sbin/gpt/add.c cvs rdiff -u -r1.4 -r1.5 src/sbin/gpt/biosboot.c src/sbin/gpt/create.c \ src/sbin/gpt/migrate.c cvs rdiff -u -r1.3 -r1.4 src/sbin/gpt/destroy.c src/sbin/gpt/recover.c cvs rdiff -u -r1.14 -r1.15 src/sbin/gpt/gpt.c cvs rdiff -u -r1.7 -r1.8 src/sbin/gpt/label.c cvs rdiff -u -r1.5 -r1.6 src/sbin/gpt/remove.c cvs rdiff -u -r1.6 -r1.7 src/sbin/gpt/show.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sbin/gpt/add.c diff -u src/sbin/gpt/add.c:1.10 src/sbin/gpt/add.c:1.11 --- src/sbin/gpt/add.c:1.10 Thu Jan 6 17:51:28 2011 +++ src/sbin/gpt/add.c Sat Aug 27 17:38:16 2011 @@ -29,7 +29,7 @@ __FBSDID($FreeBSD: src/sbin/gpt/add.c,v 1.14 2006/06/22 22:05:28 marcel Exp $); #endif #ifdef __RCSID -__RCSID($NetBSD: add.c,v 1.10 2011/01/06 17:51:28 riz Exp $); +__RCSID($NetBSD: add.c,v 1.11 2011/08/27 17:38:16 joerg Exp $); #endif #include sys/types.h @@ -52,7 +52,7 @@ const char addmsg[] = add [-b lba] [-i index] [-s lba] [-t type] device ...; -static void +__dead static void usage_add(void) { Index: src/sbin/gpt/biosboot.c diff -u src/sbin/gpt/biosboot.c:1.4 src/sbin/gpt/biosboot.c:1.5 --- src/sbin/gpt/biosboot.c:1.4 Wed Aug 17 12:27:50 2011 +++ src/sbin/gpt/biosboot.c Sat Aug 27 17:38:16 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: biosboot.c,v 1.4 2011/08/17 12:27:50 martin Exp $ */ +/* $NetBSD: biosboot.c,v 1.5 2011/08/27 17:38:16 joerg Exp $ */ /* * Copyright (c) 2009 The NetBSD Foundation, Inc. @@ -33,7 +33,7 @@ #include sys/cdefs.h #ifdef __RCSID -__RCSID($NetBSD: biosboot.c,v 1.4 2011/08/17 12:27:50 martin Exp $); +__RCSID($NetBSD: biosboot.c,v 1.5 2011/08/27 17:38:16 joerg Exp $); #endif #include sys/stat.h @@ -68,7 +68,7 @@ const char biosbootmsg[] = biosboot [-c bootcode] [-i index] device ...; -static void +__dead static void usage_biosboot(void) { fprintf(stderr, usage: %s %s\n, getprogname(), biosbootmsg); Index: src/sbin/gpt/create.c diff -u src/sbin/gpt/create.c:1.4 src/sbin/gpt/create.c:1.5 --- src/sbin/gpt/create.c:1.4 Thu Jan 6 17:42:10 2011 +++ src/sbin/gpt/create.c Sat Aug 27 17:38:16 2011 @@ -29,7 +29,7 @@ __FBSDID($FreeBSD: src/sbin/gpt/create.c,v 1.11 2005/08/31 01:47:19 marcel Exp $); #endif #ifdef __RCSID -__RCSID($NetBSD: create.c,v 1.4 2011/01/06 17:42:10 jakllsch Exp $); +__RCSID($NetBSD: create.c,v 1.5 2011/08/27 17:38:16 joerg Exp $); #endif #include sys/types.h @@ -49,7 +49,7 @@ const char createmsg[] = create [-fp] device ...; -static void +__dead static void usage_create(void) { Index: src/sbin/gpt/migrate.c diff -u src/sbin/gpt/migrate.c:1.4 src/sbin/gpt/migrate.c:1.5 --- src/sbin/gpt/migrate.c:1.4 Tue Dec 18 21:46:46 2007 +++ src/sbin/gpt/migrate.c Sat Aug 27 17:38:16 2011 @@ -29,7 +29,7 @@ __FBSDID($FreeBSD: src/sbin/gpt/migrate.c,v 1.16 2005/09/01 02:42:52 marcel Exp $); #endif #ifdef __RCSID -__RCSID($NetBSD: migrate.c,v 1.4 2007/12/18 21:46:46 riz Exp $); +__RCSID($NetBSD: migrate.c,v 1.5 2011/08/27 17:38:16 joerg Exp $); #endif #include sys/types.h @@ -62,7 +62,7 @@ const char migratemsg[] = migrate [-fs] device ...; -static void +__dead static void usage_migrate(void) { Index: src/sbin/gpt/destroy.c diff -u src/sbin/gpt/destroy.c:1.3 src/sbin/gpt/destroy.c:1.4 --- src/sbin/gpt/destroy.c:1.3 Tue Dec 18 21:46:46 2007 +++ src/sbin/gpt/destroy.c Sat Aug 27 17:38:16 2011 @@ -29,7 +29,7 @@ __FBSDID($FreeBSD: src/sbin/gpt/destroy.c,v 1.6 2005/08/31 01:47:19 marcel Exp $); #endif #ifdef __RCSID -__RCSID($NetBSD: destroy.c,v 1.3 2007/12/18 21:46:46 riz Exp $); +__RCSID($NetBSD: destroy.c,v 1.4 2011/08/27 17:38:16 joerg Exp $); #endif #include sys/types.h @@ -48,7 +48,7 @@ const char destroymsg[] = destroy [-r] device ...; -static void +__dead static void usage_destroy(void) { Index: src/sbin/gpt/recover.c diff -u src/sbin/gpt/recover.c:1.3 src/sbin/gpt/recover.c:1.4 --- src/sbin/gpt/recover.c:1.3 Tue Dec 18 21:46:47 2007 +++ src/sbin/gpt/recover.c Sat Aug 27 17:38:16 2011 @@ -29,7 +29,7 @@ __FBSDID($FreeBSD: src/sbin/gpt/recover.c,v 1.8 2005/08/31 01:47:19 marcel Exp $); #endif #ifdef __RCSID -__RCSID($NetBSD: recover.c,v 1.3 2007/12/18 21:46:47 riz Exp $); +__RCSID($NetBSD: recover.c,v 1.4 2011/08/27 17:38:16 joerg Exp $); #endif #include sys/types.h @@ -48,7 +48,7 @@ const char recovermsg[] = recover device ...; -static void +__dead static void usage_recover(void) { Index: src/sbin/gpt/gpt.c diff -u src/sbin/gpt/gpt.c:1.14 src/sbin/gpt/gpt.c:1.15 --- src/sbin/gpt/gpt.c:1.14 Thu Jan 6 16:30:40 2011 +++ src/sbin/gpt/gpt.c Sat Aug 27 17:38:16 2011 @@ -31,7 +31,7 @@
CVS commit: src/sbin/init
Module Name:src Committed By: joerg Date: Sat Aug 27 17:43:42 UTC 2011 Modified Files: src/sbin/init: init.c Log Message: Be more static To generate a diff of this commit: cvs rdiff -u -r1.100 -r1.101 src/sbin/init/init.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sbin/init/init.c diff -u src/sbin/init/init.c:1.100 src/sbin/init/init.c:1.101 --- src/sbin/init/init.c:1.100 Tue Dec 29 17:07:17 2009 +++ src/sbin/init/init.c Sat Aug 27 17:43:42 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: init.c,v 1.100 2009/12/29 17:07:17 elad Exp $ */ +/* $NetBSD: init.c,v 1.101 2011/08/27 17:43:42 joerg Exp $ */ /*- * Copyright (c) 1991, 1993 @@ -42,7 +42,7 @@ #if 0 static char sccsid[] = @(#)init.c 8.2 (Berkeley) 4/28/95; #else -__RCSID($NetBSD: init.c,v 1.100 2009/12/29 17:07:17 elad Exp $); +__RCSID($NetBSD: init.c,v 1.101 2011/08/27 17:43:42 joerg Exp $); #endif #endif /* not lint */ @@ -89,7 +89,7 @@ #define STALL_TIMEOUT 30 /* wait N secs after warning */ #define DEATH_WATCH 10 /* wait N secs for procs to die */ -const struct timespec dtrtime = {.tv_sec = 0, .tv_nsec = 25}; +static const struct timespec dtrtime = {.tv_sec = 0, .tv_nsec = 25}; #if defined(RESCUEDIR) #define INIT_BSHELL RESCUEDIR /sh @@ -101,19 +101,14 @@ #define INIT_PATH _PATH_STDPATH #endif -int main(int, char *[]); +static void handle(sig_t, ...); +static void delset(sigset_t *, ...); -void handle(sig_t, ...); -void delset(sigset_t *, ...); - -void stall(const char *, ...) -__attribute__((__format__(__printf__,1,2))); -void warning(const char *, ...) -__attribute__((__format__(__printf__,1,2))); -void emergency(const char *, ...) -__attribute__((__format__(__printf__,1,2))); -void disaster(int); -void badsys(int); +static void stall(const char *, ...) __printflike(1, 2); +static void warning(const char *, ...) __printflike(1, 2); +static void emergency(const char *, ...) __printflike(1, 2); +__dead static void disaster(int); +static void badsys(int); /* * We really need a recursive typedef... @@ -131,18 +126,18 @@ #define CLEAN_TTYS 'T' #define CATATONIA 'c' -state_func_t single_user(void); -state_func_t runcom(void); -state_func_t read_ttys(void); -state_func_t multi_user(void); -state_func_t clean_ttys(void); -state_func_t catatonia(void); -state_func_t death(void); +static state_func_t single_user(void); +static state_func_t runcom(void); +static state_func_t read_ttys(void); +static state_func_t multi_user(void); +static state_func_t clean_ttys(void); +static state_func_t catatonia(void); +static state_func_t death(void); -enum { AUTOBOOT, FASTBOOT } runcom_mode = AUTOBOOT; +static enum { AUTOBOOT, FASTBOOT } runcom_mode = AUTOBOOT; -void transition(state_t); -void setctty(const char *); +static void transition(state_t); +static void setctty(const char *); typedef struct init_session { int se_index; /* index of entry in ttys file */ @@ -160,39 +155,39 @@ struct init_session *se_next; } session_t; -void free_session(session_t *); -session_t *new_session(session_t *, int, struct ttyent *); -session_t *sessions; - -char **construct_argv(char *); -void start_window_system(session_t *); -void collect_child(pid_t, int); -pid_t start_getty(session_t *); -void transition_handler(int); -void alrm_handler(int); -int has_securelevel(void); -void setsecuritylevel(int); -int getsecuritylevel(void); -int securelevel_present; -int setupargv(session_t *, struct ttyent *); -int clang; - -int start_session_db(void); -void add_session(session_t *); -void del_session(session_t *); -session_t *find_session(pid_t); -DB *session_db; +static void free_session(session_t *); +static session_t *new_session(session_t *, int, struct ttyent *); +static session_t *sessions; + +static char **construct_argv(char *); +static void start_window_system(session_t *); +static void collect_child(pid_t, int); +static pid_t start_getty(session_t *); +static void transition_handler(int); +static void alrm_handler(int); +static int has_securelevel(void); +static void setsecuritylevel(int); +static int getsecuritylevel(void); +static int securelevel_present; +static int setupargv(session_t *, struct ttyent *); +static int clang; + +static int start_session_db(void); +static void add_session(session_t *); +static void del_session(session_t *); +static session_t *find_session(pid_t); +static DB *session_db; -int do_setttyent(void); +static int do_setttyent(void); #ifndef LETS_GET_SMALL -state_t requested_transition = runcom; +static state_t requested_transition = runcom; -void clear_session_logs(session_t *, int); -state_func_t runetcrc(int); +static void clear_session_logs(session_t *, int); +static state_func_t runetcrc(int); #ifdef SUPPORT_UTMPX static struct timeval boot_time; -state_t current_state = death; +static state_t current_state = death; static void session_utmpx(const session_t *,
CVS commit: src/sbin/mbrlabel
Module Name:src Committed By: joerg Date: Sat Aug 27 17:45:30 UTC 2011 Modified Files: src/sbin/mbrlabel: mbrlabel.c Log Message: Be more static. To generate a diff of this commit: cvs rdiff -u -r1.26 -r1.27 src/sbin/mbrlabel/mbrlabel.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sbin/mbrlabel/mbrlabel.c diff -u src/sbin/mbrlabel/mbrlabel.c:1.26 src/sbin/mbrlabel/mbrlabel.c:1.27 --- src/sbin/mbrlabel/mbrlabel.c:1.26 Wed Dec 28 06:03:15 2005 +++ src/sbin/mbrlabel/mbrlabel.c Sat Aug 27 17:45:30 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: mbrlabel.c,v 1.26 2005/12/28 06:03:15 christos Exp $ */ +/* $NetBSD: mbrlabel.c,v 1.27 2011/08/27 17:45:30 joerg Exp $ */ /* * Copyright (C) 1998 Wolfgang Solfrank. @@ -33,7 +33,7 @@ #include sys/cdefs.h #ifndef lint -__RCSID($NetBSD: mbrlabel.c,v 1.26 2005/12/28 06:03:15 christos Exp $); +__RCSID($NetBSD: mbrlabel.c,v 1.27 2011/08/27 17:45:30 joerg Exp $); #endif /* not lint */ #include stdio.h @@ -55,17 +55,16 @@ #include dkcksum.h #include extern.h -int main(int, char **); -void usage(void); -void getlabel(int); -void setlabel(int, int); -int getparts(int, u_int32_t, u_int32_t, int); -u_int16_t getshort(void *); -u_int32_t getlong(void *); +__dead static void usage(void); +static void getlabel(int); +static void setlabel(int, int); +static int getparts(int, u_int32_t, u_int32_t, int); +static u_int16_t getshort(void *); +static u_int32_t getlong(void *); struct disklabel label; -void +static void getlabel(int sd) { @@ -81,7 +80,7 @@ label.d_npartitions = getrawpartition() + 1; } -void +static void setlabel(int sd, int doraw) { int one = 1; @@ -98,7 +97,7 @@ } -u_int16_t +static u_int16_t getshort(void *p) { unsigned char *cp = p; @@ -106,7 +105,7 @@ return (cp[0] | (cp[1] 8)); } -u_int32_t +static u_int32_t getlong(void *p) { unsigned char *cp = p; @@ -114,7 +113,7 @@ return (cp[0] | (cp[1] 8) | (cp[2] 16) | (cp[3] 24)); } -int +static int getparts(int sd, u_int32_t off, u_int32_t extoff, int verbose) { unsigned char buf[DEV_BSIZE]; @@ -237,7 +236,7 @@ return (changed); } -void +static void usage(void) { fprintf(stderr, usage: %s [-fqrw] [-s sector] rawdisk\n,
CVS commit: src/libexec/rshd
Module Name:src Committed By: joerg Date: Sat Aug 27 17:46:34 UTC 2011 Modified Files: src/libexec/rshd: rshd.c Log Message: Use static. Don't manipulate environ directly, just reset it and use setenv. To generate a diff of this commit: cvs rdiff -u -r1.47 -r1.48 src/libexec/rshd/rshd.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/libexec/rshd/rshd.c diff -u src/libexec/rshd/rshd.c:1.47 src/libexec/rshd/rshd.c:1.48 --- src/libexec/rshd/rshd.c:1.47 Mon Mar 16 02:20:02 2009 +++ src/libexec/rshd/rshd.c Sat Aug 27 17:46:34 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: rshd.c,v 1.47 2009/03/16 02:20:02 lukem Exp $ */ +/* $NetBSD: rshd.c,v 1.48 2011/08/27 17:46:34 joerg Exp $ */ /* * Copyright (C) 1998 WIDE Project. @@ -69,7 +69,7 @@ #if 0 static char sccsid[] = @(#)rshd.c 8.2 (Berkeley) 4/6/94; #else -__RCSID($NetBSD: rshd.c,v 1.47 2009/03/16 02:20:02 lukem Exp $); +__RCSID($NetBSD: rshd.c,v 1.48 2011/08/27 17:46:34 joerg Exp $); #endif #endif /* not lint */ @@ -132,19 +132,17 @@ #define PAM_END #endif -int keepalive = 1; -int check_all; -int log_success; /* If TRUE, log all successful accesses */ -int sent_null; - -void doit(struct sockaddr *) __dead; -void rshd_errx(int, const char *, ...) - __attribute__((__noreturn__, __format__(__printf__, 2, 3))); -void getstr(char *, int, const char *); -int local_domain(char *); -char *topdomain(char *); -void usage(void); -int main(int, char *[]); +static int keepalive = 1; +static int check_all; +static int log_success; /* If TRUE, log all successful accesses */ +static int sent_null; + +__dead static void doit(struct sockaddr *); +__dead static void rshd_errx(int, const char *, ...) __printflike(2, 3); +static void getstr(char *, int, const char *); +static int local_domain(char *); +static char *topdomain(char *); +__dead static void usage(void); #define OPTIONS aLln extern int __check_rhosts_file; @@ -237,15 +235,9 @@ doit((struct sockaddr *)from); } -char username[20] = USER=; -char homedir[64] = HOME=; -char shell[64] = SHELL=; -char path[100] = PATH=; -char *envinit[] = - {homedir, shell, path, username, 0}; -char **environ; +extern char **environ; -void +static void doit(struct sockaddr *fromp) { struct passwd *pwd, pwres; @@ -671,11 +663,14 @@ } } #endif +{ + static char *envinit[] = { NULL }; environ = envinit; - (void)strlcat(homedir, pwd-pw_dir, sizeof(homedir)); - (void)strlcat(path, _PATH_DEFPATH, sizeof(path)); - (void)strlcat(shell, pwd-pw_shell, sizeof(shell)); - (void)strlcat(username, pwd-pw_name, sizeof(username)); +} + setenv(PATH, _PATH_DEFPATH, 1); + setenv(HOME, pwd-pw_dir, 1); + setenv(SHELL, pwd-pw_shell, 1); + setenv(USER, pwd-pw_name, 1); #endif cp = strrchr(pwd-pw_shell, '/'); @@ -717,7 +712,7 @@ #include stdarg.h -void +static void rshd_errx(int error, const char *fmt, ...) { va_list ap; @@ -737,7 +732,7 @@ exit(error); } -void +static void getstr(char *buf, int cnt, const char *err) { char c; @@ -759,7 +754,7 @@ * assume that the host is local, as it will be * interpreted as such. */ -int +static int local_domain(char *h) { char localhost[MAXHOSTNAMELEN + 1]; @@ -775,7 +770,7 @@ return (0); } -char * +static char * topdomain(char *h) { char *p, *maybe = NULL; @@ -791,7 +786,7 @@ return (maybe); } -void +static void usage(void) {
CVS commit: src/share/misc
Module Name:src Committed By: joerg Date: Sat Aug 27 17:48:11 UTC 2011 Modified Files: src/share/misc: style Log Message: Prototyping main is silly and shouldn't be encouraged. To generate a diff of this commit: cvs rdiff -u -r1.47 -r1.48 src/share/misc/style Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/share/misc/style diff -u src/share/misc/style:1.47 src/share/misc/style:1.48 --- src/share/misc/style:1.47 Sat Oct 30 20:12:32 2010 +++ src/share/misc/style Sat Aug 27 17:48:11 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: style,v 1.47 2010/10/30 20:12:32 christos Exp $ */ +/* $NetBSD: style,v 1.48 2011/08/27 17:48:11 joerg Exp $ */ /* * The revision control tag appears first, with a blank line after it. @@ -30,7 +30,7 @@ #include sys/cdefs.h __COPYRIGHT(@(#) Copyright (c) 2008\ The NetBSD Foundation, inc. All rights reserved.); -__RCSID($NetBSD: style,v 1.47 2010/10/30 20:12:32 christos Exp $); +__RCSID($NetBSD: style,v 1.48 2011/08/27 17:48:11 joerg Exp $); /* * VERY important single-line comments look like this. @@ -122,7 +122,6 @@ static int dirinfo(const char *, struct stat *, struct dirent *, struct statfs *, int *, char **[]); static void usage(void) __dead; /* declare functions that don't return dead */ -int main(int, char *[]); /* * Macros are capitalized, parenthesized, and should avoid side-effects.
CVS commit: src/sys/kern
Module Name:src Committed By: reinoud Date: Sat Aug 27 17:51:38 UTC 2011 Modified Files: src/sys/kern: kern_exec.c Log Message: Enhance EXEC_DEBUG by also printing the UVM commands To generate a diff of this commit: cvs rdiff -u -r1.325 -r1.326 src/sys/kern/kern_exec.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/kern/kern_exec.c diff -u src/sys/kern/kern_exec.c:1.325 src/sys/kern/kern_exec.c:1.326 --- src/sys/kern/kern_exec.c:1.325 Fri Aug 26 19:07:13 2011 +++ src/sys/kern/kern_exec.c Sat Aug 27 17:51:38 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: kern_exec.c,v 1.325 2011/08/26 19:07:13 jmcneill Exp $ */ +/* $NetBSD: kern_exec.c,v 1.326 2011/08/27 17:51:38 reinoud Exp $ */ /*- * Copyright (c) 2008 The NetBSD Foundation, Inc. @@ -59,7 +59,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: kern_exec.c,v 1.325 2011/08/26 19:07:13 jmcneill Exp $); +__KERNEL_RCSID(0, $NetBSD: kern_exec.c,v 1.326 2011/08/27 17:51:38 reinoud Exp $); #include opt_exec.h #include opt_ktrace.h @@ -850,6 +850,29 @@ if (pack.ep_vmcmds.evs_used == 0) panic(%s: no vmcmds, __func__); #endif + +#ifdef DEBUG_EXEC + { + size_t j; + struct exec_vmcmd *vp = pack.ep_vmcmds.evs_cmds[0]; + DPRINTF(vmcmds %u\n, pack.ep_vmcmds.evs_used); + for (j = 0; j pack.ep_vmcmds.evs_used; j++) { + DPRINTF(vmcmd[%zu] = vmcmd_map_%s %# + PRIxVADDR/%#PRIxVSIZE fd@%# + PRIxVSIZE prot=0%o flags=%d\n, j, + vp[j].ev_proc == vmcmd_map_pagedvn ? + pagedvn : + vp[j].ev_proc == vmcmd_map_readvn ? + readvn : + vp[j].ev_proc == vmcmd_map_zero ? + zero : *unknown*, + vp[j].ev_addr, vp[j].ev_len, + vp[j].ev_offset, vp[j].ev_prot, + vp[j].ev_flags); + } + } +#endif /* DEBUG_EXEC */ + for (i = 0; i pack.ep_vmcmds.evs_used !error; i++) { struct exec_vmcmd *vcp; @@ -870,10 +893,10 @@ if (error) { size_t j; struct exec_vmcmd *vp = pack.ep_vmcmds.evs_cmds[0]; - uprintf(vmcmds %zu/%u, error %d\n, i, + DPRINTF(vmcmds %zu/%u, error %d\n, i, pack.ep_vmcmds.evs_used, error); - for (j = 0; j = i; j++) -uprintf(vmcmd[%zu] = vmcmd_map_%s %# + for (j = 0; j pack.ep_vmcmds.evs_used; j++) { +DPRINTF(vmcmd[%zu] = vmcmd_map_%s %# PRIxVADDR/%#PRIxVSIZE fd@%# PRIxVSIZE prot=0%o flags=%d\n, j, vp[j].ev_proc == vmcmd_map_pagedvn ? @@ -885,6 +908,9 @@ vp[j].ev_addr, vp[j].ev_len, vp[j].ev_offset, vp[j].ev_prot, vp[j].ev_flags); +if (j == i) + DPRINTF( ^--- failed\n); + } } #endif /* DEBUG_EXEC */ if (vcp-ev_flags VMCMD_BASE) @@ -1249,6 +1275,7 @@ pathbuf_stringcopy_put(pb, pathstring); pathbuf_destroy(pb); PNBUF_PUT(resolvedpathbuf); + DPRINTF(%s finished\n, __func__); return (EJUSTRETURN); bad:
CVS commit: src/sys/kern
Module Name:src Committed By: reinoud Date: Sat Aug 27 17:53:21 UTC 2011 Modified Files: src/sys/kern: exec_elf.c Log Message: In execve1(), don't assume VM_MIN_ADDRESS is 0 for PIE executables. To generate a diff of this commit: cvs rdiff -u -r1.31 -r1.32 src/sys/kern/exec_elf.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/kern/exec_elf.c diff -u src/sys/kern/exec_elf.c:1.31 src/sys/kern/exec_elf.c:1.32 --- src/sys/kern/exec_elf.c:1.31 Tue Aug 2 16:44:01 2011 +++ src/sys/kern/exec_elf.c Sat Aug 27 17:53:21 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: exec_elf.c,v 1.31 2011/08/02 16:44:01 christos Exp $ */ +/* $NetBSD: exec_elf.c,v 1.32 2011/08/27 17:53:21 reinoud Exp $ */ /*- * Copyright (c) 1994, 2000, 2005 The NetBSD Foundation, Inc. @@ -57,7 +57,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(1, $NetBSD: exec_elf.c,v 1.31 2011/08/02 16:44:01 christos Exp $); +__KERNEL_RCSID(1, $NetBSD: exec_elf.c,v 1.32 2011/08/27 17:53:21 reinoud Exp $); #ifdef _KERNEL_OPT #include opt_pax.h @@ -152,6 +152,8 @@ #endif /* PAX_ASLR */ offset = MAX(align, PAGE_SIZE); + offset += epp-ep_vm_minaddr; + for (i = 0; i eh-e_phnum; i++) ph[i].p_vaddr += offset; eh-e_entry += offset;
CVS commit: src/sys/arch/usermode/usermode
Module Name:src Committed By: reinoud Date: Sat Aug 27 17:57:14 UTC 2011 Modified Files: src/sys/arch/usermode/usermode: copy.c Log Message: Fix copystring routines to NOT just copy all since not all space might be writable. This can be fixed by implementing/importing strnlen(3) in the kernel and/or for NetBSD/usermode to have onfaults in the copyins/copyouts. To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/sys/arch/usermode/usermode/copy.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/usermode/usermode/copy.c diff -u src/sys/arch/usermode/usermode/copy.c:1.4 src/sys/arch/usermode/usermode/copy.c:1.5 --- src/sys/arch/usermode/usermode/copy.c:1.4 Thu Aug 25 19:07:45 2011 +++ src/sys/arch/usermode/usermode/copy.c Sat Aug 27 17:57:14 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: copy.c,v 1.4 2011/08/25 19:07:45 reinoud Exp $ */ +/* $NetBSD: copy.c,v 1.5 2011/08/27 17:57:14 reinoud Exp $ */ /*- * Copyright (c) 2007 Jared D. McNeill jmcne...@invisible.ca @@ -27,13 +27,13 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: copy.c,v 1.4 2011/08/25 19:07:45 reinoud Exp $); +__KERNEL_RCSID(0, $NetBSD: copy.c,v 1.5 2011/08/27 17:57:14 reinoud Exp $); #include sys/types.h #include sys/systm.h -#include sys/param.h // tmp -#include uvm/uvm.h // tmp -#include uvm/uvm_pmap.h // tmp + +/* XXX until strnlen(3) has been added to the kernel, we *could* panic on it */ +#define strnlen(str, maxlen) min(strlen((str)), maxlen) int copyin(const void *uaddr, void *kaddr, size_t len) @@ -54,27 +54,30 @@ int copyinstr(const void *uaddr, void *kaddr, size_t len, size_t *done) { + len = min(strnlen(uaddr, len), len) + 1; strncpy(kaddr, uaddr, len); if (done) - *done = min(strlen(uaddr), len); + *done = len; return 0; } int copyoutstr(const void *kaddr, void *uaddr, size_t len, size_t *done) { + len = min(strnlen(kaddr, len), len) + 1; strncpy(uaddr, kaddr, len); if (done) - *done = min(strlen(kaddr), len); + *done = len; return 0; } int copystr(const void *kfaddr, void *kdaddr, size_t len, size_t *done) { + len = min(strnlen(kfaddr, len), len) + 1; strncpy(kdaddr, kfaddr, len); if (done) - *done = min(strlen(kfaddr), len); + *done = len; return 0; }
CVS commit: src/sys/arch/usermode/usermode
Module Name:src Committed By: reinoud Date: Sat Aug 27 17:59:24 UTC 2011 Modified Files: src/sys/arch/usermode/usermode: pmap.c Log Message: Only return the result of pmap_extract() when the return variable is not NULL. To generate a diff of this commit: cvs rdiff -u -r1.37 -r1.38 src/sys/arch/usermode/usermode/pmap.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/usermode/usermode/pmap.c diff -u src/sys/arch/usermode/usermode/pmap.c:1.37 src/sys/arch/usermode/usermode/pmap.c:1.38 --- src/sys/arch/usermode/usermode/pmap.c:1.37 Fri Aug 26 11:16:50 2011 +++ src/sys/arch/usermode/usermode/pmap.c Sat Aug 27 17:59:24 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: pmap.c,v 1.37 2011/08/26 11:16:50 jmcneill Exp $ */ +/* $NetBSD: pmap.c,v 1.38 2011/08/27 17:59:24 reinoud Exp $ */ /*- * Copyright (c) 2011 Reinoud Zandijk rein...@netbsd.org @@ -27,7 +27,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: pmap.c,v 1.37 2011/08/26 11:16:50 jmcneill Exp $); +__KERNEL_RCSID(0, $NetBSD: pmap.c,v 1.38 2011/08/27 17:59:24 reinoud Exp $); #include opt_memsize.h #include opt_kmempages.h @@ -638,7 +638,7 @@ void pmap_remove_all(pmap_t pmap) { -aprint_debug(pmap_remove_all not implemented\n); +aprint_debug(pmap_remove_all() called\n); } void @@ -665,7 +665,8 @@ if (pv == NULL) return false; - *pap = ptoa(pv-pv_ppn); + if (pap) + *pap = ptoa(pv-pv_ppn); return true; }
CVS commit: src/sys/arch/usermode/usermode
Module Name:src Committed By: reinoud Date: Sat Aug 27 18:01:37 UTC 2011 Modified Files: src/sys/arch/usermode/usermode: trap.c Log Message: Implement trap recursion detection and fix small one-off error in range checks for kernel space To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/sys/arch/usermode/usermode/trap.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/usermode/usermode/trap.c diff -u src/sys/arch/usermode/usermode/trap.c:1.6 src/sys/arch/usermode/usermode/trap.c:1.7 --- src/sys/arch/usermode/usermode/trap.c:1.6 Thu Aug 25 19:06:03 2011 +++ src/sys/arch/usermode/usermode/trap.c Sat Aug 27 18:01:37 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: trap.c,v 1.6 2011/08/25 19:06:03 reinoud Exp $ */ +/* $NetBSD: trap.c,v 1.7 2011/08/27 18:01:37 reinoud Exp $ */ /*- * Copyright (c) 2011 Reinoud Zandijk rein...@netbsd.org @@ -27,7 +27,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: trap.c,v 1.6 2011/08/25 19:06:03 reinoud Exp $); +__KERNEL_RCSID(0, $NetBSD: trap.c,v 1.7 2011/08/27 18:01:37 reinoud Exp $); #include sys/types.h #include sys/param.h @@ -83,8 +83,12 @@ vaddr_t va; vaddr_t onfault; int kmem, rv; + static volatile int recurse = 0; + recurse++; aprint_debug(trap\n); + if (recurse 1) + printf(enter trap recursion level %d\n, recurse); if ((info-si_signo == SIGSEGV) || (info-si_signo == SIGBUS)) { l = curlwp; p = l-l_proc; @@ -121,7 +125,7 @@ kmem = 1; vm_map = kernel_map; - if ((va = VM_MIN_ADDRESS) (va = VM_MAXUSER_ADDRESS)) { + if ((va = VM_MIN_ADDRESS) (va VM_MAXUSER_ADDRESS)) { kmem = 0; vm_map = vm-vm_map; } @@ -146,11 +150,14 @@ memset(tf, 0, sizeof(struct trapframe)); tf-tf_pc = onfault; tf-tf_out[0] = (rv == EACCES) ? EFAULT : rv; +recurse--; return; } panic(should deliver a trap to the process); } - + if (recurse 1) + printf(leaving trap recursion level %d\n, recurse); + recurse--; } }
CVS commit: src/sys/kern
Module Name:src Committed By: reinoud Date: Sat Aug 27 18:07:10 UTC 2011 Modified Files: src/sys/kern: kern_exec.c Log Message: Fix DPRINTF()'s missing the extra parenteses To generate a diff of this commit: cvs rdiff -u -r1.326 -r1.327 src/sys/kern/kern_exec.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/kern/kern_exec.c diff -u src/sys/kern/kern_exec.c:1.326 src/sys/kern/kern_exec.c:1.327 --- src/sys/kern/kern_exec.c:1.326 Sat Aug 27 17:51:38 2011 +++ src/sys/kern/kern_exec.c Sat Aug 27 18:07:10 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: kern_exec.c,v 1.326 2011/08/27 17:51:38 reinoud Exp $ */ +/* $NetBSD: kern_exec.c,v 1.327 2011/08/27 18:07:10 reinoud Exp $ */ /*- * Copyright (c) 2008 The NetBSD Foundation, Inc. @@ -59,7 +59,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: kern_exec.c,v 1.326 2011/08/27 17:51:38 reinoud Exp $); +__KERNEL_RCSID(0, $NetBSD: kern_exec.c,v 1.327 2011/08/27 18:07:10 reinoud Exp $); #include opt_exec.h #include opt_ktrace.h @@ -855,7 +855,7 @@ { size_t j; struct exec_vmcmd *vp = pack.ep_vmcmds.evs_cmds[0]; - DPRINTF(vmcmds %u\n, pack.ep_vmcmds.evs_used); + DPRINTF((vmcmds %u\n, pack.ep_vmcmds.evs_used); for (j = 0; j pack.ep_vmcmds.evs_used; j++) { DPRINTF(vmcmd[%zu] = vmcmd_map_%s %# PRIxVADDR/%#PRIxVSIZE fd@%# @@ -868,7 +868,7 @@ zero : *unknown*, vp[j].ev_addr, vp[j].ev_len, vp[j].ev_offset, vp[j].ev_prot, - vp[j].ev_flags); + vp[j].ev_flags)); } } #endif /* DEBUG_EXEC */ @@ -893,10 +893,10 @@ if (error) { size_t j; struct exec_vmcmd *vp = pack.ep_vmcmds.evs_cmds[0]; - DPRINTF(vmcmds %zu/%u, error %d\n, i, - pack.ep_vmcmds.evs_used, error); + DPRINTF((vmcmds %zu/%u, error %d\n, i, + pack.ep_vmcmds.evs_used, error)); for (j = 0; j pack.ep_vmcmds.evs_used; j++) { -DPRINTF(vmcmd[%zu] = vmcmd_map_%s %# +DPRINTF((vmcmd[%zu] = vmcmd_map_%s %# PRIxVADDR/%#PRIxVSIZE fd@%# PRIxVSIZE prot=0%o flags=%d\n, j, vp[j].ev_proc == vmcmd_map_pagedvn ? @@ -907,9 +907,9 @@ zero : *unknown*, vp[j].ev_addr, vp[j].ev_len, vp[j].ev_offset, vp[j].ev_prot, -vp[j].ev_flags); +vp[j].ev_flags)); if (j == i) - DPRINTF( ^--- failed\n); + DPRINTF(( ^--- failed\n)); } } #endif /* DEBUG_EXEC */ @@ -1275,7 +1275,7 @@ pathbuf_stringcopy_put(pb, pathstring); pathbuf_destroy(pb); PNBUF_PUT(resolvedpathbuf); - DPRINTF(%s finished\n, __func__); + DPRINTF((%s finished\n, __func__)); return (EJUSTRETURN); bad:
CVS commit: src/sys/kern
Module Name:src Committed By: reinoud Date: Sat Aug 27 18:11:48 UTC 2011 Modified Files: src/sys/kern: kern_exec.c Log Message: Also fix DPRINTF()'s for DEBUG_EXEC To generate a diff of this commit: cvs rdiff -u -r1.327 -r1.328 src/sys/kern/kern_exec.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/kern/kern_exec.c diff -u src/sys/kern/kern_exec.c:1.327 src/sys/kern/kern_exec.c:1.328 --- src/sys/kern/kern_exec.c:1.327 Sat Aug 27 18:07:10 2011 +++ src/sys/kern/kern_exec.c Sat Aug 27 18:11:48 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: kern_exec.c,v 1.327 2011/08/27 18:07:10 reinoud Exp $ */ +/* $NetBSD: kern_exec.c,v 1.328 2011/08/27 18:11:48 reinoud Exp $ */ /*- * Copyright (c) 2008 The NetBSD Foundation, Inc. @@ -59,7 +59,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: kern_exec.c,v 1.327 2011/08/27 18:07:10 reinoud Exp $); +__KERNEL_RCSID(0, $NetBSD: kern_exec.c,v 1.328 2011/08/27 18:11:48 reinoud Exp $); #include opt_exec.h #include opt_ktrace.h @@ -855,9 +855,9 @@ { size_t j; struct exec_vmcmd *vp = pack.ep_vmcmds.evs_cmds[0]; - DPRINTF((vmcmds %u\n, pack.ep_vmcmds.evs_used); + DPRINTF((vmcmds %u\n, pack.ep_vmcmds.evs_used)); for (j = 0; j pack.ep_vmcmds.evs_used; j++) { - DPRINTF(vmcmd[%zu] = vmcmd_map_%s %# + DPRINTF((vmcmd[%zu] = vmcmd_map_%s %# PRIxVADDR/%#PRIxVSIZE fd@%# PRIxVSIZE prot=0%o flags=%d\n, j, vp[j].ev_proc == vmcmd_map_pagedvn ?
CVS commit: src/sys/arch/usermode/conf
Module Name:src Committed By: jmcneill Date: Sat Aug 27 18:13:09 UTC 2011 Modified Files: src/sys/arch/usermode/conf: GENERIC Log Message: add options DEBUG_EXEC and LOCKDEBUG To generate a diff of this commit: cvs rdiff -u -r1.13 -r1.14 src/sys/arch/usermode/conf/GENERIC Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/usermode/conf/GENERIC diff -u src/sys/arch/usermode/conf/GENERIC:1.13 src/sys/arch/usermode/conf/GENERIC:1.14 --- src/sys/arch/usermode/conf/GENERIC:1.13 Wed Aug 24 10:59:10 2011 +++ src/sys/arch/usermode/conf/GENERIC Sat Aug 27 18:13:09 2011 @@ -1,9 +1,9 @@ -# $NetBSD: GENERIC,v 1.13 2011/08/24 10:59:10 jmcneill Exp $ +# $NetBSD: GENERIC,v 1.14 2011/08/27 18:13:09 jmcneill Exp $ include arch/usermode/conf/std.usermode options INCLUDE_CONFIG_FILE -#ident GENERIC-$Revision: 1.13 $ +#ident GENERIC-$Revision: 1.14 $ maxusers 32 makeoptions DEBUG=-O1 -g3 @@ -20,8 +20,9 @@ options SYSVSHM options DEBUG +options DEBUG_EXEC options DIAGNOSTIC -#options LOCKDEBUG +options LOCKDEBUG options COMPAT_BSDPTY options COMPAT_50
CVS commit: src/tools/compat
Module Name:src Committed By: joerg Date: Sat Aug 27 18:33:23 UTC 2011 Modified Files: src/tools/compat: compat_defs.h Log Message: Ensure __printflike exists. To generate a diff of this commit: cvs rdiff -u -r1.79 -r1.80 src/tools/compat/compat_defs.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tools/compat/compat_defs.h diff -u src/tools/compat/compat_defs.h:1.79 src/tools/compat/compat_defs.h:1.80 --- src/tools/compat/compat_defs.h:1.79 Sun Jul 17 20:54:55 2011 +++ src/tools/compat/compat_defs.h Sat Aug 27 18:33:22 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: compat_defs.h,v 1.79 2011/07/17 20:54:55 joerg Exp $ */ +/* $NetBSD: compat_defs.h,v 1.80 2011/08/27 18:33:22 joerg Exp $ */ #ifndef __NETBSD_COMPAT_DEFS_H__ #define __NETBSD_COMPAT_DEFS_H__ @@ -114,6 +114,8 @@ #define __aconst #undef __dead #define __dead +#undef __printflike +#define __printflike(x,y) #undef __restrict #define __restrict #undef __unused
CVS commit: src
Module Name:src Committed By: joerg Date: Sat Aug 27 18:35:21 UTC 2011 Modified Files: src/distrib/sets/lists/base: mi src/share/mk: Makefile bsd.lib.mk bsd.own.mk bsd.prog.mk Added Files: src/share/mk: bsd.clang-analyze.mk Log Message: Add new analyze command to run clang's static analyzer in a directory on all C/C++ files. To generate a diff of this commit: cvs rdiff -u -r1.949 -r1.950 src/distrib/sets/lists/base/mi cvs rdiff -u -r1.43 -r1.44 src/share/mk/Makefile cvs rdiff -u -r0 -r1.1 src/share/mk/bsd.clang-analyze.mk cvs rdiff -u -r1.314 -r1.315 src/share/mk/bsd.lib.mk cvs rdiff -u -r1.680 -r1.681 src/share/mk/bsd.own.mk cvs rdiff -u -r1.265 -r1.266 src/share/mk/bsd.prog.mk Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/distrib/sets/lists/base/mi diff -u src/distrib/sets/lists/base/mi:1.949 src/distrib/sets/lists/base/mi:1.950 --- src/distrib/sets/lists/base/mi:1.949 Fri Aug 26 21:22:07 2011 +++ src/distrib/sets/lists/base/mi Sat Aug 27 18:35:19 2011 @@ -1,4 +1,4 @@ -# $NetBSD: mi,v 1.949 2011/08/26 21:22:07 dyoung Exp $ +# $NetBSD: mi,v 1.950 2011/08/27 18:35:19 joerg Exp $ # # Note: Don't delete entries from here - mark them as obsolete instead, # unless otherwise stated below. @@ -3739,6 +3739,7 @@ ./usr/share/misc/vgrindefs.db base-groff-share share ./usr/share/mk base-util-share ./usr/share/mk/bsd.README base-mk-share share +./usr/share/mk/bsd.clang-analyze.mk base-mk-share share ./usr/share/mk/bsd.crypto.mk base-obsolete obsolete ./usr/share/mk/bsd.dep.mk base-mk-share share ./usr/share/mk/bsd.depall.mk base-obsolete obsolete Index: src/share/mk/Makefile diff -u src/share/mk/Makefile:1.43 src/share/mk/Makefile:1.44 --- src/share/mk/Makefile:1.43 Sat Aug 7 21:50:51 2010 +++ src/share/mk/Makefile Sat Aug 27 18:35:20 2011 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.43 2010/08/07 21:50:51 christos Exp $ +# $NetBSD: Makefile,v 1.44 2011/08/27 18:35:20 joerg Exp $ # @(#)Makefile 8.1 (Berkeley) 6/8/93 NOOBJ= # defined @@ -6,7 +6,8 @@ .include bsd.own.mk .if ${MKSHARE} != no -FILES= bsd.README bsd.dep.mk bsd.doc.mk bsd.endian.mk bsd.files.mk \ +FILES= bsd.README bsd.clang-analyze.mk bsd.dep.mk bsd.doc.mk \ + bsd.endian.mk bsd.files.mk \ bsd.gcc.mk bsd.hostlib.mk bsd.hostprog.mk bsd.inc.mk bsd.info.mk \ bsd.init.mk bsd.ioconf.mk bsd.kernobj.mk bsd.kinc.mk bsd.klinks.mk \ bsd.kmodule.mk bsd.lib.mk bsd.links.mk bsd.man.mk bsd.nls.mk \ Index: src/share/mk/bsd.lib.mk diff -u src/share/mk/bsd.lib.mk:1.314 src/share/mk/bsd.lib.mk:1.315 --- src/share/mk/bsd.lib.mk:1.314 Mon Apr 11 23:03:38 2011 +++ src/share/mk/bsd.lib.mk Sat Aug 27 18:35:20 2011 @@ -1,4 +1,4 @@ -# $NetBSD: bsd.lib.mk,v 1.314 2011/04/11 23:03:38 joerg Exp $ +# $NetBSD: bsd.lib.mk,v 1.315 2011/08/27 18:35:20 joerg Exp $ # @(#)bsd.lib.mk 8.3 (Berkeley) 4/22/94 .include bsd.init.mk @@ -776,5 +776,6 @@ .include bsd.inc.mk .include bsd.links.mk .include bsd.dep.mk +.include bsd.clang-analyze.mk ${TARGETS}: # ensure existence Index: src/share/mk/bsd.own.mk diff -u src/share/mk/bsd.own.mk:1.680 src/share/mk/bsd.own.mk:1.681 --- src/share/mk/bsd.own.mk:1.680 Thu Aug 25 00:01:25 2011 +++ src/share/mk/bsd.own.mk Sat Aug 27 18:35:20 2011 @@ -1,4 +1,4 @@ -# $NetBSD: bsd.own.mk,v 1.680 2011/08/25 00:01:25 uwe Exp $ +# $NetBSD: bsd.own.mk,v 1.681 2011/08/27 18:35:20 joerg Exp $ # This needs to be before bsd.init.mk .if defined(BSD_MK_COMPAT_FILE) @@ -691,11 +691,11 @@ .endif TARGETS+= all clean cleandir depend dependall includes \ - install lint obj regress tags html + install lint obj regress tags html analyze PHONY_NOTMAIN = all clean cleandir depend dependall distclean includes \ install lint obj regress beforedepend afterdepend \ beforeinstall afterinstall realinstall realdepend realall \ - html subdir-all subdir-install subdir-depend + html subdir-all subdir-install subdir-depend analyze .PHONY: ${PHONY_NOTMAIN} .NOTMAIN: ${PHONY_NOTMAIN} Index: src/share/mk/bsd.prog.mk diff -u src/share/mk/bsd.prog.mk:1.265 src/share/mk/bsd.prog.mk:1.266 --- src/share/mk/bsd.prog.mk:1.265 Tue Apr 26 08:22:17 2011 +++ src/share/mk/bsd.prog.mk Sat Aug 27 18:35:20 2011 @@ -1,4 +1,4 @@ -# $NetBSD: bsd.prog.mk,v 1.265 2011/04/26 08:22:17 he Exp $ +# $NetBSD: bsd.prog.mk,v 1.266 2011/08/27 18:35:20 joerg Exp $ # @(#)bsd.prog.mk 8.2 (Berkeley) 4/2/94 .ifndef HOSTPROG @@ -475,6 +475,7 @@ .include bsd.links.mk .include bsd.sys.mk .include bsd.dep.mk +.include bsd.clang-analyze.mk cleanextra: .PHONY .if defined(CLEANFILES) !empty(CLEANFILES) Added files: Index: src/share/mk/bsd.clang-analyze.mk diff -u /dev/null src/share/mk/bsd.clang-analyze.mk:1.1 --- /dev/null Sat Aug 27 18:35:21 2011 +++ src/share/mk/bsd.clang-analyze.mk Sat Aug 27 18:35:20 2011 @@ -0,0 +1,42 @@ +# $NetBSD: bsd.clang-analyze.mk,v 1.1 2011/08/27 18:35:20 joerg Exp $ + +.ifndef
CVS commit: src/external/bsd/flex/dist
Module Name:src Committed By: joerg Date: Sat Aug 27 18:36:03 UTC 2011 Modified Files: src/external/bsd/flex/dist: flex.skl Log Message: Mark yy_fatal_error as noreturn if supported by the compiler. To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/external/bsd/flex/dist/flex.skl Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/external/bsd/flex/dist/flex.skl diff -u src/external/bsd/flex/dist/flex.skl:1.5 src/external/bsd/flex/dist/flex.skl:1.6 --- src/external/bsd/flex/dist/flex.skl:1.5 Sun Dec 6 09:16:16 2009 +++ src/external/bsd/flex/dist/flex.skl Sat Aug 27 18:36:03 2011 @@ -736,6 +736,9 @@ static yy_state_type yy_get_previous_state M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG ); static yy_state_type yy_try_NUL_trans M4_YY_PARAMS( yy_state_type current_state M4_YY_PROTO_LAST_ARG); static int yy_get_next_buffer M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG ); +#if defined(__GNUC__) __GNUC__ = 3 +__attribute__((__noreturn__)) +#endif static void yy_fatal_error M4_YY_PARAMS( yyconst char msg[] M4_YY_PROTO_LAST_ARG ); ]])
CVS commit: src/sbin/mknod
Module Name:src Committed By: joerg Date: Sat Aug 27 18:37:41 UTC 2011 Modified Files: src/sbin/mknod: mknod.c pack_dev.c Log Message: static + __dead To generate a diff of this commit: cvs rdiff -u -r1.39 -r1.40 src/sbin/mknod/mknod.c cvs rdiff -u -r1.10 -r1.11 src/sbin/mknod/pack_dev.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sbin/mknod/mknod.c diff -u src/sbin/mknod/mknod.c:1.39 src/sbin/mknod/mknod.c:1.40 --- src/sbin/mknod/mknod.c:1.39 Fri Feb 13 01:37:23 2009 +++ src/sbin/mknod/mknod.c Sat Aug 27 18:37:41 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: mknod.c,v 1.39 2009/02/13 01:37:23 lukem Exp $ */ +/* $NetBSD: mknod.c,v 1.40 2011/08/27 18:37:41 joerg Exp $ */ /*- * Copyright (c) 1998, 2001 The NetBSD Foundation, Inc. @@ -37,7 +37,7 @@ #ifndef lint __COPYRIGHT(@(#) Copyright (c) 1998\ The NetBSD Foundation, Inc. All rights reserved.); -__RCSID($NetBSD: mknod.c,v 1.39 2009/02/13 01:37:23 lukem Exp $); +__RCSID($NetBSD: mknod.c,v 1.40 2011/08/27 18:37:41 joerg Exp $); #endif /* not lint */ #include sys/types.h @@ -63,8 +63,7 @@ static int gid_name(const char *, gid_t *); static portdev_t callPack(pack_t *, int, u_long *); - int main(int, char *[]); -static void usage(void); +__dead static void usage(void); #ifdef KERN_DRIVERS static struct kinfo_drivers *kern_drivers; Index: src/sbin/mknod/pack_dev.c diff -u src/sbin/mknod/pack_dev.c:1.10 src/sbin/mknod/pack_dev.c:1.11 --- src/sbin/mknod/pack_dev.c:1.10 Fri Feb 13 01:37:23 2009 +++ src/sbin/mknod/pack_dev.c Sat Aug 27 18:37:41 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: pack_dev.c,v 1.10 2009/02/13 01:37:23 lukem Exp $ */ +/* $NetBSD: pack_dev.c,v 1.11 2011/08/27 18:37:41 joerg Exp $ */ /*- * Copyright (c) 1998, 2001 The NetBSD Foundation, Inc. @@ -35,7 +35,7 @@ #include sys/cdefs.h #if !defined(lint) -__RCSID($NetBSD: pack_dev.c,v 1.10 2009/02/13 01:37:23 lukem Exp $); +__RCSID($NetBSD: pack_dev.c,v 1.11 2011/08/27 18:37:41 joerg Exp $); #endif /* not lint */ #include sys/types.h @@ -241,7 +241,7 @@ /* list of formats and pack functions */ /* this list must be sorted lexically */ -struct format { +static struct format { const char *name; pack_t *pack; } formats[] = {
CVS commit: src/sbin/ping
Module Name:src Committed By: joerg Date: Sat Aug 27 18:40:18 UTC 2011 Modified Files: src/sbin/ping: ping.c Log Message: static + __dead To generate a diff of this commit: cvs rdiff -u -r1.97 -r1.98 src/sbin/ping/ping.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sbin/ping/ping.c diff -u src/sbin/ping/ping.c:1.97 src/sbin/ping/ping.c:1.98 --- src/sbin/ping/ping.c:1.97 Sun Aug 21 06:39:09 2011 +++ src/sbin/ping/ping.c Sat Aug 27 18:40:18 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: ping.c,v 1.97 2011/08/21 06:39:09 christos Exp $ */ +/* $NetBSD: ping.c,v 1.98 2011/08/27 18:40:18 joerg Exp $ */ /* * Copyright (c) 1989, 1993 @@ -58,7 +58,7 @@ #include sys/cdefs.h #ifndef lint -__RCSID($NetBSD: ping.c,v 1.97 2011/08/21 06:39:09 christos Exp $); +__RCSID($NetBSD: ping.c,v 1.98 2011/08/27 18:40:18 joerg Exp $); #endif #include stdio.h @@ -128,8 +128,8 @@ * for duplicates. */ #define MAX_DUP_CHK (8 * 2048) -u_char rcvd_tbl[MAX_DUP_CHK/8]; -int nrepeats = 0; +static u_char rcvd_tbl[MAX_DUP_CHK/8]; +static int nrepeats = 0; #define A(seq) rcvd_tbl[(seq/8)%sizeof(rcvd_tbl)] /* byte in array */ #define B(seq) (1 (seq 0x07)) /* bit in byte */ #define SET(seq) (A(seq) |= B(seq)) @@ -142,20 +142,20 @@ }; -u_char *packet; -int packlen; -int pingflags = 0, options; -int pongflags = 0; -char *fill_pat; +static u_char *packet; +static int packlen; +static int pingflags = 0, options; +static int pongflags = 0; +static char *fill_pat; -int s; /* Socket file descriptor */ -int sloop;/* Socket file descriptor/loopback */ +static int s; /* Socket file descriptor */ +static int sloop;/* Socket file descriptor/loopback */ #define PHDR_LEN sizeof(struct tv32) /* size of timestamp header */ -struct sockaddr_in whereto, send_addr; /* Who to ping */ -struct sockaddr_in src_addr; /* from where */ -struct sockaddr_in loc_addr; /* 127.1 */ -int datalen = 64 - PHDR_LEN; /* How much data */ +static struct sockaddr_in whereto, send_addr; /* Who to ping */ +static struct sockaddr_in src_addr; /* from where */ +static struct sockaddr_in loc_addr; /* 127.1 */ +static int datalen = 64 - PHDR_LEN; /* How much data */ #ifndef __NetBSD__ static char *progname; @@ -163,7 +163,7 @@ #define setprogname(name) ((void)(progname = (name))) #endif -char hostname[MAXHOSTNAMELEN]; +static char hostname[MAXHOSTNAMELEN]; static struct { struct ip o_ip; @@ -174,40 +174,39 @@ } o_u; } out_pack; #define opack_icmp out_pack.o_u.u_icmp -struct ip *opack_ip; +static struct ip *opack_ip; -char optspace[MAX_IPOPTLEN]; /* record route space */ -int optlen; +static char optspace[MAX_IPOPTLEN]; /* record route space */ +static int optlen; - -int npackets;/* total packets to send */ -int preload;/* number of packets to preload */ -int ntransmitted; /* output sequence # = #sent */ -int ident;/* our ID, in network byte order */ - -int nreceived;/* # of packets we got back */ - -double interval; /* interval between packets */ -struct timeval interval_tv; -double tmin = 9.0; -double tmax = 0.0; -double tsum = 0.0; /* sum of all times */ -double tsumsq = 0.0; -double maxwait = 0.0; - -int bufspace = IP_MAXPACKET; - -struct timeval now, clear_cache, last_tx, next_tx, first_tx; -struct timeval last_rx, first_rx; -int lastrcvd = 1; /* last ping sent has been received */ +static int npackets;/* total packets to send */ +static int preload;/* number of packets to preload */ +static int ntransmitted; /* output sequence # = #sent */ +static int ident;/* our ID, in network byte order */ + +static int nreceived;/* # of packets we got back */ + +static double interval; /* interval between packets */ +static struct timeval interval_tv; +static double tmin = 9.0; +static double tmax = 0.0; +static double tsum = 0.0; /* sum of all times */ +static double tsumsq = 0.0; +static double maxwait = 0.0; + +static int bufspace = IP_MAXPACKET; + +static struct timeval now, clear_cache, last_tx, next_tx, first_tx; +static struct timeval last_rx, first_rx; +static int lastrcvd = 1; /* last ping sent has been received */ static struct timeval jiggle_time; static int jiggle_cnt, total_jiggled, jiggle_direction = -1; -static void doit(void); +__dead static void doit(void); static void prefinish(int); static void prtsig(int); -static void finish(int); +__dead static void finish(int); static void summary(int); static void pinger(void); static void fill(void); @@ -226,7 +225,7 @@ static void jiggle(int), jiggle_flush(int); static void gethost(const char *, const char *, struct sockaddr_in *, char *, int); -static void usage(void); +__dead static void usage(void); int main(int argc, char *argv[])
CVS commit: src/sbin/ping6
Module Name:src Committed By: joerg Date: Sat Aug 27 18:43:27 UTC 2011 Modified Files: src/sbin/ping6: ping6.c Log Message: static + __dead + G/C pathmtu To generate a diff of this commit: cvs rdiff -u -r1.74 -r1.75 src/sbin/ping6/ping6.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sbin/ping6/ping6.c diff -u src/sbin/ping6/ping6.c:1.74 src/sbin/ping6/ping6.c:1.75 --- src/sbin/ping6/ping6.c:1.74 Sun Aug 14 12:09:35 2011 +++ src/sbin/ping6/ping6.c Sat Aug 27 18:43:24 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: ping6.c,v 1.74 2011/08/14 12:09:35 christos Exp $ */ +/* $NetBSD: ping6.c,v 1.75 2011/08/27 18:43:24 joerg Exp $ */ /* $KAME: ping6.c,v 1.164 2002/11/16 14:05:37 itojun Exp $ */ /* @@ -77,7 +77,7 @@ #else #include sys/cdefs.h #ifndef lint -__RCSID($NetBSD: ping6.c,v 1.74 2011/08/14 12:09:35 christos Exp $); +__RCSID($NetBSD: ping6.c,v 1.75 2011/08/27 18:43:24 joerg Exp $); #endif #endif @@ -189,7 +189,7 @@ #define F_SUPTYPES 0x8 #define F_NOMINMTU 0x10 #define F_NOUSERDATA (F_NODEADDR | F_FQDN | F_FQDNOLD | F_SUPTYPES) -u_int options; +static u_int options; #define IN6LEN sizeof(struct in6_addr) #define SA6LEN sizeof(struct sockaddr_in6) @@ -203,81 +203,80 @@ * to 8192 for complete accuracy... */ #define MAX_DUP_CHK (8 * 8192) -int mx_dup_ck = MAX_DUP_CHK; -char rcvd_tbl[MAX_DUP_CHK / 8]; +static int mx_dup_ck = MAX_DUP_CHK; +static char rcvd_tbl[MAX_DUP_CHK / 8]; -struct addrinfo *res; -struct sockaddr_in6 dst; /* who to ping6 */ -struct sockaddr_in6 src; /* src addr of this packet */ -socklen_t srclen; -int datalen = DEFDATALEN; -int s;/* socket file descriptor */ -u_char outpack[MAXPACKETLEN]; -char BSPACE = '\b'; /* characters written for flood */ -char DOT = '.'; -char *hostname; -int ident; /* process id to identify our packets */ -u_int8_t nonce[8]; /* nonce field for node information */ -int hoplimit = -1; /* hoplimit */ -int pathmtu = 0; /* path MTU for the destination. 0 = unspec. */ +static struct addrinfo *res; +static struct sockaddr_in6 dst; /* who to ping6 */ +static struct sockaddr_in6 src; /* src addr of this packet */ +static socklen_t srclen; +static int datalen = DEFDATALEN; +static int s;/* socket file descriptor */ +static u_char outpack[MAXPACKETLEN]; +static char BSPACE = '\b'; /* characters written for flood */ +static char DOT = '.'; +static char *hostname; +static int ident; /* process id to identify our packets */ +static u_int8_t nonce[8]; /* nonce field for node information */ +static int hoplimit = -1; /* hoplimit */ /* counters */ -long npackets; /* max packets to transmit */ -long nreceived; /* # of packets we got back */ -long nrepeats; /* number of duplicates */ -long ntransmitted; /* sequence # for outbound packets = #sent */ -struct timeval interval = {1, 0}; /* interval between packets */ +static long npackets; /* max packets to transmit */ +static long nreceived; /* # of packets we got back */ +static long nrepeats; /* number of duplicates */ +static long ntransmitted; /* sequence # for outbound packets = #sent */ +static struct timeval interval = {1, 0}; /* interval between packets */ /* timing */ -int timing; /* flag to do timing */ -double tmin = 9.0; /* minimum round trip time */ -double tmax = 0.0; /* maximum round trip time */ -double tsum = 0.0; /* sum of all times, for doing average */ -double tsumsq = 0.0; /* sum of all times squared, for std. dev. */ +static int timing; /* flag to do timing */ +static double tmin = 9.0; /* minimum round trip time */ +static double tmax = 0.0; /* maximum round trip time */ +static double tsum = 0.0; /* sum of all times, for doing average */ +static double tsumsq = 0.0; /* sum of all times squared, for std. dev. */ /* for node addresses */ -u_short naflags; +static u_short naflags; /* for ancillary data(advanced API) */ -struct msghdr smsghdr; -struct iovec smsgiov; -char *scmsg = 0; +static struct msghdr smsghdr; +static struct iovec smsgiov; +static char *scmsg = 0; -volatile sig_atomic_t seenalrm; -volatile sig_atomic_t seenint; +static volatile sig_atomic_t seenalrm; +static volatile sig_atomic_t seenint; #ifdef SIGINFO -volatile sig_atomic_t seeninfo; +static volatile sig_atomic_t seeninfo; #endif -void fill(char *, char *); -int get_hoplim(struct msghdr *); -int get_pathmtu(struct msghdr *); -struct in6_pktinfo *get_rcvpktinfo(struct msghdr *); -void onsignal(int); -void retransmit(void); -void onint(int); -size_t pingerlen(void); -int pinger(void); -const char *pr_addr(struct sockaddr *, int); -void pr_icmph(struct icmp6_hdr *, u_char *); -void pr_iph(struct ip6_hdr *); -void pr_suptypes(struct icmp6_nodeinfo *, size_t); -void pr_nodeaddr(struct icmp6_nodeinfo *, int); -int myechoreply(const struct icmp6_hdr *); -int mynireply(const struct icmp6_nodeinfo *); -char
CVS commit: src/sbin/pppoectl
Module Name:src Committed By: joerg Date: Sat Aug 27 18:44:44 UTC 2011 Modified Files: src/sbin/pppoectl: pppoectl.c Log Message: static + __dead To generate a diff of this commit: cvs rdiff -u -r1.22 -r1.23 src/sbin/pppoectl/pppoectl.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sbin/pppoectl/pppoectl.c diff -u src/sbin/pppoectl/pppoectl.c:1.22 src/sbin/pppoectl/pppoectl.c:1.23 --- src/sbin/pppoectl/pppoectl.c:1.22 Fri Jul 1 02:51:52 2011 +++ src/sbin/pppoectl/pppoectl.c Sat Aug 27 18:44:44 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: pppoectl.c,v 1.22 2011/07/01 02:51:52 joerg Exp $ */ +/* $NetBSD: pppoectl.c,v 1.23 2011/08/27 18:44:44 joerg Exp $ */ /* * Copyright (c) 1997 Joerg Wunsch @@ -31,7 +31,7 @@ #include sys/cdefs.h #ifndef lint -__RCSID($NetBSD: pppoectl.c,v 1.22 2011/07/01 02:51:52 joerg Exp $); +__RCSID($NetBSD: pppoectl.c,v 1.23 2011/08/27 18:44:44 joerg Exp $); #endif @@ -52,30 +52,30 @@ #include sysexits.h #include unistd.h -static void usage(void); -static void print_error(const char *ifname, int error, const char * str); +__dead static void usage(void); +__dead static void print_error(const char *ifname, int error, const char * str); static void print_vals(const char *ifname, int phase, struct spppauthcfg *sp, int lcp_timeout, time_t idle_timeout, int authfailures, int max_auth_failures, u_int maxalive, time_t max_noreceive); -const char *phase_name(int phase); -const char *proto_name(int proto); -const char *authflags(int flags); -static void pppoectl_argument(char *arg); +static const char *phase_name(int phase); +static const char *proto_name(int proto); +static const char *authflags(int flags); +static static void pppoectl_argument(char *arg); -int hz = 0; +static int hz = 0; -int set_auth, set_lcp, set_idle_to, set_auth_failure, set_dns, +static int set_auth, set_lcp, set_idle_to, set_auth_failure, set_dns, clear_auth_failure_count, set_keepalive; -int maxalive = -1; -int max_noreceive = -1; -struct spppauthcfg spr; -struct sppplcpcfg lcp; -struct spppstatus status; -struct spppidletimeout timeout; -struct spppauthfailurestats authfailstats; -struct spppauthfailuresettings authfailset; -struct spppdnssettings dnssettings; -struct spppkeepalivesettings keepalivesettings; +static int maxalive = -1; +static int max_noreceive = -1; +static struct spppauthcfg spr; +static struct sppplcpcfg lcp; +static struct spppstatus status; +static struct spppidletimeout timeout; +static struct spppauthfailurestats authfailstats; +static struct spppauthfailuresettings authfailset; +static struct spppdnssettings dnssettings; +static struct spppkeepalivesettings keepalivesettings; int main(int argc, char **argv) @@ -571,7 +571,7 @@ #endif } -const char * +static const char * phase_name(int phase) { switch (phase) { @@ -584,7 +584,7 @@ return illegal; } -const char * +static const char * proto_name(int proto) { static char buf[12]; @@ -597,7 +597,7 @@ return buf; } -const char * +static const char * authflags(int flags) { static char buf[32];
CVS commit: src/sbin/reboot
Module Name:src Committed By: joerg Date: Sat Aug 27 18:46:20 UTC 2011 Modified Files: src/sbin/reboot: reboot.c Log Message: static + __dead To generate a diff of this commit: cvs rdiff -u -r1.38 -r1.39 src/sbin/reboot/reboot.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sbin/reboot/reboot.c diff -u src/sbin/reboot/reboot.c:1.38 src/sbin/reboot/reboot.c:1.39 --- src/sbin/reboot/reboot.c:1.38 Wed Feb 16 19:32:26 2011 +++ src/sbin/reboot/reboot.c Sat Aug 27 18:46:19 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: reboot.c,v 1.38 2011/02/16 19:32:26 wiz Exp $ */ +/* $NetBSD: reboot.c,v 1.39 2011/08/27 18:46:19 joerg Exp $ */ /* * Copyright (c) 1980, 1986, 1993 @@ -40,7 +40,7 @@ #if 0 static char sccsid[] = @(#)reboot.c 8.1 (Berkeley) 6/5/93; #else -__RCSID($NetBSD: reboot.c,v 1.38 2011/02/16 19:32:26 wiz Exp $); +__RCSID($NetBSD: reboot.c,v 1.39 2011/08/27 18:46:19 joerg Exp $); #endif #endif /* not lint */ @@ -57,11 +57,10 @@ #include unistd.h #include util.h -int main(int, char *[]); -void usage(void); +__dead static void usage(void); -int dohalt; -int dopoweroff; +static int dohalt; +static int dopoweroff; int main(int argc, char *argv[]) @@ -246,7 +245,7 @@ /* NOTREACHED */ } -void +static void usage(void) { const char *pflag = dohalt ? p : ;
CVS commit: src/sbin/rndctl
Module Name:src Committed By: joerg Date: Sat Aug 27 18:49:00 UTC 2011 Modified Files: src/sbin/rndctl: rndctl.c Log Message: static + const + __dead To generate a diff of this commit: cvs rdiff -u -r1.19 -r1.20 src/sbin/rndctl/rndctl.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sbin/rndctl/rndctl.c diff -u src/sbin/rndctl/rndctl.c:1.19 src/sbin/rndctl/rndctl.c:1.20 --- src/sbin/rndctl/rndctl.c:1.19 Sun Apr 5 12:06:33 2009 +++ src/sbin/rndctl/rndctl.c Sat Aug 27 18:48:59 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: rndctl.c,v 1.19 2009/04/05 12:06:33 lukem Exp $ */ +/* $NetBSD: rndctl.c,v 1.20 2011/08/27 18:48:59 joerg Exp $ */ /*- * Copyright (c) 1997 Michael Graff. @@ -31,7 +31,7 @@ #include sys/cdefs.h #ifndef lint -__RCSID($NetBSD: rndctl.c,v 1.19 2009/04/05 12:06:33 lukem Exp $); +__RCSID($NetBSD: rndctl.c,v 1.20 2011/08/27 18:48:59 joerg Exp $); #endif @@ -52,7 +52,7 @@ u_int32_t a_type; } arg_t; -arg_t source_types[] = { +static const arg_t source_types[] = { { ???, RND_TYPE_UNKNOWN }, { disk,RND_TYPE_DISK }, { net, RND_TYPE_NET }, @@ -62,13 +62,13 @@ { NULL, 0 } }; -static void usage(void); -u_int32_t find_type(char *name); -const char *find_name(u_int32_t); -void do_ioctl(rndctl_t *); -char * strflags(u_int32_t); -void do_list(int, u_int32_t, char *); -void do_stats(void); +__dead static void usage(void); +static u_int32_t find_type(const char *name); +static const char *find_name(u_int32_t); +static void do_ioctl(rndctl_t *); +static char * strflags(u_int32_t); +static void do_list(int, u_int32_t, char *); +static void do_stats(void); static void usage(void) @@ -81,10 +81,10 @@ exit(1); } -u_int32_t -find_type(char *name) +static u_int32_t +find_type(const char *name) { - arg_t *a; + const arg_t *a; a = source_types; @@ -98,10 +98,10 @@ return (0); } -const char * +static const char * find_name(u_int32_t type) { - arg_t *a; + const arg_t *a; a = source_types; @@ -115,7 +115,7 @@ return (???); } -void +static void do_ioctl(rndctl_t *rctl) { int fd; @@ -132,7 +132,7 @@ close(fd); } -char * +static char * strflags(u_int32_t fl) { static char str[512]; @@ -156,7 +156,7 @@ #define HEADER Source Bits Type Flags\n -void +static void do_list(int all, u_int32_t type, char *name) { rndstat_t rstat; @@ -216,8 +216,8 @@ close(fd); } -void -do_stats() +static void +do_stats(void) { rndpoolstat_t rs; int fd;
CVS commit: src/distrib/sets/lists
Module Name:src Committed By: dyoung Date: Sat Aug 27 18:54:16 UTC 2011 Modified Files: src/distrib/sets/lists/base: ad.mips64eb ad.mips64el src/distrib/sets/lists/comp: ad.mips64eb ad.mips64el Log Message: Updating setlists for mips64. Thanks Matt Thomas for the heads-up. To generate a diff of this commit: cvs rdiff -u -r1.62 -r1.63 src/distrib/sets/lists/base/ad.mips64eb cvs rdiff -u -r1.59 -r1.60 src/distrib/sets/lists/base/ad.mips64el cvs rdiff -u -r1.47 -r1.48 src/distrib/sets/lists/comp/ad.mips64eb \ src/distrib/sets/lists/comp/ad.mips64el Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/distrib/sets/lists/base/ad.mips64eb diff -u src/distrib/sets/lists/base/ad.mips64eb:1.62 src/distrib/sets/lists/base/ad.mips64eb:1.63 --- src/distrib/sets/lists/base/ad.mips64eb:1.62 Tue Jul 26 16:10:15 2011 +++ src/distrib/sets/lists/base/ad.mips64eb Sat Aug 27 18:54:15 2011 @@ -1,4 +1,4 @@ -# $NetBSD: ad.mips64eb,v 1.62 2011/07/26 16:10:15 joerg Exp $ +# $NetBSD: ad.mips64eb,v 1.63 2011/08/27 18:54:15 dyoung Exp $ ./libexec/ld.elf_so-64base-compat-shlib compat,pic ./libexec/ld.elf_so-o32base-sysutil-bin compat,pic ./usr/lib/64 base-compat-lib @@ -187,6 +187,8 @@ ./usr/lib/64/libperfuse.so.0.0 base-compat-shlib compat,pic ./usr/lib/64/libposix.so.0 base-compat-shlib compat,pic ./usr/lib/64/libposix.so.0.1 base-compat-shlib compat,pic +./usr/lib/64/libppath.so.0 base-compat-shlib compat,pic +./usr/lib/64/libppath.so.0.0 base-compat-shlib compat,pic ./usr/lib/64/libprop.so.1 base-compat-shlib compat,pic ./usr/lib/64/libprop.so.1.1 base-compat-shlib compat,pic ./usr/lib/64/libpthread.so.1 base-compat-shlib compat,pic @@ -471,6 +473,8 @@ ./usr/lib/o32/libperfuse.so.0.0 base-compat-shlib compat,pic ./usr/lib/o32/libposix.so.0 base-compat-shlib compat,pic ./usr/lib/o32/libposix.so.0.1 base-compat-shlib compat,pic +./usr/lib/o32/libppath.so.0 base-compat-shlib compat,pic +./usr/lib/o32/libppath.so.0.0 base-compat-shlib compat,pic ./usr/lib/o32/libprop.so.1 base-compat-shlib compat,pic ./usr/lib/o32/libprop.so.1.1 base-compat-shlib compat,pic ./usr/lib/o32/libpthread.so.1 base-compat-shlib compat,pic Index: src/distrib/sets/lists/base/ad.mips64el diff -u src/distrib/sets/lists/base/ad.mips64el:1.59 src/distrib/sets/lists/base/ad.mips64el:1.60 --- src/distrib/sets/lists/base/ad.mips64el:1.59 Tue Jul 26 16:10:15 2011 +++ src/distrib/sets/lists/base/ad.mips64el Sat Aug 27 18:54:15 2011 @@ -1,4 +1,4 @@ -# $NetBSD: ad.mips64el,v 1.59 2011/07/26 16:10:15 joerg Exp $ +# $NetBSD: ad.mips64el,v 1.60 2011/08/27 18:54:15 dyoung Exp $ ./libexec/ld.elf_so-64base-compat-shlib compat,pic ./libexec/ld.elf_so-o32base-sysutil-bin compat,pic ./usr/lib/64 base-compat-lib @@ -187,6 +187,8 @@ ./usr/lib/64/libperfuse.so.0.0 base-compat-shlib compat,pic ./usr/lib/64/libposix.so.0 base-compat-shlib compat,pic ./usr/lib/64/libposix.so.0.1 base-compat-shlib compat,pic +./usr/lib/64/libppath.so.0 base-compat-shlib compat,pic +./usr/lib/64/libppath.so.0.0 base-compat-shlib compat,pic ./usr/lib/64/libprop.so.1 base-compat-shlib compat,pic ./usr/lib/64/libprop.so.1.1 base-compat-shlib compat,pic ./usr/lib/64/libpthread.so.1 base-compat-shlib compat,pic @@ -471,6 +473,8 @@ ./usr/lib/o32/libperfuse.so.0.0 base-compat-shlib compat,pic ./usr/lib/o32/libposix.so.0 base-compat-shlib compat,pic ./usr/lib/o32/libposix.so.0.1 base-compat-shlib compat,pic +./usr/lib/o32/libppath.so.0 base-compat-shlib compat,pic +./usr/lib/o32/libppath.so.0.0 base-compat-shlib compat,pic ./usr/lib/o32/libprop.so.1 base-compat-shlib compat,pic ./usr/lib/o32/libprop.so.1.1 base-compat-shlib compat,pic ./usr/lib/o32/libpthread.so.1 base-compat-shlib compat,pic Index: src/distrib/sets/lists/comp/ad.mips64eb diff -u src/distrib/sets/lists/comp/ad.mips64eb:1.47 src/distrib/sets/lists/comp/ad.mips64eb:1.48 --- src/distrib/sets/lists/comp/ad.mips64eb:1.47 Tue Jul 26 16:10:15 2011 +++ src/distrib/sets/lists/comp/ad.mips64eb Sat Aug 27 18:54:15 2011 @@ -1,4 +1,4 @@ -# $NetBSD: ad.mips64eb,v 1.47 2011/07/26 16:10:15 joerg Exp $ +# $NetBSD: ad.mips64eb,v 1.48 2011/08/27 18:54:15 dyoung Exp $ ./usr/bin/elf2aoutcomp-obsolete obsolete ./usr/bin/elf2ecoffcomp-sysutil-bin ./usr/include/gcc-4.5/loongson.h comp-c-include gcccmds,gcc=45 @@ -475,6 +475,10 @@ ./usr/lib/64/libposix.so base-sys-shlib compat,pic ./usr/lib/64/libposix_p.a comp-c-proflib compat,profile ./usr/lib/64/libposix_pic.a comp-c-piclib compat,pic +./usr/lib/64/libppath.acomp-c-lib compat +./usr/lib/64/libppath.so base-sys-shlib compat,pic +./usr/lib/64/libppath_p.a comp-c-proflib compat,profile +./usr/lib/64/libppath_pic.a comp-c-piclib compat,pic ./usr/lib/64/libprop.acomp-c-lib compat ./usr/lib/64/libprop.sobase-sys-shlib
CVS commit: src/sbin/shutdown
Module Name:src Committed By: joerg Date: Sat Aug 27 18:54:39 UTC 2011 Modified Files: src/sbin/shutdown: shutdown.c Log Message: statc + __dead To generate a diff of this commit: cvs rdiff -u -r1.54 -r1.55 src/sbin/shutdown/shutdown.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sbin/shutdown/shutdown.c diff -u src/sbin/shutdown/shutdown.c:1.54 src/sbin/shutdown/shutdown.c:1.55 --- src/sbin/shutdown/shutdown.c:1.54 Wed Feb 16 19:33:48 2011 +++ src/sbin/shutdown/shutdown.c Sat Aug 27 18:54:39 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: shutdown.c,v 1.54 2011/02/16 19:33:48 wiz Exp $ */ +/* $NetBSD: shutdown.c,v 1.55 2011/08/27 18:54:39 joerg Exp $ */ /* * Copyright (c) 1988, 1990, 1993 @@ -39,7 +39,7 @@ #if 0 static char sccsid[] = @(#)shutdown.c 8.4 (Berkeley) 4/28/95; #else -__RCSID($NetBSD: shutdown.c,v 1.54 2011/02/16 19:33:48 wiz Exp $); +__RCSID($NetBSD: shutdown.c,v 1.55 2011/08/27 18:54:39 joerg Exp $); #endif #endif /* not lint */ @@ -99,12 +99,12 @@ static void badtime(void) __dead; static void die_you_gravy_sucking_pig_dog(void) __dead; static void doitfast(void); -void dorcshutdown(void); +static void dorcshutdown(void); static void finish(int) __dead; static void getoffset(char *); -static void loop(void); +static void loop(void) __dead; static void nolog(void); -static void timeout(int); +static void timeout(int) __dead; static void timewarn(time_t); static void usage(void) __dead; @@ -250,7 +250,7 @@ #endif } -void +static void loop(void) { const struct interval *tp; @@ -294,7 +294,7 @@ static jmp_buf alarmbuf; -void +static void timewarn(time_t timeleft) { static int first; @@ -435,7 +435,7 @@ #define ATOI2(s) ((s) += 2, ((s)[-2] - '0') * 10 + ((s)[-1] - '0')) -void +static void getoffset(char *timearg) { struct tm *lt; @@ -515,7 +515,7 @@ errx(1, time is already past); } -void +static void dorcshutdown(void) { (void)printf(\r\nAbout to run shutdown hooks...\r\n); @@ -528,7 +528,7 @@ } #define FSMSG fastboot file for fsck\n -void +static void doitfast(void) { int fastfd; @@ -541,7 +541,7 @@ } #define NOMSG \n\nNO LOGINS: System going down at -void +static void nolog(void) { int logfd;
CVS commit: src/sbin/slattach
Module Name:src Committed By: joerg Date: Sat Aug 27 18:55:21 UTC 2011 Modified Files: src/sbin/slattach: slattach.c Log Message: static + __dead To generate a diff of this commit: cvs rdiff -u -r1.30 -r1.31 src/sbin/slattach/slattach.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sbin/slattach/slattach.c diff -u src/sbin/slattach/slattach.c:1.30 src/sbin/slattach/slattach.c:1.31 --- src/sbin/slattach/slattach.c:1.30 Sun Jul 20 01:20:23 2008 +++ src/sbin/slattach/slattach.c Sat Aug 27 18:55:21 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: slattach.c,v 1.30 2008/07/20 01:20:23 lukem Exp $ */ +/* $NetBSD: slattach.c,v 1.31 2011/08/27 18:55:21 joerg Exp $ */ /* * Copyright (c) 1988, 1993 @@ -42,7 +42,7 @@ #if 0 static char sccsid[] = @(#)slattach.c 8.2 (Berkeley) 1/7/94; #else -__RCSID($NetBSD: slattach.c,v 1.30 2008/07/20 01:20:23 lukem Exp $); +__RCSID($NetBSD: slattach.c,v 1.31 2011/08/27 18:55:21 joerg Exp $); #endif #endif /* not lint */ @@ -65,13 +65,13 @@ #include termios.h #include unistd.h -int speed = 9600; -int slipdisc = SLIPDISC; +static int speed = 9600; +static int slipdisc = SLIPDISC; -char devicename[32]; +static char devicename[32]; -int ttydisc(char *); -void usage(void); +static int ttydisc(char *); +__dead static void usage(void); int main(int argc, char *argv[]) @@ -146,7 +146,7 @@ sigsuspend(nsigset); } -int +static int ttydisc(char *name) { if (strcmp(name, slip) == 0) @@ -161,7 +161,7 @@ return -1; } -void +static void usage(void) {
CVS commit: src
Module Name:src Committed By: dyoung Date: Sat Aug 27 18:55:52 UTC 2011 Modified Files: src/distrib/sets/lists/tests: mi src/tests/lib: Makefile src/tests/lib/libppath: Makefile Log Message: Build and install ppath(3) tests. To generate a diff of this commit: cvs rdiff -u -r1.377 -r1.378 src/distrib/sets/lists/tests/mi cvs rdiff -u -r1.14 -r1.15 src/tests/lib/Makefile cvs rdiff -u -r1.1 -r1.2 src/tests/lib/libppath/Makefile Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/distrib/sets/lists/tests/mi diff -u src/distrib/sets/lists/tests/mi:1.377 src/distrib/sets/lists/tests/mi:1.378 --- src/distrib/sets/lists/tests/mi:1.377 Thu Aug 25 15:34:05 2011 +++ src/distrib/sets/lists/tests/mi Sat Aug 27 18:55:52 2011 @@ -1,4 +1,4 @@ -# $NetBSD: mi,v 1.377 2011/08/25 15:34:05 dyoung Exp $ +# $NetBSD: mi,v 1.378 2011/08/27 18:55:52 dyoung Exp $ # # Note: don't delete entries from here - mark them as obsolete instead. # @@ -558,6 +558,8 @@ ./usr/libdata/debug/usr/tests/lib/libposix/posix1/t_rename.debug tests-lib-debug debug,atf ./usr/libdata/debug/usr/tests/lib/libposix/posix2 tests-lib-debug ./usr/libdata/debug/usr/tests/lib/libposix/posix2/t_rename.debug tests-lib-debug debug,atf +./usr/libdata/debug/usr/tests/lib/libppathtests-lib-debug +./usr/libdata/debug/usr/tests/lib/libppath/t_ppath.debug tests-lib-debug debug,atf ./usr/libdata/debug/usr/tests/lib/libproptests-lib-debug ./usr/libdata/debug/usr/tests/lib/libprop/t_basic.debug tests-lib-debug debug,atf ./usr/libdata/debug/usr/tests/lib/libpthreadtests-lib-debug @@ -2261,6 +2263,9 @@ ./usr/tests/lib/libposix/posix2 tests-lib-tests atf ./usr/tests/lib/libposix/posix2/Atffile tests-lib-tests atf ./usr/tests/lib/libposix/posix2/t_rename tests-lib-tests atf +./usr/tests/lib/libppath tests-lib-tests atf +./usr/tests/lib/libppath/Atffile tests-lib-tests atf +./usr/tests/lib/libppath/t_ppath tests-lib-tests atf ./usr/tests/lib/libproptests-lib-tests atf ./usr/tests/lib/libprop/Atffile tests-lib-tests atf ./usr/tests/lib/libprop/t_basic tests-lib-tests atf Index: src/tests/lib/Makefile diff -u src/tests/lib/Makefile:1.14 src/tests/lib/Makefile:1.15 --- src/tests/lib/Makefile:1.14 Sun Apr 10 09:49:13 2011 +++ src/tests/lib/Makefile Sat Aug 27 18:55:51 2011 @@ -1,9 +1,9 @@ -# $NetBSD: Makefile,v 1.14 2011/04/10 09:49:13 blymn Exp $ +# $NetBSD: Makefile,v 1.15 2011/08/27 18:55:51 dyoung Exp $ .include bsd.own.mk TESTS_SUBDIRS= csu libbluetooth libc libcurses libevent libm \ - libobjc libposix libprop libpthread \ + libobjc libposix libppath libprop libpthread \ librt librumpclient librumphijack libutil semaphore .if ${MKCRYPTO} != no Index: src/tests/lib/libppath/Makefile diff -u src/tests/lib/libppath/Makefile:1.1 src/tests/lib/libppath/Makefile:1.2 --- src/tests/lib/libppath/Makefile:1.1 Thu Aug 25 19:09:46 2011 +++ src/tests/lib/libppath/Makefile Sat Aug 27 18:55:52 2011 @@ -1,11 +1,12 @@ -# $Id: Makefile,v 1.1 2011/08/25 19:09:46 dyoung Exp $ +# $Id: Makefile,v 1.2 2011/08/27 18:55:52 dyoung Exp $ .include bsd.own.mk -LIBPPATH != make -V .OBJDIR -C $(.CURDIR)/../lib +TESTSDIR= ${TESTSBASE}/lib/libppath -TESTS_C=t_ppath t_proplib -SRCS.t_proplib=t_proplib.c personnel.c personnel.h +#LIBPPATH != make -V .OBJDIR -C $(.CURDIR)/../lib + +TESTS_C=t_ppath SRCS.t_ppath=t_ppath.c personnel.c personnel.h CPPFLAGS+=-I$(.OBJDIR) @@ -19,8 +20,9 @@ CLEANFILES+=personnel.c personnel.h -LDADD+=-L$(LIBPPATH) -lppath -lprop -DPADD+=$(LIBPPATH)/libppath.a +#LDADD+=-L$(LIBPPATH) +LDADD+=-lppath -lprop +#DPADD+=$(LIBPPATH)/libppath.a .include bsd.test.mk -.include ../mk/tags.mk +#.include ../mk/tags.mk
CVS commit: src/sbin/svhlabel
Module Name:src Committed By: joerg Date: Sat Aug 27 18:55:58 UTC 2011 Modified Files: src/sbin/svhlabel: svhlabel.c Log Message: __dead + kill main prototype. To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/sbin/svhlabel/svhlabel.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sbin/svhlabel/svhlabel.c diff -u src/sbin/svhlabel/svhlabel.c:1.5 src/sbin/svhlabel/svhlabel.c:1.6 --- src/sbin/svhlabel/svhlabel.c:1.5 Mon Apr 6 12:33:11 2009 +++ src/sbin/svhlabel/svhlabel.c Sat Aug 27 18:55:58 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: svhlabel.c,v 1.5 2009/04/06 12:33:11 lukem Exp $ */ +/* $NetBSD: svhlabel.c,v 1.6 2011/08/27 18:55:58 joerg Exp $ */ /* * Copyright (C) 2007 Stephen M. Rumble. @@ -34,7 +34,7 @@ #include sys/cdefs.h #ifndef lint -__RCSID($NetBSD: svhlabel.c,v 1.5 2009/04/06 12:33:11 lukem Exp $); +__RCSID($NetBSD: svhlabel.c,v 1.6 2011/08/27 18:55:58 joerg Exp $); #endif /* not lint */ #include stdio.h @@ -59,8 +59,7 @@ #include dkcksum.h #include extern.h -int main(int, char **); -static void usage(void); +__dead static void usage(void); static void getlabel(int); static void setlabel(int, int); static int getparts(int, int);
CVS commit: src/sbin/swapctl
Module Name:src Committed By: joerg Date: Sat Aug 27 18:57:50 UTC 2011 Modified Files: src/sbin/swapctl: swapctl.c Log Message: static + __dead To generate a diff of this commit: cvs rdiff -u -r1.35 -r1.36 src/sbin/swapctl/swapctl.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sbin/swapctl/swapctl.c diff -u src/sbin/swapctl/swapctl.c:1.35 src/sbin/swapctl/swapctl.c:1.36 --- src/sbin/swapctl/swapctl.c:1.35 Thu Sep 24 16:15:20 2009 +++ src/sbin/swapctl/swapctl.c Sat Aug 27 18:57:50 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: swapctl.c,v 1.35 2009/09/24 16:15:20 apb Exp $ */ +/* $NetBSD: swapctl.c,v 1.36 2011/08/27 18:57:50 joerg Exp $ */ /* * Copyright (c) 1996, 1997, 1999 Matthew R. Green @@ -64,7 +64,7 @@ #include sys/cdefs.h #ifndef lint -__RCSID($NetBSD: swapctl.c,v 1.35 2009/09/24 16:15:20 apb Exp $); +__RCSID($NetBSD: swapctl.c,v 1.36 2011/08/27 18:57:50 joerg Exp $); #endif @@ -88,7 +88,7 @@ #include swapctl.h -int command; +static int command; /* * Commands for swapctl(8). These are mutually exclusive. @@ -121,45 +121,45 @@ /* * Option flags, and the commands with which they are valid. */ -int kflag; /* display in 1K^x blocks */ +static int kflag; /* display in 1K^x blocks */ #define KFLAG_CMDS (CMD_l | CMD_s) #define MFLAG_CMDS (CMD_l | CMD_s) #define GFLAG_CMDS (CMD_l | CMD_s) -int hflag; /* display with humanize_number */ +static int hflag; /* display with humanize_number */ #define HFLAG_CMDS (CMD_l | CMD_s) -int pflag; /* priority was specified */ +static int pflag; /* priority was specified */ #define PFLAG_CMDS (CMD_A | CMD_a | CMD_c) -char *tflag; /* swap device type (blk, noblk, auto) */ -int autoflag; /* 1, if tflag is auto */ +static char *tflag; /* swap device type (blk, noblk, auto) */ +static int autoflag; /* 1, if tflag is auto */ #define TFLAG_CMDS (CMD_A | CMD_U) -int fflag; /* first swap becomes dump */ +static int fflag; /* first swap becomes dump */ #define FFLAG_CMDS (CMD_A) -int oflag; /* only autoset dump device */ +static int oflag; /* only autoset dump device */ #define OFLAG_CMDS (CMD_A) -int nflag; /* no execute, just print actions */ +static int nflag; /* no execute, just print actions */ #define NFLAG_CMDS (CMD_A | CMD_U) -int pri; /* uses 0 as default pri */ +static int pri; /* uses 0 as default pri */ static void change_priority(char *); static int add_swap(char *, int); static int delete_swap(char *); static void set_dumpdev(char *); static int get_dumpdev(void); -static void do_fstab(int); +__dead static void do_fstab(int); static int check_fstab(void); static void do_localdevs(int); static void do_localdisk(const char *, int); static int do_wedgesofdisk(int fd, int); static int do_partitionsofdisk(const char *, int fd, int); -static void usage(void); -static void swapon_command(int, char **); +__dead static void usage(void); +__dead static void swapon_command(int, char **); #if 0 static void swapoff_command(int, char **); #endif
CVS commit: src/sbin/ttyflags
Module Name:src Committed By: joerg Date: Sat Aug 27 18:58:52 UTC 2011 Modified Files: src/sbin/ttyflags: ttyflags.c Log Message: static + __dead To generate a diff of this commit: cvs rdiff -u -r1.17 -r1.18 src/sbin/ttyflags/ttyflags.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sbin/ttyflags/ttyflags.c diff -u src/sbin/ttyflags/ttyflags.c:1.17 src/sbin/ttyflags/ttyflags.c:1.18 --- src/sbin/ttyflags/ttyflags.c:1.17 Sun Jul 20 01:20:23 2008 +++ src/sbin/ttyflags/ttyflags.c Sat Aug 27 18:58:51 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: ttyflags.c,v 1.17 2008/07/20 01:20:23 lukem Exp $ */ +/* $NetBSD: ttyflags.c,v 1.18 2011/08/27 18:58:51 joerg Exp $ */ /* * Copyright (c) 1994 Christopher G. Demetriou @@ -41,7 +41,7 @@ #endif /* not lint */ #ifndef lint -__RCSID($NetBSD: ttyflags.c,v 1.17 2008/07/20 01:20:23 lukem Exp $); +__RCSID($NetBSD: ttyflags.c,v 1.18 2011/08/27 18:58:51 joerg Exp $); #endif /* not lint */ #include sys/types.h @@ -58,12 +58,12 @@ #include ttyent.h #include unistd.h -int change_all(void); -int change_ttyflags(struct ttyent *); -int change_ttys(char **); -void usage(void); +static int change_all(void); +static int change_ttyflags(struct ttyent *); +static int change_ttys(char **); +__dead static void usage(void); -int nflag, vflag; +static int nflag, vflag; /* * Ttyflags sets the device-specific tty flags, based on the contents @@ -116,7 +116,7 @@ /* * Change all /etc/ttys entries' flags. */ -int +static int change_all(void) { struct ttyent *tep; @@ -132,7 +132,7 @@ /* * Change the specified ttys' flags. */ -int +static int change_ttys(char **ttylist) { struct ttyent *tep; @@ -159,7 +159,7 @@ * Actually do the work; find out what the new flags value should be, * open the device, and change the flags. */ -int +static int change_ttyflags(struct ttyent *tep) { int fd, flags, rval, st, sep; @@ -237,7 +237,7 @@ /* * Print usage information when a bogus set of arguments is given. */ -void +static void usage(void) { (void)fprintf(stderr, usage: ttyflags [-v] [-a | tty ... ]\n);
CVS commit: src/sbin/wdogctl
Module Name:src Committed By: joerg Date: Sat Aug 27 19:00:35 UTC 2011 Modified Files: src/sbin/wdogctl: wdogctl.c Log Message: static + __dead To generate a diff of this commit: cvs rdiff -u -r1.19 -r1.20 src/sbin/wdogctl/wdogctl.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sbin/wdogctl/wdogctl.c diff -u src/sbin/wdogctl/wdogctl.c:1.19 src/sbin/wdogctl/wdogctl.c:1.20 --- src/sbin/wdogctl/wdogctl.c:1.19 Tue Jan 4 23:48:44 2011 +++ src/sbin/wdogctl/wdogctl.c Sat Aug 27 19:00:35 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: wdogctl.c,v 1.19 2011/01/04 23:48:44 wiz Exp $ */ +/* $NetBSD: wdogctl.c,v 1.20 2011/08/27 19:00:35 joerg Exp $ */ /*- * Copyright (c) 2000 Zembu Labs, Inc. @@ -35,7 +35,7 @@ #include sys/cdefs.h #ifndef lint -__RCSID($NetBSD: wdogctl.c,v 1.19 2011/01/04 23:48:44 wiz Exp $); +__RCSID($NetBSD: wdogctl.c,v 1.20 2011/08/27 19:00:35 joerg Exp $); #endif @@ -56,17 +56,16 @@ #define _PATH_WATCHDOG /dev/watchdog -int main(int, char *[]); -void enable_kernel(const char *, u_int); -void enable_user(const char *, u_int, int); -void enable_ext(const char *, u_int); -void tickle_ext(void); -void disable(void); -void prep_wmode(struct wdog_mode *, int, const char *, u_int); -void list_timers(void); -void usage(void); +static void enable_kernel(const char *, u_int); +static void enable_user(const char *, u_int, int); +static void enable_ext(const char *, u_int); +static void tickle_ext(void); +static void disable(void); +static void prep_wmode(struct wdog_mode *, int, const char *, u_int); +static void list_timers(void); +__dead static void usage(void); -int Aflag; +static int Aflag; /* Caution -- ordered list; entries = CMD_EXT_TICKLE set timers */ enum cmd { @@ -173,7 +172,7 @@ exit(EXIT_SUCCESS); } -void +static void prep_wmode(struct wdog_mode *wp, int mode, const char *name, u_int period) { if (strlen(name) = WDOG_NAMESIZE) @@ -186,7 +185,7 @@ wp-wm_mode |= WDOG_FEATURE_ALARM; } -void +static void enable_kernel(const char *name, u_int period) { struct wdog_mode wm; @@ -204,7 +203,7 @@ (void)close(fd); } -void +static void enable_ext(const char *name, u_int period) { struct wdog_mode wm; @@ -226,7 +225,7 @@ return; } -void +static void enable_user(const char *name, u_int period, int cancel_on_close) { struct wdog_mode wm; @@ -310,8 +309,8 @@ /* NOTREACHED */ } -void -tickle_ext() +static void +tickle_ext(void) { int fd; @@ -324,7 +323,7 @@ (void)close(fd); } -void +static void disable(void) { struct wdog_mode wm; @@ -362,7 +361,7 @@ } } -void +static void list_timers(void) { struct wdog_conf wc; @@ -439,7 +438,7 @@ (void)close(fd); } -void +static void usage(void) {
CVS commit: src/sbin/wsconsctl
Module Name:src Committed By: joerg Date: Sat Aug 27 19:01:34 UTC 2011 Modified Files: src/sbin/wsconsctl: map_parse.y wsconsctl.h Log Message: Mark yyerror as static and dead. To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.10 src/sbin/wsconsctl/map_parse.y cvs rdiff -u -r1.10 -r1.11 src/sbin/wsconsctl/wsconsctl.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sbin/wsconsctl/map_parse.y diff -u src/sbin/wsconsctl/map_parse.y:1.9 src/sbin/wsconsctl/map_parse.y:1.10 --- src/sbin/wsconsctl/map_parse.y:1.9 Tue Nov 30 12:22:06 2010 +++ src/sbin/wsconsctl/map_parse.y Sat Aug 27 19:01:34 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: map_parse.y,v 1.9 2010/11/30 12:22:06 phx Exp $ */ +/* $NetBSD: map_parse.y,v 1.10 2011/08/27 19:01:34 joerg Exp $ */ /*- * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -198,7 +198,7 @@ }; %% -void +__dead static void yyerror(const char *msg) { Index: src/sbin/wsconsctl/wsconsctl.h diff -u src/sbin/wsconsctl/wsconsctl.h:1.10 src/sbin/wsconsctl/wsconsctl.h:1.11 --- src/sbin/wsconsctl/wsconsctl.h:1.10 Mon Apr 28 20:23:09 2008 +++ src/sbin/wsconsctl/wsconsctl.h Sat Aug 27 19:01:34 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: wsconsctl.h,v 1.10 2008/04/28 20:23:09 martin Exp $ */ +/* $NetBSD: wsconsctl.h,v 1.11 2011/08/27 19:01:34 joerg Exp $ */ /*- * Copyright (c) 1998, 2004 The NetBSD Foundation, Inc. @@ -91,6 +91,5 @@ #ifndef YYEMPTY int yyparse(void); #endif -void yyerror(const char *); int yylex(void); void map_scan_setinput(char *);
CVS commit: src/etc/mtree
Module Name:src Committed By: dyoung Date: Sat Aug 27 19:02:29 UTC 2011 Modified Files: src/etc/mtree: NetBSD.dist.tests Log Message: Straggler from last: add the directory for ppath(3) tests. To generate a diff of this commit: cvs rdiff -u -r1.51 -r1.52 src/etc/mtree/NetBSD.dist.tests Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/etc/mtree/NetBSD.dist.tests diff -u src/etc/mtree/NetBSD.dist.tests:1.51 src/etc/mtree/NetBSD.dist.tests:1.52 --- src/etc/mtree/NetBSD.dist.tests:1.51 Thu Jul 7 07:40:46 2011 +++ src/etc/mtree/NetBSD.dist.tests Sat Aug 27 19:02:29 2011 @@ -1,4 +1,4 @@ -# $NetBSD: NetBSD.dist.tests,v 1.51 2011/07/07 07:40:46 jruoho Exp $ +# $NetBSD: NetBSD.dist.tests,v 1.52 2011/08/27 19:02:29 dyoung Exp $ ./usr/libdata/debug/usr/tests ./usr/libdata/debug/usr/tests/atf @@ -79,6 +79,7 @@ ./usr/libdata/debug/usr/tests/lib/libposix/bsd ./usr/libdata/debug/usr/tests/lib/libposix/posix1 ./usr/libdata/debug/usr/tests/lib/libposix/posix2 +./usr/libdata/debug/usr/tests/lib/libppath ./usr/libdata/debug/usr/tests/lib/libprop ./usr/libdata/debug/usr/tests/lib/libpthread ./usr/libdata/debug/usr/tests/lib/librt @@ -204,6 +205,7 @@ ./usr/tests/lib/libposix/bsd ./usr/tests/lib/libposix/posix1 ./usr/tests/lib/libposix/posix2 +./usr/tests/lib/libppath ./usr/tests/lib/libprop ./usr/tests/lib/libpthread ./usr/tests/lib/librt
CVS commit: src/sys/compat/netbsd32
Module Name:src Committed By: bouyer Date: Sat Aug 27 19:25:35 UTC 2011 Modified Files: src/sys/compat/netbsd32: netbsd32_ioctl.c netbsd32_ioctl.h Log Message: translate WDOGIOC_GWDOGS To generate a diff of this commit: cvs rdiff -u -r1.56 -r1.57 src/sys/compat/netbsd32/netbsd32_ioctl.c cvs rdiff -u -r1.35 -r1.36 src/sys/compat/netbsd32/netbsd32_ioctl.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/compat/netbsd32/netbsd32_ioctl.c diff -u src/sys/compat/netbsd32/netbsd32_ioctl.c:1.56 src/sys/compat/netbsd32/netbsd32_ioctl.c:1.57 --- src/sys/compat/netbsd32/netbsd32_ioctl.c:1.56 Mon Apr 4 18:24:56 2011 +++ src/sys/compat/netbsd32/netbsd32_ioctl.c Sat Aug 27 19:25:35 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: netbsd32_ioctl.c,v 1.56 2011/04/04 18:24:56 ahoka Exp $ */ +/* $NetBSD: netbsd32_ioctl.c,v 1.57 2011/08/27 19:25:35 bouyer Exp $ */ /* * Copyright (c) 1998, 2001 Matthew R. Green @@ -31,7 +31,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: netbsd32_ioctl.c,v 1.56 2011/04/04 18:24:56 ahoka Exp $); +__KERNEL_RCSID(0, $NetBSD: netbsd32_ioctl.c,v 1.57 2011/08/27 19:25:35 bouyer Exp $); #include sys/param.h #include sys/systm.h @@ -51,6 +51,7 @@ #include sys/ktrace.h #include sys/kmem.h #include sys/envsys.h +#include sys/wdog.h #ifdef __sparc__ #include dev/sun/fbio.h @@ -279,6 +280,14 @@ *p = (u_long)*s32p; } +static inline void +netbsd32_to_wdog_conf(struct netbsd32_wdog_conf *s32p, struct wdog_conf *p, u_long cmd) +{ + + p-wc_names = (char *)NETBSD32PTR64(s32p-wc_names); + p-wc_count = s32p-wc_count; +} + /* * handle ioctl conversions from 64-bit kernel - netbsd32 */ @@ -436,6 +445,14 @@ } static inline void +netbsd32_from_wdog_conf(struct wdog_conf *p, struct netbsd32_wdog_conf *s32p, u_long cmd) +{ + + NETBSD32PTR32(s32p-wc_names, p-wc_names); + s32p-wc_count = p-wc_count; +} + +static inline void netbsd32_from_u_long(u_long *p, netbsd32_u_long *s32p, u_long cmd) { @@ -743,6 +760,9 @@ case ENVSYS_REMOVEPROPS32: IOCTL_STRUCT_CONV_TO(ENVSYS_REMOVEPROPS, plistref); + case WDOGIOC_GWDOGS32: + IOCTL_STRUCT_CONV_TO(WDOGIOC_GWDOGS, wdog_conf); + default: #ifdef NETBSD32_MD_IOCTL error = netbsd32_md_ioctl(fp, com, data32, l); Index: src/sys/compat/netbsd32/netbsd32_ioctl.h diff -u src/sys/compat/netbsd32/netbsd32_ioctl.h:1.35 src/sys/compat/netbsd32/netbsd32_ioctl.h:1.36 --- src/sys/compat/netbsd32/netbsd32_ioctl.h:1.35 Mon Apr 4 18:24:56 2011 +++ src/sys/compat/netbsd32/netbsd32_ioctl.h Sat Aug 27 19:25:35 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: netbsd32_ioctl.h,v 1.35 2011/04/04 18:24:56 ahoka Exp $ */ +/* $NetBSD: netbsd32_ioctl.h,v 1.36 2011/08/27 19:25:35 bouyer Exp $ */ /* * Copyright (c) 1998, 2001 Matthew R. Green @@ -392,3 +392,10 @@ #define ENVSYS_GETDICTIONARY32 _IOWR('E', 0, struct netbsd32_plistref) #define ENVSYS_SETDICTIONARY32 _IOWR('E', 1, struct netbsd32_plistref) #define ENVSYS_REMOVEPROPS32 _IOWR('E', 2, struct netbsd32_plistref) + +/* from sys/wdog.h */ +struct netbsd32_wdog_conf { + netbsd32_charp wc_names; + int wc_count; +}; +#define WDOGIOC_GWDOGS32 _IOWR('w', 5, struct netbsd32_wdog_conf)
CVS commit: src/sys/kern
Module Name:src Committed By: martin Date: Sat Aug 27 19:52:22 UTC 2011 Modified Files: src/sys/kern: subr_autoconf.c Log Message: Enhance a panic message slightly To generate a diff of this commit: cvs rdiff -u -r1.218 -r1.219 src/sys/kern/subr_autoconf.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/kern/subr_autoconf.c diff -u src/sys/kern/subr_autoconf.c:1.218 src/sys/kern/subr_autoconf.c:1.219 --- src/sys/kern/subr_autoconf.c:1.218 Tue Aug 9 21:07:14 2011 +++ src/sys/kern/subr_autoconf.c Sat Aug 27 19:52:22 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: subr_autoconf.c,v 1.218 2011/08/09 21:07:14 dyoung Exp $ */ +/* $NetBSD: subr_autoconf.c,v 1.219 2011/08/27 19:52:22 martin Exp $ */ /* * Copyright (c) 1996, 2000 Christopher G. Demetriou @@ -77,7 +77,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: subr_autoconf.c,v 1.218 2011/08/09 21:07:14 dyoung Exp $); +__KERNEL_RCSID(0, $NetBSD: subr_autoconf.c,v 1.219 2011/08/27 19:52:22 martin Exp $); #ifdef _KERNEL_OPT #include opt_ddb.h @@ -1314,7 +1314,8 @@ if ((ca-ca_flags DVF_PRIV_ALLOC) == 0 ca-ca_devsize sizeof(struct device)) - panic(config_devalloc: %s, cf-cf_atname); + panic(config_devalloc: %s (%zu %zu), cf-cf_atname, + ca-ca_devsize, sizeof(struct device)); /* get memory for all device vars */ KASSERT((ca-ca_flags DVF_PRIV_ALLOC) || ca-ca_devsize = sizeof(struct device));
CVS commit: src/sys/dev/pci
Module Name:src Committed By: martin Date: Sat Aug 27 20:02:18 UTC 2011 Modified Files: src/sys/dev/pci: igsfb_pci.c Log Message: I suppose mrg did mean to include this change in yesterday commit: use CFATTACH_DECL_NEW for real. To generate a diff of this commit: cvs rdiff -u -r1.21 -r1.22 src/sys/dev/pci/igsfb_pci.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/pci/igsfb_pci.c diff -u src/sys/dev/pci/igsfb_pci.c:1.21 src/sys/dev/pci/igsfb_pci.c:1.22 --- src/sys/dev/pci/igsfb_pci.c:1.21 Tue Jul 26 08:59:37 2011 +++ src/sys/dev/pci/igsfb_pci.c Sat Aug 27 20:02:18 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: igsfb_pci.c,v 1.21 2011/07/26 08:59:37 mrg Exp $ */ +/* $NetBSD: igsfb_pci.c,v 1.22 2011/08/27 20:02:18 martin Exp $ */ /* * Copyright (c) 2002, 2003 Valeriy E. Ushakov @@ -31,7 +31,7 @@ * Integraphics Systems IGA 168x and CyberPro series. */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: igsfb_pci.c,v 1.21 2011/07/26 08:59:37 mrg Exp $); +__KERNEL_RCSID(0, $NetBSD: igsfb_pci.c,v 1.22 2011/08/27 20:02:18 martin Exp $); #include sys/param.h #include sys/systm.h @@ -75,7 +75,7 @@ static int igsfb_pci_match(device_t, cfdata_t, void *); static void igsfb_pci_attach(device_t, device_t, void *); -CFATTACH_DECL(igsfb_pci, sizeof(struct igsfb_softc), +CFATTACH_DECL_NEW(igsfb_pci, sizeof(struct igsfb_softc), igsfb_pci_match, igsfb_pci_attach, NULL, NULL);
CVS commit: src/sbin/fdisk
Module Name:src Committed By: christos Date: Sat Aug 27 20:49:03 UTC 2011 Modified Files: src/sbin/fdisk: fdisk.c Log Message: one static is enough, otherwise you risk zapping yourself. To generate a diff of this commit: cvs rdiff -u -r1.132 -r1.133 src/sbin/fdisk/fdisk.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sbin/fdisk/fdisk.c diff -u src/sbin/fdisk/fdisk.c:1.132 src/sbin/fdisk/fdisk.c:1.133 --- src/sbin/fdisk/fdisk.c:1.132 Sat Aug 27 13:16:01 2011 +++ src/sbin/fdisk/fdisk.c Sat Aug 27 16:49:03 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: fdisk.c,v 1.132 2011/08/27 17:16:01 joerg Exp $ */ +/* $NetBSD: fdisk.c,v 1.133 2011/08/27 20:49:03 christos Exp $ */ /* * Mach Operating System @@ -39,7 +39,7 @@ #include sys/cdefs.h #ifndef lint -__RCSID($NetBSD: fdisk.c,v 1.132 2011/08/27 17:16:01 joerg Exp $); +__RCSID($NetBSD: fdisk.c,v 1.133 2011/08/27 20:49:03 christos Exp $); #endif /* not lint */ #define MBRPTYPENAMES @@ -267,7 +267,7 @@ static void intuit_translated_geometry(void); static void get_bios_geometry(void); static void get_extended_ptn(void); -static static void get_ptn_alignmemt(void); +static void get_ptn_alignmemt(void); #if defined(USE_DISKLIST) static void get_diskname(const char *, char *, size_t); #endif
CVS commit: src/sys/arch/usermode/dev
Module Name:src Committed By: jmcneill Date: Sat Aug 27 20:49:36 UTC 2011 Modified Files: src/sys/arch/usermode/dev: cpu.c Log Message: CPU_DEBUG: remove printf in cpu_signotify, and print pid/lid in cpu_switchto To generate a diff of this commit: cvs rdiff -u -r1.16 -r1.17 src/sys/arch/usermode/dev/cpu.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/usermode/dev/cpu.c diff -u src/sys/arch/usermode/dev/cpu.c:1.16 src/sys/arch/usermode/dev/cpu.c:1.17 --- src/sys/arch/usermode/dev/cpu.c:1.16 Wed Aug 24 19:55:35 2011 +++ src/sys/arch/usermode/dev/cpu.c Sat Aug 27 20:49:36 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: cpu.c,v 1.16 2011/08/24 19:55:35 jmcneill Exp $ */ +/* $NetBSD: cpu.c,v 1.17 2011/08/27 20:49:36 jmcneill Exp $ */ /*- * Copyright (c) 2007 Jared D. McNeill jmcne...@invisible.ca @@ -27,7 +27,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: cpu.c,v 1.16 2011/08/24 19:55:35 jmcneill Exp $); +__KERNEL_RCSID(0, $NetBSD: cpu.c,v 1.17 2011/08/27 20:49:36 jmcneill Exp $); #include sys/param.h #include sys/conf.h @@ -156,9 +156,13 @@ struct cpu_info *ci = curcpu(); #ifdef CPU_DEBUG - printf(cpu_switchto [%s] - [%s]\n, + printf(cpu_switchto [%s,pid=%d,lid=%d] - [%s,pid=%d,lid=%d]\n, oldlwp ? oldlwp-l_name : none, - newlwp ? newlwp-l_name : none); + oldlwp ? oldlwp-l_proc-p_pid : -1, + oldlwp ? oldlwp-l_lid : -1, + newlwp ? newlwp-l_name : none, + newlwp ? newlwp-l_proc-p_pid : -1, + newlwp ? newlwp-l_lid : -1); if (oldpcb) { printf(oldpcb uc_link=%p, uc_stack.ss_sp=%p, uc_stack.ss_size=%d\n, @@ -202,9 +206,6 @@ void cpu_signotify(struct lwp *l) { -#ifdef CPU_DEBUG - printf(cpu_signotify\n); -#endif } void
CVS commit: src/sys/arch/usermode
Module Name:src Committed By: reinoud Date: Sat Aug 27 21:14:15 UTC 2011 Modified Files: src/sys/arch/usermode/include: thunk.h src/sys/arch/usermode/usermode: thunk.c Log Message: Add a thunk_atexit() so ucontext() ends can be dealt with as they should To generate a diff of this commit: cvs rdiff -u -r1.17 -r1.18 src/sys/arch/usermode/include/thunk.h cvs rdiff -u -r1.19 -r1.20 src/sys/arch/usermode/usermode/thunk.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/usermode/include/thunk.h diff -u src/sys/arch/usermode/include/thunk.h:1.17 src/sys/arch/usermode/include/thunk.h:1.18 --- src/sys/arch/usermode/include/thunk.h:1.17 Thu Aug 25 11:06:29 2011 +++ src/sys/arch/usermode/include/thunk.h Sat Aug 27 21:14:15 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: thunk.h,v 1.17 2011/08/25 11:06:29 jmcneill Exp $ */ +/* $NetBSD: thunk.h,v 1.18 2011/08/27 21:14:15 reinoud Exp $ */ /*- * Copyright (c) 2011 Jared D. McNeill jmcne...@invisible.ca @@ -77,6 +77,7 @@ int thunk_sigaction(int, const struct sigaction *, struct sigaction *); void thunk_signal(int, void (*)(int)); +int thunk_atexit(void (*function)(void)); int thunk_aio_read(struct aiocb *); int thunk_aio_write(struct aiocb *); Index: src/sys/arch/usermode/usermode/thunk.c diff -u src/sys/arch/usermode/usermode/thunk.c:1.19 src/sys/arch/usermode/usermode/thunk.c:1.20 --- src/sys/arch/usermode/usermode/thunk.c:1.19 Thu Aug 25 11:06:29 2011 +++ src/sys/arch/usermode/usermode/thunk.c Sat Aug 27 21:14:15 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: thunk.c,v 1.19 2011/08/25 11:06:29 jmcneill Exp $ */ +/* $NetBSD: thunk.c,v 1.20 2011/08/27 21:14:15 reinoud Exp $ */ /*- * Copyright (c) 2011 Jared D. McNeill jmcne...@invisible.ca @@ -27,7 +27,7 @@ */ #include sys/cdefs.h -__RCSID($NetBSD: thunk.c,v 1.19 2011/08/25 11:06:29 jmcneill Exp $); +__RCSID($NetBSD: thunk.c,v 1.20 2011/08/27 21:14:15 reinoud Exp $); #include sys/types.h #include sys/ansi.h @@ -265,6 +265,12 @@ } int +thunk_atexit(void (*function)(void)) +{ + return atexit(function); +} + +int thunk_aio_read(struct aiocb *aiocbp) { return aio_read(aiocbp);
CVS commit: src/sys/arch/usermode/dev
Module Name:src Committed By: reinoud Date: Sat Aug 27 21:15:07 UTC 2011 Modified Files: src/sys/arch/usermode/dev: cpu.c Log Message: Print when the cpu_trampoline is called() To generate a diff of this commit: cvs rdiff -u -r1.17 -r1.18 src/sys/arch/usermode/dev/cpu.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/usermode/dev/cpu.c diff -u src/sys/arch/usermode/dev/cpu.c:1.17 src/sys/arch/usermode/dev/cpu.c:1.18 --- src/sys/arch/usermode/dev/cpu.c:1.17 Sat Aug 27 20:49:36 2011 +++ src/sys/arch/usermode/dev/cpu.c Sat Aug 27 21:15:07 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: cpu.c,v 1.17 2011/08/27 20:49:36 jmcneill Exp $ */ +/* $NetBSD: cpu.c,v 1.18 2011/08/27 21:15:07 reinoud Exp $ */ /*- * Copyright (c) 2007 Jared D. McNeill jmcne...@invisible.ca @@ -27,7 +27,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: cpu.c,v 1.17 2011/08/27 20:49:36 jmcneill Exp $); +__KERNEL_RCSID(0, $NetBSD: cpu.c,v 1.18 2011/08/27 21:15:07 reinoud Exp $); #include sys/param.h #include sys/conf.h @@ -50,7 +50,7 @@ #include uvm/uvm_extern.h #include uvm/uvm_page.h -/* #define CPU_DEBUG */ +#define CPU_DEBUG static int cpu_match(device_t, cfdata_t, void *); static void cpu_attach(device_t, device_t, void *); @@ -269,6 +269,9 @@ static void cpu_lwp_trampoline(void (*func)(void *), void *arg) { +#ifdef CPU_DEBUG + printf(cpu_lwp_trampoline called with func %p, arg %p\n, (void *) func, arg); +#endif lwp_startup(curcpu()-ci_stash, curlwp); func(arg);
CVS commit: src/sys/arch/usermode/usermode
Module Name:src Committed By: reinoud Date: Sat Aug 27 21:16:15 UTC 2011 Modified Files: src/sys/arch/usermode/usermode: machdep.c Log Message: Print when retregs() is called. To generate a diff of this commit: cvs rdiff -u -r1.15 -r1.16 src/sys/arch/usermode/usermode/machdep.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/usermode/usermode/machdep.c diff -u src/sys/arch/usermode/usermode/machdep.c:1.15 src/sys/arch/usermode/usermode/machdep.c:1.16 --- src/sys/arch/usermode/usermode/machdep.c:1.15 Thu Aug 25 11:06:29 2011 +++ src/sys/arch/usermode/usermode/machdep.c Sat Aug 27 21:16:15 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: machdep.c,v 1.15 2011/08/25 11:06:29 jmcneill Exp $ */ +/* $NetBSD: machdep.c,v 1.16 2011/08/27 21:16:15 reinoud Exp $ */ /*- * Copyright (c) 2007 Jared D. McNeill jmcne...@invisible.ca @@ -27,7 +27,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: machdep.c,v 1.15 2011/08/25 11:06:29 jmcneill Exp $); +__KERNEL_RCSID(0, $NetBSD: machdep.c,v 1.16 2011/08/27 21:16:15 reinoud Exp $); #include sys/types.h #include sys/param.h @@ -134,6 +134,7 @@ void setregs(struct lwp *l, struct exec_package *pack, vaddr_t stack) { +printf(setregs called: lwp %p, exec package %p, stack %p\n, l, pack, (void *) stack); } void
CVS commit: src/sys/arch/usermode/usermode
Module Name:src Committed By: reinoud Date: Sat Aug 27 21:17:27 UTC 2011 Modified Files: src/sys/arch/usermode/usermode: syscall.c Log Message: Add dirty copy of child_return() To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/sys/arch/usermode/usermode/syscall.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/usermode/usermode/syscall.c diff -u src/sys/arch/usermode/usermode/syscall.c:1.2 src/sys/arch/usermode/usermode/syscall.c:1.3 --- src/sys/arch/usermode/usermode/syscall.c:1.2 Wed Oct 21 16:07:00 2009 +++ src/sys/arch/usermode/usermode/syscall.c Sat Aug 27 21:17:26 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: syscall.c,v 1.2 2009/10/21 16:07:00 snj Exp $ */ +/* $NetBSD: syscall.c,v 1.3 2011/08/27 21:17:26 reinoud Exp $ */ /*- * Copyright (c) 2007 Jared D. McNeill jmcne...@invisible.ca @@ -27,21 +27,37 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: syscall.c,v 1.2 2009/10/21 16:07:00 snj Exp $); +__KERNEL_RCSID(0, $NetBSD: syscall.c,v 1.3 2011/08/27 21:17:26 reinoud Exp $); #include sys/types.h #include sys/param.h #include sys/systm.h #include sys/proc.h +#include sys/lwp.h +#include sys/sched.h +#include sys/userret.h +#include machine/pcb.h void syscall(void); void child_return(void *arg) { +printf(child returned! arg %p\n, arg); +printf(xxx now what? switch to `userland' i.e. new code?\n); + lwp_t *l = arg; +// struct pcb *pcb = lwp_getpcb(l); +// struct trapframe *frame = pcb-pcb_tf; + +/* XXX? */ + //frame-tf_r0 = 0; + + mi_userret(l); +// ktrsysret(SYS_fork, 0, 0); } void syscall(void) { +printf(syscall called !\n); }
CVS commit: src/sys/arch/usermode/usermode
Module Name:src Committed By: reinoud Date: Sat Aug 27 21:19:18 UTC 2011 Modified Files: src/sys/arch/usermode/usermode: trap.c Log Message: Catch the atexit() so we can bypass the libc feature that if one ucontext() ends that it then call exit() To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.8 src/sys/arch/usermode/usermode/trap.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/usermode/usermode/trap.c diff -u src/sys/arch/usermode/usermode/trap.c:1.7 src/sys/arch/usermode/usermode/trap.c:1.8 --- src/sys/arch/usermode/usermode/trap.c:1.7 Sat Aug 27 18:01:37 2011 +++ src/sys/arch/usermode/usermode/trap.c Sat Aug 27 21:19:17 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: trap.c,v 1.7 2011/08/27 18:01:37 reinoud Exp $ */ +/* $NetBSD: trap.c,v 1.8 2011/08/27 21:19:17 reinoud Exp $ */ /*- * Copyright (c) 2011 Reinoud Zandijk rein...@netbsd.org @@ -27,12 +27,14 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: trap.c,v 1.7 2011/08/27 18:01:37 reinoud Exp $); +__KERNEL_RCSID(0, $NetBSD: trap.c,v 1.8 2011/08/27 21:19:17 reinoud Exp $); #include sys/types.h #include sys/param.h #include sys/systm.h #include sys/proc.h +#include sys/systm.h +#include sys/userret.h #include uvm/uvm_extern.h #include machine/cpu.h //#include machine/ctlreg.h @@ -46,6 +48,8 @@ void setup_signal_handlers(void); static void mem_access_handler(int sig, siginfo_t *info, void *ctx); +static void exit_func(void); + static struct sigaction sa; extern int errno; @@ -53,7 +57,14 @@ void startlwp(void *arg) { +} +static void +exit_func(void) +{ + if (panicstr == NULL) + child_return(curlwp); + panic(atexit() with panic `%s`, panicstr); } void @@ -66,6 +77,8 @@ panic(couldn't register SIGSEGV handler : %d, errno); if (thunk_sigaction(SIGBUS, sa, NULL) == -1) panic(couldn't register SIGBUS handler : %d, errno); + if (thunk_atexit(exit_func)) + panic(couldn't register atexit() handler : %d, errno); } static struct trapframe kernel_tf;
CVS commit: src/sys/arch/usermode
Module Name:src Committed By: jmcneill Date: Sat Aug 27 21:43:06 UTC 2011 Modified Files: src/sys/arch/usermode/conf: files.usermode src/sys/arch/usermode/dev: cpu.c Log Message: defflag CPU_DEBUG To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/sys/arch/usermode/conf/files.usermode cvs rdiff -u -r1.18 -r1.19 src/sys/arch/usermode/dev/cpu.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/usermode/conf/files.usermode diff -u src/sys/arch/usermode/conf/files.usermode:1.6 src/sys/arch/usermode/conf/files.usermode:1.7 --- src/sys/arch/usermode/conf/files.usermode:1.6 Thu Aug 25 11:06:29 2011 +++ src/sys/arch/usermode/conf/files.usermode Sat Aug 27 21:43:06 2011 @@ -1,10 +1,11 @@ -# $NetBSD: files.usermode,v 1.6 2011/08/25 11:06:29 jmcneill Exp $ +# $NetBSD: files.usermode,v 1.7 2011/08/27 21:43:06 jmcneill Exp $ maxpartitions 8 maxusers 8 16 64 defparam opt_memsize.hMEMSIZE defflag opt_sdl.hSDL +defflag opt_cpu.hCPU_DEBUG define thunkbus { } Index: src/sys/arch/usermode/dev/cpu.c diff -u src/sys/arch/usermode/dev/cpu.c:1.18 src/sys/arch/usermode/dev/cpu.c:1.19 --- src/sys/arch/usermode/dev/cpu.c:1.18 Sat Aug 27 21:15:07 2011 +++ src/sys/arch/usermode/dev/cpu.c Sat Aug 27 21:43:06 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: cpu.c,v 1.18 2011/08/27 21:15:07 reinoud Exp $ */ +/* $NetBSD: cpu.c,v 1.19 2011/08/27 21:43:06 jmcneill Exp $ */ /*- * Copyright (c) 2007 Jared D. McNeill jmcne...@invisible.ca @@ -26,8 +26,10 @@ * POSSIBILITY OF SUCH DAMAGE. */ +#include opt_cpu.h + #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: cpu.c,v 1.18 2011/08/27 21:15:07 reinoud Exp $); +__KERNEL_RCSID(0, $NetBSD: cpu.c,v 1.19 2011/08/27 21:43:06 jmcneill Exp $); #include sys/param.h #include sys/conf.h @@ -50,8 +52,6 @@ #include uvm/uvm_extern.h #include uvm/uvm_page.h -#define CPU_DEBUG - static int cpu_match(device_t, cfdata_t, void *); static void cpu_attach(device_t, device_t, void *);
CVS commit: src/usr.sbin/btattach
Module Name:src Committed By: joerg Date: Sat Aug 27 22:17:53 UTC 2011 Modified Files: src/usr.sbin/btattach: btattach.c Log Message: Mark types as static and usage as dead. To generate a diff of this commit: cvs rdiff -u -r1.11 -r1.12 src/usr.sbin/btattach/btattach.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/btattach/btattach.c diff -u src/usr.sbin/btattach/btattach.c:1.11 src/usr.sbin/btattach/btattach.c:1.12 --- src/usr.sbin/btattach/btattach.c:1.11 Tue Mar 9 02:01:51 2010 +++ src/usr.sbin/btattach/btattach.c Sat Aug 27 22:17:53 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: btattach.c,v 1.11 2010/03/09 02:01:51 kiyohara Exp $ */ +/* $NetBSD: btattach.c,v 1.12 2011/08/27 22:17:53 joerg Exp $ */ /*- * Copyright (c) 2008 Iain Hibbert @@ -27,7 +27,7 @@ #include sys/cdefs.h __COPYRIGHT(@(#) Copyright (c) 2008 Iain Hibbert. All rights reserved.); -__RCSID($NetBSD: btattach.c,v 1.11 2010/03/09 02:01:51 kiyohara Exp $); +__RCSID($NetBSD: btattach.c,v 1.12 2011/08/27 22:17:53 joerg Exp $); #include sys/ioctl.h #include sys/param.h @@ -47,13 +47,13 @@ #include btattach.h static void sighandler(int); -static void usage(void); +__dead static void usage(void); static void test(const char *, tcflag_t, tcflag_t); static int sigcount = 0; /* signals received */ static int opt_debug = 0; /* global? */ -const struct devtype types[] = { +static const struct devtype types[] = { { .name = bcm2035, .line = btuart,
CVS commit: src/usr.sbin/btconfig
Module Name:src Committed By: joerg Date: Sat Aug 27 22:22:01 UTC 2011 Modified Files: src/usr.sbin/btconfig: btconfig.c Log Message: static + __dead To generate a diff of this commit: cvs rdiff -u -r1.24 -r1.25 src/usr.sbin/btconfig/btconfig.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/btconfig/btconfig.c diff -u src/usr.sbin/btconfig/btconfig.c:1.24 src/usr.sbin/btconfig/btconfig.c:1.25 --- src/usr.sbin/btconfig/btconfig.c:1.24 Sun Nov 28 20:37:24 2010 +++ src/usr.sbin/btconfig/btconfig.c Sat Aug 27 22:22:01 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: btconfig.c,v 1.24 2010/11/28 20:37:24 plunky Exp $ */ +/* $NetBSD: btconfig.c,v 1.25 2011/08/27 22:22:01 joerg Exp $ */ /*- * Copyright (c) 2006 Itronix Inc. @@ -33,7 +33,7 @@ #include sys/cdefs.h __COPYRIGHT(@(#) Copyright (c) 2006 Itronix, Inc. All rights reserved.); -__RCSID($NetBSD: btconfig.c,v 1.24 2010/11/28 20:37:24 plunky Exp $); +__RCSID($NetBSD: btconfig.c,v 1.25 2011/08/27 22:22:01 joerg Exp $); #include sys/ioctl.h #include sys/param.h @@ -49,47 +49,46 @@ #include unistd.h #include util.h -int main(int, char *[]); -void badarg(const char *); -void badparam(const char *); -void badval(const char *, const char *); -void usage(void); -int set_unit(unsigned long); -void config_unit(void); -void print_val(const char *, const char **, int); -void print_info(int); -void print_stats(void); -void print_class(const char *, uint8_t *); -void print_class0(void); -void print_voice(int); -void tag(const char *); -void print_features0(uint8_t *); -void print_features1(uint8_t *); -void print_result(int, struct bt_devinquiry *); -void do_inquiry(void); - -void hci_req(uint16_t, uint8_t , void *, size_t, void *, size_t); -void save_value(uint16_t, void *, size_t); -void load_value(uint16_t, void *, size_t); +__dead static void badarg(const char *); +__dead static void badparam(const char *); +__dead static void badval(const char *, const char *); +__dead static void usage(void); +static int set_unit(unsigned long); +static void config_unit(void); +static void print_val(const char *, const char **, int); +static void print_info(int); +static void print_stats(void); +static void print_class(const char *, uint8_t *); +static void print_class0(void); +static void print_voice(int); +static void tag(const char *); +static void print_features0(uint8_t *); +static void print_features1(uint8_t *); +static void print_result(int, struct bt_devinquiry *); +static void do_inquiry(void); + +static void hci_req(uint16_t, uint8_t , void *, size_t, void *, size_t); +static void save_value(uint16_t, void *, size_t); +static void load_value(uint16_t, void *, size_t); #define MAX_STR_SIZE 0xff /* print width */ -int width = 0; +static int width = 0; #define MAX_WIDTH 70 /* global variables */ -int hci; -struct btreq btr; +static int hci; +static struct btreq btr; /* command line flags */ -int verbose = 0; /* more info */ -int lflag = 0; /* list devices */ -int sflag = 0; /* get/zero stats */ +static int verbose = 0; /* more info */ +static int lflag = 0; /* list devices */ +static int sflag = 0; /* get/zero stats */ /* device up/down (flag) */ -int opt_enable = 0; -int opt_reset = 0; +static int opt_enable = 0; +static int opt_reset = 0; #define FLAGS_FMT \20 \ \001UP \ \002RUNNING \ @@ -105,60 +104,60 @@ /* authorisation (flag) */ -int opt_auth = 0; +static int opt_auth = 0; /* encryption (flag) */ -int opt_encrypt = 0; +static int opt_encrypt = 0; /* scan enable options (flags) */ -int opt_pscan = 0; -int opt_iscan = 0; +static int opt_pscan = 0; +static int opt_iscan = 0; /* master role option */ -int opt_master = 0; +static int opt_master = 0; /* link policy options (flags) */ -int opt_switch = 0; -int opt_hold = 0; -int opt_sniff = 0; -int opt_park = 0; +static int opt_switch = 0; +static int opt_hold = 0; +static int opt_sniff = 0; +static int opt_park = 0; /* class of device (hex value) */ -int opt_class = 0; -uint32_t class; +static int opt_class = 0; +static uint32_t class; /* packet type mask (hex value) */ -int opt_ptype = 0; -uint32_t ptype; +static int opt_ptype = 0; +static uint32_t ptype; /* unit name (string) */ -int opt_name = 0; -char name[MAX_STR_SIZE]; +static int opt_name = 0; +static char name[MAX_STR_SIZE]; /* pin type */ -int opt_pin = 0; +static int opt_pin = 0; /* Inquiry */ -int opt_rssi = 0; /* inquiry_with_rssi (obsolete flag) */ -int opt_imode = 0; /* inquiry mode */ -int opt_inquiry = 0; +static int opt_rssi = 0; /* inquiry_with_rssi (obsolete flag) */ +static int opt_imode = 0; /* inquiry mode */ +static int opt_inquiry = 0; #define INQUIRY_LENGTH 10 /* seconds */ #define INQUIRY_MAX_RESPONSES 10 -const char *imodes[] = { std, rssi, ext, NULL }; +static const char *imodes[] = { std, rssi, ext, NULL }; /* Voice Settings */ -int
CVS commit: src/usr.sbin/btdevctl
Module Name:src Committed By: joerg Date: Sat Aug 27 22:24:14 UTC 2011 Modified Files: src/usr.sbin/btdevctl: btdevctl.c Log Message: static + __dead To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.10 src/usr.sbin/btdevctl/btdevctl.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/btdevctl/btdevctl.c diff -u src/usr.sbin/btdevctl/btdevctl.c:1.9 src/usr.sbin/btdevctl/btdevctl.c:1.10 --- src/usr.sbin/btdevctl/btdevctl.c:1.9 Sun Mar 20 19:46:13 2011 +++ src/usr.sbin/btdevctl/btdevctl.c Sat Aug 27 22:24:14 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: btdevctl.c,v 1.9 2011/03/20 19:46:13 plunky Exp $ */ +/* $NetBSD: btdevctl.c,v 1.10 2011/08/27 22:24:14 joerg Exp $ */ /*- * Copyright (c) 2006 Itronix Inc. @@ -35,7 +35,7 @@ __COPYRIGHT(@(#) Copyright (c) 2006 The NetBSD Foundation, Inc.\ @(#) Copyright (c) 2006 Itronix, Inc.\ All rights reserved.); -__RCSID($NetBSD: btdevctl.c,v 1.9 2011/03/20 19:46:13 plunky Exp $); +__RCSID($NetBSD: btdevctl.c,v 1.10 2011/08/27 22:24:14 joerg Exp $); #include prop/proplib.h #include sys/ioctl.h @@ -54,10 +54,9 @@ #define BTHUB_PATH /dev/bthub -int main(int, char *[]); -void usage(void); -char *uppercase(const char *); -int bthub_pioctl(unsigned long, prop_dictionary_t); +__dead static void usage(void); +static char *uppercase(const char *); +static int bthub_pioctl(unsigned long, prop_dictionary_t); int main(int argc, char *argv[]) @@ -211,7 +210,7 @@ exit(EXIT_SUCCESS); } -void +static void usage(void) { @@ -231,7 +230,7 @@ exit(EXIT_FAILURE); } -char * +static char * uppercase(const char *arg) { char *str, *ptr; @@ -246,7 +245,7 @@ return str; } -int +static int bthub_pioctl(unsigned long cmd, prop_dictionary_t dict) { int fd;
CVS commit: src/usr.sbin/bthcid
Module Name:src Committed By: joerg Date: Sat Aug 27 22:26:05 UTC 2011 Modified Files: src/usr.sbin/bthcid: bthcid.c Log Message: static + __dead To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/usr.sbin/bthcid/bthcid.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/bthcid/bthcid.c diff -u src/usr.sbin/bthcid/bthcid.c:1.5 src/usr.sbin/bthcid/bthcid.c:1.6 --- src/usr.sbin/bthcid/bthcid.c:1.5 Mon Oct 5 12:34:26 2009 +++ src/usr.sbin/bthcid/bthcid.c Sat Aug 27 22:26:05 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: bthcid.c,v 1.5 2009/10/05 12:34:26 plunky Exp $ */ +/* $NetBSD: bthcid.c,v 1.6 2011/08/27 22:26:05 joerg Exp $ */ /*- * Copyright (c) 2006 Itronix Inc. @@ -33,7 +33,7 @@ __COPYRIGHT(@(#) Copyright (c) 2006 Itronix, Inc.\ Copyright (c) 2001-2002 Maksim Yevmenkin m_evmen...@yahoo.com.\ All rights reserved.); -__RCSID($NetBSD: bthcid.c,v 1.5 2009/10/05 12:34:26 plunky Exp $); +__RCSID($NetBSD: bthcid.c,v 1.6 2011/08/27 22:26:05 joerg Exp $); #include sys/param.h #include sys/stat.h @@ -49,15 +49,15 @@ #include bthcid.h -const char *socket_name = BTHCID_SOCKET_NAME; - int detach = 1; +static const char *socket_name = BTHCID_SOCKET_NAME; +static int detach = 1; static struct event sighup_ev; static struct event sigint_ev; static struct event sigterm_ev; -static void process_signal(int, short, void *); -static void usage(void); +__dead static void process_signal(int, short, void *); +__dead static void usage(void); int main(int argc, char *argv[])
CVS commit: src/usr.sbin/btpand
Module Name:src Committed By: joerg Date: Sat Aug 27 22:30:44 UTC 2011 Modified Files: src/usr.sbin/btpand: bnep.c Log Message: Sprinkle const To generate a diff of this commit: cvs rdiff -u -r1.10 -r1.11 src/usr.sbin/btpand/bnep.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/btpand/bnep.c diff -u src/usr.sbin/btpand/bnep.c:1.10 src/usr.sbin/btpand/bnep.c:1.11 --- src/usr.sbin/btpand/bnep.c:1.10 Tue Feb 8 21:43:45 2011 +++ src/usr.sbin/btpand/bnep.c Sat Aug 27 22:30:44 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: bnep.c,v 1.10 2011/02/08 21:43:45 plunky Exp $ */ +/* $NetBSD: bnep.c,v 1.11 2011/08/27 22:30:44 joerg Exp $ */ /*- * Copyright (c) 2008 Iain Hibbert @@ -26,7 +26,7 @@ */ #include sys/cdefs.h -__RCSID($NetBSD: bnep.c,v 1.10 2011/02/08 21:43:45 plunky Exp $); +__RCSID($NetBSD: bnep.c,v 1.11 2011/08/27 22:30:44 joerg Exp $); #include bluetooth.h #include sdp.h @@ -49,7 +49,7 @@ static bool bnep_pfilter(channel_t *, packet_t *); static bool bnep_mfilter(channel_t *, packet_t *); -static uint8_t NAP_UUID[] = { +static const uint8_t NAP_UUID[] = { 0x00, 0x00, 0x11, 0x16, 0x00, 0x00, 0x10, 0x00, @@ -57,7 +57,7 @@ 0x00, 0x80, 0x5f, 0x9b, 0x34, 0xfb }; -static uint8_t GN_UUID[] = { +static const uint8_t GN_UUID[] = { 0x00, 0x00, 0x11, 0x17, 0x00, 0x00, 0x10, 0x00, @@ -65,7 +65,7 @@ 0x00, 0x80, 0x5f, 0x9b, 0x34, 0xfb, }; -static uint8_t PANU_UUID[] = { +static const uint8_t PANU_UUID[] = { 0x00, 0x00, 0x11, 0x15, 0x00, 0x00, 0x10, 0x00,
CVS commit: src/usr.sbin/chroot
Module Name:src Committed By: joerg Date: Sat Aug 27 22:32:44 UTC 2011 Modified Files: src/usr.sbin/chroot: chroot.c Log Message: Use __dead. Move global variables into function scope. To generate a diff of this commit: cvs rdiff -u -r1.16 -r1.17 src/usr.sbin/chroot/chroot.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/chroot/chroot.c diff -u src/usr.sbin/chroot/chroot.c:1.16 src/usr.sbin/chroot/chroot.c:1.17 --- src/usr.sbin/chroot/chroot.c:1.16 Mon Aug 15 14:43:17 2011 +++ src/usr.sbin/chroot/chroot.c Sat Aug 27 22:32:44 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: chroot.c,v 1.16 2011/08/15 14:43:17 wiz Exp $ */ +/* $NetBSD: chroot.c,v 1.17 2011/08/27 22:32:44 joerg Exp $ */ /* * Copyright (c) 1988, 1993 @@ -39,7 +39,7 @@ #if 0 static char sccsid[] = @(#)chroot.c 8.1 (Berkeley) 6/9/93; #else -__RCSID($NetBSD: chroot.c,v 1.16 2011/08/15 14:43:17 wiz Exp $); +__RCSID($NetBSD: chroot.c,v 1.17 2011/08/27 22:32:44 joerg Exp $); #endif #endif /* not lint */ @@ -56,16 +56,14 @@ #include string.h #include unistd.h -int main(int, char **); -void usage(void) __dead; - -char *user; /* user to switch to before running program */ -char *group; /* group to switch to ... */ -char *grouplist; /* group list to switch to ... */ +static void usage(void) __dead; int main(int argc, char *argv[]) { + char *user; /* user to switch to before running program */ + char *group; /* group to switch to ... */ + char *grouplist; /* group list to switch to ... */ struct group *gp; struct passwd *pw; char *endp, *p; @@ -175,7 +173,7 @@ /* NOTREACHED */ } -void +static void usage(void) {
CVS commit: src/usr.sbin/cpuctl
Module Name:src Committed By: joerg Date: Sat Aug 27 22:38:48 UTC 2011 Modified Files: src/usr.sbin/cpuctl: cpuctl.c Log Message: static + __dead To generate a diff of this commit: cvs rdiff -u -r1.15 -r1.16 src/usr.sbin/cpuctl/cpuctl.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/cpuctl/cpuctl.c diff -u src/usr.sbin/cpuctl/cpuctl.c:1.15 src/usr.sbin/cpuctl/cpuctl.c:1.16 --- src/usr.sbin/cpuctl/cpuctl.c:1.15 Thu Apr 23 01:36:56 2009 +++ src/usr.sbin/cpuctl/cpuctl.c Sat Aug 27 22:38:48 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: cpuctl.c,v 1.15 2009/04/23 01:36:56 lukem Exp $ */ +/* $NetBSD: cpuctl.c,v 1.16 2011/08/27 22:38:48 joerg Exp $ */ /*- * Copyright (c) 2007, 2008, 2009 The NetBSD Foundation, Inc. @@ -31,7 +31,7 @@ #ifndef lint #include sys/cdefs.h -__RCSID($NetBSD: cpuctl.c,v 1.15 2009/04/23 01:36:56 lukem Exp $); +__RCSID($NetBSD: cpuctl.c,v 1.16 2011/08/27 22:38:48 joerg Exp $); #endif /* not lint */ #include sys/param.h @@ -53,18 +53,17 @@ #include cpuctl.h -u_int getcpuid(char **); -int main(int, char **); -void usage(void); - -void cpu_identify(char **); -void cpu_list(char **); -void cpu_offline(char **); -void cpu_online(char **); -void cpu_intr(char **); -void cpu_nointr(char **); +static u_int getcpuid(char **); +__dead static void usage(void); -struct cmdtab { +static void cpu_identify(char **); +static void cpu_list(char **); +static void cpu_offline(char **); +static void cpu_online(char **); +static void cpu_intr(char **); +static void cpu_nointr(char **); + +static struct cmdtab { const char *label; int takesargs; void (*func)(char **); @@ -78,7 +77,7 @@ { NULL, 0, NULL }, }; -int fd; +static int fd; int main(int argc, char **argv) @@ -108,7 +107,7 @@ /* NOTREACHED */ } -void +static void usage(void) { const char *progname = getprogname(); @@ -123,7 +122,7 @@ /* NOTREACHED */ } -void +static void cpu_online(char **argv) { cpustate_t cs; @@ -136,7 +135,7 @@ err(EXIT_FAILURE, IOC_CPU_SETSTATE); } -void +static void cpu_offline(char **argv) { cpustate_t cs; @@ -149,7 +148,7 @@ err(EXIT_FAILURE, IOC_CPU_SETSTATE); } -void +static void cpu_intr(char **argv) { cpustate_t cs; @@ -162,7 +161,7 @@ err(EXIT_FAILURE, IOC_CPU_SETSTATE); } -void +static void cpu_nointr(char **argv) { cpustate_t cs; @@ -180,7 +179,7 @@ } } -void +static void cpu_identify(char **argv) { char name[32]; @@ -211,7 +210,7 @@ identifycpu(name); } -u_int +static u_int getcpuid(char **argv) { char *argp; @@ -229,7 +228,7 @@ return id; } -void +static void cpu_list(char **argv) { const char *state, *intr;
CVS commit: src/usr.sbin/ypset
Module Name:src Committed By: joerg Date: Sat Aug 27 22:41:36 UTC 2011 Modified Files: src/usr.sbin/ypset: ypset.c Log Message: ANSIfy To generate a diff of this commit: cvs rdiff -u -r1.16 -r1.17 src/usr.sbin/ypset/ypset.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/ypset/ypset.c diff -u src/usr.sbin/ypset/ypset.c:1.16 src/usr.sbin/ypset/ypset.c:1.17 --- src/usr.sbin/ypset/ypset.c:1.16 Tue Sep 7 13:20:41 2004 +++ src/usr.sbin/ypset/ypset.c Sat Aug 27 22:41:35 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: ypset.c,v 1.16 2004/09/07 13:20:41 jrf Exp $ */ +/* $NetBSD: ypset.c,v 1.17 2011/08/27 22:41:35 joerg Exp $ */ /* * Copyright (c) 1992, 1993 Theo de Raadt dera...@fsa.ca @@ -28,7 +28,7 @@ #include sys/cdefs.h #ifndef lint -__RCSID($NetBSD: ypset.c,v 1.16 2004/09/07 13:20:41 jrf Exp $); +__RCSID($NetBSD: ypset.c,v 1.17 2011/08/27 22:41:35 joerg Exp $); #endif #include sys/param.h @@ -47,15 +47,12 @@ #include rpcsvc/ypclnt.h #include arpa/inet.h -int main __P((int, char *[])); -static void usage __P((void)); -static void gethostaddr __P((const char *, struct in_addr *)); -static int bind_tohost __P((struct sockaddr_in *, char *, char *)); +__dead static void usage(void); +static void gethostaddr(const char *, struct in_addr *); +static int bind_tohost(struct sockaddr_in *, char *, char *); int -main(argc, argv) - int argc; - char *argv[]; +main(int argc, char *argv[]) { struct sockaddr_in sin; char *domainname; @@ -95,9 +92,7 @@ } static void -gethostaddr(host, ia) - const char *host; - struct in_addr *ia; +gethostaddr(const char *host, struct in_addr *ia) { struct hostent *hp; @@ -112,9 +107,7 @@ } static int -bind_tohost(sin, dom, server) - struct sockaddr_in *sin; - char *dom, *server; +bind_tohost(struct sockaddr_in *sin, char *dom, char *server) { struct ypbind_setdom ypsd; struct timeval tv; @@ -158,7 +151,7 @@ } static void -usage() +usage(void) { (void) fprintf(stderr, usage: %s [-h host ] [-d domain] server\n, getprogname());
CVS commit: src/sys/dev/dm
Module Name:src Committed By: joerg Date: Sat Aug 27 23:31:12 UTC 2011 Modified Files: src/sys/dev/dm: dm_target.c Log Message: Revert last, assertions on undefined variables don't make sense. To generate a diff of this commit: cvs rdiff -u -r1.16 -r1.17 src/sys/dev/dm/dm_target.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/dm/dm_target.c diff -u src/sys/dev/dm/dm_target.c:1.16 src/sys/dev/dm/dm_target.c:1.17 --- src/sys/dev/dm/dm_target.c:1.16 Sat Aug 27 17:06:08 2011 +++ src/sys/dev/dm/dm_target.c Sat Aug 27 23:31:12 2011 @@ -1,4 +1,4 @@ -/*$NetBSD: dm_target.c,v 1.16 2011/08/27 17:06:08 ahoka Exp $ */ +/*$NetBSD: dm_target.c,v 1.17 2011/08/27 23:31:12 joerg Exp $ */ /* * Copyright (c) 2008 The NetBSD Foundation, Inc. @@ -150,16 +150,6 @@ { dm_target_t *dmt; - /* Sanity check for any missing function */ - KASSERT(dmt-init != NULL); - KASSERT(dmt-status != NULL); - KASSERT(dmt-strategy != NULL); - KASSERT(dmt-deps != NULL); - KASSERT(dmt-destroy != NULL); - KASSERT(dmt-upcall != NULL); - KASSERT(dmt-sync != NULL); - KASSERT(dmt-secsize != NULL); - mutex_enter(dm_target_mutex); dmt = dm_target_lookup_name(dm_target-name);
CVS commit: src/games/hack
Module Name:src Committed By: joerg Date: Sat Aug 27 23:42:33 UTC 2011 Modified Files: src/games/hack: extern.h Log Message: Mark error() as dead, so that validation for setclipped works correctly. To generate a diff of this commit: cvs rdiff -u -r1.17 -r1.18 src/games/hack/extern.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/games/hack/extern.h diff -u src/games/hack/extern.h:1.17 src/games/hack/extern.h:1.18 --- src/games/hack/extern.h:1.17 Fri Aug 26 06:18:17 2011 +++ src/games/hack/extern.h Sat Aug 27 23:42:33 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: extern.h,v 1.17 2011/08/26 06:18:17 dholland Exp $ */ +/* $NetBSD: extern.h,v 1.18 2011/08/27 23:42:33 joerg Exp $ */ /*- * Copyright (c) 1997 The NetBSD Foundation, Inc. @@ -449,7 +449,7 @@ void gettty(void); void settty(const char *); void setftty(void); -void error(const char *, ...) __printflike(1, 2); +void error(const char *, ...) __printflike(1, 2) __dead; void getlin(char *); void getret(void); void cgetret(const char *);
CVS commit: src/sys/arch/usermode
Module Name:src Committed By: jmcneill Date: Sun Aug 28 00:40:10 UTC 2011 Modified Files: src/sys/arch/usermode/dev: cpu.c src/sys/arch/usermode/usermode: trap.c Log Message: cpu_lwp_trampoline isn't supposed to return, so drop the atexit handler and drop a panic() at the end of the function To generate a diff of this commit: cvs rdiff -u -r1.19 -r1.20 src/sys/arch/usermode/dev/cpu.c cvs rdiff -u -r1.8 -r1.9 src/sys/arch/usermode/usermode/trap.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/usermode/dev/cpu.c diff -u src/sys/arch/usermode/dev/cpu.c:1.19 src/sys/arch/usermode/dev/cpu.c:1.20 --- src/sys/arch/usermode/dev/cpu.c:1.19 Sat Aug 27 21:43:06 2011 +++ src/sys/arch/usermode/dev/cpu.c Sun Aug 28 00:40:10 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: cpu.c,v 1.19 2011/08/27 21:43:06 jmcneill Exp $ */ +/* $NetBSD: cpu.c,v 1.20 2011/08/28 00:40:10 jmcneill Exp $ */ /*- * Copyright (c) 2007 Jared D. McNeill jmcne...@invisible.ca @@ -29,7 +29,7 @@ #include opt_cpu.h #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: cpu.c,v 1.19 2011/08/27 21:43:06 jmcneill Exp $); +__KERNEL_RCSID(0, $NetBSD: cpu.c,v 1.20 2011/08/28 00:40:10 jmcneill Exp $); #include sys/param.h #include sys/conf.h @@ -275,6 +275,8 @@ lwp_startup(curcpu()-ci_stash, curlwp); func(arg); + + panic(%s: shouldn't return, __func__); } void Index: src/sys/arch/usermode/usermode/trap.c diff -u src/sys/arch/usermode/usermode/trap.c:1.8 src/sys/arch/usermode/usermode/trap.c:1.9 --- src/sys/arch/usermode/usermode/trap.c:1.8 Sat Aug 27 21:19:17 2011 +++ src/sys/arch/usermode/usermode/trap.c Sun Aug 28 00:40:10 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: trap.c,v 1.8 2011/08/27 21:19:17 reinoud Exp $ */ +/* $NetBSD: trap.c,v 1.9 2011/08/28 00:40:10 jmcneill Exp $ */ /*- * Copyright (c) 2011 Reinoud Zandijk rein...@netbsd.org @@ -27,7 +27,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: trap.c,v 1.8 2011/08/27 21:19:17 reinoud Exp $); +__KERNEL_RCSID(0, $NetBSD: trap.c,v 1.9 2011/08/28 00:40:10 jmcneill Exp $); #include sys/types.h #include sys/param.h @@ -48,7 +48,6 @@ void setup_signal_handlers(void); static void mem_access_handler(int sig, siginfo_t *info, void *ctx); -static void exit_func(void); static struct sigaction sa; @@ -59,14 +58,6 @@ { } -static void -exit_func(void) -{ - if (panicstr == NULL) - child_return(curlwp); - panic(atexit() with panic `%s`, panicstr); -} - void setup_signal_handlers(void) { @@ -77,8 +68,6 @@ panic(couldn't register SIGSEGV handler : %d, errno); if (thunk_sigaction(SIGBUS, sa, NULL) == -1) panic(couldn't register SIGBUS handler : %d, errno); - if (thunk_atexit(exit_func)) - panic(couldn't register atexit() handler : %d, errno); } static struct trapframe kernel_tf;
CVS commit: src/sys/arch/x86/x86
Module Name:src Committed By: dyoung Date: Sun Aug 28 00:51:22 UTC 2011 Modified Files: src/sys/arch/x86/x86: pmap.c Log Message: Use __strict_weak_alias(). To generate a diff of this commit: cvs rdiff -u -r1.128 -r1.129 src/sys/arch/x86/x86/pmap.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/x86/x86/pmap.c diff -u src/sys/arch/x86/x86/pmap.c:1.128 src/sys/arch/x86/x86/pmap.c:1.129 --- src/sys/arch/x86/x86/pmap.c:1.128 Sun Aug 14 02:31:08 2011 +++ src/sys/arch/x86/x86/pmap.c Sun Aug 28 00:51:21 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: pmap.c,v 1.128 2011/08/14 02:31:08 rmind Exp $ */ +/* $NetBSD: pmap.c,v 1.129 2011/08/28 00:51:21 dyoung Exp $ */ /*- * Copyright (c) 2008, 2010 The NetBSD Foundation, Inc. @@ -171,7 +171,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: pmap.c,v 1.128 2011/08/14 02:31:08 rmind Exp $); +__KERNEL_RCSID(0, $NetBSD: pmap.c,v 1.129 2011/08/28 00:51:21 dyoung Exp $); #include opt_user_ldt.h #include opt_lockdebug.h @@ -1069,7 +1069,7 @@ } } -__weak_alias(pmap_kenter_ma, pmap_kenter_pa); +__strict_weak_alias(pmap_kenter_ma, pmap_kenter_pa); #if defined(__x86_64__) /* @@ -2882,7 +2882,7 @@ return (0); } -__weak_alias(pmap_extract_ma, pmap_extract); +__strict_weak_alias(pmap_extract_ma, pmap_extract); #ifdef XEN @@ -3780,7 +3780,7 @@ * defined as macro in pmap.h */ -__weak_alias(pmap_enter, pmap_enter_default); +__strict_weak_alias(pmap_enter, pmap_enter_default); int pmap_enter_default(pmap_t pmap, vaddr_t va, paddr_t pa, vm_prot_t prot,
CVS commit: src/usr.bin/audio
Module Name:src Committed By: joerg Date: Sun Aug 28 01:17:48 UTC 2011 Modified Files: src/usr.bin/audio/common: audio.c libaudio.h sun.c wav.c src/usr.bin/audio/ctl: ctl.c src/usr.bin/audio/play: play.c src/usr.bin/audio/record: record.c Log Message: ANSIfy. Add static. Add __dead. To generate a diff of this commit: cvs rdiff -u -r1.19 -r1.20 src/usr.bin/audio/common/audio.c cvs rdiff -u -r1.16 -r1.17 src/usr.bin/audio/common/libaudio.h cvs rdiff -u -r1.6 -r1.7 src/usr.bin/audio/common/sun.c cvs rdiff -u -r1.9 -r1.10 src/usr.bin/audio/common/wav.c cvs rdiff -u -r1.38 -r1.39 src/usr.bin/audio/ctl/ctl.c cvs rdiff -u -r1.53 -r1.54 src/usr.bin/audio/play/play.c cvs rdiff -u -r1.50 -r1.51 src/usr.bin/audio/record/record.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/audio/common/audio.c diff -u src/usr.bin/audio/common/audio.c:1.19 src/usr.bin/audio/common/audio.c:1.20 --- src/usr.bin/audio/common/audio.c:1.19 Thu May 29 14:51:27 2008 +++ src/usr.bin/audio/common/audio.c Sun Aug 28 01:17:47 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: audio.c,v 1.19 2008/05/29 14:51:27 mrg Exp $ */ +/* $NetBSD: audio.c,v 1.20 2011/08/28 01:17:47 joerg Exp $ */ /* * Copyright (c) 1999 Matthew R. Green @@ -32,7 +32,7 @@ #include sys/cdefs.h #ifndef lint -__RCSID($NetBSD: audio.c,v 1.19 2008/05/29 14:51:27 mrg Exp $); +__RCSID($NetBSD: audio.c,v 1.20 2011/08/28 01:17:47 joerg Exp $); #endif @@ -51,7 +51,7 @@ /* what format am i? */ -struct { +static const struct { const char *fname; int fno; } formats[] = { @@ -67,8 +67,7 @@ }; int -audio_format_from_str(str) - char *str; +audio_format_from_str(char *str) { int i; @@ -81,7 +80,7 @@ /* back and forth between encodings */ -struct { +static const struct { const char *ename; int eno; } encs[] = { @@ -110,8 +109,7 @@ const char * -audio_enc_from_val(val) - int val; +audio_enc_from_val(int val) { int i; @@ -122,8 +120,7 @@ } int -audio_enc_to_val(enc) - const char *enc; +audio_enc_to_val(const char *enc) { int i; @@ -137,9 +134,7 @@ } void -decode_int(arg, intp) - const char *arg; - int *intp; +decode_int(const char *arg, int *intp) { char *ep; int ret; @@ -154,9 +149,7 @@ } void -decode_time(arg, tvp) - const char *arg; - struct timeval *tvp; +decode_time(const char *arg, struct timeval *tvp) { char *s, *colon, *dot; char *copy = strdup(arg); @@ -206,9 +199,7 @@ * decode a string into an encoding value. */ void -decode_encoding(arg, encp) - const char *arg; - int *encp; +decode_encoding(const char *arg, int *encp) { size_t len; int i; @@ -222,7 +213,7 @@ errx(1, unknown encoding `%s', arg); } -const char *const audio_errlist[] = { +static const char *const audio_errlist[] = { error zero,/* nothing? */ no audio entry, /* AUDIO_ENOENT */ short header,/* AUDIO_ESHORTHDR */ @@ -233,8 +224,7 @@ }; const char * -audio_errstring(errval) - int errval; +audio_errstring(int errval) { errval = -errval; Index: src/usr.bin/audio/common/libaudio.h diff -u src/usr.bin/audio/common/libaudio.h:1.16 src/usr.bin/audio/common/libaudio.h:1.17 --- src/usr.bin/audio/common/libaudio.h:1.16 Thu Jun 18 02:37:27 2009 +++ src/usr.bin/audio/common/libaudio.h Sun Aug 28 01:17:47 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: libaudio.h,v 1.16 2009/06/18 02:37:27 mrg Exp $ */ +/* $NetBSD: libaudio.h,v 1.17 2011/08/28 01:17:47 joerg Exp $ */ /* * Copyright (c) 1999, 2009 Matthew R. Green @@ -159,6 +159,8 @@ /* returns size of header, or -ve for failure */ ssize_t audio_wav_parse_hdr (void *, size_t, u_int *, u_int *, u_int *, u_int *, size_t *); +extern int verbose; + /* * audio routine error codes */ Index: src/usr.bin/audio/common/sun.c diff -u src/usr.bin/audio/common/sun.c:1.6 src/usr.bin/audio/common/sun.c:1.7 --- src/usr.bin/audio/common/sun.c:1.6 Thu May 29 14:51:27 2008 +++ src/usr.bin/audio/common/sun.c Sun Aug 28 01:17:47 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: sun.c,v 1.6 2008/05/29 14:51:27 mrg Exp $ */ +/* $NetBSD: sun.c,v 1.7 2011/08/28 01:17:47 joerg Exp $ */ /* * Copyright (c) 2002 Matthew R. Green @@ -32,7 +32,7 @@ #include sys/cdefs.h #ifndef lint -__RCSID($NetBSD: sun.c,v 1.6 2008/05/29 14:51:27 mrg Exp $); +__RCSID($NetBSD: sun.c,v 1.7 2011/08/28 01:17:47 joerg Exp $); #endif @@ -52,7 +52,7 @@ /* * SunOS/NeXT .au format helpers */ -struct { +static const struct { int file_encoding; int encoding; int precision; @@ -80,10 +80,7 @@ }; int -audio_sun_to_encoding(sun_encoding, encp, precp) - int sun_encoding; - u_int *encp; - u_int *precp; +audio_sun_to_encoding(int sun_encoding, u_int *encp, u_int *precp) { int i; @@ -97,10 +94,7 @@ } int -audio_encoding_to_sun(encoding, precision, sunep) - int encoding; - int precision; - int *sunep; +audio_encoding_to_sun(int encoding, int precision, int *sunep) {
CVS commit: src/usr.bin/make
Module Name:src Committed By: sjg Date: Sun Aug 28 03:54:07 UTC 2011 Modified Files: src/usr.bin/make: job.c make.1 meta.c Log Message: In meta mode, we create .meta files for most targets. These capture all the interesting data - useful for debugging. In such cases there is no need to replicate commands in the build log. Rather than run the entire build .SILENT, allow meta mode to set that flag per target iff a .meta file is created. Normal behavior is retained for targets where no .meta file is created, ensuring that no build data is lost. To generate a diff of this commit: cvs rdiff -u -r1.158 -r1.159 src/usr.bin/make/job.c cvs rdiff -u -r1.194 -r1.195 src/usr.bin/make/make.1 cvs rdiff -u -r1.21 -r1.22 src/usr.bin/make/meta.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/make/job.c diff -u src/usr.bin/make/job.c:1.158 src/usr.bin/make/job.c:1.159 --- src/usr.bin/make/job.c:1.158 Sun Aug 14 13:06:09 2011 +++ src/usr.bin/make/job.c Sun Aug 28 03:54:07 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: job.c,v 1.158 2011/08/14 13:06:09 christos Exp $ */ +/* $NetBSD: job.c,v 1.159 2011/08/28 03:54:07 sjg Exp $ */ /* * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. @@ -70,14 +70,14 @@ */ #ifndef MAKE_NATIVE -static char rcsid[] = $NetBSD: job.c,v 1.158 2011/08/14 13:06:09 christos Exp $; +static char rcsid[] = $NetBSD: job.c,v 1.159 2011/08/28 03:54:07 sjg Exp $; #else #include sys/cdefs.h #ifndef lint #if 0 static char sccsid[] = @(#)job.c 8.2 (Berkeley) 3/19/94; #else -__RCSID($NetBSD: job.c,v 1.158 2011/08/14 13:06:09 christos Exp $); +__RCSID($NetBSD: job.c,v 1.159 2011/08/28 03:54:07 sjg Exp $); #endif #endif /* not lint */ #endif @@ -1592,6 +1592,9 @@ #ifdef USE_META if (useMeta) { meta_job_start(job, gn); + if (Targ_Silent(gn)) { /* might have changed */ + job-flags |= JOB_SILENT; + } } #endif /* Index: src/usr.bin/make/make.1 diff -u src/usr.bin/make/make.1:1.194 src/usr.bin/make/make.1:1.195 --- src/usr.bin/make/make.1:1.194 Thu Aug 18 15:36:51 2011 +++ src/usr.bin/make/make.1 Sun Aug 28 03:54:07 2011 @@ -1,4 +1,4 @@ -.\ $NetBSD: make.1,v 1.194 2011/08/18 15:36:51 sjg Exp $ +.\ $NetBSD: make.1,v 1.195 2011/08/28 03:54:07 sjg Exp $ .\ .\ Copyright (c) 1990, 1993 .\ The Regents of the University of California. All rights reserved. @@ -29,7 +29,7 @@ .\ .\ from: @(#)make.1 8.4 (Berkeley) 3/19/94 .\ -.Dd August 18, 2011 +.Dd August 28, 2011 .Dt MAKE 1 .Os .Sh NAME @@ -799,6 +799,10 @@ determining whether a target is out of date in meta mode. See also .Ic .NOMETA_CMP . +.It Pa silent= Ar bf +If +.Va bf +is True, when a .meta file is created, mark the target .El .It Va .MAKE.META.BAILIWICK In meta mode, provides a list of prefixes which Index: src/usr.bin/make/meta.c diff -u src/usr.bin/make/meta.c:1.21 src/usr.bin/make/meta.c:1.22 --- src/usr.bin/make/meta.c:1.21 Thu Aug 18 00:00:21 2011 +++ src/usr.bin/make/meta.c Sun Aug 28 03:54:07 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: meta.c,v 1.21 2011/08/18 00:00:21 sjg Exp $ */ +/* $NetBSD: meta.c,v 1.22 2011/08/28 03:54:07 sjg Exp $ */ /* * Implement 'meta' mode. @@ -64,6 +64,7 @@ static Boolean metaVerbose = FALSE; static Boolean metaIgnoreCMDs = FALSE; /* ignore CMDs in .meta files */ static Boolean metaCurdirOk = FALSE; /* write .meta in .CURDIR Ok? */ +static Boolean metaSilent = FALSE; /* if we have a .meta be SILENT */ extern Boolean forceJobs; extern Boolean comatMake; @@ -510,7 +511,11 @@ Var_Append(.MAKE.META.FILES, fname, VAR_GLOBAL); Var_Append(.MAKE.META.CREATED, fname, VAR_GLOBAL); - + +gn-type |= OP_META; /* in case anyone wants to know */ +if (metaSilent) { + gn-type |= OP_SILENT; +} out: for (i--; i = 0; i--) { if (p[i]) @@ -556,6 +561,9 @@ if ((cp = strstr(make_mode, curdirok=))) { metaCurdirOk = boolValue(cp[9]); } + if ((cp = strstr(make_mode, silent=))) { + metaSilent = boolValue(cp[7]); + } if (strstr(make_mode, ignore-cmd)) metaIgnoreCMDs = TRUE; /* for backwards compatability */
CVS commit: src/sys/arch/x86/pci
Module Name:src Committed By: dyoung Date: Sun Aug 28 04:59:37 UTC 2011 Modified Files: src/sys/arch/x86/pci: pci_machdep.c Log Message: Make the override implementation more concise. Saves about three lines of code per routine, makes it more explicit what's going on, and avoids recursion, though the compiler probably optimized the tail recursion in the old code. To generate a diff of this commit: cvs rdiff -u -r1.46 -r1.47 src/sys/arch/x86/pci/pci_machdep.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/x86/pci/pci_machdep.c diff -u src/sys/arch/x86/pci/pci_machdep.c:1.46 src/sys/arch/x86/pci/pci_machdep.c:1.47 --- src/sys/arch/x86/pci/pci_machdep.c:1.46 Sat Aug 27 09:32:11 2011 +++ src/sys/arch/x86/pci/pci_machdep.c Sun Aug 28 04:59:37 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: pci_machdep.c,v 1.46 2011/08/27 09:32:11 christos Exp $ */ +/* $NetBSD: pci_machdep.c,v 1.47 2011/08/28 04:59:37 dyoung Exp $ */ /*- * Copyright (c) 1997, 1998 The NetBSD Foundation, Inc. @@ -73,7 +73,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: pci_machdep.c,v 1.46 2011/08/27 09:32:11 christos Exp $); +__KERNEL_RCSID(0, $NetBSD: pci_machdep.c,v 1.47 2011/08/28 04:59:37 dyoung Exp $); #include sys/types.h #include sys/param.h @@ -418,17 +418,14 @@ pcitag_t pci_make_tag(pci_chipset_tag_t pc, int bus, int device, int function) { + pci_chipset_tag_t ipc; pcitag_t tag; - if (pc != NULL) { - if ((pc-pc_present PCI_OVERRIDE_MAKE_TAG) != 0) { - return (*pc-pc_ov-ov_make_tag)(pc-pc_ctx, - pc, bus, device, function); - } - if (pc-pc_super != NULL) { - return pci_make_tag(pc-pc_super, bus, device, - function); - } + for (ipc = pc; ipc != NULL; ipc = ipc-pc_super) { + if ((ipc-pc_present PCI_OVERRIDE_MAKE_TAG) == 0) + continue; + return (*ipc-pc_ov-ov_make_tag)(ipc-pc_ctx, + pc, bus, device, function); } switch (pci_mode) { @@ -456,17 +453,14 @@ pci_decompose_tag(pci_chipset_tag_t pc, pcitag_t tag, int *bp, int *dp, int *fp) { + pci_chipset_tag_t ipc; - if (pc != NULL) { - if ((pc-pc_present PCI_OVERRIDE_DECOMPOSE_TAG) != 0) { - (*pc-pc_ov-ov_decompose_tag)(pc-pc_ctx, - pc, tag, bp, dp, fp); - return; - } - if (pc-pc_super != NULL) { - pci_decompose_tag(pc-pc_super, tag, bp, dp, fp); - return; - } + for (ipc = pc; ipc != NULL; ipc = ipc-pc_super) { + if ((ipc-pc_present PCI_OVERRIDE_DECOMPOSE_TAG) == 0) + continue; + (*ipc-pc_ov-ov_decompose_tag)(ipc-pc_ctx, + pc, tag, bp, dp, fp); + return; } switch (pci_mode) { @@ -494,18 +488,16 @@ pcireg_t pci_conf_read(pci_chipset_tag_t pc, pcitag_t tag, int reg) { + pci_chipset_tag_t ipc; pcireg_t data; struct pci_conf_lock ocl; KASSERT((reg 0x3) == 0); - if (pc != NULL) { - if ((pc-pc_present PCI_OVERRIDE_CONF_READ) != 0) { - return (*pc-pc_ov-ov_conf_read)(pc-pc_ctx, - pc, tag, reg); - } - if (pc-pc_super != NULL) - return pci_conf_read(pc-pc_super, tag, reg); + for (ipc = pc; ipc != NULL; ipc = ipc-pc_super) { + if ((ipc-pc_present PCI_OVERRIDE_CONF_READ) == 0) + continue; + return (*ipc-pc_ov-ov_conf_read)(ipc-pc_ctx, pc, tag, reg); } #if defined(__i386__) defined(XBOX) @@ -526,20 +518,17 @@ void pci_conf_write(pci_chipset_tag_t pc, pcitag_t tag, int reg, pcireg_t data) { + pci_chipset_tag_t ipc; struct pci_conf_lock ocl; KASSERT((reg 0x3) == 0); - if (pc != NULL) { - if ((pc-pc_present PCI_OVERRIDE_CONF_WRITE) != 0) { - (*pc-pc_ov-ov_conf_write)(pc-pc_ctx, pc, tag, reg, - data); - return; - } - if (pc-pc_super != NULL) { - pci_conf_write(pc-pc_super, tag, reg, data); - return; - } + for (ipc = pc; ipc != NULL; ipc = ipc-pc_super) { + if ((ipc-pc_present PCI_OVERRIDE_CONF_WRITE) == 0) + continue; + (*ipc-pc_ov-ov_conf_write)(ipc-pc_ctx, pc, tag, reg, + data); + return; } #if defined(__i386__) defined(XBOX)
CVS commit: src/sys/arch/x86/pci
Module Name:src Committed By: dyoung Date: Sun Aug 28 05:32:41 UTC 2011 Modified Files: src/sys/arch/x86/pci: pci_addr_fixup.c Log Message: Replace some anonymous constants with PCI_ constants. Print debugging information using aprint_debug(9) not aprint_verbose(9) and be consistent about that. Get rid of the pciaddrverbose switch for debugging printfs. Make 'static' several functions that are private to this module. Don't test truth of arbitrary integers but compare with 0. Change 'return (x)' to 'return x'. To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/sys/arch/x86/pci/pci_addr_fixup.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/x86/pci/pci_addr_fixup.c diff -u src/sys/arch/x86/pci/pci_addr_fixup.c:1.6 src/sys/arch/x86/pci/pci_addr_fixup.c:1.7 --- src/sys/arch/x86/pci/pci_addr_fixup.c:1.6 Fri Jul 1 18:22:08 2011 +++ src/sys/arch/x86/pci/pci_addr_fixup.c Sun Aug 28 05:32:41 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: pci_addr_fixup.c,v 1.6 2011/07/01 18:22:08 dyoung Exp $ */ +/* $NetBSD: pci_addr_fixup.c,v 1.7 2011/08/28 05:32:41 dyoung Exp $ */ /*- * Copyright (c) 2000 UCHIYAMA Yasushi. All rights reserved. @@ -27,7 +27,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: pci_addr_fixup.c,v 1.6 2011/07/01 18:22:08 dyoung Exp $); +__KERNEL_RCSID(0, $NetBSD: pci_addr_fixup.c,v 1.7 2011/08/28 05:32:41 dyoung Exp $); #include sys/param.h #include sys/systm.h @@ -46,17 +46,13 @@ struct pciaddr pciaddr; -static int pciaddrverbose = 0; - -void pciaddr_resource_reserve(pci_chipset_tag_t, pcitag_t, void *context); -int pciaddr_do_resource_reserve(pci_chipset_tag_t, pcitag_t, int, +static void pciaddr_resource_reserve(pci_chipset_tag_t, pcitag_t, void *); +static int pciaddr_do_resource_reserve(pci_chipset_tag_t, pcitag_t, int, void *, int, bus_addr_t *, bus_size_t); -void pciaddr_resource_allocate(pci_chipset_tag_t, pcitag_t, void *context); -int pciaddr_do_resource_allocate(pci_chipset_tag_t, pcitag_t, int, +static void pciaddr_resource_allocate(pci_chipset_tag_t, pcitag_t, void *); +static int pciaddr_do_resource_allocate(pci_chipset_tag_t, pcitag_t, int, void *, int, bus_addr_t *, bus_size_t); -int device_is_agp(pci_chipset_tag_t, pcitag_t); - -int device_is_agp(pci_chipset_tag_t, pcitag_t); +static int device_is_agp(pci_chipset_tag_t, pcitag_t); #define PCIADDR_MEM_START 0x0 #define PCIADDR_MEM_END 0x @@ -147,22 +143,20 @@ } -void +static void pciaddr_resource_reserve(pci_chipset_tag_t pc, pcitag_t tag, void *context) { - if (pciaddrverbose) pciaddr_print_devid(pc, tag); pciaddr_resource_manage(pc, tag, pciaddr_do_resource_reserve, pciaddr); } -void +static void pciaddr_resource_allocate(pci_chipset_tag_t pc, pcitag_t tag, void *context) { - if (pciaddrverbose) pciaddr_print_devid(pc, tag); pciaddr_resource_manage(pc, tag, pciaddr_do_resource_allocate, @@ -184,15 +178,15 @@ aprint_error(WARNING: unknown PCI device header.); pciaddr.nbogus++; return; - case 0: + case PCI_HDRTYPE_DEVICE: reg_start = PCI_MAPREG_START; reg_end = PCI_MAPREG_END; break; - case 1: /* PCI-PCI bridge */ + case PCI_HDRTYPE_PPB: /* PCI-PCI bridge */ reg_start = PCI_MAPREG_START; reg_end = PCI_MAPREG_PPB_END; break; - case 2: /* PCI-CardBus bridge */ + case PCI_HDRTYPE_PCB: /* PCI-CardBus bridge */ reg_start = PCI_MAPREG_START; reg_end = PCI_MAPREG_PCB_END; break; @@ -229,7 +223,7 @@ } addr = pciaddr_ioaddr(val); - if (!size) /* unused register */ + if (size == 0) /* unused register */ continue; if (type == PCI_MAPREG_TYPE_MEM) @@ -255,13 +249,13 @@ PCI_COMMAND_MASTER_ENABLE); pci_conf_write(pc, tag, PCI_COMMAND_STATUS_REG, val); - if (error) + if (error != 0) pciaddr.nbogus++; aprint_debug(\n\t\t[%s]\n, error ? NG : OK); } -int +static int pciaddr_do_resource_allocate(pci_chipset_tag_t pc, pcitag_t tag, int mapreg, void *ctx, int type, bus_addr_t *addr, bus_size_t size) { @@ -270,22 +264,22 @@ int error; struct extent *ex; - if (*addr) /* no need to allocate */ - return (0); + if (*addr != 0) /* no need to allocate */ + return 0; ex = (type == PCI_MAPREG_TYPE_MEM ? pciaddrmap-extent_mem : pciaddrmap-extent_port); /* XXX Don't allocate if device is AGP device to avoid conflict. */ if (device_is_agp(pc, tag)) - return (0); + return 0; start = (type == PCI_MAPREG_TYPE_MEM ? pciaddrmap-mem_alloc_start : pciaddrmap-port_alloc_start); if (start ex-ex_start || start + size - 1 = ex-ex_end) { aprint_debug(No available resources. fixup failed\n); - return (1); + return 1; } error = extent_alloc_subregion(ex, start, ex-ex_end, size, size, 0, @@ -293,26 +287,22 @@ (u_long *)addr); if (error) { aprint_debug(No available