[Nelug] ioctl() problem

Edward Younger - Sun Volume System Products - Software Engineer Edward.Younger at sun.com
Mon Feb 24 10:27:02 UTC 2003


Ignore this. I obviously hit the send instead of cancel key.

Eddy.

Eddy Younger writes:

 >  > 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 
 > 
 > _______________________________________________
 > Nelug mailing list
 > Nelug at mailman.lug.org.uk
 > http://mailman.lug.org.uk/mailman/listinfo/nelug




More information about the Nelug mailing list