322 |
|
} |
323 |
|
|
324 |
|
long long transfer_diff(long long new, long long old){ |
325 |
< |
#if defined(SOL7) || defined(LINUX) || defined(FREEBSD) || defined(DFBSD) |
326 |
< |
#define MAXVAL 0xffffffffLL |
325 |
> |
#if defined(SOL7) || defined(LINUX) || defined(FREEBSD) || defined(DFBSD) || defined(OPENBSD) |
326 |
> |
/* 32-bit quantities, so we must explicitly deal with wraparound. */ |
327 |
> |
#define MAXVAL 0x100000000LL |
328 |
> |
if (new >= old) { |
329 |
> |
return new - old; |
330 |
> |
} else { |
331 |
> |
return MAXVAL + new - old; |
332 |
> |
} |
333 |
|
#else |
334 |
< |
#define MAXVAL 0xffffffffffffffffLL |
334 |
> |
/* 64-bit quantities, so plain subtraction works. */ |
335 |
> |
return new - old; |
336 |
|
#endif |
330 |
– |
long long result; |
331 |
– |
if(new>=old){ |
332 |
– |
result = (new-old); |
333 |
– |
}else{ |
334 |
– |
result = (MAXVAL+(new-old)); |
335 |
– |
} |
336 |
– |
|
337 |
– |
return result; |
338 |
– |
|
337 |
|
} |
338 |
|
|
339 |
|
network_stat_t *get_network_stats_diff(int *entries) { |