Skip to content

Commit

Permalink
Merge branch 'main' into fix_early_quit
Browse files Browse the repository at this point in the history
  • Loading branch information
KeithWiles authored Sep 29, 2023
2 parents 9145bc1 + 6a86e1a commit 0ccf313
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 7 deletions.
6 changes: 3 additions & 3 deletions app/cli-functions.c
Original file line number Diff line number Diff line change
Expand Up @@ -836,11 +836,11 @@ pcap_cmd(int argc, char **argv)

switch (m->index) {
case 10:
pcap = pktgen.info[pktgen.portNum].pcap;
max_cnt = pcap->pkt_count;
value = strtoul(argv[1], NULL, 10);
pcap = pktgen.info[pktgen.portNum].pcap;
value = strtoul(argv[1], NULL, 10);

if (pcap) {
max_cnt = pcap->pkt_count;
if (value >= max_cnt)
pcap->pkt_idx = max_cnt - RTE_MIN(PCAP_PAGE_SIZE, (int)max_cnt);
else
Expand Down
28 changes: 24 additions & 4 deletions app/pktgen-main.c
Original file line number Diff line number Diff line change
Expand Up @@ -420,13 +420,26 @@ main(int argc, char **argv)
{
uint32_t i;
int32_t ret;
struct sigaction sa;
sigset_t set;

setlocale(LC_ALL, "");

signal(SIGSEGV, sig_handler);
signal(SIGHUP, sig_handler);
signal(SIGINT, sig_handler);
signal(SIGPIPE, sig_handler);
sa.sa_handler = sig_handler;
sigemptyset(&sa.sa_mask);
sa.sa_flags = 0;

sigaction(SIGSEGV, &sa, NULL);
sigaction(SIGHUP, &sa, NULL);
sigaction(SIGINT, &sa, NULL);
sigaction(SIGPIPE, &sa, NULL);

/* Block SIGWINCH for all threads,
* because we only want it to be
* handled by the main thread */
sigemptyset(&set);
sigaddset(&set, SIGWINCH);
pthread_sigmask(SIG_BLOCK, &set, NULL);

scrn_setw(1); /* Reset the window size, from possible crash run. */
scrn_pos(100, 1); /* Move the cursor to the bottom of the screen again */
Expand Down Expand Up @@ -561,6 +574,13 @@ main(int argc, char **argv)
}

pktgen_log_info("=== Run CLI\n");

/* Unblock SIGWINCH so main thread
* can handle screen resizes */
sigemptyset(&set);
sigaddset(&set, SIGWINCH);
pthread_sigmask(SIG_UNBLOCK, &set, NULL);

cli_start(NULL);

scrn_pause();
Expand Down

0 comments on commit 0ccf313

Please sign in to comment.