52 |
|
/* Stuff which could be defined by defining KERNEL, but |
53 |
|
* that would be a bad idea, so we'll just declare it here |
54 |
|
*/ |
55 |
+ |
#include <linux/version.h> |
56 |
+ |
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) |
57 |
+ |
typedef __uint8_t __u8; |
58 |
+ |
typedef __uint16_t __u16; |
59 |
+ |
typedef __uint32_t __u32; |
60 |
+ |
typedef __uint64_t __u64; |
61 |
+ |
#else |
62 |
|
typedef __uint8_t u8; |
63 |
|
typedef __uint16_t u16; |
64 |
|
typedef __uint32_t u32; |
65 |
|
typedef __uint64_t u64; |
66 |
+ |
#endif |
67 |
|
#include <linux/ethtool.h> |
68 |
|
#include <linux/sockios.h> |
69 |
|
#include <unistd.h> |
683 |
|
network_iface_stat_ptr->speed = ethcmd.speed; |
684 |
|
|
685 |
|
switch (ethcmd.duplex) { |
686 |
< |
case 0x00: |
686 |
> |
case DUPLEX_FULL: |
687 |
|
network_iface_stat_ptr->dup = SG_IFACE_DUPLEX_FULL; |
688 |
|
break; |
689 |
< |
case 0x01: |
689 |
> |
case DUPLEX_HALF: |
690 |
|
network_iface_stat_ptr->dup = SG_IFACE_DUPLEX_HALF; |
691 |
|
break; |
692 |
|
default: |
703 |
|
close(sock); |
704 |
|
fclose(f); |
705 |
|
#endif |
706 |
+ |
#ifdef CYGWIN |
707 |
+ |
sg_set_error(SG_ERROR_UNSUPPORTED, "Cygwin"); |
708 |
+ |
return NULL; |
709 |
+ |
#endif |
710 |
+ |
#ifdef HPUX |
711 |
+ |
sg_set_error(SG_ERROR_UNSUPPORTED, "HP-UX"); |
712 |
+ |
return NULL; |
713 |
+ |
#endif |
714 |
+ |
|
715 |
|
*entries = ifaces; |
716 |
|
return network_iface_stats; |
717 |
|
} |