#include <pthread.h>
#include <sched.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <getopt.h>
#include <bsd/string.h>
#include <stdint.h>
#include <strings.h>
#include "main.h"
static int
{
if (!_obj)
return -1;
switch (obj.
hdr->cbtype) {
break;
break;
break;
break;
break;
break;
break;
pthread_setaffinity_np(pthread_self(), sizeof(cpu_set_t),
CNE_ERR_RET(
"Unable to create thread %d (%s) or type %s\n", idx, obj.
thd->name,
} else
break;
default:
return -1;
}
return 0;
}
static void
print_usage(char *prog_name)
{
cne_printf(
"Usage: %s [-h] [-c json_file] <mode>\n"
" -c <json-file> The JSON configuration file\n"
" -C Wait on unix domain socket for JSON or JSON-C file\n"
" -d More debug stats are displayed\n"
" -D JCFG debug decoding\n"
" -V JCFG information verbose\n"
" -P JCFG debug parsing\n"
" -h Display the help information\n",
prog_name);
}
int
parse_args(int argc, char **argv)
{
struct option lgopts[] = {{NULL, 0, 0, 0}};
int opt, option_index, flags = 0;
char json_file[1024] = {0};
app->num_threads = NUM_DEFAULT_PHILOSPHERS;
for (;;) {
opt = getopt_long(argc, argv, "hc:dCDPVt:", lgopts, &option_index);
if (opt == EOF)
break;
switch (opt) {
case 'h':
print_usage(argv[0]);
return -1;
case 'c':
strlcpy(json_file, optarg, sizeof(json_file));
break;
case 'd':
app->flags |= APP_DEBUG_STATS;
break;
case 'C':
break;
case 'D':
break;
case 'P':
break;
case 'V':
break;
default:
CNE_ERR("Invalid command option\n");
print_usage(argv[0]);
return -1;
}
}
if (optind < argc)
app->num_threads = atoi(argv[optind]);
app->jinfo =
jcfg_parser(flags, (
const char *)json_file);
if (app->jinfo == NULL)
CNE_ERR_RET(
"*** Did not find any configuration to use ***\n");
return 0;
}
CNDP_API int cne_printf(const char *fmt,...)
CNDP_API int thread_create(const char *name, thd_func_t func, void *arg)
CNDP_API jcfg_info_t * jcfg_parser(int flags, const char *s)
CNDP_API int jcfg_process(jcfg_info_t *jinfo, int flags, jcfg_parse_cb_t *cb, void *cb_arg)