Blame sysdeps/unix/sysv/linux/dl-librecon.h

Packit 6c4009
/* Optional code to distinguish library flavours.
Packit 6c4009
   Copyright (C) 2001-2018 Free Software Foundation, Inc.
Packit 6c4009
   This file is part of the GNU C Library.
Packit 6c4009
   Contributed by Jakub Jelinek <jakub@redhat.com>, 2001.
Packit 6c4009
Packit 6c4009
   The GNU C Library is free software; you can redistribute it and/or
Packit 6c4009
   modify it under the terms of the GNU Lesser General Public
Packit 6c4009
   License as published by the Free Software Foundation; either
Packit 6c4009
   version 2.1 of the License, or (at your option) any later version.
Packit 6c4009
Packit 6c4009
   The GNU C Library is distributed in the hope that it will be useful,
Packit 6c4009
   but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit 6c4009
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Packit 6c4009
   Lesser General Public License for more details.
Packit 6c4009
Packit 6c4009
   You should have received a copy of the GNU Lesser General Public
Packit 6c4009
   License along with the GNU C Library; if not, see
Packit 6c4009
   <http://www.gnu.org/licenses/>.  */
Packit 6c4009
Packit 6c4009
#ifndef _DL_LIBRECON_H
Packit 6c4009
#define _DL_LIBRECON_H	1
Packit 6c4009
Packit 6c4009
static inline void __attribute__ ((unused, always_inline))
Packit 6c4009
_dl_osversion_init (char *assume_kernel)
Packit 6c4009
{
Packit 6c4009
  unsigned long int i, j, osversion = 0;
Packit 6c4009
  char *p = assume_kernel, *q;
Packit 6c4009
Packit 6c4009
  for (i = 0; i < 3; i++, p = q + 1)
Packit 6c4009
    {
Packit 6c4009
      j = _dl_strtoul (p, &q);
Packit 6c4009
      if (j >= 255 || p == q || (i < 2 && *q && *q != '.'))
Packit 6c4009
	{
Packit 6c4009
	  osversion = 0;
Packit 6c4009
	  break;
Packit 6c4009
	}
Packit 6c4009
      osversion |= j << (16 - 8 * i);
Packit 6c4009
      if (!*q)
Packit 6c4009
	break;
Packit 6c4009
    }
Packit 6c4009
  if (osversion)
Packit 6c4009
    GLRO(dl_osversion) = osversion;
Packit 6c4009
}
Packit 6c4009
Packit 6c4009
/* Recognizing extra environment variables.  */
Packit 6c4009
#define EXTRA_LD_ENVVARS_13 \
Packit 6c4009
    if (memcmp (envline, "ASSUME_KERNEL", 13) == 0)			      \
Packit 6c4009
      {									      \
Packit 6c4009
	_dl_osversion_init (&envline[14]);				      \
Packit 6c4009
	break;								      \
Packit 6c4009
      }
Packit 6c4009
Packit 6c4009
#define DL_OSVERSION_INIT \
Packit 6c4009
  do {									      \
Packit 6c4009
    char *assume_kernel = getenv ("LD_ASSUME_KERNEL");			      \
Packit 6c4009
    if (assume_kernel)							      \
Packit 6c4009
      _dl_osversion_init (assume_kernel);				      \
Packit 6c4009
  } while (0)
Packit 6c4009
Packit 6c4009
#endif /* dl-librecon.h */