| 940 | } |
| 941 | |
| 942 | int main(int argc, char **argv) |
| 943 | { |
| 944 | struct rte_ring *r; |
| 945 | struct rte_mempool *mp; |
| 946 | struct sigaction action = { |
| 947 | .sa_flags = SA_RESTART, |
| 948 | .sa_handler = signal_handler, |
| 949 | }; |
| 950 | struct sigaction origaction; |
| 951 | dumpcap_out_t out; |
| 952 | char *p; |
| 953 | |
| 954 | p = strrchr(argv[0], '/'); |
| 955 | if (p == NULL) |
| 956 | progname = argv[0]; |
| 957 | else |
| 958 | progname = p + 1; |
| 959 | |
| 960 | parse_opts(argc, argv); |
| 961 | dpdk_init(); |
| 962 | |
| 963 | if (show_interfaces) |
| 964 | dump_interfaces(); |
| 965 | |
| 966 | if (rte_eth_dev_count_avail() == 0) |
| 967 | rte_exit(EXIT_FAILURE, "No Ethernet ports found\n"); |
| 968 | |
| 969 | if (TAILQ_EMPTY(&interfaces)) |
| 970 | set_default_interface(); |
| 971 | else |
| 972 | find_interfaces(); |
| 973 | |
| 974 | compile_filters(); |
| 975 | |
| 976 | sigemptyset(&action.sa_mask); |
| 977 | sigaction(SIGTERM, &action, NULL); |
| 978 | sigaction(SIGINT, &action, NULL); |
| 979 | sigaction(SIGPIPE, &action, NULL); |
| 980 | sigaction(SIGHUP, NULL, &origaction); |
| 981 | if (origaction.sa_handler == SIG_DFL) |
| 982 | sigaction(SIGHUP, &action, NULL); |
| 983 | |
| 984 | enable_primary_monitor(); |
| 985 | |
| 986 | if (print_stats) { |
| 987 | statistics_loop(); |
| 988 | exit(0); |
| 989 | } |
| 990 | |
| 991 | r = create_ring(); |
| 992 | mp = create_mempool(); |
| 993 | out = create_output(); |
| 994 | |
| 995 | start_time = time(NULL); |
| 996 | enable_pdump(r, mp); |
| 997 | |
| 998 | if (!quiet) { |
| 999 | fprintf(stderr, "Packets captured: "); |
nothing calls this directly
no test coverage detected