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 9 #include <linux/errno.h> 10 11 extern int errno; 12 13 #define __set_errno(val) do { errno = val; } while (0) 14 15 /** 16 * errno_str() - get description for error number 17 * 18 * @errno: error number (negative in case of error) 19 * Return: string describing the error. If CONFIG_ERRNO_STR is not 20 * defined an empty string is returned. 21 */ 22 #ifdef CONFIG_ERRNO_STR 23 const char *errno_str(int errno); 24 #else 25 static const char error_message[] = ""; 26 errno_str(int errno)27static inline const char *errno_str(int errno) 28 { 29 return error_message; 30 } 31 #endif 32 #endif /* _ERRNO_H */ 33