On 11/22/22 2:14 AM, Stefan Roesch wrote:
This adds two example programs to test the napi busy poll functionality. It consists of a client program and a server program. To get a napi id, the client and the server program need to be run on different hosts. To test the napi busy poll timeout, the -t needs to be specified. A reasonable value for the busy poll timeout is 100. By specifying the busy poll timeout on the server and the client the best results are accomplished. Signed-off-by: Stefan Roesch <shr@xxxxxxxxxxxx>
Since commit: fd6b571b0b03aeeb529f235c5c9c0a7c3256340c ("github: Add -Wmissing-prototypes for GitHub CI bot") liburing GitHub CI robot enforces functions and global variables that are not used outside the translation unit to be marked as static. This patch fails the build. GitHub CI says: clang -Werror -D_GNU_SOURCE -I../src/include/ -g -O3 -Wall -Wextra -Werror -Wmissing-prototypes -o napi-busy-poll-client napi-busy-poll-client.c -L../src/ -luring clang -Werror -D_GNU_SOURCE -I../src/include/ -g -O3 -Wall -Wextra -Werror -Wmissing-prototypes -o napi-busy-poll-server napi-busy-poll-server.c -L../src/ -luring napi-busy-poll-client.c:78:6: error: no previous prototype for function 'printUsage' [-Werror,-Wmissing-prototypes] void printUsage(const char *name) ^ napi-busy-poll-client.c:78:1: note: declare 'static' if the function is not intended to be used outside of this translation unit void printUsage(const char *name) ^ static napi-busy-poll-client.c:102:6: error: no previous prototype for function 'printError' [-Werror,-Wmissing-prototypes] void printError(const char *msg, int opt) ^ napi-busy-poll-client.c:102:1: note: declare 'static' if the function is not intended to be used outside of this translation unit void printError(const char *msg, int opt) ^ static napi-busy-poll-client.c:108:6: error: no previous prototype for function 'setProcessScheduler' [-Werror,-Wmissing-prototypes] void setProcessScheduler(void) ^ napi-busy-poll-client.c:108:1: note: declare 'static' if the function is not intended to be used outside of this translation unit void setProcessScheduler(void) ^ static napi-busy-poll-client.c:118:8: error: no previous prototype for function 'diffTimespec' [-Werror,-Wmissing-prototypes] double diffTimespec(const struct timespec *time1, const struct timespec *time0) ^ napi-busy-poll-client.c:118:1: note: declare 'static' if the function is not intended to be used outside of this translation unit double diffTimespec(const struct timespec *time1, const struct timespec *time0) ^ static napi-busy-poll-client.c:124:10: error: no previous prototype for function 'encodeUserData' [-Werror,-Wmissing-prototypes] uint64_t encodeUserData(char type, int fd) ^ napi-busy-poll-client.c:124:1: note: declare 'static' if the function is not intended to be used outside of this translation unit uint64_t encodeUserData(char type, int fd) ^ static napi-busy-poll-client.c:129:6: error: no previous prototype for function 'decodeUserData' [-Werror,-Wmissing-prototypes] void decodeUserData(uint64_t data, char *type, int *fd) ^ napi-busy-poll-client.c:129:1: note: declare 'static' if the function is not intended to be used outside of this translation unit void decodeUserData(uint64_t data, char *type, int *fd) ^ static napi-busy-poll-client.c:135:13: error: no previous prototype for function 'opTypeToStr' [-Werror,-Wmissing-prototypes] const char *opTypeToStr(char type) ^ napi-busy-poll-client.c:135:7: note: declare 'static' if the function is not intended to be used outside of this translation unit const char *opTypeToStr(char type) ^ static napi-busy-poll-client.c:159:6: error: no previous prototype for function 'reportNapi' [-Werror,-Wmissing-prototypes] void reportNapi(struct ctx *ctx) ^ napi-busy-poll-client.c:159:1: note: declare 'static' if the function is not intended to be used outside of this translation unit void reportNapi(struct ctx *ctx) ^ static napi-busy-poll-client.c:173:6: error: no previous prototype for function 'sendPing' [-Werror,-Wmissing-prototypes] void sendPing(struct ctx *ctx) ^ napi-busy-poll-client.c:173:1: note: declare 'static' if the function is not intended to be used outside of this translation unit void sendPing(struct ctx *ctx) ^ static napi-busy-poll-client.c:183:6: error: no previous prototype for function 'receivePing' [-Werror,-Wmissing-prototypes] void receivePing(struct ctx *ctx) ^ napi-busy-poll-client.c:183:1: note: declare 'static' if the function is not intended to be used outside of this translation unit void receivePing(struct ctx *ctx) ^ static napi-busy-poll-client.c:191:6: error: no previous prototype for function 'recordRTT' [-Werror,-Wmissing-prototypes] void recordRTT(struct ctx *ctx) ^ napi-busy-poll-client.c:191:1: note: declare 'static' if the function is not intended to be used outside of this translation unit void recordRTT(struct ctx *ctx) ^ static napi-busy-poll-client.c:203:6: error: no previous prototype for function 'printStats' [-Werror,-Wmissing-prototypes] void printStats(struct ctx *ctx) ^ napi-busy-poll-client.c:203:1: note: declare 'static' if the function is not intended to be used outside of this translation unit void printStats(struct ctx *ctx) ^ static napi-busy-poll-client.c:230:5: error: no previous prototype for function 'completion' [-Werror,-Wmissing-prototypes] int completion(struct ctx *ctx, struct io_uring_cqe *cqe) ^ napi-busy-poll-client.c:230:1: note: declare 'static' if the function is not intended to be used outside of this translation unit int completion(struct ctx *ctx, struct io_uring_cqe *cqe) ^ static 13 errors generated. make[1]: *** [Makefile:38: napi-busy-poll-client] Error 1 make[1]: *** Waiting for unfinished jobs.... napi-busy-poll-server.c:78:6: error: no previous prototype for function 'printUsage' [-Werror,-Wmissing-prototypes] void printUsage(const char *name) ^ napi-busy-poll-server.c:78:1: note: declare 'static' if the function is not intended to be used outside of this translation unit void printUsage(const char *name) ^ static napi-busy-poll-server.c:104:6: error: no previous prototype for function 'printError' [-Werror,-Wmissing-prototypes] void printError(const char *msg, int opt) ^ napi-busy-poll-server.c:104:1: note: declare 'static' if the function is not intended to be used outside of this translation unit void printError(const char *msg, int opt) ^ static napi-busy-poll-server.c:110:6: error: no previous prototype for function 'setProcessScheduler' [-Werror,-Wmissing-prototypes] void setProcessScheduler() ^ napi-busy-poll-server.c:110:1: note: declare 'static' if the function is not intended to be used outside of this translation unit void setProcessScheduler() ^ static napi-busy-poll-server.c:120:10: error: no previous prototype for function 'encodeUserData' [-Werror,-Wmissing-prototypes] uint64_t encodeUserData(char type, int fd) ^ napi-busy-poll-server.c:120:1: note: declare 'static' if the function is not intended to be used outside of this translation unit uint64_t encodeUserData(char type, int fd) ^ static napi-busy-poll-server.c:125:6: error: no previous prototype for function 'decodeUserData' [-Werror,-Wmissing-prototypes] void decodeUserData(uint64_t data, char *type, int *fd) ^ napi-busy-poll-server.c:125:1: note: declare 'static' if the function is not intended to be used outside of this translation unit void decodeUserData(uint64_t data, char *type, int *fd) ^ static napi-busy-poll-server.c:131:13: error: no previous prototype for function 'opTypeToStr' [-Werror,-Wmissing-prototypes] const char *opTypeToStr(char type) ^ napi-busy-poll-server.c:131:7: note: declare 'static' if the function is not intended to be used outside of this translation unit const char *opTypeToStr(char type) ^ static napi-busy-poll-server.c:155:6: error: no previous prototype for function 'reportNapi' [-Werror,-Wmissing-prototypes] void reportNapi(struct ctx *ctx) ^ napi-busy-poll-server.c:155:1: note: declare 'static' if the function is not intended to be used outside of this translation unit void reportNapi(struct ctx *ctx) ^ static napi-busy-poll-server.c:169:6: error: no previous prototype for function 'sendPing' [-Werror,-Wmissing-prototypes] void sendPing(struct ctx *ctx) ^ napi-busy-poll-server.c:169:1: note: declare 'static' if the function is not intended to be used outside of this translation unit void sendPing(struct ctx *ctx) ^ static napi-busy-poll-server.c:178:6: error: no previous prototype for function 'receivePing' [-Werror,-Wmissing-prototypes] void receivePing(struct ctx *ctx) ^ napi-busy-poll-server.c:178:1: note: declare 'static' if the function is not intended to be used outside of this translation unit void receivePing(struct ctx *ctx) ^ static napi-busy-poll-server.c:193:6: error: no previous prototype for function 'completion' [-Werror,-Wmissing-prototypes] void completion(struct ctx *ctx, struct io_uring_cqe *cqe) ^ napi-busy-poll-server.c:193:1: note: declare 'static' if the function is not intended to be used outside of this translation unit void completion(struct ctx *ctx, struct io_uring_cqe *cqe) ^ static 10 errors generated. make[1]: *** [Makefile:38: napi-busy-poll-server] Error 1 make: *** [Makefile:12: all] Error 2 make[1]: Leaving directory '/home/runner/work/liburing/liburing/examples' Error: Process completed with exit code 2. -- Ammar Faizi