Lines Matching defs:msghdr

84 static void msg_freehdr(struct msg *msghdr);
357 msg_freehdr(struct msg *msghdr)
359 while (msghdr->msg_ts > 0) {
361 if (msghdr->msg_spot < 0 || msghdr->msg_spot >= msginfo.msgseg)
362 panic("msghdr->msg_spot out of range");
363 next = msgmaps[msghdr->msg_spot].next;
364 msgmaps[msghdr->msg_spot].next = free_msgmaps;
365 free_msgmaps = msghdr->msg_spot;
367 msghdr->msg_spot = next;
368 if (msghdr->msg_ts >= msginfo.msgssz)
369 msghdr->msg_ts -= msginfo.msgssz;
371 msghdr->msg_ts = 0;
373 if (msghdr->msg_spot != -1)
374 panic("msghdr->msg_spot != -1");
375 msghdr->msg_next = free_msghdrs;
376 free_msghdrs = msghdr;
378 mac_sysvmsg_label_recycle(msghdr);
450 struct msg *msghdr;
458 * msq/msghdr info as it progresses, and there is no going
460 * thread cannot free a certain msghdr. The msq will get
463 for (msghdr = msqptr->u.msg_first; msghdr != NULL;
464 msghdr = msghdr->msg_next) {
465 eval = mac_sysvmsq_check_msgrmid(kauth_cred_get(), msghdr);
471 msghdr = msqptr->u.msg_first;
472 while (msghdr != NULL) {
476 msqptr->u.msg_cbytes -= msghdr->msg_ts;
478 msghdr_tmp = msghdr;
479 msghdr = msghdr->msg_next;
723 struct msg *msghdr;
939 msghdr = free_msghdrs;
940 free_msghdrs = msghdr->msg_next;
941 msghdr->msg_spot = -1;
942 msghdr->msg_ts = msgsz;
945 mac_sysvmsg_label_associate(kauth_cred_get(), msqptr, msghdr);
966 msgmaps[next].next = msghdr->msg_spot;
967 msghdr->msg_spot = next;
979 msghdr->msg_type = CAST_DOWN(long,msgtype);
985 msghdr->msg_type = msg_type32;
994 msg_freehdr(msghdr);
1004 if (msghdr->msg_type < 1) {
1005 msg_freehdr(msghdr);
1009 printf("mtype (%ld) < 1\n", msghdr->msg_type);
1018 next = msghdr->msg_spot;
1039 msg_freehdr(msghdr);
1063 msg_freehdr(msghdr);
1077 * Note: Since the task/thread allocates the msghdr and usually
1079 * won't be necessary to check whether the msghdr has access
1082 * individual policies derive a non-identical label for the msghdr
1083 * from the current thread label and may want to check the msghdr
1087 eval = mac_sysvmsq_check_enqueue(kauth_cred_get(), msghdr, msqptr);
1089 msg_freehdr(msghdr);
1099 msqptr->u.msg_first = msghdr;
1100 msqptr->u.msg_last = msghdr;
1102 msqptr->u.msg_last->msg_next = msghdr;
1103 msqptr->u.msg_last = msghdr;
1107 msqptr->u.msg_cbytes += msghdr->msg_ts;
1139 struct msg *msghdr;
1197 msghdr = NULL;
1198 while (msghdr == NULL) {
1200 msghdr = msqptr->u.msg_first;
1201 if (msghdr != NULL) {
1202 if (msgsz < msghdr->msg_ts &&
1206 msgsz, msghdr->msg_ts);
1213 msghdr);
1221 msqptr->u.msg_first = msghdr->msg_next;
1232 while ((msghdr = *prev) != NULL) {
1242 if (msgtyp == msghdr->msg_type ||
1243 msghdr->msg_type <= -msgtyp) {
1246 msghdr->msg_type, msgtyp);
1248 if (msgsz < msghdr->msg_ts &&
1252 msgsz, msghdr->msg_ts);
1259 kauth_cred_get(), msghdr);
1263 *prev = msghdr->msg_next;
1264 if (msghdr == msqptr->u.msg_last) {
1283 previous = msghdr;
1284 prev = &(msghdr->msg_next);
1289 * We've either extracted the msghdr for the appropriate
1294 if (msghdr != NULL)
1363 msqptr->u.msg_cbytes -= msghdr->msg_ts;
1376 msghdr->msg_ts);
1378 if (msgsz > msghdr->msg_ts)
1379 msgsz = msghdr->msg_ts;
1390 msgtype = msghdr->msg_type;
1396 msg_type32 = msghdr->msg_type;
1407 msg_freehdr(msghdr);
1418 next = msghdr->msg_spot;
1440 msg_freehdr(msghdr);
1452 msg_freehdr(msghdr);