diff options
author | 2013-02-09 20:56:35 +0000 | |
---|---|---|
committer | 2013-02-09 20:56:35 +0000 | |
commit | 5ad789c566927b3d88235dcdddc2fd2abe4e352d (patch) | |
tree | 5cb56143f4dea9bb25004fcb2005b76741dacb75 | |
parent | Grammar, typos (diff) | |
download | wireguard-openbsd-5ad789c566927b3d88235dcdddc2fd2abe4e352d.tar.xz wireguard-openbsd-5ad789c566927b3d88235dcdddc2fd2abe4e352d.zip |
Add explicit __attribute__ ((__format__(__kprintf__)))) to the functions and
function pointer arguments which are {used as,} wrappers around the kernel
printf function.
No functional change.
-rw-r--r-- | sys/dev/acpi/dsdt.c | 5 | ||||
-rw-r--r-- | sys/kern/kern_malloc.c | 11 | ||||
-rw-r--r-- | sys/kern/kern_malloc_debug.c | 5 | ||||
-rw-r--r-- | sys/kern/kern_proc.c | 5 | ||||
-rw-r--r-- | sys/kern/subr_disk.c | 4 | ||||
-rw-r--r-- | sys/kern/subr_extent.c | 8 | ||||
-rw-r--r-- | sys/kern/subr_pool.c | 31 | ||||
-rw-r--r-- | sys/kern/uipc_mbuf.c | 5 | ||||
-rw-r--r-- | sys/kern/vfs_bio.c | 7 | ||||
-rw-r--r-- | sys/kern/vfs_subr.c | 13 | ||||
-rw-r--r-- | sys/sys/systm.h | 8 | ||||
-rw-r--r-- | sys/ufs/ffs/ffs_softdep.c | 8 |
12 files changed, 65 insertions, 45 deletions
diff --git a/sys/dev/acpi/dsdt.c b/sys/dev/acpi/dsdt.c index 8bfc1bb255e..94af4eb24d7 100644 --- a/sys/dev/acpi/dsdt.c +++ b/sys/dev/acpi/dsdt.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dsdt.c,v 1.198 2013/01/18 04:07:06 pirofti Exp $ */ +/* $OpenBSD: dsdt.c,v 1.199 2013/02/09 20:56:35 miod Exp $ */ /* * Copyright (c) 2005 Jordan Hargrave <jordan@openbsd.org> * @@ -2640,7 +2640,8 @@ aml_disprintf(void *arg, const char *fmt, ...) void aml_disasm(struct aml_scope *scope, int lvl, - void (*dbprintf)(void *, const char *, ...), + void (*dbprintf)(void *, const char *, ...) + __attribute__((__format__(__kprintf__,2,3))), void *arg) { int pc, opcode; diff --git a/sys/kern/kern_malloc.c b/sys/kern/kern_malloc.c index bd5ce1f38b6..3873e20c03a 100644 --- a/sys/kern/kern_malloc.c +++ b/sys/kern/kern_malloc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_malloc.c,v 1.92 2012/03/30 23:03:42 pirofti Exp $ */ +/* $OpenBSD: kern_malloc.c,v 1.93 2013/02/09 20:56:35 miod Exp $ */ /* $NetBSD: kern_malloc.c,v 1.15.4.2 1996/06/13 17:10:56 cgd Exp $ */ /* @@ -328,11 +328,11 @@ malloc(unsigned long size, int type, int flags) vm_map_unlock(kmem_map); if (!rv) { - printf("%s %d of object %p size 0x%lx %s %s" + printf("%s %zd of object %p size 0x%lx %s %s" " (invalid addr %p)\n", "Data modified on freelist: word", (int32_t *)&kbp->kb_next - (int32_t *)kbp, va, size, - "previous type", savedtype, addr); + "previous type", savedtype, (void *)addr); kbp->kb_next = NULL; } } @@ -355,7 +355,7 @@ malloc(unsigned long size, int type, int flags) for (lp = (int32_t *)va; lp < end; lp++) { if (*lp == WEIRD_ADDR) continue; - printf("%s %d of object %p size 0x%lx %s %s" + printf("%s %zd of object %p size 0x%lx %s %s" " (0x%x != 0x%x)\n", "Data modified on freelist: word", lp - (int32_t *)va, va, size, @@ -710,7 +710,8 @@ malloc_roundup(size_t sz) #include <ddb/db_output.h> void -malloc_printit(int (*pr)(const char *, ...)) +malloc_printit( + int (*pr)(const char *, ...) __attribute__((__format__(__kprintf__,1,2)))) { #ifdef KMEMSTATS struct kmemstats *km; diff --git a/sys/kern/kern_malloc_debug.c b/sys/kern/kern_malloc_debug.c index 68ee1e0bdf7..a0fcf2fc91f 100644 --- a/sys/kern/kern_malloc_debug.c +++ b/sys/kern/kern_malloc_debug.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_malloc_debug.c,v 1.28 2011/07/28 14:07:01 mcbride Exp $ */ +/* $OpenBSD: kern_malloc_debug.c,v 1.29 2013/02/09 20:56:35 miod Exp $ */ /* * Copyright (c) 1999, 2000 Artur Grabowski <art@openbsd.org> @@ -300,7 +300,8 @@ debug_malloc_assert_allocated(void *addr, const char *func) } void -debug_malloc_printit(int (*pr)(const char *, ...), vaddr_t addr) +debug_malloc_printit( + int (*pr)(const char *, ...) __attribute__((__format__(__kprintf__,1,2)))) { struct debug_malloc_entry *md; diff --git a/sys/kern/kern_proc.c b/sys/kern/kern_proc.c index ad861c8e8af..e2115ecb221 100644 --- a/sys/kern/kern_proc.c +++ b/sys/kern/kern_proc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_proc.c,v 1.48 2012/04/10 15:50:52 guenther Exp $ */ +/* $OpenBSD: kern_proc.c,v 1.49 2013/02/09 20:56:35 miod Exp $ */ /* $NetBSD: kern_proc.c,v 1.14 1996/02/09 18:59:41 christos Exp $ */ /* @@ -380,7 +380,8 @@ orphanpg(struct pgrp *pg) #ifdef DDB void -proc_printit(struct proc *p, const char *modif, int (*pr)(const char *, ...)) +proc_printit(struct proc *p, const char *modif, + int (*pr)(const char *, ...) __attribute__((__format__(__kprintf__,1,2)))) { static const char *const pstat[] = { "idle", "run", "sleep", "stop", "zombie", "dead", "onproc" diff --git a/sys/kern/subr_disk.c b/sys/kern/subr_disk.c index c79eb61cb59..c39538ba772 100644 --- a/sys/kern/subr_disk.c +++ b/sys/kern/subr_disk.c @@ -1,4 +1,4 @@ -/* $OpenBSD: subr_disk.c,v 1.145 2012/04/07 16:48:38 krw Exp $ */ +/* $OpenBSD: subr_disk.c,v 1.146 2013/02/09 20:56:35 miod Exp $ */ /* $NetBSD: subr_disk.c,v 1.17 1996/03/16 23:17:08 christos Exp $ */ /* @@ -756,7 +756,7 @@ diskerr(struct buf *bp, char *dname, char *what, int pri, int blkdone, struct disklabel *lp) { int unit = DISKUNIT(bp->b_dev), part = DISKPART(bp->b_dev); - int (*pr)(const char *, ...); + int (*pr)(const char *, ...) __attribute__((__format__(__kprintf__,1,2))); char partname = 'a' + part; daddr64_t sn; diff --git a/sys/kern/subr_extent.c b/sys/kern/subr_extent.c index be1d4616b8d..ff231cbadfa 100644 --- a/sys/kern/subr_extent.c +++ b/sys/kern/subr_extent.c @@ -1,4 +1,4 @@ -/* $OpenBSD: subr_extent.c,v 1.45 2011/01/05 13:36:19 fgsch Exp $ */ +/* $OpenBSD: subr_extent.c,v 1.46 2013/02/09 20:56:35 miod Exp $ */ /* $NetBSD: subr_extent.c,v 1.7 1996/11/21 18:46:34 cgd Exp $ */ /*- @@ -69,7 +69,8 @@ #endif #if defined(DIAGNOSTIC) || defined(DDB) -void extent_print1(struct extent *, int (*)(const char *, ...)); +void extent_print1(struct extent *, int (*)(const char *, ...) + __attribute__((__format__(__kprintf__,1,2)))); #endif static void extent_insert_and_optimize(struct extent *, u_long, u_long, @@ -1158,7 +1159,8 @@ extent_print(struct extent *ex) } void -extent_print1(struct extent *ex, int (*pr)(const char *, ...)) +extent_print1(struct extent *ex, + int (*pr)(const char *, ...) __attribute__((__format__(__kprintf__,1,2)))) { struct extent_region *rp; diff --git a/sys/kern/subr_pool.c b/sys/kern/subr_pool.c index 64a3156bcb5..f05872ac102 100644 --- a/sys/kern/subr_pool.c +++ b/sys/kern/subr_pool.c @@ -1,4 +1,4 @@ -/* $OpenBSD: subr_pool.c,v 1.112 2012/12/24 19:43:11 guenther Exp $ */ +/* $OpenBSD: subr_pool.c,v 1.113 2013/02/09 20:56:35 miod Exp $ */ /* $NetBSD: subr_pool.c,v 1.61 2001/09/26 07:14:56 chs Exp $ */ /*- @@ -138,9 +138,10 @@ void pool_large_free_ni(struct pool *, void *); #ifdef DDB -void pool_print_pagelist(struct pool_pagelist *, - int (*)(const char *, ...)); -void pool_print1(struct pool *, const char *, int (*)(const char *, ...)); +void pool_print_pagelist(struct pool_pagelist *, int (*)(const char *, ...) + __attribute__((__format__(__kprintf__,1,2)))); +void pool_print1(struct pool *, const char *, int (*)(const char *, ...) + __attribute__((__format__(__kprintf__,1,2)))); #endif #define pool_sleep(pl) msleep(pl, &pl->pr_mtx, PSWP, pl->pr_wchan, 0) @@ -637,7 +638,7 @@ startover: i < pp->pr_size / sizeof(int); i++) { if (ip[i] != ph->ph_magic) { panic("pool_do_get(%s): free list modified: " - "page %p; item addr %p; offset 0x%x=0x%x", + "page %p; item addr %p; offset 0x%zx=0x%x", pp->pr_wchan, ph->ph_page, pi, i * sizeof(int), ip[i]); } @@ -1121,13 +1122,15 @@ pool_reclaim_all(void) * Diagnostic helpers. */ void -pool_printit(struct pool *pp, const char *modif, int (*pr)(const char *, ...)) +pool_printit(struct pool *pp, const char *modif, + int (*pr)(const char *, ...) __attribute__((__format__(__kprintf__,1,2)))) { pool_print1(pp, modif, pr); } void -pool_print_pagelist(struct pool_pagelist *pl, int (*pr)(const char *, ...)) +pool_print_pagelist(struct pool_pagelist *pl, + int (*pr)(const char *, ...) __attribute__((__format__(__kprintf__,1,2)))) { struct pool_item_header *ph; #ifdef DIAGNOSTIC @@ -1149,7 +1152,8 @@ pool_print_pagelist(struct pool_pagelist *pl, int (*pr)(const char *, ...)) } void -pool_print1(struct pool *pp, const char *modif, int (*pr)(const char *, ...)) +pool_print1(struct pool *pp, const char *modif, + int (*pr)(const char *, ...) __attribute__((__format__(__kprintf__,1,2)))) { struct pool_item_header *ph; int print_pagelist = 0; @@ -1223,12 +1227,12 @@ db_show_all_pools(db_expr_t expr, int haddr, db_expr_t count, char *modif) "Maxpg", "Idle"); else - db_printf("%-10s %18s %18s\n", + db_printf("%-12s %18s %18s\n", "Name", "Address", "Allocator"); TAILQ_FOREACH(pp, &pool_head, pr_poollist) { if (mode == 'a') { - db_printf("%-10s %18p %18p\n", pp->pr_wchan, pp, + db_printf("%-12s %18p %18p\n", pp->pr_wchan, pp, pp->pr_alloc); continue; } @@ -1311,7 +1315,7 @@ pool_chk_page(struct pool *pp, struct pool_item_header *ph, int expected) if (ip[i] != ph->ph_magic) { printf("pool(%s): free list modified: " "page %p; item ordinal %d; addr %p " - "(p %p); offset 0x%x=0x%x\n", + "(p %p); offset 0x%zx=0x%x\n", pp->pr_wchan, ph->ph_page, n, pi, page, i * sizeof(int), ip[i]); } @@ -1367,8 +1371,9 @@ pool_chk(struct pool *pp) #ifdef DDB void -pool_walk(struct pool *pp, int full, int (*pr)(const char *, ...), - void (*func)(void *, int, int (*)(const char *, ...))) +pool_walk(struct pool *pp, int full, + int (*pr)(const char *, ...) __attribute__((__format__(__kprintf__,1,2))), + void (*func)(void *, int, int (*)(const char *, ...) __attribute__((__format__(__kprintf__,1,2))))) { struct pool_item_header *ph; struct pool_item *pi; diff --git a/sys/kern/uipc_mbuf.c b/sys/kern/uipc_mbuf.c index 0589ef9fa7c..0cb9de8c7d0 100644 --- a/sys/kern/uipc_mbuf.c +++ b/sys/kern/uipc_mbuf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uipc_mbuf.c,v 1.168 2013/02/07 11:06:42 mikeb Exp $ */ +/* $OpenBSD: uipc_mbuf.c,v 1.169 2013/02/09 20:56:35 miod Exp $ */ /* $NetBSD: uipc_mbuf.c,v 1.15.4.1 1996/06/13 17:11:44 cgd Exp $ */ /* @@ -1346,7 +1346,8 @@ m_dup_pkthdr(struct mbuf *to, struct mbuf *from, int wait) #ifdef DDB void -m_print(void *v, int (*pr)(const char *, ...)) +m_print(void *v, + int (*pr)(const char *, ...) __attribute__((__format__(__kprintf__,1,2)))) { struct mbuf *m = v; diff --git a/sys/kern/vfs_bio.c b/sys/kern/vfs_bio.c index 7a6a77d8ed6..8b9f88ffbff 100644 --- a/sys/kern/vfs_bio.c +++ b/sys/kern/vfs_bio.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vfs_bio.c,v 1.144 2013/01/18 08:52:04 beck Exp $ */ +/* $OpenBSD: vfs_bio.c,v 1.145 2013/02/09 20:56:35 miod Exp $ */ /* $NetBSD: vfs_bio.c,v 1.44 1996/06/11 11:15:36 pk Exp $ */ /* @@ -1239,12 +1239,13 @@ biodone(struct buf *bp) } #ifdef DDB -void bcstats_print(int (*)(const char *, ...)); +void bcstats_print(int (*)(const char *, ...) __attribute__((__format__(__kprintf__,1,2)))); /* * bcstats_print: ddb hook to print interesting buffer cache counters */ void -bcstats_print(int (*pr)(const char *, ...)) +bcstats_print( + int (*pr)(const char *, ...) __attribute__((__format__(__kprintf__,1,2)))) { (*pr)("Current Buffer Cache status:\n"); (*pr)("numbufs %lld busymapped %lld, delwri %lld\n", diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c index 3a6ff0773c4..55ad5eb33c7 100644 --- a/sys/kern/vfs_subr.c +++ b/sys/kern/vfs_subr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vfs_subr.c,v 1.200 2012/11/17 23:08:22 beck Exp $ */ +/* $OpenBSD: vfs_subr.c,v 1.201 2013/02/09 20:56:35 miod Exp $ */ /* $NetBSD: vfs_subr.c,v 1.53 1996/04/22 01:39:13 christos Exp $ */ /* @@ -2150,7 +2150,8 @@ vn_isdisk(struct vnode *vp, int *errp) #include <ddb/db_output.h> void -vfs_buf_print(void *b, int full, int (*pr)(const char *, ...)) +vfs_buf_print(void *b, int full, + int (*pr)(const char *, ...) __attribute__((__format__(__kprintf__,1,2)))) { struct buf *bp = b; @@ -2177,7 +2178,8 @@ const char *vtypes[] = { VTYPE_NAMES }; const char *vtags[] = { VTAG_NAMES }; void -vfs_vnode_print(void *v, int full, int (*pr)(const char *, ...)) +vfs_vnode_print(void *v, int full, + int (*pr)(const char *, ...) __attribute__((__format__(__kprintf__,1,2)))) { struct vnode *vp = v; @@ -2186,7 +2188,7 @@ vfs_vnode_print(void *v, int full, int (*pr)(const char *, ...)) vp->v_type > nitems(vtypes)? "<unk>":vtypes[vp->v_type], vp->v_type, vp->v_mount, vp->v_mountedhere); - (*pr)("data %p usecount %d writecount %ld holdcnt %ld numoutput %d\n", + (*pr)("data %p usecount %d writecount %d holdcnt %d numoutput %d\n", vp->v_data, vp->v_usecount, vp->v_writecount, vp->v_holdcnt, vp->v_numoutput); @@ -2210,7 +2212,8 @@ vfs_vnode_print(void *v, int full, int (*pr)(const char *, ...)) } void -vfs_mount_print(struct mount *mp, int full, int (*pr)(const char *, ...)) +vfs_mount_print(struct mount *mp, int full, + int (*pr)(const char *, ...) __attribute__((__format__(__kprintf__,1,2)))) { struct vfsconf *vfc = mp->mnt_vfc; struct vnode *vp; diff --git a/sys/sys/systm.h b/sys/sys/systm.h index dd3823db0c8..71117f8bd56 100644 --- a/sys/sys/systm.h +++ b/sys/sys/systm.h @@ -1,4 +1,4 @@ -/* $OpenBSD: systm.h,v 1.94 2012/10/17 22:32:01 deraadt Exp $ */ +/* $OpenBSD: systm.h,v 1.95 2013/02/09 20:56:35 miod Exp $ */ /* $NetBSD: systm.h,v 1.50 1996/06/09 04:55:09 briggs Exp $ */ /*- @@ -172,8 +172,10 @@ int printf(const char *, ...) __attribute__((__format__(__kprintf__,1,2))); void uprintf(const char *, ...) __attribute__((__format__(__kprintf__,1,2))); -int vprintf(const char *, va_list); -int vsnprintf(char *, size_t, const char *, va_list); +int vprintf(const char *, va_list) + __attribute__((__format__(__kprintf__,1,0))); +int vsnprintf(char *, size_t, const char *, va_list) + __attribute__((__format__(__kprintf__,3,0))); int snprintf(char *buf, size_t, const char *, ...) __attribute__((__format__(__kprintf__,3,4))); struct tty; diff --git a/sys/ufs/ffs/ffs_softdep.c b/sys/ufs/ffs/ffs_softdep.c index 6510304dbfc..3541ea36804 100644 --- a/sys/ufs/ffs/ffs_softdep.c +++ b/sys/ufs/ffs/ffs_softdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ffs_softdep.c,v 1.114 2013/01/16 22:41:47 beck Exp $ */ +/* $OpenBSD: ffs_softdep.c,v 1.115 2013/02/09 20:56:35 miod Exp $ */ /* * Copyright 1998, 2000 Marshall Kirk McKusick. All Rights Reserved. @@ -5611,7 +5611,8 @@ softdep_error(char *func, int error) #include <ddb/db_output.h> void -softdep_print(struct buf *bp, int full, int (*pr)(const char *, ...)) +softdep_print(struct buf *bp, int full, + int (*pr)(const char *, ...) __attribute__((__format__(__kprintf__,1,2)))) { struct worklist *wk; @@ -5621,7 +5622,8 @@ softdep_print(struct buf *bp, int full, int (*pr)(const char *, ...)) } void -worklist_print(struct worklist *wk, int full, int (*pr)(const char *, ...)) +worklist_print(struct worklist *wk, int full, + int (*pr)(const char *, ...) __attribute__((__format__(__kprintf__,1,2)))) { struct pagedep *pagedep; struct inodedep *inodedep; |