Bug in ino_select() for machines where sizeof(int) != sizeof(long)

Pete Delaney pete at ecrcvax.UUCP
Thu Aug 1 10:00:55 AEST 1985


	There is a small bug in ino_select() for UNIX machines where the
sizeof(int) !=  sizeof(long).  The problem is that i_rd is declared as a
daddr_t and is cast to a dev_t throughout the kernel (yek!).  Anyway,
the code in sys_inode.c is missing the cast.
__________________________________________________________________________
				C O D E
ino_select(fp, which)
	struct file *fp;
	int which;
{
	register struct inode *ip = (struct inode *)fp->f_data;

	switch (ip->i_mode & IFMT) {

	default:
		return (1);		/* XXX */

	case IFCHR:
		return
#ifdef KEEP_4BSD_BUG
		    (*cdevsw[major(ip->i_rdev)].d_select)(ip->i_rdev, which);
#else
		    (*cdevsw[major(ip->i_rdev)].d_select)((dev_t)ip->i_rdev, which);
#endif
	}
}
-------------------------------------------------------------------------------
			T R A C E    I N D  I C A T I O N

<19550,0X35,pid:60,3	>     selscan(): bits:0X00000000 &= ~(1L<<(i:1-1)
<19551,0X35,pid:60,4	>      ino_select(fp:0X0003EB0A, which:1): entry
<19552,0X1A,pid:60,5	>       ttselect(dev:0X00000000, rw:1797): entry
						^	      ^
					        |	      |
						     B U G		
					i_rd should be cast to INT!!
__________________________________________________________________________
-- 

--------------------------------------------
Pete Delaney - Rocky Mnt. Unix Consultant	Phone: (49) 89 92699-139
European Computer-Industry Research Center 	UUCP: mcvax!unido!ecrcvax!pete
ArabellaStrasse 17 				UUCP Domain: pete at ecrcvax.UUCP
D-8000 Muenchen 81, West Germany 		X25: (262)-45890040262
CSNET:pete%ecrcvax.UUCP at Germany.CSNET		     Login: <to be provided?>
------------------------------------------------------------------------------



More information about the Comp.unix.wizards mailing list