预创建所有用于喷洒的消息队列 (MSG_SPRAY_COUNT + 伪造事件用的额外队列)
| 1946 | |
| 1947 | // 预创建所有用于喷洒的消息队列 (MSG_SPRAY_COUNT + 伪造事件用的额外队列) |
| 1948 | void setup_msg_queues() { |
| 1949 | printf("[0-4] Setting up %d message queues...\n", MSG_SPRAY_COUNT); |
| 1950 | for (int i = 0; i < MSG_SPRAY_COUNT; i++) { |
| 1951 | if ((msg_queue_ids[i] = msgget(IPC_PRIVATE, 0644 | IPC_CREAT)) == -1) { |
| 1952 | perror("msgget"); |
| 1953 | exit(1); |
| 1954 | } |
| 1955 | } |
| 1956 | for (int i = 0 ; i < MSG_FAKE_A_COUNT + MSG_FAKE_B_COUNT; i++) { |
| 1957 | if ((msg_fake_ids[i] = msgget(IPC_PRIVATE, 0644 | IPC_CREAT)) == -1) { |
| 1958 | perror("msgget"); |
| 1959 | exit(1); |
| 1960 | } |
| 1961 | } |
| 1962 | } |
| 1963 | |
| 1964 | // 辅助函数: 向所有 msg 队列发送带有唯一印章的消息 |
| 1965 | // 每个 msg_msgseg 的 payload 区域填充 (msg_idx << 32) | byte_offset |