Blame view

include/errno.h 700 Bytes
83d290c56   Tom Rini   SPDX: Convert all...
1
  /* SPDX-License-Identifier: GPL-2.0+ */
00e9e6d1f   Simon Glass   errno: Add copyri...
2
3
4
  /*
   * Copyright (C) 2014 Samsung Electronics
   * Przemyslaw Marczak <p.marczak@samsung.com>
00e9e6d1f   Simon Glass   errno: Add copyri...
5
   */
65cd3fa81   Wolfgang Denk   Add basic errno s...
6
  #ifndef _ERRNO_H
00e9e6d1f   Simon Glass   errno: Add copyri...
7
  #define _ERRNO_H
65cd3fa81   Wolfgang Denk   Add basic errno s...
8

5d97dff04   Masahiro Yamada   treewide: replace...
9
  #include <linux/errno.h>
65cd3fa81   Wolfgang Denk   Add basic errno s...
10
11
12
13
  
  extern int errno;
  
  #define __set_errno(val) do { errno = val; } while (0)
f279e1d91   Heinrich Schuchardt   lib: errno: avoid...
14
15
16
17
18
19
20
  /**
   * errno_str() - get description for error number
   *
   * @errno:	error number (negative in case of error)
   * Return:	string describing the error. If CONFIG_ERRNO_STR is not
   *		defined an empty string is returned.
   */
59345b1f0   Przemyslaw Marczak   lib: errno: intro...
21
22
  #ifdef CONFIG_ERRNO_STR
  const char *errno_str(int errno);
862887d88   Simon Glass   errno: Allow errn...
23
  #else
f279e1d91   Heinrich Schuchardt   lib: errno: avoid...
24
  static const char error_message[] = "";
862887d88   Simon Glass   errno: Allow errn...
25
26
  static inline const char *errno_str(int errno)
  {
f279e1d91   Heinrich Schuchardt   lib: errno: avoid...
27
  	return error_message;
862887d88   Simon Glass   errno: Allow errn...
28
  }
59345b1f0   Przemyslaw Marczak   lib: errno: intro...
29
  #endif
65cd3fa81   Wolfgang Denk   Add basic errno s...
30
  #endif /* _ERRNO_H */