diff options
author | Jens Axboe <axboe@kernel.dk> | 2024-02-14 13:13:36 -0700 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2024-02-14 13:13:36 -0700 |
commit | 674b77a2bfe0ff84376c95031d4b1a689c6b8563 (patch) | |
tree | fa619e83d4f753e7284dbeeaf5e39df0e7c88611 | |
parent | f49d641e4914ade8bed4b3542686fe9d5df380fa (diff) | |
download | liburing-674b77a2bfe0ff84376c95031d4b1a689c6b8563.tar.gz |
examples/napi: allow option for -s
Easier to remember what you're running if -s0/-s1 is used rather than
just have it be an on-toggle.
Signed-off-by: Jens Axboe <axboe@kernel.dk>
-rw-r--r-- | examples/napi-busy-poll-client.c | 4 | ||||
-rw-r--r-- | examples/napi-busy-poll-server.c | 4 |
2 files changed, 4 insertions, 4 deletions
diff --git a/examples/napi-busy-poll-client.c b/examples/napi-busy-poll-client.c index 4ae0354f..43dcca85 100644 --- a/examples/napi-busy-poll-client.c +++ b/examples/napi-busy-poll-client.c @@ -302,7 +302,7 @@ int main(int argc, char *argv[]) memset(&opt, 0, sizeof(struct options)); // Process flags. - while ((flag = getopt_long(argc, argv, ":hsbua:n:p:t:6d:", longopts, NULL)) != -1) { + while ((flag = getopt_long(argc, argv, ":hs:bua:n:p:t:6d:", longopts, NULL)) != -1) { switch (flag) { case 'a': strcpy(opt.addr, optarg); @@ -321,7 +321,7 @@ int main(int argc, char *argv[]) strcpy(opt.port, optarg); break; case 's': - opt.sq_poll = true; + opt.sq_poll = !!atoi(optarg); break; case 't': opt.timeout = atoi(optarg); diff --git a/examples/napi-busy-poll-server.c b/examples/napi-busy-poll-server.c index 9a4d1226..584632a9 100644 --- a/examples/napi-busy-poll-server.c +++ b/examples/napi-busy-poll-server.c @@ -263,7 +263,7 @@ int main(int argc, char *argv[]) memset(&opt, 0, sizeof(struct options)); // Process flags. - while ((flag = getopt_long(argc, argv, ":lhsbua:n:p:t:6d:", longopts, NULL)) != -1) { + while ((flag = getopt_long(argc, argv, ":lhs:bua:n:p:t:6d:", longopts, NULL)) != -1) { switch (flag) { case 'a': strcpy(opt.addr, optarg); @@ -285,7 +285,7 @@ int main(int argc, char *argv[]) strcpy(opt.port, optarg); break; case 's': - opt.sq_poll = true; + opt.sq_poll = !!atoi(optarg); break; case 't': opt.timeout = atoi(optarg); |