[Nelug] ioctl() problem

Eddy Younger eddy at shofar.uklinux.net
Sun Feb 23 23:59:01 UTC 2003


 > Part of foo_ioctl() code:
 > 
 > int foo_ioctl( struct inode *inode,  
 >                struct file *filep, 
 >                unsigned int cmd, 
 >                unsigned long arg)
 > {
 >    int dat, rval;
 >   <... test here for correct command 'cmd' ...>
 >  spin_lock( &foo_lock);
 >  switch (cmd)
 >     {
 >   case: FOO_IO:
 >      dat = _foo_pull( );
 >    spin_unlock( &foo_lock);
 >       rval = put_user( dat, (unsigned long *) arg);




      rval = put_user( dat, &arg);


 > #ifdef DEBUG
 >   printk( KERN_INFO "foo: read %d %x", rval, dat);
 > #endif
 >       return rval;
 >       break;
 >       .............  other case(s)
 > }

-- 
"One university computer center kept a teddy bear near the help desk. 
 Students with mysterious bugs were required to explain them to the bear
 before they could speak to a human counselor" - Practice of Programming 




More information about the Nelug mailing list