1 /* Linux sys_errlist compatibility macro definitions.
2    Copyright (C) 2020-2021 Free Software Foundation, Inc.
3    This file is part of the GNU C Library.
4 
5    The GNU C Library is free software; you can redistribute it and/or
6    modify it under the terms of the GNU Lesser General Public
7    License as published by the Free Software Foundation; either
8    version 2.1 of the License, or (at your option) any later version.
9 
10    The GNU C Library is distributed in the hope that it will be useful,
11    but WITHOUT ANY WARRANTY; without even the implied warranty of
12    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13    Lesser General Public License for more details.
14 
15    You should have received a copy of the GNU Lesser General Public
16    License along with the GNU C Library; if not, see
17    <https://www.gnu.org/licenses/>.  */
18 
19 #ifndef _ERRLIST_COMPAT_H
20 #define _ERRLIST_COMPAT_H
21 
22 #include <shlib-compat.h>
23 
24 /* Define new compat symbols for symbols  _sys_errlist, sys_errlist,
25    _sys_nerr, and sys_nerr for version VERSION with NUMBERERR times number of
26    bytes per long int size.
27    Both _sys_errlist and sys_errlist alias to _sys_errlist_internal symbol
28    (defined on errlist.c) while _sys_nerr and sys_nerr created new variable
29    with the expected size.  */
30 #define DEFINE_COMPAT_ERRLIST(NUMBERERR, VERSION) 			     \
31   const int __##VERSION##_sys_nerr = NUMBERERR;				     \
32   strong_alias (__##VERSION##_sys_nerr, __##VERSION##__sys_nerr); 	     \
33   declare_symbol_alias (__ ## VERSION ## _sys_errlist, _sys_errlist_internal,\
34 			object, NUMBERERR * (ULONG_WIDTH / UCHAR_WIDTH));    \
35   declare_symbol_alias (__ ## VERSION ## __sys_errlist,			     \
36 			_sys_errlist_internal, object,			     \
37 			NUMBERERR * (ULONG_WIDTH / UCHAR_WIDTH));	     \
38   compat_symbol (libc, __## VERSION ## _sys_nerr, sys_nerr, VERSION);	     \
39   compat_symbol (libc, __## VERSION ## __sys_nerr, _sys_nerr, VERSION);      \
40   compat_symbol (libc, __## VERSION ## _sys_errlist, sys_errlist, VERSION);  \
41   compat_symbol (libc, __## VERSION ## __sys_errlist, _sys_errlist, VERSION);\
42 
43 #endif
44