Changeset f9df20e
- Timestamp:
- 06/19/18 16:48:33 (3 years ago)
- Branches:
- cachetimestamps, develop, master, rc-4.0.4, ringdecrementfix, ringperformance
- Children:
- 528a27c, 95ca714
- Parents:
- 86b365b
- Location:
- lib
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
lib/format_linux_common.c
rcc9c9de rf9df20e 49 49 50 50 #include "format_linux_common.h" 51 52 unsigned int rand_seedp = 0; 51 53 52 54 #ifdef HAVE_NETPACKET_PACKET_H … … 201 203 /* Some examples use pid for the group however that would limit a single 202 204 * application to use only int/ring format, instead using rand */ 203 FORMAT_DATA->fanout_group = (uint16_t) rand();205 FORMAT_DATA->fanout_group = (uint16_t) (rand_r(&rand_seedp) % 65536); 204 206 return 0; 205 207 } -
lib/format_linux_common.h
r4697684 rf9df20e 421 421 struct linux_per_stream_t *stream) 422 422 { 423 int fanout_opt = ((int)FORMAT_DATA->fanout_flags << 16) | 424 (int)FORMAT_DATA->fanout_group; 425 if (setsockopt(stream->fd, SOL_PACKET, PACKET_FANOUT, 426 &fanout_opt, sizeof(fanout_opt)) == -1) { 427 trace_set_err(libtrace, TRACE_ERR_INIT_FAILED, 423 int fanout_opt; 424 int attempts = 0; 425 while (attempts < 5) { 426 fanout_opt = ((int)FORMAT_DATA->fanout_flags << 16) | 427 (int)FORMAT_DATA->fanout_group; 428 429 if (setsockopt(stream->fd, SOL_PACKET, PACKET_FANOUT, 430 &fanout_opt, sizeof(fanout_opt)) == -1) { 431 trace_set_err(libtrace, TRACE_ERR_INIT_FAILED, 428 432 "Converting the fd to a socket fanout failed %s", 429 433 libtrace->uridata); 430 return -1; 434 FORMAT_DATA->fanout_group ++; 435 attempts ++; 436 continue; 437 } 438 return 0; 431 439 } 432 return 0;440 return -1; 433 441 } 434 442 #endif /* HAVE_NETPACKET_PACKET_H */
Note: See TracChangeset
for help on using the changeset viewer.