MCPcopy Create free account
hub / github.com/axboe/liburing / main

Function main

examples/napi-busy-poll-server.c:253–450  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

251}
252
253int main(int argc, char *argv[])
254{
255 int flag;
256 struct ctx ctx;
257 struct __kernel_timespec *tsPtr;
258 struct __kernel_timespec ts;
259 struct io_uring_params params;
260 struct io_uring_napi napi;
261 int ret, af;
262
263 memset(&opt, 0, sizeof(struct options));
264
265 // Process flags.
266 while ((flag = getopt_long(argc, argv, ":lhs:bua:n:p:t:6d:", longopts, NULL)) != -1) {
267 switch (flag) {
268 case 'a':
269 strcpy(opt.addr, optarg);
270 break;
271 case 'b':
272 opt.busy_loop = true;
273 break;
274 case 'h':
275 printUsage(argv[0]);
276 exit(0);
277 break;
278 case 'l':
279 opt.listen = true;
280 break;
281 case 'n':
282 opt.num_pings = atoi(optarg) + 1;
283 break;
284 case 'p':
285 strcpy(opt.port, optarg);
286 break;
287 case 's':
288 opt.sq_poll = !!atoi(optarg);
289 break;
290 case 't':
291 opt.timeout = atoi(optarg);
292 break;
293 case 'u':
294 opt.prefer_busy_poll = true;
295 break;
296 case '6':
297 opt.ipv6 = true;
298 break;
299 case 'd':
300 opt.defer_tw = !!atoi(optarg);
301 break;
302 case ':':
303 printError("Missing argument", optopt);
304 printUsage(argv[0]);
305 exit(-1);
306 break;
307 case '?':
308 printError("Unrecognized option", optopt);
309 printUsage(argv[0]);
310 exit(-1);

Callers

nothing calls this directly

Calls 10

io_uring_register_napiFunction · 0.85
io_uring_unregister_napiFunction · 0.85
io_uring_queue_exitFunction · 0.85
printUsageFunction · 0.70
printErrorFunction · 0.70
setProcessSchedulerFunction · 0.70
receivePingFunction · 0.70
completionFunction · 0.70

Tested by

no test coverage detected