(root)/
glibc-2.38/
sysdeps/
unix/
sysv/
linux/
errlist-compat.h
       1  /* Linux sys_errlist compatibility macro definitions.
       2     Copyright (C) 2020-2023 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  #include <limits.h>
      24  
      25  /* Define new compat symbols for symbols  _sys_errlist, sys_errlist,
      26     _sys_nerr, and sys_nerr for version VERSION with NUMBERERR times number of
      27     bytes per long int size.
      28     Both _sys_errlist and sys_errlist alias to _sys_errlist_internal symbol
      29     (defined on errlist.c) while _sys_nerr and sys_nerr created new variable
      30     with the expected size.  */
      31  #ifdef __ASSEMBLER__
      32  # define DEFINE_COMPAT_ERRLIST(NUMBERERR, VERSION) 			    \
      33    declare_object_symbol_alias (__ ## VERSION ## _sys_errlist,		    \
      34  			       _sys_errlist_internal,			    \
      35  			       NUMBERERR * (ULONG_WIDTH / UCHAR_WIDTH))	    \
      36  			       ASM_LINE_SEP				    \
      37    declare_object_symbol_alias (__ ## VERSION ## __sys_errlist,		    \
      38  			       _sys_errlist_internal, 			    \
      39  			       NUMBERERR * (ULONG_WIDTH / UCHAR_WIDTH))	    \
      40  			       ASM_LINE_SEP				    \
      41    compat_symbol (libc, __## VERSION ## _sys_errlist, sys_errlist, VERSION)  \
      42  		 ASM_LINE_SEP						    \
      43    compat_symbol (libc, __## VERSION ## __sys_errlist, _sys_errlist, VERSION)
      44  #else
      45  # define DEFINE_COMPAT_ERRLIST(NUMBERERR, VERSION) 			    \
      46    const int __##VERSION##_sys_nerr = NUMBERERR;				    \
      47    strong_alias (__##VERSION##_sys_nerr, __##VERSION##__sys_nerr);	    \
      48    compat_symbol (libc, __## VERSION ## _sys_nerr, sys_nerr, VERSION);	    \
      49    compat_symbol (libc, __## VERSION ## __sys_nerr, _sys_nerr, VERSION);
      50  #endif
      51  
      52  #endif