Compiles again on BSD
This commit is contained in:
parent
f3f26a0f40
commit
409e53b7b9
10
src/probe.c
10
src/probe.c
|
@ -130,16 +130,18 @@ struct ifinfo
|
||||||
int stats[IF_LAST+1];
|
int stats[IF_LAST+1];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#ifdef _GNU_SOURCE
|
||||||
static int ifinfo_append(struct ifinfo ** dev, char * buf, int nb);
|
static int ifinfo_append(struct ifinfo ** dev, char * buf, int nb);
|
||||||
|
#endif
|
||||||
static int ifinfo(struct ifinfo ** dev)
|
static int ifinfo(struct ifinfo ** dev)
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
#ifdef _GNU_SOURCE
|
||||||
FILE * fp;
|
FILE * fp;
|
||||||
char buf[200];
|
char buf[200];
|
||||||
int i;
|
int i;
|
||||||
int len;
|
int len;
|
||||||
|
|
||||||
#ifdef _GNU_SOURCE
|
|
||||||
if((fp = fopen("/proc/net/dev", "r")) == NULL)
|
if((fp = fopen("/proc/net/dev", "r")) == NULL)
|
||||||
return -1;
|
return -1;
|
||||||
for(i = 0; fgets(buf, sizeof(buf), fp) != NULL; i++)
|
for(i = 0; fgets(buf, sizeof(buf), fp) != NULL; i++)
|
||||||
|
@ -160,10 +162,11 @@ static int ifinfo(struct ifinfo ** dev)
|
||||||
ret++;
|
ret++;
|
||||||
}
|
}
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
return ret;
|
|
||||||
#endif
|
#endif
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef _GNU_SOURCE
|
||||||
static int ifinfo_append(struct ifinfo ** dev, char * buf, int nb)
|
static int ifinfo_append(struct ifinfo ** dev, char * buf, int nb)
|
||||||
{
|
{
|
||||||
struct ifinfo * p;
|
struct ifinfo * p;
|
||||||
|
@ -195,6 +198,7 @@ static int ifinfo_append(struct ifinfo ** dev, char * buf, int nb)
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/* Probe */
|
/* Probe */
|
||||||
|
@ -253,9 +257,9 @@ static int _probe_error(char * message, int ret)
|
||||||
static int _probe_timeout(Probe * probe)
|
static int _probe_timeout(Probe * probe)
|
||||||
{
|
{
|
||||||
struct utmpx * ut;
|
struct utmpx * ut;
|
||||||
|
int i;
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
static unsigned int count = 0;
|
static unsigned int count = 0;
|
||||||
static int i;
|
|
||||||
|
|
||||||
fprintf(stderr, "%s%d%s", "_probe_timeout(", count++, ")\n");
|
fprintf(stderr, "%s%d%s", "_probe_timeout(", count++, ")\n");
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue
Block a user