| 177 | } |
| 178 | |
| 179 | int write_msg(int msqid, const void *msgp, size_t msgsz, long msgtyp) { |
| 180 | *(long *)msgp = msgtyp; |
| 181 | if (msgsnd(msqid, msgp, msgsz - sizeof(long), 0) < 0) { |
| 182 | perror("[-] msgsnd"); |
| 183 | return -1; |
| 184 | } |
| 185 | return 0; |
| 186 | } |
| 187 | |
| 188 | int peek_msg(int msqid, void *msgp, size_t msgsz, long msgtyp) { |
| 189 | if (msgrcv(msqid, msgp, msgsz - sizeof(long), msgtyp, MSG_COPY | IPC_NOWAIT) < |