unistd.h 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. /*
  2. * Copyright (C) 2000 - 2004 Jeff Dike (jdike@karaya.com)
  3. * Licensed under the GPL
  4. */
  5. #ifndef _UM_UNISTD_H_
  6. #define _UM_UNISTD_H_
  7. #include <linux/syscalls.h>
  8. #include "linux/resource.h"
  9. #include "asm/uaccess.h"
  10. extern int um_execve(const char *file, char *const argv[], char *const env[]);
  11. #ifdef __KERNEL__
  12. /* We get __ARCH_WANT_OLD_STAT and __ARCH_WANT_STAT64 from the base arch */
  13. #define __ARCH_WANT_IPC_PARSE_VERSION
  14. #define __ARCH_WANT_OLD_READDIR
  15. #define __ARCH_WANT_SYS_ALARM
  16. #define __ARCH_WANT_SYS_GETHOSTNAME
  17. #define __ARCH_WANT_SYS_PAUSE
  18. #define __ARCH_WANT_SYS_SGETMASK
  19. #define __ARCH_WANT_SYS_SIGNAL
  20. #define __ARCH_WANT_SYS_TIME
  21. #define __ARCH_WANT_SYS_UTIME
  22. #define __ARCH_WANT_SYS_WAITPID
  23. #define __ARCH_WANT_SYS_SOCKETCALL
  24. #define __ARCH_WANT_SYS_FADVISE64
  25. #define __ARCH_WANT_SYS_GETPGRP
  26. #define __ARCH_WANT_SYS_LLSEEK
  27. #define __ARCH_WANT_SYS_NICE
  28. #define __ARCH_WANT_SYS_OLD_GETRLIMIT
  29. #define __ARCH_WANT_SYS_OLDUMOUNT
  30. #define __ARCH_WANT_SYS_SIGPENDING
  31. #define __ARCH_WANT_SYS_SIGPROCMASK
  32. #define __ARCH_WANT_SYS_RT_SIGACTION
  33. #endif
  34. #ifdef __KERNEL_SYSCALLS__
  35. #include <linux/compiler.h>
  36. #include <linux/types.h>
  37. static inline int execve(const char *filename, char *const argv[],
  38. char *const envp[])
  39. {
  40. mm_segment_t fs;
  41. int ret;
  42. fs = get_fs();
  43. set_fs(KERNEL_DS);
  44. ret = um_execve(filename, argv, envp);
  45. set_fs(fs);
  46. if (ret >= 0)
  47. return ret;
  48. errno = -(long)ret;
  49. return -1;
  50. }
  51. int sys_execve(char *file, char **argv, char **env);
  52. #endif /* __KERNEL_SYSCALLS__ */
  53. #undef __KERNEL_SYSCALLS__
  54. #include "asm/arch/unistd.h"
  55. #endif /* _UM_UNISTD_H_*/