MCPcopy Create free account
hub / github.com/F-Stack/f-stack / us_vhost_parse_socket_path

Function us_vhost_parse_socket_path

dpdk/examples/vhost/main.c:569–589  ·  view source on GitHub ↗

* Set socket file path. */

Source from the content-addressed store, hash-verified

567 * Set socket file path.
568 */
569static int
570us_vhost_parse_socket_path(const char *q_arg)
571{
572 char *old;
573
574 /* parse number string */
575 if (strnlen(q_arg, PATH_MAX) == PATH_MAX)
576 return -1;
577
578 old = socket_files;
579 socket_files = realloc(socket_files, PATH_MAX * (nb_sockets + 1));
580 if (socket_files == NULL) {
581 free(old);
582 return -1;
583 }
584
585 strlcpy(socket_files + nb_sockets * PATH_MAX, q_arg, PATH_MAX);
586 nb_sockets++;
587
588 return 0;
589}
590
591/*
592 * Parse the portmask provided at run time.

Callers 1

us_vhost_parse_argsFunction · 0.85

Calls 4

strnlenFunction · 0.85
reallocFunction · 0.50
freeFunction · 0.50
strlcpyFunction · 0.50

Tested by

no test coverage detected