From owner-freebsd-audit Sun Mar 3 13:21:29 2002 Delivered-To: freebsd-audit@freebsd.org Received: from storm.FreeBSD.org.uk (storm.FreeBSD.org.uk [194.242.139.170]) by hub.freebsd.org (Postfix) with ESMTP id E3E2137B41A for ; Sun, 3 Mar 2002 13:20:22 -0800 (PST) Received: (from uucp@localhost) by storm.FreeBSD.org.uk (8.11.6/8.11.6) with UUCP id g23LKMN08913 for audit@freebsd.org; Sun, 3 Mar 2002 21:20:22 GMT (envelope-from mark@grimreaper.grondar.za) Received: from grimreaper (localhost [127.0.0.1]) by grimreaper.grondar.org (8.12.2/8.12.2) with ESMTP id g23LJ8RV002907 for ; Sun, 3 Mar 2002 21:19:08 GMT (envelope-from mark@grimreaper.grondar.za) Message-Id: <200203032119.g23LJ8RV002907@grimreaper.grondar.org> To: audit@freebsd.org Subject: Kernel; lint warnings and fixes. Review, please? MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----- =_aaaaaaaaaa0" Content-ID: <2904.1015190331.0@grimreaper> Date: Sun, 03 Mar 2002 21:19:08 +0000 From: Mark Murray Sender: owner-freebsd-audit@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG ------- =_aaaaaaaaaa0 Content-Type: text/plain; charset="us-ascii" Content-ID: <2904.1015190331.1@grimreaper> [ D'uh. This time I actually MIMEified the mail ] Hi Please review the enclosed diffs. they are intended to make no functional difference other than fixing lint warnings. Thanks! M -- o Mark Murray \_ O.\_ Warning: this .sig is umop ap!sdn ------- =_aaaaaaaaaa0 Content-Type: text/plain; name="kernel.diff"; charset="us-ascii" Content-ID: <2904.1015190331.2@grimreaper> Content-Description: Kernel lint warning fixes Index: i386/include/atomic.h =================================================================== RCS file: /home/ncvs/src/sys/i386/include/atomic.h,v retrieving revision 1.26 diff -u -d -r1.26 atomic.h --- i386/include/atomic.h 28 Feb 2002 06:17:05 -0000 1.26 +++ i386/include/atomic.h 1 Mar 2002 22:13:09 -0000 @@ -89,6 +89,7 @@ * The assembly is volatilized to demark potential before-and-after side * effects if an interrupt or SMP collision were to occur. */ +#ifdef __GNUC__ #define ATOMIC_ASM(NAME, TYPE, OP, CONS, V) \ static __inline void \ atomic_##NAME##_##TYPE(volatile u_##TYPE *p, u_##TYPE v)\ @@ -97,6 +98,11 @@ : "+m" (*p) \ : CONS (V)); \ } +#else /* !__GNUC__ */ +#warning "This file must be compiled with GCC" +#define ATOMIC_ASM(NAME, TYPE, OP, CONS, V) \ +static extern void atomic_##NAME##_##TYPE(volatile u_##TYPE *p, u_##TYPE v) +#endif /* __GNUC__ */ /* * Atomic compare and set, used by the mutex functions @@ -106,6 +112,7 @@ * Returns 0 on failure, non-zero on success */ +#if defined(__GNUC__) #if defined(I386_CPU) static __inline int atomic_cmpset_int(volatile u_int *dst, u_int exp, u_int src) @@ -151,7 +158,24 @@ return (res); } #endif /* defined(I386_CPU) */ +#else /* !defined(__GNUC__) */ +/* + * XXXX: Dummy function!! Do not be confused into thinking that this is + * actually atomic! + */ +static __inline int +atomic_cmpset_int(volatile u_int *dst, u_int exp, u_int src) +{ + if (*dst == exp) { + *dst = new; + return 1; + } + else + return 0; +} +#endif /* defined(__GNUC__) */ +#if defined(__GNUC__) #if defined(I386_CPU) /* * We assume that a = b will do atomic loads and stores. @@ -172,7 +196,7 @@ *p = v; \ __asm __volatile("" : : : "memory"); \ } -#else +#else /* !defined(I386_CPU) */ #define ATOMIC_STORE_LOAD(TYPE, LOP, SOP) \ static __inline u_##TYPE \ @@ -200,6 +224,28 @@ : : "memory"); \ } #endif /* defined(I386_CPU) */ +#else /* !defined(__GNUC__) */ + +/* + * XXXX: Dummy functions!! Do not be confused into thinking that these are + * actually atomic! + */ +#define ATOMIC_STORE_LOAD(TYPE, LOP, SOP) \ +static __inline u_##TYPE \ +atomic_load_acq_##TYPE(volatile u_##TYPE *p) \ +{ \ + return (*p); \ +} \ + \ +/* \ + * The XCHG instruction asserts LOCK automagically. \ + */ \ +static __inline void \ +atomic_store_rel_##TYPE(volatile u_##TYPE *p, u_##TYPE v)\ +{ \ + *p = v; \ +} +#endif /* defined(__GNUC__) */ #endif /* KLD_MODULE */ ATOMIC_ASM(set, char, "orb %b1,%0", "iq", v) @@ -370,6 +416,7 @@ #undef ATOMIC_PTR +#if defined(__GNUC__) static __inline u_int atomic_readandclear_int(volatile u_int *addr) { @@ -384,7 +431,22 @@ return (result); } +#else /* !defined(__GNUC__) */ +/* + * XXXX: Dummy! + */ +static __inline u_int +atomic_readandclear_int(volatile u_int *addr) +{ + u_int ret; + ret = *addr; + *addr = 0; + return (ret); +} +#endif /* defined(__GNUC__) */ + +#if defined(__GNUC__) static __inline u_long atomic_readandclear_long(volatile u_long *addr) { @@ -399,5 +461,19 @@ return (result); } +#else /* !defined(__GNUC__) */ +/* + * XXXX: Dummy! + */ +static __inline u_long +atomic_readandclear_long(volatile u_long *addr) +{ + u_long ret; + + ret = *addr; + *addr = 0; + return (ret); +} +#endif /* defined(__GNUC__) */ #endif /* !defined(WANT_FUNCTIONS) */ #endif /* ! _MACHINE_ATOMIC_H_ */ Index: i386/include/bus_at386.h =================================================================== RCS file: /home/ncvs/src/sys/i386/include/bus_at386.h,v retrieving revision 1.18 diff -u -d -r1.18 bus_at386.h --- i386/include/bus_at386.h 18 Feb 2002 13:43:19 -0000 1.18 +++ i386/include/bus_at386.h 24 Feb 2002 21:28:54 -0000 @@ -274,6 +274,7 @@ else #endif { +#ifdef __GNUC__ __asm __volatile(" \n\ cld \n\ 1: movb (%2),%%al \n\ @@ -282,6 +283,7 @@ "=D" (addr), "=c" (count) : "r" (bsh + offset), "0" (addr), "1" (count) : "%eax", "memory"); +#endif } #endif } @@ -301,6 +303,7 @@ else #endif { +#ifdef __GNUC__ __asm __volatile(" \n\ cld \n\ 1: movw (%2),%%ax \n\ @@ -309,6 +312,7 @@ "=D" (addr), "=c" (count) : "r" (bsh + offset), "0" (addr), "1" (count) : "%eax", "memory"); +#endif } #endif } @@ -328,6 +332,7 @@ else #endif { +#ifdef __GNUC__ __asm __volatile(" \n\ cld \n\ 1: movl (%2),%%eax \n\ @@ -336,6 +341,7 @@ "=D" (addr), "=c" (count) : "r" (bsh + offset), "0" (addr), "1" (count) : "%eax", "memory"); +#endif } #endif } @@ -374,7 +380,8 @@ if (tag == I386_BUS_SPACE_IO) #endif { - int _port_ = bsh + offset; \ + int _port_ = bsh + offset; +#ifdef __GNUC__ __asm __volatile(" \n\ cld \n\ 1: inb %w2,%%al \n\ @@ -384,6 +391,7 @@ "=D" (addr), "=c" (count), "=d" (_port_) : "0" (addr), "1" (count), "2" (_port_) : "%eax", "memory", "cc"); +#endif } #endif #if defined(_I386_BUS_MEMIO_H_) @@ -391,7 +399,8 @@ else #endif { - int _port_ = bsh + offset; \ + int _port_ = bsh + offset; +#ifdef __GNUC__ __asm __volatile(" \n\ cld \n\ repne \n\ @@ -399,6 +408,7 @@ "=D" (addr), "=c" (count), "=S" (_port_) : "0" (addr), "1" (count), "2" (_port_) : "memory", "cc"); +#endif } #endif } @@ -412,7 +422,8 @@ if (tag == I386_BUS_SPACE_IO) #endif { - int _port_ = bsh + offset; \ + int _port_ = bsh + offset; +#ifdef __GNUC__ __asm __volatile(" \n\ cld \n\ 1: inw %w2,%%ax \n\ @@ -422,6 +433,7 @@ "=D" (addr), "=c" (count), "=d" (_port_) : "0" (addr), "1" (count), "2" (_port_) : "%eax", "memory", "cc"); +#endif } #endif #if defined(_I386_BUS_MEMIO_H_) @@ -429,7 +441,8 @@ else #endif { - int _port_ = bsh + offset; \ + int _port_ = bsh + offset; +#ifdef __GNUC__ __asm __volatile(" \n\ cld \n\ repne \n\ @@ -437,6 +450,7 @@ "=D" (addr), "=c" (count), "=S" (_port_) : "0" (addr), "1" (count), "2" (_port_) : "memory", "cc"); +#endif } #endif } @@ -450,7 +464,8 @@ if (tag == I386_BUS_SPACE_IO) #endif { - int _port_ = bsh + offset; \ + int _port_ = bsh + offset; +#ifdef __GNUC__ __asm __volatile(" \n\ cld \n\ 1: inl %w2,%%eax \n\ @@ -460,6 +475,7 @@ "=D" (addr), "=c" (count), "=d" (_port_) : "0" (addr), "1" (count), "2" (_port_) : "%eax", "memory", "cc"); +#endif } #endif #if defined(_I386_BUS_MEMIO_H_) @@ -467,7 +483,8 @@ else #endif { - int _port_ = bsh + offset; \ + int _port_ = bsh + offset; +#ifdef __GNUC__ __asm __volatile(" \n\ cld \n\ repne \n\ @@ -475,6 +492,7 @@ "=D" (addr), "=c" (count), "=S" (_port_) : "0" (addr), "1" (count), "2" (_port_) : "memory", "cc"); +#endif } #endif } @@ -595,6 +613,7 @@ else #endif { +#ifdef __GNUC__ __asm __volatile(" \n\ cld \n\ 1: lodsb \n\ @@ -603,6 +622,7 @@ "=S" (addr), "=c" (count) : "r" (bsh + offset), "0" (addr), "1" (count) : "%eax", "memory", "cc"); +#endif } #endif } @@ -622,6 +642,7 @@ else #endif { +#ifdef __GNUC__ __asm __volatile(" \n\ cld \n\ 1: lodsw \n\ @@ -630,6 +651,7 @@ "=S" (addr), "=c" (count) : "r" (bsh + offset), "0" (addr), "1" (count) : "%eax", "memory", "cc"); +#endif } #endif } @@ -649,6 +671,7 @@ else #endif { +#ifdef __GNUC__ __asm __volatile(" \n\ cld \n\ 1: lodsl \n\ @@ -657,6 +680,7 @@ "=S" (addr), "=c" (count) : "r" (bsh + offset), "0" (addr), "1" (count) : "%eax", "memory", "cc"); +#endif } #endif } @@ -696,7 +720,8 @@ if (tag == I386_BUS_SPACE_IO) #endif { - int _port_ = bsh + offset; \ + int _port_ = bsh + offset; +#ifdef __GNUC__ __asm __volatile(" \n\ cld \n\ 1: lodsb \n\ @@ -706,6 +731,7 @@ "=d" (_port_), "=S" (addr), "=c" (count) : "0" (_port_), "1" (addr), "2" (count) : "%eax", "memory", "cc"); +#endif } #endif #if defined(_I386_BUS_MEMIO_H_) @@ -713,7 +739,8 @@ else #endif { - int _port_ = bsh + offset; \ + int _port_ = bsh + offset; +#ifdef __GNUC__ __asm __volatile(" \n\ cld \n\ repne \n\ @@ -721,6 +748,7 @@ "=D" (_port_), "=S" (addr), "=c" (count) : "0" (_port_), "1" (addr), "2" (count) : "memory", "cc"); +#endif } #endif } @@ -734,7 +762,8 @@ if (tag == I386_BUS_SPACE_IO) #endif { - int _port_ = bsh + offset; \ + int _port_ = bsh + offset; +#ifdef __GNUC__ __asm __volatile(" \n\ cld \n\ 1: lodsw \n\ @@ -744,6 +773,7 @@ "=d" (_port_), "=S" (addr), "=c" (count) : "0" (_port_), "1" (addr), "2" (count) : "%eax", "memory", "cc"); +#endif } #endif #if defined(_I386_BUS_MEMIO_H_) @@ -751,7 +781,8 @@ else #endif { - int _port_ = bsh + offset; \ + int _port_ = bsh + offset; +#ifdef __GNUC__ __asm __volatile(" \n\ cld \n\ repne \n\ @@ -759,6 +790,7 @@ "=D" (_port_), "=S" (addr), "=c" (count) : "0" (_port_), "1" (addr), "2" (count) : "memory", "cc"); +#endif } #endif } @@ -772,7 +804,8 @@ if (tag == I386_BUS_SPACE_IO) #endif { - int _port_ = bsh + offset; \ + int _port_ = bsh + offset; +#ifdef __GNUC__ __asm __volatile(" \n\ cld \n\ 1: lodsl \n\ @@ -782,6 +815,7 @@ "=d" (_port_), "=S" (addr), "=c" (count) : "0" (_port_), "1" (addr), "2" (count) : "%eax", "memory", "cc"); +#endif } #endif #if defined(_I386_BUS_MEMIO_H_) @@ -789,7 +823,8 @@ else #endif { - int _port_ = bsh + offset; \ + int _port_ = bsh + offset; +#ifdef __GNUC__ __asm __volatile(" \n\ cld \n\ repne \n\ @@ -797,6 +832,7 @@ "=D" (_port_), "=S" (addr), "=c" (count) : "0" (_port_), "1" (addr), "2" (count) : "memory", "cc"); +#endif } #endif } @@ -1167,10 +1203,12 @@ bus_space_barrier(bus_space_tag_t tag, bus_space_handle_t bsh, bus_size_t offset, bus_size_t len, int flags) { +#ifdef __GNUC__ if (flags & BUS_SPACE_BARRIER_READ) __asm __volatile("lock; addl $0,0(%%esp)" : : : "memory"); else __asm __volatile("" : : : "memory"); +#endif } #endif /* _I386_BUS_AT386_H_ */ Index: i386/include/pcpu.h =================================================================== RCS file: /home/ncvs/src/sys/i386/include/pcpu.h,v retrieving revision 1.32 diff -u -d -r1.32 pcpu.h --- i386/include/pcpu.h 11 Dec 2001 23:33:40 -0000 1.32 +++ i386/include/pcpu.h 28 Feb 2002 10:44:43 -0000 @@ -32,8 +32,22 @@ #ifdef _KERNEL #ifndef __GNUC__ -#error gcc is required to use this file -#endif + +#ifndef lint +#error gcc or lint is required to use this file +#else /* lint */ +#define __PCPU_PTR(name) +#define __PCPU_GET(name) +#define __PCPU_SET(name, val) +#define PCPU_GET(member) __PCPU_GET(pc_ ## member) +#define PCPU_PTR(member) __PCPU_PTR(pc_ ## member) +#define PCPU_SET(member, val) __PCPU_SET(pc_ ## member, val) +#define PCPU_MD_FIELDS \ + int foo; \ + char bar +#endif /* lint */ + +#else /* __GNUC__ */ #include #include @@ -141,6 +155,8 @@ #define PCPU_GET(member) __PCPU_GET(pc_ ## member) #define PCPU_PTR(member) __PCPU_PTR(pc_ ## member) #define PCPU_SET(member, val) __PCPU_SET(pc_ ## member, val) + +#endif /* __GNUC__ */ #endif /* _KERNEL */ Index: i386/include/profile.h =================================================================== RCS file: /home/ncvs/src/sys/i386/include/profile.h,v retrieving revision 1.26 diff -u -d -r1.26 profile.h --- i386/include/profile.h 31 Jan 2002 13:49:55 -0000 1.26 +++ i386/include/profile.h 19 Feb 2002 16:56:31 -0000 @@ -82,28 +82,35 @@ #define _MCOUNT_DECL static __inline void _mcount -#define MCOUNT \ -void \ -mcount() \ -{ \ - uintfptr_t selfpc, frompc; \ - /* \ - * Find the return address for mcount, \ - * and the return address for mcount's caller. \ - * \ - * selfpc = pc pushed by call to mcount \ - */ \ - asm("movl 4(%%ebp),%0" : "=r" (selfpc)); \ - /* \ - * frompc = pc pushed by call to mcount's caller. \ - * The caller's stack frame has already been built, so %ebp is \ - * the caller's frame pointer. The caller's raddr is in the \ - * caller's frame following the caller's caller's frame pointer. \ - */ \ - asm("movl (%%ebp),%0" : "=r" (frompc)); \ - frompc = ((uintfptr_t *)frompc)[1]; \ - _mcount(frompc, selfpc); \ +#ifdef __GNUC__ +#define MCOUNT \ +void \ +mcount() \ +{ \ + uintfptr_t selfpc, frompc; \ + /* \ + * Find the return address for mcount, \ + * and the return address for mcount's caller. \ + * \ + * selfpc = pc pushed by call to mcount \ + */ \ + asm("movl 4(%%ebp),%0" : "=r" (selfpc)); \ + /* \ + * frompc = pc pushed by call to mcount's caller. \ + * The caller's stack frame has already been built, so %ebp is \ + * the caller's frame pointer. The caller's raddr is in the \ + * caller's frame following the caller's caller's frame pointer.\ + */ \ + asm("movl (%%ebp),%0" : "=r" (frompc)); \ + frompc = ((uintfptr_t *)frompc)[1]; \ + _mcount(frompc, selfpc); \ +} +#else /* __GNUC__ */ +void \ +mcount() \ +{ \ } +#endif /* __GNUC__ */ typedef unsigned int uintfptr_t; @@ -117,16 +124,16 @@ #ifdef _KERNEL -void mcount __P((uintfptr_t frompc, uintfptr_t selfpc)); -void kmupetext __P((uintfptr_t nhighpc)); +void mcount(uintfptr_t frompc, uintfptr_t selfpc); +void kmupetext(uintfptr_t nhighpc); #ifdef GUPROF struct gmonparam; -void nullfunc_loop_profiled __P((void)); -void nullfunc_profiled __P((void)); -void startguprof __P((struct gmonparam *p)); -void stopguprof __P((struct gmonparam *p)); +void nullfunc_loop_profiled(void); +void nullfunc_profiled(void); +void startguprof(struct gmonparam *p); +void stopguprof(struct gmonparam *p); #else #define startguprof(p) #define stopguprof(p) @@ -139,12 +146,12 @@ __BEGIN_DECLS #ifdef __GNUC__ #ifdef __ELF__ -void mcount __P((void)) __asm(".mcount"); +void mcount(void) __asm(".mcount"); #else -void mcount __P((void)) __asm("mcount"); +void mcount(void) __asm("mcount"); #endif #endif -static void _mcount __P((uintfptr_t frompc, uintfptr_t selfpc)); +static void _mcount(uintfptr_t frompc, uintfptr_t selfpc); __END_DECLS #endif /* _KERNEL */ @@ -154,11 +161,11 @@ extern int cputime_bias; __BEGIN_DECLS -int cputime __P((void)); -void empty_loop __P((void)); -void mexitcount __P((uintfptr_t selfpc)); -void nullfunc __P((void)); -void nullfunc_loop __P((void)); +int cputime(void); +void empty_loop(void); +void mexitcount(uintfptr_t selfpc); +void nullfunc(void); +void nullfunc_loop(void); __END_DECLS #endif Index: kern/bus_if.m =================================================================== RCS file: /home/ncvs/src/sys/kern/bus_if.m,v retrieving revision 1.19 diff -u -d -r1.19 bus_if.m --- kern/bus_if.m 28 Nov 2000 06:49:15 -0000 1.19 +++ kern/bus_if.m 24 Feb 2002 21:39:42 -0000 @@ -82,20 +82,20 @@ # Read an instance variable. Return 0 on success. # METHOD int read_ivar { - device_t dev; - device_t child; - int index; - uintptr_t *result; + device_t _dev; + device_t _child; + int _index; + uintptr_t *_result; }; # # Write an instance variable. Return 0 on success. # METHOD int write_ivar { - device_t dev; - device_t child; - int index; - uintptr_t value; + device_t _dev; + device_t _child; + int _index; + uintptr_t _value; }; # @@ -103,8 +103,8 @@ # to reclaim any resources allocated on behalf of the child. # METHOD void child_detached { - device_t dev; - device_t child; + device_t _dev; + device_t _child; }; # @@ -113,8 +113,8 @@ # attach any un-matched children of the bus. # METHOD void driver_added { - device_t dev; - driver_t *driver; + device_t _dev; + driver_t *_driver; } DEFAULT bus_generic_driver_added; # @@ -124,10 +124,10 @@ # added after the last existing child with the same order. # METHOD device_t add_child { - device_t dev; - int order; - const char *name; - int unit; + device_t _dev; + int _order; + const char *_name; + int _unit; }; # @@ -145,30 +145,30 @@ # uses the resource. # METHOD struct resource * alloc_resource { - device_t dev; - device_t child; - int type; - int *rid; - u_long start; - u_long end; - u_long count; - u_int flags; + device_t _dev; + device_t _child; + int _type; + int *_rid; + u_long _start; + u_long _end; + u_long _count; + u_int _flags; } DEFAULT null_alloc_resource; METHOD int activate_resource { - device_t dev; - device_t child; - int type; - int rid; - struct resource *r; + device_t _dev; + device_t _child; + int _type; + int _rid; + struct resource *_r; }; METHOD int deactivate_resource { - device_t dev; - device_t child; - int type; - int rid; - struct resource *r; + device_t _dev; + device_t _child; + int _type; + int _rid; + struct resource *_r; }; # @@ -177,28 +177,28 @@ # is not necessarily the same as the one the client passed). # METHOD int release_resource { - device_t dev; - device_t child; - int type; - int rid; - struct resource *res; + device_t _dev; + device_t _child; + int _type; + int _rid; + struct resource *_res; }; METHOD int setup_intr { - device_t dev; - device_t child; - struct resource *irq; - int flags; - driver_intr_t *intr; - void *arg; - void **cookiep; + device_t _dev; + device_t _child; + struct resource *_irq; + int _flags; + driver_intr_t *_intr; + void *_arg; + void **_cookiep; }; METHOD int teardown_intr { - device_t dev; - device_t child; - struct resource *irq; - void *cookie; + device_t _dev; + device_t _child; + struct resource *_irq; + void *_cookie; }; # @@ -206,12 +206,12 @@ # the type or rid are out of range. # METHOD int set_resource { - device_t dev; - device_t child; - int type; - int rid; - u_long start; - u_long count; + device_t _dev; + device_t _child; + int _type; + int _rid; + u_long _start; + u_long _count; }; # @@ -219,28 +219,28 @@ # out of range or have not been set. # METHOD int get_resource { - device_t dev; - device_t child; - int type; - int rid; - u_long *startp; - u_long *countp; + device_t _dev; + device_t _child; + int _type; + int _rid; + u_long *_startp; + u_long *_countp; }; # # Delete a resource. # METHOD void delete_resource { - device_t dev; - device_t child; - int type; - int rid; + device_t _dev; + device_t _child; + int _type; + int _rid; }; # # Return a struct resource_list. # METHOD struct resource_list * get_resource_list { - device_t dev; - device_t child; + device_t _dev; + device_t _child; } DEFAULT bus_generic_get_resource_list; Index: kern/kern_sysctl.c =================================================================== RCS file: /home/ncvs/src/sys/kern/kern_sysctl.c,v retrieving revision 1.121 diff -u -d -r1.121 kern_sysctl.c --- kern/kern_sysctl.c 27 Feb 2002 18:32:12 -0000 1.121 +++ kern/kern_sysctl.c 1 Mar 2002 17:51:00 -0000 @@ -311,7 +311,7 @@ sysctl_unregister_oid(oidp); if (del) { if (oidp->descr) - free(oidp->descr, M_SYSCTLOID); + free((void *)(uintptr_t)(const void *)oidp->descr, M_SYSCTLOID); free((void *)(uintptr_t)(const void *)oidp->oid_name, M_SYSCTLOID); free(oidp, M_SYSCTLOID); @@ -376,7 +376,7 @@ int len = strlen(descr) + 1; oidp->descr = malloc(len, M_SYSCTLOID, M_WAITOK); if (oidp->descr) - strcpy(oidp->descr, descr); + strcpy((char *)(uintptr_t)(const void *)oidp->descr, descr); } /* Update the context, if used */ if (clist != NULL) Index: sys/eventhandler.h =================================================================== RCS file: /home/ncvs/src/sys/sys/eventhandler.h,v retrieving revision 1.17 diff -u -d -r1.17 eventhandler.h --- sys/eventhandler.h 12 Sep 2001 08:38:05 -0000 1.17 +++ sys/eventhandler.h 1 Mar 2002 12:09:50 -0000 @@ -39,21 +39,19 @@ #include #include -struct eventhandler_entry -{ - TAILQ_ENTRY(eventhandler_entry) ee_link; - int ee_priority; - void *ee_arg; +struct eventhandler_entry { + TAILQ_ENTRY(eventhandler_entry) ee_link; + int ee_priority; + void *ee_arg; }; -struct eventhandler_list -{ - char *el_name; - int el_flags; +struct eventhandler_list { + char *el_name; + int el_flags; #define EHE_INITTED (1<<0) - struct lock el_lock; - TAILQ_ENTRY(eventhandler_list) el_link; - TAILQ_HEAD(,eventhandler_entry) el_entries; + struct lock el_lock; + TAILQ_ENTRY(eventhandler_list) el_link; + TAILQ_HEAD(,eventhandler_entry) el_entries; }; typedef struct eventhandler_entry *eventhandler_tag; @@ -70,10 +68,9 @@ */ #define EVENTHANDLER_FAST_DECLARE(name, type) \ extern struct eventhandler_list Xeventhandler_list_ ## name ; \ -struct eventhandler_entry_ ## name \ -{ \ - struct eventhandler_entry ee; \ - type eh_func; \ +struct eventhandler_entry_ ## name { \ + struct eventhandler_entry ee; \ + type eh_func; \ }; \ struct __hack @@ -81,29 +78,30 @@ struct eventhandler_list Xeventhandler_list_ ## name = { #name }; \ struct __hack -#define EVENTHANDLER_FAST_INVOKE(name, args...) \ -do { \ - struct eventhandler_list *_el = &Xeventhandler_list_ ## name ; \ - struct eventhandler_entry *_ep, *_en; \ - \ - if (_el->el_flags & EHE_INITTED) { \ - lockmgr(&_el->el_lock, LK_EXCLUSIVE, NULL, curthread); \ - _ep = TAILQ_FIRST(&(_el->el_entries)); \ - while (_ep != NULL) { \ - _en = TAILQ_NEXT(_ep, ee_link); \ - ((struct eventhandler_entry_ ## name *)_ep)->eh_func(_ep->ee_arg , \ - ## args); \ - _ep = _en; \ - } \ - lockmgr(&_el->el_lock, LK_RELEASE, NULL, curthread); \ - } \ +#define EVENTHANDLER_FAST_INVOKE(name, args...) \ +do { \ + struct eventhandler_list *_el = &Xeventhandler_list_ ## name ; \ + struct eventhandler_entry *_ep, *_en; \ + struct eventhandler_entry ## name *_epn; \ + \ + if (_el->el_flags & EHE_INITTED) { \ + lockmgr(&_el->el_lock, LK_EXCLUSIVE, NULL, curthread); \ + _ep = TAILQ_FIRST(&(_el->el_entries)); \ + while (_ep != NULL) { \ + _en = TAILQ_NEXT(_ep, ee_link); \ + _epn = (struct eventhandler_entry_ ## name *)_ep;\ + _epn->eh_func(_ep->ee_arg , ## args ); \ + _ep = _en; \ + } \ + lockmgr(&_el->el_lock, LK_RELEASE, NULL, curthread); \ + } \ } while (0) -#define EVENTHANDLER_FAST_REGISTER(name, func, arg, priority) \ - eventhandler_register(&Xeventhandler_list_ ## name, #name, func, arg, priority) +#define EVENTHANDLER_FAST_REGISTER(name, func, arg, priority) \ + eventhandler_register(&Xeventhandler_list_ ## name, #name, func, arg, priority) #define EVENTHANDLER_FAST_DEREGISTER(name, tag) \ - eventhandler_deregister(&Xeventhandler_list_ ## name, tag) + eventhandler_deregister(&Xeventhandler_list_ ## name, tag) /* * Slow handlers are entirely dynamic; lists are created @@ -115,39 +113,40 @@ #define EVENTHANDLER_DECLARE(name, type) \ struct eventhandler_entry_ ## name \ { \ - struct eventhandler_entry ee; \ - type eh_func; \ + struct eventhandler_entry ee; \ + type eh_func;\ }; \ struct __hack -#define EVENTHANDLER_INVOKE(name, args...) \ -do { \ - struct eventhandler_list *_el; \ - struct eventhandler_entry *_ep, *_en; \ - \ - if (((_el = eventhandler_find_list(#name)) != NULL) && \ - (_el->el_flags & EHE_INITTED)) { \ - lockmgr(&_el->el_lock, LK_EXCLUSIVE, NULL, curthread); \ - _ep = TAILQ_FIRST(&(_el->el_entries)); \ - while (_ep != NULL) { \ - _en = TAILQ_NEXT(_ep, ee_link); \ - ((struct eventhandler_entry_ ## name *)_ep)->eh_func(_ep->ee_arg , \ - ## args); \ - _ep = _en; \ - } \ - lockmgr(&_el->el_lock, LK_RELEASE, NULL, curthread); \ - } \ +#define EVENTHANDLER_INVOKE(name, args...) \ +do { \ + struct eventhandler_list *_el; \ + struct eventhandler_entry *_ep, *_en; \ + struct eventhandler_entry_ ## name *_epn; \ + \ + if (((_el = eventhandler_find_list(#name)) != NULL) && \ + (_el->el_flags & EHE_INITTED)) { \ + lockmgr(&_el->el_lock, LK_EXCLUSIVE, NULL, curthread); \ + _ep = TAILQ_FIRST(&(_el->el_entries)); \ + while (_ep != NULL) { \ + _en = TAILQ_NEXT(_ep, ee_link); \ + _epn = (struct eventhandler_entry_ ## name *)_ep;\ + _epn->eh_func( _ep->ee_arg , ## args ); \ + _ep = _en; \ + } \ + lockmgr(&_el->el_lock, LK_RELEASE, NULL, curthread); \ + } \ } while (0) #define EVENTHANDLER_REGISTER(name, func, arg, priority) \ - eventhandler_register(NULL, #name, func, arg, priority) + eventhandler_register(NULL, #name, func, arg, priority) -#define EVENTHANDLER_DEREGISTER(name, tag) \ -do { \ - struct eventhandler_list *_el; \ - \ - if ((_el = eventhandler_find_list(#name)) != NULL) \ - eventhandler_deregister(_el, tag); \ +#define EVENTHANDLER_DEREGISTER(name, tag) \ +do { \ + struct eventhandler_list *_el; \ + \ + if ((_el = eventhandler_find_list(#name)) != NULL) \ + eventhandler_deregister(_el, tag); \ } while(0) @@ -165,7 +164,7 @@ */ /* Shutdown events */ -typedef void (*shutdown_fn) __P((void *, int)); +typedef void (*shutdown_fn)(void *, int); #define SHUTDOWN_PRI_FIRST 0 #define SHUTDOWN_PRI_DEFAULT 10000 @@ -176,7 +175,7 @@ EVENTHANDLER_DECLARE(shutdown_final, shutdown_fn); /* Idle process event */ -typedef void (*idle_eventhandler_t) __P((void *, int)); +typedef void (*idle_eventhandler_t)(void *, int); #define IDLE_PRI_FIRST 10000 #define IDLE_PRI_LAST 20000 Index: sys/kernel.h =================================================================== RCS file: /home/ncvs/src/sys/sys/kernel.h,v retrieving revision 1.98 diff -u -d -r1.98 kernel.h --- sys/kernel.h 9 Jan 2002 04:58:49 -0000 1.98 +++ sys/kernel.h 1 Mar 2002 12:26:44 -0000 @@ -229,13 +229,13 @@ subsystem, \ order, \ func, \ - ident \ + (ident) \ }; \ DATA_SET(sysinit_set,uniquifier ## _sys_init); #define SYSINIT(uniquifier, subsystem, order, func, ident) \ C_SYSINIT(uniquifier, subsystem, order, \ - (sysinit_cfunc_t)(sysinit_nfunc_t)func, (void *)ident) + (sysinit_cfunc_t)(sysinit_nfunc_t)func, (void *)(ident)) /* * Called on module unload: no special processing @@ -245,13 +245,13 @@ subsystem, \ order, \ func, \ - ident \ + (ident) \ }; \ DATA_SET(sysuninit_set,uniquifier ## _sys_uninit) #define SYSUNINIT(uniquifier, subsystem, order, func, ident) \ C_SYSUNINIT(uniquifier, subsystem, order, \ - (sysinit_cfunc_t)(sysinit_nfunc_t)func, (void *)ident) + (sysinit_cfunc_t)(sysinit_nfunc_t)func, (void *)(ident)) void sysinit_add __P((struct sysinit **set, struct sysinit **set_end)); Index: sys/linker_set.h =================================================================== RCS file: /home/ncvs/src/sys/sys/linker_set.h,v retrieving revision 1.9 diff -u -d -r1.9 linker_set.h --- sys/linker_set.h 13 Jun 2001 10:58:39 -0000 1.9 +++ sys/linker_set.h 2 Mar 2002 14:32:09 -0000 @@ -42,6 +42,7 @@ * Private macros, not to be used outside this header file. */ /* this bit of h0h0magic brought to you by cpp */ +#ifdef __GNUC__ #define __GLOBL(sym) __GLOBL2(sym) #define __GLOBL2(sym) __asm(".globl " #sym) @@ -50,6 +51,12 @@ __GLOBL(__CONCAT(__stop_set_,set)); \ static void const * const __set_##set##_sym_##sym \ __attribute__((__section__("set_" #set),__unused__)) = &sym +#else /* !__GNUC__ */ +#ifndef lint +#error "This file needs to be compiled by GCC or lint" +#endif /* lint */ +#define __MAKE_SET(set, sym) extern void const * const (__set_##set##_sym_##sym) +#endif /* __GNUC__ */ /* * Public macros. Index: sys/lock.h =================================================================== RCS file: /home/ncvs/src/sys/sys/lock.h,v retrieving revision 1.42 diff -u -d -r1.42 lock.h --- sys/lock.h 5 Jan 2002 08:47:13 -0000 1.42 +++ sys/lock.h 24 Feb 2002 21:41:04 -0000 @@ -245,8 +245,8 @@ witness_restore((lock), __CONCAT(n, __wf), __CONCAT(n, __wl)) #else /* WITNESS */ -#define WITNESS_INIT(lock) (lock)->lo_flags |= LO_INITIALIZED -#define WITNESS_DESTROY(lock) (lock)->lo_flags &= ~LO_INITIALIZED +#define WITNESS_INIT(lock) ((lock)->lo_flags |= LO_INITIALIZED) +#define WITNESS_DESTROY(lock) ((lock)->lo_flags &= ~LO_INITIALIZED) #define WITNESS_LOCK(lock, flags, file, line) #define WITNESS_UPGRADE(lock, flags, file, line) #define WITNESS_DOWNGRADE(lock, flags, file, line) Index: sys/malloc.h =================================================================== RCS file: /home/ncvs/src/sys/sys/malloc.h,v retrieving revision 1.54 diff -u -d -r1.54 malloc.h --- sys/malloc.h 10 Aug 2001 06:37:04 -0000 1.54 +++ sys/malloc.h 28 Feb 2002 10:24:13 -0000 @@ -153,7 +153,7 @@ * Deprecated macro versions of not-quite-malloc() and free(). */ #define MALLOC(space, cast, size, type, flags) \ - (space) = (cast)malloc((u_long)(size), (type), (flags)) + ((space) = (cast)malloc((u_long)(size), (type), (flags))) #define FREE(addr, type) free((addr), (type)) /* Index: sys/sysctl.h =================================================================== RCS file: /home/ncvs/src/sys/sys/sysctl.h,v retrieving revision 1.101 diff -u -d -r1.101 sysctl.h --- sys/sysctl.h 16 Dec 2001 02:55:41 -0000 1.101 +++ sys/sysctl.h 1 Mar 2002 12:19:45 -0000 @@ -133,14 +133,14 @@ struct sysctl_oid_list *oid_parent; SLIST_ENTRY(sysctl_oid) oid_link; int oid_number; - int oid_kind; + u_int oid_kind; void *oid_arg1; int oid_arg2; const char *oid_name; int (*oid_handler)(SYSCTL_HANDLER_ARGS); const char *oid_fmt; int oid_refcnt; - char *descr; + const char *descr; }; #define SYSCTL_IN(r, p, l) (r->newfunc)(r, p, l) ------- =_aaaaaaaaaa0-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message