syscall.c 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. /*
  2. * Copyright (C) 2000 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
  3. * Licensed under the GPL
  4. */
  5. #include <linux/file.h>
  6. #include <linux/fs.h>
  7. #include <linux/mm.h>
  8. #include <linux/sched.h>
  9. #include <linux/utsname.h>
  10. #include <linux/syscalls.h>
  11. #include <asm/current.h>
  12. #include <asm/mman.h>
  13. #include <asm/uaccess.h>
  14. #include <asm/unistd.h>
  15. long sys_fork(void)
  16. {
  17. return do_fork(SIGCHLD, UPT_SP(&current->thread.regs.regs),
  18. &current->thread.regs, 0, NULL, NULL);
  19. }
  20. long sys_vfork(void)
  21. {
  22. return do_fork(CLONE_VFORK | CLONE_VM | SIGCHLD,
  23. UPT_SP(&current->thread.regs.regs),
  24. &current->thread.regs, 0, NULL, NULL);
  25. }
  26. long sys_clone(unsigned long clone_flags, unsigned long newsp,
  27. void __user *parent_tid, void __user *child_tid)
  28. {
  29. if (!newsp)
  30. newsp = UPT_SP(&current->thread.regs.regs);
  31. return do_fork(clone_flags, newsp, &current->thread.regs, 0, parent_tid,
  32. child_tid);
  33. }
  34. long old_mmap(unsigned long addr, unsigned long len,
  35. unsigned long prot, unsigned long flags,
  36. unsigned long fd, unsigned long offset)
  37. {
  38. long err = -EINVAL;
  39. if (offset & ~PAGE_MASK)
  40. goto out;
  41. err = sys_mmap_pgoff(addr, len, prot, flags, fd, offset >> PAGE_SHIFT);
  42. out:
  43. return err;
  44. }