/* kernel/my_foo.c
 *
 * author : marco corvi <marco_corvi@geocities.com>
 * date   : feb 2001
 *
 * This is my system call "my_foo()"
 *
 */

#include <linux/mm.h>
#include <linux/unistd.h>
/*
#include <linux/smp_lock.h>
*/

/*
#include <sys/time.h>
*/
#include <linux/kernel.h>

#include <asm/uaccess.h>

extern struct timeval xtime;

asmlinkage int sys_my_foo( int flag, struct timeval * thetime ) 
{
  int write_fail;

  printk(KERN_ALERT "my_foo ... \n" );

  cli();

  write_fail = verify_area( VERIFY_WRITE, thetime, sizeof(struct timeval) );
  if (write_fail) {
    printk(KERN_ALERT "my_foo: cannot write into user space\n");
    sti();
    return -1;
  }
  copy_to_user( thetime, &xtime, sizeof(struct timeval) );

  printk(KERN_ALERT "my_foo flag %d\n", flag);

  sti();

  return 0;
}


