MCPcopy Create free account
hub / github.com/F-Stack/f-stack / msq_remove

Function msq_remove

freebsd/kern/sysv_msg.c:412–448  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

410}
411
412static void
413msq_remove(struct msqid_kernel *msqkptr)
414{
415 struct msg *msghdr;
416
417 racct_sub_cred(msqkptr->cred, RACCT_NMSGQ, 1);
418 racct_sub_cred(msqkptr->cred, RACCT_MSGQQUEUED, msqkptr->u.msg_qnum);
419 racct_sub_cred(msqkptr->cred, RACCT_MSGQSIZE, msqkptr->u.msg_cbytes);
420 crfree(msqkptr->cred);
421 msqkptr->cred = NULL;
422
423 /* Free the message headers */
424 msghdr = msqkptr->u.__msg_first;
425 while (msghdr != NULL) {
426 struct msg *msghdr_tmp;
427
428 /* Free the segments of each message */
429 msqkptr->u.msg_cbytes -= msghdr->msg_ts;
430 msqkptr->u.msg_qnum--;
431 msghdr_tmp = msghdr;
432 msghdr = msghdr->msg_next;
433 msg_freehdr(msghdr_tmp);
434 }
435
436 if (msqkptr->u.msg_cbytes != 0)
437 panic("msg_cbytes is screwed up");
438 if (msqkptr->u.msg_qnum != 0)
439 panic("msg_qnum is screwed up");
440
441 msqkptr->u.msg_qbytes = 0; /* Mark it as free */
442
443#ifdef MAC
444 mac_sysvmsq_cleanup(msqkptr);
445#endif
446
447 wakeup(msqkptr);
448}
449
450static struct prison *
451msg_find_prison(struct ucred *cred)

Callers 2

kern_msgctlFunction · 0.85
msg_prison_cleanupFunction · 0.85

Calls 6

msg_freehdrFunction · 0.85
mac_sysvmsq_cleanupFunction · 0.85
racct_sub_credFunction · 0.70
crfreeFunction · 0.70
panicFunction · 0.70
wakeupFunction · 0.70

Tested by

no test coverage detected