home *** CD-ROM | disk | FTP | other *** search
/ Il CD di internet / CD.iso / SOURCE / KERNEL-S / V1.0 / LINUX-1.0 / LINUX-1 / linux / fs / proc / kmsg.c < prev    next >
Encoding:
C/C++ Source or Header  |  1993-12-27  |  1.6 KB  |  77 lines

  1. /*
  2.  *  linux/fs/proc/kmsg.c
  3.  *
  4.  *  Copyright (C) 1992  by Linus Torvalds
  5.  *
  6.  */
  7.  
  8. #include <linux/types.h>
  9. #include <linux/errno.h>
  10. #include <linux/sched.h>
  11. #include <linux/kernel.h>
  12.  
  13. #include <asm/segment.h>
  14. #include <asm/io.h>
  15.  
  16. extern unsigned long log_size;
  17. extern struct wait_queue * log_wait;
  18.  
  19. asmlinkage int sys_syslog(int type, char * bug, int count);
  20.  
  21. static int kmsg_open(struct inode * inode, struct file * file)
  22. {
  23.     return sys_syslog(1,NULL,0);
  24. }
  25.  
  26. static void kmsg_release(struct inode * inode, struct file * file)
  27. {
  28.     (void) sys_syslog(0,NULL,0);
  29. }
  30.  
  31. static int kmsg_read(struct inode * inode, struct file * file,char * buf, int count)
  32. {
  33.     return sys_syslog(2,buf,count);
  34. }
  35.  
  36. static int kmsg_select(struct inode *inode, struct file *file, int sel_type, select_table * wait)
  37. {
  38.     if (sel_type != SEL_IN)
  39.         return 0;
  40.     if (log_size)
  41.         return 1;
  42.     select_wait(&log_wait, wait);
  43.     return 0;
  44. }
  45.  
  46.  
  47. static struct file_operations proc_kmsg_operations = {
  48.     NULL,        /* kmsg_lseek */
  49.     kmsg_read,
  50.     NULL,        /* kmsg_write */
  51.     NULL,        /* kmsg_readdir */
  52.     kmsg_select,    /* kmsg_select */
  53.     NULL,        /* kmsg_ioctl */
  54.     NULL,        /* mmap */
  55.     kmsg_open,
  56.     kmsg_release,
  57.     NULL        /* can't fsync */
  58. };
  59.  
  60. struct inode_operations proc_kmsg_inode_operations = {
  61.     &proc_kmsg_operations,    /* default base directory file-ops */
  62.     NULL,            /* create */
  63.     NULL,            /* lookup */
  64.     NULL,            /* link */
  65.     NULL,            /* unlink */
  66.     NULL,            /* symlink */
  67.     NULL,            /* mkdir */
  68.     NULL,            /* rmdir */
  69.     NULL,            /* mknod */
  70.     NULL,            /* rename */
  71.     NULL,            /* readlink */
  72.     NULL,            /* follow_link */
  73.     NULL,            /* bmap */
  74.     NULL,            /* truncate */
  75.     NULL            /* permission */
  76. };
  77.