sys_parisc.c
上传用户:lgb322
上传日期:2013-02-24
资源大小:30529k
文件大小:2k
源码类别:

嵌入式Linux

开发平台:

Unix_Linux

  1. /*
  2.  * linux/arch/parisc/kernel/sys_parisc.c
  3.  *
  4.  * this implements the missing syscalls.
  5.  */
  6. #include <asm/uaccess.h>
  7. #include <linux/file.h>
  8. #include <linux/fs.h>
  9. #include <linux/linkage.h>
  10. #include <linux/mm.h>
  11. #include <linux/mman.h>
  12. #include <linux/smp_lock.h>
  13. /* for some reason, "old_readdir" is the only syscall which does not begin
  14.  * with "sys_", which breaks the ENTRY_* macros in syscall.S so I "fixed"
  15.  * it here.
  16.  */
  17. int sys_old_readdir(unsigned int fd, void *dirent, unsigned int count)
  18. {
  19.     return old_readdir(fd, dirent, count);
  20. }
  21. int sys_pipe(int *fildes)
  22. {
  23. int fd[2];
  24. int error;
  25. lock_kernel();
  26. error = do_pipe(fd);
  27. unlock_kernel();
  28. if (!error) {
  29. if (copy_to_user(fildes, fd, 2*sizeof(int)))
  30. error = -EFAULT;
  31. }
  32. return error;
  33. }
  34. int sys_pause(void)
  35. {
  36. current->state = TASK_INTERRUPTIBLE;
  37. schedule();
  38. return -ERESTARTNOHAND;
  39. }
  40. int sys_mmap(unsigned long addr, unsigned long len,
  41. unsigned long prot, unsigned long flags, unsigned long fd,
  42. unsigned long offset)
  43. {
  44. struct file * file = NULL;
  45. int error;
  46. down_write(&current->mm->mmap_sem);
  47. lock_kernel();
  48. if (!(flags & MAP_ANONYMOUS)) {
  49. error = -EBADF;
  50. file = fget(fd);
  51. if (!file)
  52. goto out;
  53. }
  54. flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE);
  55. error = do_mmap(file, addr, len, prot, flags, offset);
  56. if (file != NULL)
  57. fput(file);
  58. out:
  59. unlock_kernel();
  60. up_write(&current->mm->mmap_sem);
  61. return error;
  62. }
  63. int sys_ioperm(unsigned long from, unsigned long num, int on)
  64. {
  65. return -ENOSYS;
  66. }
  67. long sys_shmat_wrapper(int shmid, void *shmaddr, int shmflag)
  68. {
  69. extern int sys_shmat(int shmid, char *shmaddr, int shmflg,
  70.      unsigned long * raddr);
  71. unsigned long raddr;
  72. int r;
  73. r = sys_shmat(shmid, shmaddr, shmflag, &raddr);
  74. if (r < 0)
  75. return r;
  76. return raddr;
  77. }