diff options
author | Marc Espie <espie@cvs.openbsd.org> | 1999-11-20 18:52:01 +0000 |
---|---|---|
committer | Marc Espie <espie@cvs.openbsd.org> | 1999-11-20 18:52:01 +0000 |
commit | 5514cce54eeb6b5b2fc4bc8ec005b474e563c9e2 (patch) | |
tree | 5116bee8052fbccf26146a95d6ddcdae6ba752ff | |
parent | 1c4a3676fce5aeb3e26ee82bb20b040dbda864d6 (diff) |
ioctl arguments are u_long.
Replaces `undefined' code with `defined' behavior...
gcc 2.96 performs switch cases range analysis, warns about unreachable
cases, and weeds them out.
In
switch(i) {
case VALUE:
}
VALUE is first coerced into the type of i. If i is signed, VALUE is
unsigned and exceeds i range, you lose... the result of the conversion
is undefined.
-rw-r--r-- | sys/arch/i386/i386/pctr.c | 6 | ||||
-rw-r--r-- | sys/arch/i386/isa/pcvt/pcvt_drv.c | 4 | ||||
-rw-r--r-- | sys/arch/i386/isa/pcvt/pcvt_ext.c | 4 | ||||
-rw-r--r-- | sys/arch/i386/isa/pcvt/pcvt_hdr.h | 10 | ||||
-rw-r--r-- | sys/arch/i386/isa/pcvt/pcvt_kbd.c | 4 | ||||
-rw-r--r-- | sys/arch/i386/isa/pcvt/pcvt_sup.c | 4 | ||||
-rw-r--r-- | sys/compat/ibcs2/ibcs2_syscallargs.h | 4 | ||||
-rw-r--r-- | sys/compat/ossaudio/ossaudiovar.h | 4 | ||||
-rw-r--r-- | sys/dev/audio.c | 10 | ||||
-rw-r--r-- | sys/dev/pci/brooktree848.c | 14 | ||||
-rw-r--r-- | sys/net/if.c | 4 |
11 files changed, 34 insertions, 34 deletions
diff --git a/sys/arch/i386/i386/pctr.c b/sys/arch/i386/i386/pctr.c index 2c444b2e5a7..15427a936fc 100644 --- a/sys/arch/i386/i386/pctr.c +++ b/sys/arch/i386/i386/pctr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pctr.c,v 1.12 1998/06/04 04:56:42 downsj Exp $ */ +/* $OpenBSD: pctr.c,v 1.13 1999/11/20 18:51:59 espie Exp $ */ /* * Pentium performance counter driver for OpenBSD. @@ -39,7 +39,7 @@ int pctr_isintel; void pctrattach __P((int)); int pctropen __P((dev_t, int, int, struct proc *)); int pctrclose __P((dev_t, int, int, struct proc *)); -int pctrioctl __P((dev_t, int, caddr_t, int, struct proc *)); +int pctrioctl __P((dev_t, u_long, caddr_t, int, struct proc *)); int p5ctrsel __P((int fflag, u_int cmd, u_int fn)); static __inline void p5ctrrd __P((struct pctrst *st)); int p6ctrsel __P((int fflag, u_int cmd, u_int fn)); @@ -189,7 +189,7 @@ p6ctrrd (st) int pctrioctl (dev, cmd, data, fflag, p) dev_t dev; - int cmd; + u_long cmd; caddr_t data; int fflag; struct proc *p; diff --git a/sys/arch/i386/isa/pcvt/pcvt_drv.c b/sys/arch/i386/isa/pcvt/pcvt_drv.c index ead34c90411..dd2a0ba8fa4 100644 --- a/sys/arch/i386/isa/pcvt/pcvt_drv.c +++ b/sys/arch/i386/isa/pcvt/pcvt_drv.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pcvt_drv.c,v 1.24 1999/09/08 12:56:41 aaron Exp $ */ +/* $OpenBSD: pcvt_drv.c,v 1.25 1999/11/20 18:52:00 espie Exp $ */ /* * Copyright (c) 1992, 1995 Hellmuth Michaelis and Joerg Wunsch. @@ -401,7 +401,7 @@ pctty(Dev_t dev) } int -pcioctl(Dev_t dev, int cmd, caddr_t data, int flag, struct proc *p) +pcioctl(Dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p) { register int error; register struct tty *tp; diff --git a/sys/arch/i386/isa/pcvt/pcvt_ext.c b/sys/arch/i386/isa/pcvt/pcvt_ext.c index 0937e85aa1f..adc4cdc4669 100644 --- a/sys/arch/i386/isa/pcvt/pcvt_ext.c +++ b/sys/arch/i386/isa/pcvt/pcvt_ext.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pcvt_ext.c,v 1.22 1999/09/29 22:29:10 aaron Exp $ */ +/* $OpenBSD: pcvt_ext.c,v 1.23 1999/11/20 18:52:00 espie Exp $ */ /* * Copyright (c) 1992, 1995 Hellmuth Michaelis and Joerg Wunsch. @@ -2562,7 +2562,7 @@ vgapage(int new_screen) * VT_USL ioctl handling *---------------------------------------------------------------------------*/ int -usl_vt_ioctl(Dev_t dev, int cmd, caddr_t data, int flag, struct proc *p) +usl_vt_ioctl(Dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p) { int i, j, error, opri, mode; struct vt_mode newmode; diff --git a/sys/arch/i386/isa/pcvt/pcvt_hdr.h b/sys/arch/i386/isa/pcvt/pcvt_hdr.h index 248c5f62db2..1d3ecfa2073 100644 --- a/sys/arch/i386/isa/pcvt/pcvt_hdr.h +++ b/sys/arch/i386/isa/pcvt/pcvt_hdr.h @@ -1,4 +1,4 @@ -/* $OpenBSD: pcvt_hdr.h,v 1.27 1999/10/20 19:15:51 deraadt Exp $ */ +/* $OpenBSD: pcvt_hdr.h,v 1.28 1999/11/20 18:52:00 espie Exp $ */ /* * Copyright (c) 1992, 1995 Hellmuth Michaelis and Joerg Wunsch. @@ -1033,7 +1033,7 @@ int pcopen ( Dev_t dev, int flag, int mode, struct proc *p ); int pcclose ( Dev_t dev, int flag, int mode, struct proc *p ); int pcread ( Dev_t dev, struct uio *uio, int flag ); int pcwrite ( Dev_t dev, struct uio *uio, int flag ); -int pcioctl ( Dev_t dev, int cmd, caddr_t data, int flag, struct proc *p ); +int pcioctl ( Dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p ); int pcmmap ( Dev_t dev, int offset, int nprot ); struct tty * @@ -1049,7 +1049,7 @@ void pcstart ( struct tty *tp ); void pcstop ( struct tty *tp, int flag ); void switch_screen ( int n, int oldgrafx, int newgrafx ); -int usl_vt_ioctl (Dev_t dev,int cmd,caddr_t data,int flag,struct proc *); +int usl_vt_ioctl (Dev_t dev, u_long cmd,caddr_t data,int flag,struct proc *); int vt_activate ( int newscreen ); int vgapage ( int n ); void get_usl_keymap( keymap_t *map ); @@ -1078,7 +1078,7 @@ int kbd_cmd ( int val ); void kbd_code_init ( void ); void kbd_code_init1 ( void ); void kbd_setmode(int mode); -int kbdioctl ( Dev_t dev, int cmd, caddr_t data, int flag ); +int kbdioctl ( Dev_t dev, u_long cmd, caddr_t data, int flag ); void loadchar ( int fontset, int character, int char_scanlines, u_char *char_table ); void mda2egaorvga ( void ); @@ -1114,7 +1114,7 @@ void vga_screen_off ( void ); void vga_screen_on ( void ); char *vga_string ( int number ); int vga_test ( void ); -int vgaioctl ( Dev_t dev, int cmd, caddr_t data, int flag ); +int vgaioctl ( Dev_t dev, u_long cmd, caddr_t data, int flag ); void vgapaletteio ( unsigned idx, struct rgb *val, int writeit ); void vt_aln ( struct video_state *svsp ); void vt_clearudk ( struct video_state *svsp ); diff --git a/sys/arch/i386/isa/pcvt/pcvt_kbd.c b/sys/arch/i386/isa/pcvt/pcvt_kbd.c index 5add2e802c5..03d2ede8a0e 100644 --- a/sys/arch/i386/isa/pcvt/pcvt_kbd.c +++ b/sys/arch/i386/isa/pcvt/pcvt_kbd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pcvt_kbd.c,v 1.27 1999/10/07 02:43:08 aaron Exp $ */ +/* $OpenBSD: pcvt_kbd.c,v 1.28 1999/11/20 18:52:00 espie Exp $ */ /* * Copyright (c) 1992, 1995 Hellmuth Michaelis and Joerg Wunsch. @@ -1838,7 +1838,7 @@ setkeydef(Ovl_tbl *data) * keyboard ioctl's entry *---------------------------------------------------------------------------*/ int -kbdioctl(Dev_t dev, int cmd, caddr_t data, int flag) +kbdioctl(Dev_t dev, u_long cmd, caddr_t data, int flag) { int key; diff --git a/sys/arch/i386/isa/pcvt/pcvt_sup.c b/sys/arch/i386/isa/pcvt/pcvt_sup.c index 7c1594d89b5..ddaba8d60ae 100644 --- a/sys/arch/i386/isa/pcvt/pcvt_sup.c +++ b/sys/arch/i386/isa/pcvt/pcvt_sup.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pcvt_sup.c,v 1.11 1999/10/16 18:56:36 aaron Exp $ */ +/* $OpenBSD: pcvt_sup.c,v 1.12 1999/11/20 18:52:00 espie Exp $ */ /* * Copyright (c) 1992, 1995 Hellmuth Michaelis and Joerg Wunsch. @@ -109,7 +109,7 @@ static u_short getrand ( void ); * execute vga ioctls *---------------------------------------------------------------------------*/ int -vgaioctl(Dev_t dev, int cmd, caddr_t data, int flag) +vgaioctl(Dev_t dev, u_long cmd, caddr_t data, int flag) { if(minor(dev) >= PCVT_NSCREENS) return -1; diff --git a/sys/compat/ibcs2/ibcs2_syscallargs.h b/sys/compat/ibcs2/ibcs2_syscallargs.h index 1446b718d1c..2968117aacc 100644 --- a/sys/compat/ibcs2/ibcs2_syscallargs.h +++ b/sys/compat/ibcs2/ibcs2_syscallargs.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ibcs2_syscallargs.h,v 1.6 1999/06/07 07:18:35 deraadt Exp $ */ +/* $OpenBSD: ibcs2_syscallargs.h,v 1.7 1999/11/20 18:52:00 espie Exp $ */ /* * System call argument lists. @@ -189,7 +189,7 @@ struct ibcs2_sys_semsys_args { struct ibcs2_sys_ioctl_args { syscallarg(int) fd; - syscallarg(int) cmd; + syscallarg(u_long) cmd; syscallarg(caddr_t) data; }; diff --git a/sys/compat/ossaudio/ossaudiovar.h b/sys/compat/ossaudio/ossaudiovar.h index aa7424c730d..8f28215259c 100644 --- a/sys/compat/ossaudio/ossaudiovar.h +++ b/sys/compat/ossaudio/ossaudiovar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ossaudiovar.h,v 1.2 1998/04/26 22:15:45 provos Exp $ */ +/* $OpenBSD: ossaudiovar.h,v 1.3 1999/11/20 18:52:00 espie Exp $ */ /* $NetBSD: ossaudiovar.h,v 1.4 1997/10/16 16:49:40 augustss Exp $ */ /* @@ -45,7 +45,7 @@ struct oss_sys_ioctl_args { #define OSS_IOC_IN 0x40000000 /* copy in parameters */ #define OSS_IOC_OUT 0x80000000 /* copy out parameters */ #define OSS_IOC_INOUT (OSS_IOC_IN | OSS_IOC_OUT) -#define _OSS_IOCTL(w,x,y,z) ((int)((w)|(((z)&OSS_IOCPARM_MASK)<<16)|((x)<<8)|(y))) +#define _OSS_IOCTL(w,x,y,z) ((u_long)((w)|(((z)&OSS_IOCPARM_MASK)<<16)|((x)<<8)|(y))) #define _OSS_IO(x,y) _OSS_IOCTL(OSS_IOC_VOID, x, y, 0) #define _OSS_IOR(x,y,t) _OSS_IOCTL(OSS_IOC_OUT, x, y, sizeof(t)) #define _OSS_IOW(x,y,t) _OSS_IOCTL(OSS_IOC_IN, x, y, sizeof(t)) diff --git a/sys/dev/audio.c b/sys/dev/audio.c index 6d82fa19950..b4f2fbfb9b8 100644 --- a/sys/dev/audio.c +++ b/sys/dev/audio.c @@ -1,4 +1,4 @@ -/* $OpenBSD: audio.c,v 1.17 1999/06/19 19:49:02 jason Exp $ */ +/* $OpenBSD: audio.c,v 1.18 1999/11/20 18:51:58 espie Exp $ */ /* $NetBSD: audio.c,v 1.105 1998/09/27 16:43:56 christos Exp $ */ /* @@ -108,13 +108,13 @@ int audio_open __P((dev_t, int, int, struct proc *)); int audio_close __P((dev_t, int, int, struct proc *)); int audio_read __P((dev_t, struct uio *, int)); int audio_write __P((dev_t, struct uio *, int)); -int audio_ioctl __P((dev_t, int, caddr_t, int, struct proc *)); +int audio_ioctl __P((dev_t, u_long, caddr_t, int, struct proc *)); int audio_select __P((dev_t, int, struct proc *)); int audio_mmap __P((dev_t, int, int)); int mixer_open __P((dev_t, int, int, struct proc *)); int mixer_close __P((dev_t, int, int, struct proc *)); -int mixer_ioctl __P((dev_t, int, caddr_t, int, struct proc *)); +int mixer_ioctl __P((dev_t, u_long, caddr_t, int, struct proc *)); static void mixer_remove __P((struct audio_softc *, struct proc *p)); static void mixer_signal __P((struct audio_softc *)); @@ -1440,7 +1440,7 @@ audio_write(dev, uio, ioflag) int audio_ioctl(dev, cmd, addr, flag, p) dev_t dev; - int cmd; + u_long cmd; caddr_t addr; int flag; struct proc *p; @@ -2791,7 +2791,7 @@ mixer_close(dev, flags, ifmt, p) int mixer_ioctl(dev, cmd, addr, flag, p) dev_t dev; - int cmd; + u_long cmd; caddr_t addr; int flag; struct proc *p; diff --git a/sys/dev/pci/brooktree848.c b/sys/dev/pci/brooktree848.c index 3fd0f7c7a12..b0af9eee599 100644 --- a/sys/dev/pci/brooktree848.c +++ b/sys/dev/pci/brooktree848.c @@ -1,4 +1,4 @@ -/* $OpenBSD: brooktree848.c,v 1.13 1999/11/03 19:22:52 angelos Exp $ */ +/* $OpenBSD: brooktree848.c,v 1.14 1999/11/20 18:51:59 espie Exp $ */ /* $Roger: brooktree848.c,v 1.85 1999/06/12 14:54:54 roger Exp $ */ /* BT848 Driver for Brooktree's Bt848, Bt848A, Bt849A, Bt878, Bt879 based cards. @@ -1351,7 +1351,7 @@ static int video_open( bktr_ptr_t bktr ); static int video_close( bktr_ptr_t bktr ); static int video_read( bktr_ptr_t bktr, int unit, dev_t dev, struct uio *uio ); static int video_ioctl( bktr_ptr_t bktr, int unit, - int cmd, caddr_t arg, struct proc* pr ); + u_long cmd, caddr_t arg, struct proc* pr ); static void start_capture( bktr_ptr_t bktr, unsigned type ); static void set_fps( bktr_ptr_t bktr, u_short fps ); @@ -1363,7 +1363,7 @@ static void set_fps( bktr_ptr_t bktr, u_short fps ); static int tuner_open( bktr_ptr_t bktr ); static int tuner_close( bktr_ptr_t bktr ); static int tuner_ioctl( bktr_ptr_t bktr, int unit, - int cmd, caddr_t arg, struct proc* pr ); + u_long cmd, caddr_t arg, struct proc* pr ); static int tuner_getchnlset( struct bktr_chnlset *chnlset ); static int tv_channel( bktr_ptr_t bktr, int channel ); @@ -1406,7 +1406,7 @@ static void remote_read(bktr_ptr_t bktr, struct bktr_remote *remote); * ioctls common to both video & tuner. */ static int common_ioctl( bktr_ptr_t bktr, bt848_ptr_t bt848, - int cmd, caddr_t arg ); + u_long cmd, caddr_t arg ); /* @@ -2178,7 +2178,7 @@ vbi_read(bktr_ptr_t bktr, dev_t dev, struct uio *uio) * video ioctls */ static int -video_ioctl( bktr_ptr_t bktr, int unit, int cmd, caddr_t arg, struct proc* pr ) +video_ioctl( bktr_ptr_t bktr, int unit, u_long cmd, caddr_t arg, struct proc* pr ) { bt848_ptr_t bt848; volatile u_char c_temp; @@ -2782,7 +2782,7 @@ video_ioctl( bktr_ptr_t bktr, int unit, int cmd, caddr_t arg, struct proc* pr ) * tuner ioctls */ static int -tuner_ioctl( bktr_ptr_t bktr, int unit, int cmd, caddr_t arg, struct proc* pr ) +tuner_ioctl( bktr_ptr_t bktr, int unit, u_long cmd, caddr_t arg, struct proc* pr ) { bt848_ptr_t bt848; int tmp_int; @@ -3176,7 +3176,7 @@ tuner_ioctl( bktr_ptr_t bktr, int unit, int cmd, caddr_t arg, struct proc* pr ) * common ioctls */ int -common_ioctl( bktr_ptr_t bktr, bt848_ptr_t bt848, int cmd, caddr_t arg ) +common_ioctl( bktr_ptr_t bktr, bt848_ptr_t bt848, u_long cmd, caddr_t arg ) { int pixfmt; unsigned int temp; diff --git a/sys/net/if.c b/sys/net/if.c index 96f9b3b345e..2670eba4e5d 100644 --- a/sys/net/if.c +++ b/sys/net/if.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if.c,v 1.23 1999/11/09 17:49:01 millert Exp $ */ +/* $OpenBSD: if.c,v 1.24 1999/11/20 18:51:58 espie Exp $ */ /* $NetBSD: if.c,v 1.35 1996/05/07 05:26:04 thorpej Exp $ */ /* @@ -639,7 +639,7 @@ ifioctl(so, cmd, data, p) (struct mbuf *) ifp)); #else { - int ocmd = cmd; + u_long ocmd = cmd; switch (cmd) { |