dl-syscalls.h 790 B

12345678910111213141516171819202122232425
  1. /* We can't use the real errno in ldso, since it has not yet
  2. * been dynamicly linked in yet. */
  3. #include "sys/syscall.h"
  4. extern int _dl_errno;
  5. #undef __set_errno
  6. #define __set_errno(X) {(_dl_errno) = (X);}
  7. #undef __syscall_return
  8. #define __syscall_return(type, res) \
  9. do { \
  10. /* \
  11. * Note: when returning from kernel the return value is in r9 \
  12. * \
  13. * This prevents conflicts between return value and arg1 \
  14. * when dispatching signal handler, in other words makes \
  15. * life easier in the system call epilogue (see entry.S) \
  16. */ \
  17. register unsigned long __sr2 __asm__ ("r2") = res; \
  18. if ((unsigned long)(res) >= (unsigned long)(-125)) { \
  19. _dl_errno = -(res); \
  20. __sr2 = -1; \
  21. } \
  22. return (type)(__sr2); \
  23. } while (0)