aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog26
-rw-r--r--elf/dl-lookup.c1
-rw-r--r--elf/do-lookup.h12
-rw-r--r--math/libm-test.c10
-rw-r--r--stdio-common/vfprintf.c4
-rw-r--r--sysdeps/libm-ieee754/w_j0.c16
-rw-r--r--sysdeps/libm-ieee754/w_j0f.c12
-rw-r--r--sysdeps/libm-ieee754/w_j0l.c10
-rw-r--r--sysdeps/libm-ieee754/w_j1.c16
-rw-r--r--sysdeps/libm-ieee754/w_j1f.c16
-rw-r--r--sysdeps/libm-ieee754/w_j1l.c10
-rw-r--r--sysdeps/libm-ieee754/w_jn.c16
-rw-r--r--sysdeps/libm-ieee754/w_jnf.c12
-rw-r--r--sysdeps/libm-ieee754/w_jnl.c10
-rw-r--r--sysdeps/unix/sysv/linux/i386/sigaction.c2
-rw-r--r--sysdeps/unix/sysv/linux/if_index.c48
-rw-r--r--sysdeps/unix/sysv/linux/kernel-features.h5
17 files changed, 130 insertions, 96 deletions
diff --git a/ChangeLog b/ChangeLog
index 7671f61e47..d7fa0d48a5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,31 @@
1999-06-06 Ulrich Drepper <drepper@cygnus.com>
+ * sysdeps/unix/sysv/linux/kernel-features.h: Define
+ __ASSUME_SIOCGIFNAME for kernel >= 2.1.50.
+ * sysdeps/unix/sysv/linux/if_index.c: Correct typo (SIOGIFNAME ->
+ SIOCGIFNAME) and use __ASSUME_SIOCGIFNAME.
+
+ * sysdeps/libm-ieee754/w_j0.c: Remove __ from symbol definitions.
+ * sysdeps/libm-ieee754/w_j0f.c: Likewise.
+ * sysdeps/libm-ieee754/w_j0l.c: Likewise.
+ * sysdeps/libm-ieee754/w_j1.c: Likewise.
+ * sysdeps/libm-ieee754/w_j1f.c: Likewise.
+ * sysdeps/libm-ieee754/w_j1l.c: Likewise.
+ * sysdeps/libm-ieee754/w_jn.c: Likewise.
+ * sysdeps/libm-ieee754/w_jnf.c: Likewise.
+ * sysdeps/libm-ieee754/w_jnl.c: Likewise.
+
+ * stdio-common.c: Correct typos.
+
+ * math/libm-test.c (jn_test): Adjust delta.
+ (y1_test): Likewise.
+ (yn_test): Likewise.
+
+ * elf/do-lookup.h: It should never happen that if we expect a versioned
+ symbol from a file the file has no version table. This should have
+ been checked in dl-version.c.
+ * elf/dl-lookup.c: Include assert.h.
+
* sysdeps/unix/sysv/linux/i386/sigaction.c: Correct restorer
function handling.
diff --git a/elf/dl-lookup.c b/elf/dl-lookup.c
index 16173c9068..7646587833 100644
--- a/elf/dl-lookup.c
+++ b/elf/dl-lookup.c
@@ -18,6 +18,7 @@
Boston, MA 02111-1307, USA. */
#include <alloca.h>
+#include <assert.h>
#include <string.h>
#include <unistd.h>
#include <elf/ldsodefs.h>
diff --git a/elf/do-lookup.h b/elf/do-lookup.h
index 01ad29345e..147560bd32 100644
--- a/elf/do-lookup.h
+++ b/elf/do-lookup.h
@@ -99,10 +99,14 @@ FCT (const char *undef_name, unsigned long int hash,
/* We need a versioned symbol but haven't found any. If
this is the object which is referenced in the verneed
entry it is a bug in the library since a symbol must
- not simply disappear. */
- if (version->filename != NULL
- && _dl_name_match_p (version->filename, map))
- return -2;
+ not simply disappear.
+
+ It would also be a bug in the object since it means that
+ the list of required versions is incomplete and so the
+ tests in dl-version.c haven't found a problem.*/
+ assert (version->filename == NULL
+ || ! _dl_name_match_p (version->filename, map));
+
/* Otherwise we accept the symbol. */
}
else
diff --git a/math/libm-test.c b/math/libm-test.c
index 49cce03d00..3e5033094c 100644
--- a/math/libm-test.c
+++ b/math/libm-test.c
@@ -5618,7 +5618,7 @@ jn_test (void)
CHOOSE(0, 0, 3e-17));
check ("jn (10, 0) = 0", FUNC(jn) (10, 0.0), 0.0);
check_eps ("jn (10, 0.1) = 2.6905...*10^-20", FUNC(jn) (10, 0.1), 0.26905328954342155795e-19,
- CHOOSE(0, 2e-35, 2e-27));
+ CHOOSE(0, 2e-35, 4e-27));
check_eps ("jn (10, 0.7) = 7.517...*10^-12", FUNC(jn) (10, 0.7), 0.75175911502153953928e-11,
CHOOSE(0, 7e-27, 9e-19));
check_eps ("jn (10, 1.0) = 2.630...*10^-11", FUNC(jn) (10, 1.0), 0.26306151236874532070e-9,
@@ -5682,7 +5682,8 @@ y1_test (void)
CHOOSE(0, 3e-16, 0));
check_eps ("y1 (1.0) = -0.78121...", FUNC(y1) (1.0), -0.78121282130028871655,
CHOOSE(0, 2e-16, 0));
- check ("y1 (1.5) = -0.41230...", FUNC(y1) (1.5), -0.41230862697391129595);
+ check_eps ("y1 (1.5) = -0.41230...", FUNC(y1) (1.5), -0.41230862697391129595,
+ CHOOSE (0, 0, 3e-8));
check_eps ("y1 (2.0) = -0.10703...", FUNC(y1) (2.0), -0.10703243154093754689,
CHOOSE(0, 2e-17, 1.5e-8));
check_eps ("y1 (8.0) = -0.15806...", FUNC(y1) (8.0), -0.15806046173124749426,
@@ -5735,7 +5736,8 @@ yn_test (void)
CHOOSE(0, 3e-16, 0));
check_eps ("yn (1, 1.0) = -0.78121...", FUNC(yn) (1, 1.0), -0.78121282130028871655,
CHOOSE(0, 2e-16, 0));
- check ("yn (1, 1.5) = -0.41230...", FUNC(yn) (1, 1.5), -0.41230862697391129595);
+ check_eps ("yn (1, 1.5) = -0.41230...", FUNC(yn) (1, 1.5), -0.41230862697391129595,
+ CHOOSE (0, 0, 3e-8));
check_eps ("yn (1, 2.0) = -0.10703...", FUNC(yn) (1, 2.0), -0.10703243154093754689,
CHOOSE(0, 2e-17, 2e-8));
check_eps ("yn (1, 8.0) = -0.15806...", FUNC(yn) (1, 8.0), -0.15806046173124749426,
@@ -5764,7 +5766,7 @@ yn_test (void)
check_eps ("yn (10, 0.1) = -1.183...*10^18", FUNC(yn) (10, 0.1), -0.11831335132045197885e19,
CHOOSE(0, 6e2, 2e11));
check_eps ("yn (10, 0.7) = -4.244...*10^9", FUNC(yn) (10, 0.7), -0.42447194260703866924e10,
- CHOOSE(0, 3e-6, 6e2));
+ CHOOSE(0, 3e-6, 8e2));
check_eps ("yn (10, 1.0) = -1.216...*10^8", FUNC(yn) (10, 1.0), -0.12161801427868918929e9,
CHOOSE(0, 0, 9));
check_eps ("yn (10, 2.0) = -129184.5...", FUNC(yn) (10, 2.0), -129184.54220803928264,
diff --git a/stdio-common/vfprintf.c b/stdio-common/vfprintf.c
index e544c6518c..390ce91f71 100644
--- a/stdio-common/vfprintf.c
+++ b/stdio-common/vfprintf.c
@@ -1088,8 +1088,8 @@ vfprintf (FILE *s, const CHAR_T *format, va_list ap)
int showsign = 0; /* Always begin with plus or minus sign. */
int group = 0; /* Print numbers according grouping rules. */
int is_long_double = 0; /* Argument is long double/ long long int. */
- int is_short = 0; /* Argument is long int. */
- int is_long = 0; /* Argument is short int. */
+ int is_short = 0; /* Argument is short int. */
+ int is_long = 0; /* Argument is long int. */
int is_char = 0; /* Argument is promoted (unsigned) char. */
int width = 0; /* Width of output; 0 means none specified. */
int prec = -1; /* Precision of output; -1 means none specified. */
diff --git a/sysdeps/libm-ieee754/w_j0.c b/sysdeps/libm-ieee754/w_j0.c
index c327e1c98f..5a018760bb 100644
--- a/sysdeps/libm-ieee754/w_j0.c
+++ b/sysdeps/libm-ieee754/w_j0.c
@@ -22,9 +22,9 @@ static char rcsid[] = "$NetBSD: w_j0.c,v 1.6 1995/05/10 20:49:11 jtc Exp $";
#include "math_private.h"
#ifdef __STDC__
- double __j0(double x) /* wrapper j0 */
+ double j0(double x) /* wrapper j0 */
#else
- double __j0(x) /* wrapper j0 */
+ double j0(x) /* wrapper j0 */
double x;
#endif
{
@@ -39,17 +39,15 @@ static char rcsid[] = "$NetBSD: w_j0.c,v 1.6 1995/05/10 20:49:11 jtc Exp $";
return z;
#endif
}
-weak_alias (__j0, j0)
#ifdef NO_LONG_DOUBLE
-strong_alias (__j0, __j0l)
-weak_alias (__j0, j0l)
+strong_alias (j0, j0l)
#endif
#ifdef __STDC__
- double __y0(double x) /* wrapper y0 */
+ double y0(double x) /* wrapper y0 */
#else
- double __y0(x) /* wrapper y0 */
+ double y0(x) /* wrapper y0 */
double x;
#endif
{
@@ -73,8 +71,6 @@ weak_alias (__j0, j0l)
return z;
#endif
}
-weak_alias (__y0, y0)
#ifdef NO_LONG_DOUBLE
-strong_alias (__y0, __y0l)
-weak_alias (__y0, y0l)
+strong_alias (y0, y0l)
#endif
diff --git a/sysdeps/libm-ieee754/w_j0f.c b/sysdeps/libm-ieee754/w_j0f.c
index cc8ec6f2d9..32e2eebb56 100644
--- a/sysdeps/libm-ieee754/w_j0f.c
+++ b/sysdeps/libm-ieee754/w_j0f.c
@@ -8,7 +8,7 @@
*
* Developed at SunPro, a Sun Microsystems, Inc. business.
* Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice
+ * software is freely granted, provided that this notice
* is preserved.
* ====================================================
*/
@@ -25,9 +25,9 @@ static char rcsid[] = "$NetBSD: w_j0f.c,v 1.3 1995/05/10 20:49:13 jtc Exp $";
#include "math_private.h"
#ifdef __STDC__
- float __j0f(float x) /* wrapper j0f */
+ float j0f(float x) /* wrapper j0f */
#else
- float __j0f(x) /* wrapper j0f */
+ float j0f(x) /* wrapper j0f */
float x;
#endif
{
@@ -43,12 +43,11 @@ static char rcsid[] = "$NetBSD: w_j0f.c,v 1.3 1995/05/10 20:49:13 jtc Exp $";
return z;
#endif
}
-weak_alias (__j0f, j0f)
#ifdef __STDC__
- float __y0f(float x) /* wrapper y0f */
+ float y0f(float x) /* wrapper y0f */
#else
- float __y0f(x) /* wrapper y0f */
+ float y0f(x) /* wrapper y0f */
float x;
#endif
{
@@ -73,4 +72,3 @@ weak_alias (__j0f, j0f)
return z;
#endif
}
-weak_alias (__y0f, y0f)
diff --git a/sysdeps/libm-ieee754/w_j0l.c b/sysdeps/libm-ieee754/w_j0l.c
index 7b4144c95e..b74d9ddcff 100644
--- a/sysdeps/libm-ieee754/w_j0l.c
+++ b/sysdeps/libm-ieee754/w_j0l.c
@@ -26,9 +26,9 @@ static char rcsid[] = "$NetBSD: $";
#include "math_private.h"
#ifdef __STDC__
- long double __j0l(long double x) /* wrapper j0l */
+ long double j0l(long double x) /* wrapper j0l */
#else
- long double __j0l(x) /* wrapper j0 */
+ long double j0l(x) /* wrapper j0 */
long double x;
#endif
{
@@ -43,12 +43,11 @@ static char rcsid[] = "$NetBSD: $";
return z;
#endif
}
-weak_alias (__j0l, j0l)
#ifdef __STDC__
- long double __y0l(long double x) /* wrapper y0l */
+ long double y0l(long double x) /* wrapper y0l */
#else
- long double __y0l(x) /* wrapper y0 */
+ long double y0l(x) /* wrapper y0 */
long double x;
#endif
{
@@ -72,4 +71,3 @@ weak_alias (__j0l, j0l)
return z;
#endif
}
-weak_alias (__y0l, y0l)
diff --git a/sysdeps/libm-ieee754/w_j1.c b/sysdeps/libm-ieee754/w_j1.c
index ae6e9b5537..39fe8543b1 100644
--- a/sysdeps/libm-ieee754/w_j1.c
+++ b/sysdeps/libm-ieee754/w_j1.c
@@ -22,9 +22,9 @@ static char rcsid[] = "$NetBSD: w_j1.c,v 1.6 1995/05/10 20:49:15 jtc Exp $";
#include "math_private.h"
#ifdef __STDC__
- double __j1(double x) /* wrapper j1 */
+ double j1(double x) /* wrapper j1 */
#else
- double __j1(x) /* wrapper j1 */
+ double j1(x) /* wrapper j1 */
double x;
#endif
{
@@ -40,17 +40,15 @@ static char rcsid[] = "$NetBSD: w_j1.c,v 1.6 1995/05/10 20:49:15 jtc Exp $";
return z;
#endif
}
-weak_alias (__j1, j1)
#ifdef NO_LONG_DOUBLE
-strong_alias (__j1, __j1l)
-weak_alias (__j1, j1l)
+strong_alias (j1, j1l)
#endif
#ifdef __STDC__
- double __y1(double x) /* wrapper y1 */
+ double y1(double x) /* wrapper y1 */
#else
- double __y1(x) /* wrapper y1 */
+ double y1(x) /* wrapper y1 */
double x;
#endif
{
@@ -74,8 +72,6 @@ weak_alias (__j1, j1l)
return z;
#endif
}
-weak_alias (__y1, y1)
#ifdef NO_LONG_DOUBLE
-strong_alias (__y1, __y1l)
-weak_alias (__y1, y1l)
+strong_alias (y1, y1l)
#endif
diff --git a/sysdeps/libm-ieee754/w_j1f.c b/sysdeps/libm-ieee754/w_j1f.c
index a1419b31b8..2a7c8db819 100644
--- a/sysdeps/libm-ieee754/w_j1f.c
+++ b/sysdeps/libm-ieee754/w_j1f.c
@@ -8,7 +8,7 @@
*
* Developed at SunPro, a Sun Microsystems, Inc. business.
* Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice
+ * software is freely granted, provided that this notice
* is preserved.
* ====================================================
*/
@@ -17,17 +17,17 @@
static char rcsid[] = "$NetBSD: w_j1f.c,v 1.3 1995/05/10 20:49:17 jtc Exp $";
#endif
-/*
- * wrapper of j1f,y1f
+/*
+ * wrapper of j1f,y1f
*/
#include "math.h"
#include "math_private.h"
#ifdef __STDC__
- float __j1f(float x) /* wrapper j1f */
+ float j1f(float x) /* wrapper j1f */
#else
- float __j1f(x) /* wrapper j1f */
+ float j1f(x) /* wrapper j1f */
float x;
#endif
{
@@ -44,12 +44,11 @@ static char rcsid[] = "$NetBSD: w_j1f.c,v 1.3 1995/05/10 20:49:17 jtc Exp $";
return z;
#endif
}
-weak_alias (__j1f, j1f)
#ifdef __STDC__
- float __y1f(float x) /* wrapper y1f */
+ float y1f(float x) /* wrapper y1f */
#else
- float __y1f(x) /* wrapper y1f */
+ float y1f(x) /* wrapper y1f */
float x;
#endif
{
@@ -74,4 +73,3 @@ weak_alias (__j1f, j1f)
return z;
#endif
}
-weak_alias (__y1f, y1f)
diff --git a/sysdeps/libm-ieee754/w_j1l.c b/sysdeps/libm-ieee754/w_j1l.c
index 223ab79cde..49a486cf8e 100644
--- a/sysdeps/libm-ieee754/w_j1l.c
+++ b/sysdeps/libm-ieee754/w_j1l.c
@@ -26,9 +26,9 @@ static char rcsid[] = "$NetBSD: $";
#include "math_private.h"
#ifdef __STDC__
- long double __j1l(long double x) /* wrapper j1l */
+ long double j1l(long double x) /* wrapper j1l */
#else
- long double __j1l(x) /* wrapper j1l */
+ long double j1l(x) /* wrapper j1l */
long double x;
#endif
{
@@ -44,12 +44,11 @@ static char rcsid[] = "$NetBSD: $";
return z;
#endif
}
-weak_alias (__j1l, j1l)
#ifdef __STDC__
- long double __y1l(long double x) /* wrapper y1l */
+ long double y1l(long double x) /* wrapper y1l */
#else
- long double __y1l(x) /* wrapper y1l */
+ long double y1l(x) /* wrapper y1l */
long double x;
#endif
{
@@ -73,4 +72,3 @@ weak_alias (__j1l, j1l)
return z;
#endif
}
-weak_alias (__y1l, y1l)
diff --git a/sysdeps/libm-ieee754/w_jn.c b/sysdeps/libm-ieee754/w_jn.c
index ecd86c0d8b..85fc383fb7 100644
--- a/sysdeps/libm-ieee754/w_jn.c
+++ b/sysdeps/libm-ieee754/w_jn.c
@@ -44,9 +44,9 @@ static char rcsid[] = "$NetBSD: w_jn.c,v 1.6 1995/05/10 20:49:19 jtc Exp $";
#include "math_private.h"
#ifdef __STDC__
- double __jn(int n, double x) /* wrapper jn */
+ double jn(int n, double x) /* wrapper jn */
#else
- double __jn(n,x) /* wrapper jn */
+ double jn(n,x) /* wrapper jn */
double x; int n;
#endif
{
@@ -62,17 +62,15 @@ static char rcsid[] = "$NetBSD: w_jn.c,v 1.6 1995/05/10 20:49:19 jtc Exp $";
return z;
#endif
}
-weak_alias (__jn, jn)
#ifdef NO_LONG_DOUBLE
-strong_alias (__jn, __jnl)
-weak_alias (__jn, jnl)
+strong_alias (jn, jnl)
#endif
#ifdef __STDC__
- double __yn(int n, double x) /* wrapper yn */
+ double yn(int n, double x) /* wrapper yn */
#else
- double __yn(n,x) /* wrapper yn */
+ double yn(n,x) /* wrapper yn */
double x; int n;
#endif
{
@@ -96,8 +94,6 @@ weak_alias (__jn, jnl)
return z;
#endif
}
-weak_alias (__yn, yn)
#ifdef NO_LONG_DOUBLE
-strong_alias (__yn, __ynl)
-weak_alias (__yn, ynl)
+strong_alias (yn, ynl)
#endif
diff --git a/sysdeps/libm-ieee754/w_jnf.c b/sysdeps/libm-ieee754/w_jnf.c
index 82cdc9f769..63ad335573 100644
--- a/sysdeps/libm-ieee754/w_jnf.c
+++ b/sysdeps/libm-ieee754/w_jnf.c
@@ -8,7 +8,7 @@
*
* Developed at SunPro, a Sun Microsystems, Inc. business.
* Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice
+ * software is freely granted, provided that this notice
* is preserved.
* ====================================================
*/
@@ -21,9 +21,9 @@ static char rcsid[] = "$NetBSD: w_jnf.c,v 1.3 1995/05/10 20:49:21 jtc Exp $";
#include "math_private.h"
#ifdef __STDC__
- float __jnf(int n, float x) /* wrapper jnf */
+ float jnf(int n, float x) /* wrapper jnf */
#else
- float __jnf(n,x) /* wrapper jnf */
+ float jnf(n,x) /* wrapper jnf */
float x; int n;
#endif
{
@@ -40,12 +40,11 @@ static char rcsid[] = "$NetBSD: w_jnf.c,v 1.3 1995/05/10 20:49:21 jtc Exp $";
return z;
#endif
}
-weak_alias (__jnf, jnf)
#ifdef __STDC__
- float __ynf(int n, float x) /* wrapper ynf */
+ float ynf(int n, float x) /* wrapper ynf */
#else
- float __ynf(n,x) /* wrapper ynf */
+ float ynf(n,x) /* wrapper ynf */
float x; int n;
#endif
{
@@ -70,4 +69,3 @@ weak_alias (__jnf, jnf)
return z;
#endif
}
-weak_alias (__ynf, ynf)
diff --git a/sysdeps/libm-ieee754/w_jnl.c b/sysdeps/libm-ieee754/w_jnl.c
index 0a243db30a..866e3cdb00 100644
--- a/sysdeps/libm-ieee754/w_jnl.c
+++ b/sysdeps/libm-ieee754/w_jnl.c
@@ -48,9 +48,9 @@ static char rcsid[] = "$NetBSD: $";
#include "math_private.h"
#ifdef __STDC__
- long double __jnl(int n, long double x) /* wrapper jnl */
+ long double jnl(int n, long double x) /* wrapper jnl */
#else
- long double __jnl(n,x) /* wrapper jnl */
+ long double jnl(n,x) /* wrapper jnl */
long double x; int n;
#endif
{
@@ -66,12 +66,11 @@ static char rcsid[] = "$NetBSD: $";
return z;
#endif
}
-weak_alias (__jnl, jnl)
#ifdef __STDC__
- long double __ynl(int n, long double x) /* wrapper ynl */
+ long double ynl(int n, long double x) /* wrapper ynl */
#else
- long double __ynl(n,x) /* wrapper ynl */
+ long double ynl(n,x) /* wrapper ynl */
long double x; int n;
#endif
{
@@ -95,4 +94,3 @@ weak_alias (__jnl, jnl)
return z;
#endif
}
-weak_alias (__ynl, ynl)
diff --git a/sysdeps/unix/sysv/linux/i386/sigaction.c b/sysdeps/unix/sysv/linux/i386/sigaction.c
index fddb22a4e0..c126cdaee8 100644
--- a/sysdeps/unix/sysv/linux/i386/sigaction.c
+++ b/sysdeps/unix/sysv/linux/i386/sigaction.c
@@ -75,7 +75,7 @@ __sigaction (int sig, const struct sigaction *act, struct sigaction *oact)
{
kact.k_sa_handler = act->sa_handler;
memcpy (&kact.sa_mask, &act->sa_mask, sizeof (sigset_t));
- kact.sa_flags = act->sa_flags;
+ kact.sa_flags = act->sa_flags | SA_RESTORER;
kact.sa_restorer = ((act->sa_flags & SA_SIGINFO)
? &restore_rt : &restore);
diff --git a/sysdeps/unix/sysv/linux/if_index.c b/sysdeps/unix/sysv/linux/if_index.c
index 9b3db6abfb..67fba93cd4 100644
--- a/sysdeps/unix/sysv/linux/if_index.c
+++ b/sysdeps/unix/sysv/linux/if_index.c
@@ -26,6 +26,8 @@
#include <sys/ioctl.h>
#include <bits/libc-lock.h>
+#include "kernel-features.h"
+
/* Try to get a socket to talk to the kernel. */
#if defined SIOGIFINDEX || defined SIOGIFNAME
static int
@@ -120,8 +122,12 @@ if_nameindex (void)
unsigned int nifs, i;
int rq_len;
struct if_nameindex *idx = NULL;
+# if __ASSUME_SIOCGIFNAME == 0
static int old_siocgifconf;
-#define RQ_IFS 4
+# else
+# define old_siocgifconf 0
+# endif
+# define RQ_IFS 4
if (fd < 0)
return NULL;
@@ -136,7 +142,9 @@ if_nameindex (void)
ifc.ifc_len = 0;
if (__ioctl (fd, SIOCGIFCONF, &ifc) < 0 || ifc.ifc_len == 0)
{
+# if __ASSUME_SIOCGIFNAME == 0
old_siocgifconf = 1;
+# endif
rq_len = RQ_IFS * sizeof (struct ifreq);
}
else
@@ -199,24 +207,31 @@ if_nameindex (void)
char *
if_indextoname (unsigned int ifindex, char *ifname)
{
-#ifndef SIOGIFINDEX
+#if !defined SIOGIFINDEX && __ASSUME_SIOCGIFNAME == 0
__set_errno (ENOSYS);
return NULL;
#else
+# if __ASSUME_SIOCGIFNAME == 0
struct if_nameindex *idx;
struct if_nameindex *p;
char *result = NULL;
+# endif
-#ifdef SIOGIFNAME
+# if defined SIOCGIFNAME || __ASSUME_SIOCGIFNAME > 0
/* We may be able to do the conversion directly, rather than searching a
list. This ioctl is not present in kernels before version 2.1.50. */
struct ifreq ifr;
int fd;
- static int siogifname_works_not;
+# if __ASSUME_SIOCGIFNAME == 0
+ static int siocgifname_works_not;
- if (!siogifname_works_not)
+ if (!siocgifname_works_not)
+# endif
{
+# if __ASSUME_SIOCGIFNAME == 0
int serrno = errno;
+# endif
+ int status;
fd = opensock ();
@@ -224,23 +239,27 @@ if_indextoname (unsigned int ifindex, char *ifname)
return NULL;
ifr.ifr_ifindex = ifindex;
- if (__ioctl (fd, SIOGIFNAME, &ifr) < 0)
+ status = __ioctl (fd, SIOCGIFNAME, &ifr);
+
+ __close (fd);
+
+# if __ASSUME_SIOCGIFNAME == 0
+ if (status < 0)
{
if (errno == EINVAL)
- siogifname_works_not = 1; /* Don't make the same mistake twice. */
+ siocgifname_works_not = 1; /* Don't make the same mistake twice. */
}
else
- {
- __close (fd);
- return strncpy (ifname, ifr.ifr_name, IFNAMSIZ);
- }
-
- __close (fd);
+ return strncpy (ifname, ifr.ifr_name, IFNAMSIZ);
__set_errno (serrno);
+# else
+ return status < 0 ? NULL : strncpy (ifname, ifr.ifr_name, IFNAMSIZ);
+# endif
}
-#endif
+# endif
+# if __ASSUME_SIOCGIFNAME == 0
idx = if_nameindex ();
if (idx != NULL)
@@ -255,5 +274,6 @@ if_indextoname (unsigned int ifindex, char *ifname)
if_freenameindex (idx);
}
return result;
+# endif
#endif
}
diff --git a/sysdeps/unix/sysv/linux/kernel-features.h b/sysdeps/unix/sysv/linux/kernel-features.h
index 1bd7ba4ba8..db2bfe24d5 100644
--- a/sysdeps/unix/sysv/linux/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/kernel-features.h
@@ -69,3 +69,8 @@
#if __LINUX_KERNEL_VERSION >= 131584
# define __ASSUME_SETRESUID_SYSCALL 1
#endif
+
+/* The SIOCGIFNAME ioctl is available starting with 2.1.50. */
+#if __LINUX_KERNEL_VERSION >= 131408
+# define __ASSUME_SIOCGIFNAME 1
+#endif