1
1

opal/util/ethtool: fix compilation on older Linux when struct ethtool_cmd has no speed_hi field

Refs: open-mpi/ompi#1628
Этот коммит содержится в:
Gilles Gouaillardet 2016-05-19 11:42:22 +09:00
родитель 66f53ec29a
Коммит fd93d236b1
2 изменённых файлов: 43 добавлений и 1 удалений

Просмотреть файл

@ -653,6 +653,42 @@ AC_CHECK_DECLS([ethtool_cmd_speed, SIOCETHTOOL],
#include <linux/sockios.h>
#endif])
AC_CHECK_MEMBERS([struct ethtool_cmd.speed_hi],
[], [], [AC_INCLUDES_DEFAULT
#ifdef HAVE_LINUX_ETHTOOL_H
#include <linux/ethtool.h>
#endif
#ifdef HAVE_LINUX_SOCKIOS_H
#include <linux/sockios.h>
#endif])
AC_CHECK_MEMBERS([struct ethtool_cmd.speed_hi],
[], [], [AC_INCLUDES_DEFAULT
#ifdef HAVE_LINUX_ETHTOOL_H
#include <linux/ethtool.h>
#endif
#ifdef HAVE_LINUX_SOCKIOS_H
#include <linux/sockios.h>
#endif])
AC_CHECK_MEMBERS([struct ethtool_cmd.speed_hi],
[], [], [AC_INCLUDES_DEFAULT
#ifdef HAVE_LINUX_ETHTOOL_H
#include <linux/ethtool.h>
#endif
#ifdef HAVE_LINUX_SOCKIOS_H
#include <linux/sockios.h>
#endif])
AC_CHECK_MEMBERS([struct ethtool_cmd.speed_hi],
[], [], [AC_INCLUDES_DEFAULT
#ifdef HAVE_LINUX_ETHTOOL_H
#include <linux/ethtool.h>
#endif
#ifdef HAVE_LINUX_SOCKIOS_H
#include <linux/sockios.h>
#endif])
AC_CHECK_DECLS([AF_UNSPEC, PF_UNSPEC, AF_INET6, PF_INET6],
[], [], [AC_INCLUDES_DEFAULT
#if HAVE_SYS_SOCKET_H

Просмотреть файл

@ -1,5 +1,7 @@
/*
* Copyright (c) 2016 Karol Mroz. All rights reserved.
* Copyright (c) 2016 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
@ -31,11 +33,15 @@
#include "opal/util/ethtool.h"
#include "opal/util/if.h"
#if !defined(HAVE_DECL_ETHTOOL_CMD_SPEED)
#if ! HAVE_DECL_ETHTOOL_CMD_SPEED
static inline unsigned int
ethtool_cmd_speed(const struct ethtool_cmd *ep)
{
#ifdef HAVE_STRUCT_ETHTOOL_CMD_SPEED_HI
return (ep->speed_hi << 16) | ep->speed;
#else
return ep->speed;
#endif
}
#endif