errno.h 825 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. /* SPDX-License-Identifier: GPL-2.0+ */
  2. /*
  3. * Copyright (C) 2014 Samsung Electronics
  4. * Przemyslaw Marczak <p.marczak@samsung.com>
  5. */
  6. #ifndef _ERRNO_H
  7. #define _ERRNO_H
  8. #include <linux/errno.h>
  9. #ifdef __SANDBOX__
  10. #define __errno_asm_label asm("__u_boot_errno")
  11. #else
  12. #define __errno_asm_label
  13. #endif
  14. extern int errno __errno_asm_label;
  15. #define __set_errno(val) do { errno = val; } while (0)
  16. /**
  17. * errno_str() - get description for error number
  18. *
  19. * @errno: error number (negative in case of error)
  20. * Return: string describing the error. If CONFIG_ERRNO_STR is not
  21. * defined an empty string is returned.
  22. */
  23. #ifdef CONFIG_ERRNO_STR
  24. const char *errno_str(int errno);
  25. #else
  26. static const char error_message[] = "";
  27. static inline const char *errno_str(int errno)
  28. {
  29. return error_message;
  30. }
  31. #endif
  32. #endif /* _ERRNO_H */