Commit c773d09b authored by Aurelio Colosimo's avatar Aurelio Colosimo

struct timeval tv moved to posix_arch_data (is arch dependent)

parent b41b238e
...@@ -154,11 +154,13 @@ int posix_net_check_pkt(struct pp_instance *ppi, int delay_ms) ...@@ -154,11 +154,13 @@ int posix_net_check_pkt(struct pp_instance *ppi, int delay_ms)
int i; int i;
int ret = 0; int ret = 0;
int maxfd; int maxfd;
struct posix_arch_data *arch_data =
(struct posix_arch_data *)ppi->arch_data;
if (delay_ms != -1) { if (delay_ms != -1) {
/* Wait for a packet or for the timeout */ /* Wait for a packet or for the timeout */
ppi->tv.tv_sec = delay_ms / 1000; arch_data->tv.tv_sec = delay_ms / 1000;
ppi->tv.tv_usec = (delay_ms % 1000) * 1000; arch_data->tv.tv_usec = (delay_ms % 1000) * 1000;
} }
ppi->net_path->gen_ch.pkt_present = 0; ppi->net_path->gen_ch.pkt_present = 0;
...@@ -169,7 +171,7 @@ int posix_net_check_pkt(struct pp_instance *ppi, int delay_ms) ...@@ -169,7 +171,7 @@ int posix_net_check_pkt(struct pp_instance *ppi, int delay_ms)
FD_ZERO(&set); FD_ZERO(&set);
FD_SET(ppi->net_path->gen_ch.fd, &set); FD_SET(ppi->net_path->gen_ch.fd, &set);
FD_SET(ppi->net_path->evt_ch.fd, &set); FD_SET(ppi->net_path->evt_ch.fd, &set);
i = select(maxfd + 1, &set, NULL, NULL, &ppi->tv); i = select(maxfd + 1, &set, NULL, NULL, &arch_data->tv);
if (i < 0 && errno != EINTR) if (i < 0 && errno != EINTR)
exit(__LINE__); exit(__LINE__);
......
...@@ -40,12 +40,13 @@ int main(int argc, char **argv) ...@@ -40,12 +40,13 @@ int main(int argc, char **argv)
ppi->net_path = calloc(1, sizeof(*ppi->net_path)); ppi->net_path = calloc(1, sizeof(*ppi->net_path));
ppi->buf_out = calloc(1, PP_PACKET_SIZE); ppi->buf_out = calloc(1, PP_PACKET_SIZE);
ppi->buf_in = calloc(1, PP_PACKET_SIZE); ppi->buf_in = calloc(1, PP_PACKET_SIZE);
ppi->frgn_master = calloc(1, sizeof(*ppi->frgn_master));; ppi->frgn_master = calloc(1, sizeof(*ppi->frgn_master));
ppi->arch_data = calloc(1, sizeof(struct posix_arch_data));
if ((!ppi->defaultDS) || (!ppi->currentDS) || (!ppi->parentDS) if ((!ppi->defaultDS) || (!ppi->currentDS) || (!ppi->parentDS)
|| (!ppi->portDS) || (!ppi->timePropertiesDS) || (!ppi->sent_seq_id) || (!ppi->portDS) || (!ppi->timePropertiesDS) || (!ppi->sent_seq_id)
|| (!ppi->net_path) || (!ppi->buf_out) || (!ppi->buf_in) || (!ppi->net_path) || (!ppi->buf_out) || (!ppi->buf_in)
|| (!ppi->frgn_master) || (!ppi->frgn_master) || (!ppi->arch_data)
) )
exit(__LINE__); exit(__LINE__);
......
...@@ -6,6 +6,11 @@ ...@@ -6,6 +6,11 @@
* These are the functions provided by the various posix files * These are the functions provided by the various posix files
*/ */
struct posix_arch_data
{
struct timeval tv;
};
extern int posix_net_init(struct pp_instance *ppi); extern int posix_net_init(struct pp_instance *ppi);
extern int posix_net_check_pkt(struct pp_instance *ppi, int delay_ms); extern int posix_net_check_pkt(struct pp_instance *ppi, int delay_ms);
......
...@@ -111,7 +111,6 @@ struct pp_instance { ...@@ -111,7 +111,6 @@ struct pp_instance {
void *ext_data; /* if protocol ext needs it */ void *ext_data; /* if protocol ext needs it */
struct pp_runtime_opts *rt_opts; struct pp_runtime_opts *rt_opts;
struct pp_net_path *net_path; struct pp_net_path *net_path;
struct timeval tv;
/* Data sets */ /* Data sets */
DSDefault *defaultDS; DSDefault *defaultDS;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment