mirror of
https://git.rtems.org/rtems-libbsd/
synced 2025-05-14 04:19:34 +08:00
parent
cb01e5b2a1
commit
47ec4b85e5
@ -1232,8 +1232,8 @@ pcap_loop_monitor(rtems_task_argument arg)
|
|||||||
rtems_task_exit();
|
rtems_task_exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static void
|
||||||
pcap_loop_wrapper(pcap_t *pd, int cnt, pcap_handler cb, u_char *ud)
|
pcap_create_loop_monitor(pcap_t *pd)
|
||||||
{
|
{
|
||||||
rtems_status_code sc;
|
rtems_status_code sc;
|
||||||
rtems_task_priority priority;
|
rtems_task_priority priority;
|
||||||
@ -1248,9 +1248,8 @@ pcap_loop_wrapper(pcap_t *pd, int cnt, pcap_handler cb, u_char *ud)
|
|||||||
RTEMS_MINIMUM_STACK_SIZE, RTEMS_DEFAULT_MODES,
|
RTEMS_MINIMUM_STACK_SIZE, RTEMS_DEFAULT_MODES,
|
||||||
RTEMS_DEFAULT_ATTRIBUTES, &id);
|
RTEMS_DEFAULT_ATTRIBUTES, &id);
|
||||||
if (sc != RTEMS_SUCCESSFUL) {
|
if (sc != RTEMS_SUCCESSFUL) {
|
||||||
fprintf(stderr, "tcpdump: cannot create helper thread: %s\n",
|
error("cannot create pcap loop monitor thread: %s\n",
|
||||||
rtems_status_text(sc));
|
rtems_status_text(sc));
|
||||||
return (-1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fprintf(stdout, "tcpdump: press <ENTER> or 'q' or 'Q' to quit\n");
|
fprintf(stdout, "tcpdump: press <ENTER> or 'q' or 'Q' to quit\n");
|
||||||
@ -1264,12 +1263,8 @@ pcap_loop_wrapper(pcap_t *pd, int cnt, pcap_handler cb, u_char *ud)
|
|||||||
|
|
||||||
sc = rtems_event_transient_receive(RTEMS_WAIT, RTEMS_NO_TIMEOUT);
|
sc = rtems_event_transient_receive(RTEMS_WAIT, RTEMS_NO_TIMEOUT);
|
||||||
assert(sc == RTEMS_SUCCESSFUL);
|
assert(sc == RTEMS_SUCCESSFUL);
|
||||||
|
|
||||||
return (pcap_loop(pd, cnt, cb, ud));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#define pcap_loop(pd, cnt, cb, ud) pcap_loop_wrapper(pd, cnt, cb, ud)
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
destroy_pcap_dumper(void *arg)
|
destroy_pcap_dumper(void *arg)
|
||||||
{
|
{
|
||||||
@ -2211,6 +2206,11 @@ main(int argc, char **argv)
|
|||||||
#endif /* HAVE_CAPSICUM */
|
#endif /* HAVE_CAPSICUM */
|
||||||
|
|
||||||
do {
|
do {
|
||||||
|
#ifdef __rtems__
|
||||||
|
if (RFileName == NULL) {
|
||||||
|
pcap_create_loop_monitor(pd);
|
||||||
|
}
|
||||||
|
#endif /* __rtems__ */
|
||||||
status = pcap_loop(pd, cnt, callback, pcap_userdata);
|
status = pcap_loop(pd, cnt, callback, pcap_userdata);
|
||||||
if (WFileName == NULL) {
|
if (WFileName == NULL) {
|
||||||
/*
|
/*
|
||||||
|
Loading…
x
Reference in New Issue
Block a user