-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathutils.h
36 lines (29 loc) · 914 Bytes
/
utils.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#ifndef UTILS_H
#define UTILS_H
#ifndef MIN
#define MIN(x,y) ((x)>(y)?(y):(x))
#endif
#ifndef MAX
#define MAX(x,y) ((x)>(y)?(x):(y))
#endif
#include <sys/types.h>
#include "sidecar.h"
#define malloc_and_test(x) _malloc_and_test(x,__FILE__,__LINE__)
/* important that this be uint32_t; u32 doesn't seem to have the desired
effect on nspring's 64-bit box. */
typedef struct pseudohdr {
/*for computing TCP checksum, see TCP/IP Illustrated p. 145 */
u_int32_t s_addr;
u_int32_t d_addr;
u_int8_t zero;
u_int8_t proto;
u_int16_t length;
} pseudohdr;
unsigned int getLocalIP();
unsigned short in_cksum(u16 *ptr,int nbytes);
struct timeval diff_time(struct timeval now,struct timeval then);
int getmemusage(long * total, long * resident);
void * _malloc_and_test(size_t size,char * file, int linen);
double timerdiv(struct timeval * num, struct timeval * den);
unsigned long long gethrcycle_x86();
#endif