syscalls_32.c 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. /*
  2. * Copyright (C) 2000 - 2003 Jeff Dike (jdike@addtoit.com)
  3. * Licensed under the GPL
  4. */
  5. #include <linux/syscalls.h>
  6. #include <sysdep/syscalls.h>
  7. /*
  8. * The prototype on i386 is:
  9. *
  10. * int clone(int flags, void * child_stack, int * parent_tidptr, struct user_desc * newtls
  11. *
  12. * and the "newtls" arg. on i386 is read by copy_thread directly from the
  13. * register saved on the stack.
  14. */
  15. long i386_clone(unsigned long clone_flags, unsigned long newsp,
  16. int __user *parent_tid, void *newtls, int __user *child_tid)
  17. {
  18. return sys_clone(clone_flags, newsp, parent_tid, child_tid);
  19. }
  20. long sys_sigaction(int sig, const struct old_sigaction __user *act,
  21. struct old_sigaction __user *oact)
  22. {
  23. struct k_sigaction new_ka, old_ka;
  24. int ret;
  25. if (act) {
  26. old_sigset_t mask;
  27. if (!access_ok(VERIFY_READ, act, sizeof(*act)) ||
  28. __get_user(new_ka.sa.sa_handler, &act->sa_handler) ||
  29. __get_user(new_ka.sa.sa_restorer, &act->sa_restorer) ||
  30. __get_user(new_ka.sa.sa_flags, &act->sa_flags) ||
  31. __get_user(mask, &act->sa_mask))
  32. return -EFAULT;
  33. siginitset(&new_ka.sa.sa_mask, mask);
  34. }
  35. ret = do_sigaction(sig, act ? &new_ka : NULL, oact ? &old_ka : NULL);
  36. if (!ret && oact) {
  37. if (!access_ok(VERIFY_WRITE, oact, sizeof(*oact)) ||
  38. __put_user(old_ka.sa.sa_handler, &oact->sa_handler) ||
  39. __put_user(old_ka.sa.sa_restorer, &oact->sa_restorer) ||
  40. __put_user(old_ka.sa.sa_flags, &oact->sa_flags) ||
  41. __put_user(old_ka.sa.sa_mask.sig[0], &oact->sa_mask))
  42. return -EFAULT;
  43. }
  44. return ret;
  45. }