Example program which can connect to a unix domain socket, read a uint32_t intger and echo it back.
This is an experiment toy for testing my memory sharing change to the stenographer project.
POSIX Memory Sharing
====================
Between stenographer and this client.
+-----------+-----------+-----------+-----------+
| 1MB Block | 1MB Block | ... ... | 1MB Block |
+-----------+-----------+-----------+-----------+
1MB Block Memory Address
========= ==============
||
+--------------------------------+ ||
| | ||
| struct tpacket_block_desc | ||
| | ||
|--------------------------------| ||
| | ||
| struct tpacket3_hdr | ||
| | ||
|--------------------------------| ||
| | ||
| packet | ||
| | ||
|--------------------------------| \/
| |
| ... |
| |
|--------------------------------|
| |
| struct tpacket3_hdr |
| |
|--------------------------------|
| |
| packet |
| |
+--------------------------------+
- The "tpacket_block_desc->hdr->num_pkts" records the number of packet in the block.
- The "tpacket3_hdr->tp_next_offset" provides the offset from the starting address of the "struct tpacket3_hrd" to the next one.
- The "tpacket3_hdr->tp_nsec" provides the timestamp in nanoseconds (I think).