rusage: Fix initialization of rusage->num_processors

Refs: #1064
Change-Id: I4c04127a766b9c71f726113b8b7d6416ff971bff
This commit is contained in:
Masamichi Takagi
2018-06-19 17:52:38 +09:00
committed by Dominique Martinet
parent 8ff754c466
commit a6ac4acf40
8 changed files with 402 additions and 12 deletions

44
test/rusage/util.h Normal file
View File

@@ -0,0 +1,44 @@
#ifndef __UTIL_H_INCLUDED__
#define __UTIL_H_INCLUDED__
#define DEBUG
#ifdef DEBUG
#define dprintf(...) do { \
char msg[1024]; \
sprintf(msg, __VA_ARGS__); \
fprintf(stderr, "%s,%s", __func__, msg); \
} while (0)
#else
#define dprintf(...) do { } while (0)
#endif
#define eprintf(...) do { \
char msg[1024]; \
sprintf(msg, __VA_ARGS__); \
fprintf(stderr, "%s,%s", __func__, msg); \
} while (0)
#define CHKANDJUMP(cond, err, ...) do { \
if (cond) { \
eprintf(__VA_ARGS__); \
ret = err; \
goto fn_fail; \
} \
} while (0)
#define OKNG(cond, ...) do { \
if (cond) { \
printf("[ OK ] "); \
printf(__VA_ARGS__); \
} else { \
printf("[ NG ] "); \
printf(__VA_ARGS__); \
ret = -EINVAL; \
goto out; \
} \
} while (0)
#endif