mirror of
https://github.com/videolan/vlc.git
synced 2024-11-23 09:53:43 +08:00
compat: Linux getauxval() replacement
This was added over a decade ago, but 🤷...
This commit is contained in:
parent
b2a480167b
commit
ea93bcb8d3
43
compat/getauxval.c
Normal file
43
compat/getauxval.c
Normal file
@ -0,0 +1,43 @@
|
||||
/*****************************************************************************
|
||||
* getauxval.c: Linux getauxval() replacement
|
||||
*****************************************************************************
|
||||
* Copyright © 2022 Rémi Denis-Courmont
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation; either version 2.1 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
|
||||
*****************************************************************************/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
extern char **environ;
|
||||
|
||||
unsigned long getauxval(unsigned long type)
|
||||
{
|
||||
const unsigned long *auxv;
|
||||
size_t i = 0;
|
||||
|
||||
while (environ[i++] != NULL);
|
||||
|
||||
auxv = (const void *)&environ[i];
|
||||
|
||||
for (i = 0; auxv[i]; i += 2)
|
||||
if (auxv[i] == type)
|
||||
return auxv[i + 1];
|
||||
|
||||
return 0;
|
||||
}
|
@ -734,6 +734,7 @@ dnl Check for non-standard system calls
|
||||
case "$SYS" in
|
||||
"linux")
|
||||
AC_CHECK_FUNCS([eventfd vmsplice sched_getaffinity recvmmsg memfd_create])
|
||||
AC_REPLACE_FUNCS([getauxval])
|
||||
;;
|
||||
"mingw32")
|
||||
AC_CHECK_FUNCS([_lock_file])
|
||||
|
@ -503,6 +503,11 @@ void *lfind( const void *key, const void *base, size_t *nmemb,
|
||||
void tdestroy( void *root, void (*free_node)(void *nodep) );
|
||||
#endif
|
||||
|
||||
/* sys/auxv.h */
|
||||
#ifndef HAVE_GETAUXVAL
|
||||
unsigned long getauxval(unsigned long);
|
||||
#endif
|
||||
|
||||
/* Random numbers */
|
||||
#ifndef HAVE_NRAND48
|
||||
double erand48 (unsigned short subi[3]);
|
||||
|
Loading…
Reference in New Issue
Block a user