Searched refs:msgque (Results 1 - 2 of 2) sorted by relevance
/linux-4.1.27/tools/testing/selftests/ipc/ |
H A D | msgque.c | 33 int restore_queue(struct msgque_data *msgque) restore_queue() argument 43 sprintf(buf, "%d", msgque->msq_id); restore_queue() 51 id = msgget(msgque->key, msgque->mode | IPC_CREAT | IPC_EXCL); restore_queue() 57 if (id != msgque->msq_id) { restore_queue() 59 id, msgque->msq_id); restore_queue() 64 for (i = 0; i < msgque->qnum; i++) { restore_queue() 65 if (msgsnd(msgque->msq_id, &msgque->messages[i].mtype, restore_queue() 66 msgque->messages[i].msize, IPC_NOWAIT) != 0) { restore_queue() 80 int check_and_destroy_queue(struct msgque_data *msgque) check_and_destroy_queue() argument 86 ret = msgrcv(msgque->msq_id, &message.mtype, MAX_MSG_SIZE, check_and_destroy_queue() 95 if (ret != msgque->messages[cnt].msize) { check_and_destroy_queue() 97 msgque->messages[cnt].msize); check_and_destroy_queue() 101 if (message.mtype != msgque->messages[cnt].mtype) { check_and_destroy_queue() 106 if (memcmp(message.mtext, msgque->messages[cnt].mtext, ret)) { check_and_destroy_queue() 114 if (cnt != msgque->qnum) { check_and_destroy_queue() 122 if (msgctl(msgque->msq_id, IPC_RMID, 0)) { check_and_destroy_queue() 129 int dump_queue(struct msgque_data *msgque) dump_queue() argument 145 if (ret == msgque->msq_id) dump_queue() 149 msgque->messages = malloc(sizeof(struct msg1) * ds.msg_qnum); dump_queue() 150 if (msgque->messages == NULL) { dump_queue() 155 msgque->qnum = ds.msg_qnum; dump_queue() 156 msgque->mode = ds.msg_perm.mode; dump_queue() 157 msgque->qbytes = ds.msg_qbytes; dump_queue() 159 for (i = 0; i < msgque->qnum; i++) { dump_queue() 160 ret = msgrcv(msgque->msq_id, &msgque->messages[i].mtype, dump_queue() 166 msgque->messages[i].msize = ret; dump_queue() 171 int fill_msgque(struct msgque_data *msgque) fill_msgque() argument 177 if (msgsnd(msgque->msq_id, &msgbuf.mtype, sizeof(TEST_STRING), fill_msgque() 185 if (msgsnd(msgque->msq_id, &msgbuf.mtype, sizeof(ANOTHER_TEST_STRING), fill_msgque() 196 struct msgque_data msgque; main() local 203 msgque.key = ftok(argv[0], 822155650); main() 204 if (msgque.key == -1) { main() 209 msgque.msq_id = msgget(msgque.key, IPC_CREAT | IPC_EXCL | 0666); main() 210 if (msgque.msq_id == -1) { main() 216 err = fill_msgque(&msgque); main() 222 err = dump_queue(&msgque); main() 228 err = check_and_destroy_queue(&msgque); main() 234 err = restore_queue(&msgque); main() 240 err = check_and_destroy_queue(&msgque); main() 248 if (msgctl(msgque.msq_id, IPC_RMID, 0)) { main()
|
H A D | Makefile | 15 $(CC) $(CFLAGS) msgque.c -o msgque_test
|
Completed in 56 milliseconds