FreeBSD/sys/kern/subr_msgbuf.c
/*
 * Add a character into the message buffer, and update the checksum and
 * sequence number.
 *
 * The caller should hold the message buffer spinlock.
 */
Add a character into the message buffer, and update the checksum and
sequence number.

The caller should hold the message buffer spinlock.
Add a character into the message buffer and update the checksum and sequence number . The caller should hold the message buffer spinlock .
static void
msgbuf_do_addchar(struct msgbuf * const mbp, u_int * const seq, const int c)
{
	u_int pos;
	pos = MSGBUF_SEQ_TO_POS(mbp, *seq);
	mbp->msg_cksum += (u_int)(u_char)c -
	    (u_int)(u_char)mbp->msg_ptr[pos];
	mbp->msg_ptr[pos] = c;
	*seq = MSGBUF_SEQNORM(mbp, *seq + 1);
}
static void msgbuf_do_addchar ( struct msgbuf * const mbp , u_int * const seq , const int c ) { u_int pos ; pos = MSGBUF_SEQ_TO_POS ( mbp , * seq ) ; mbp -> msg_cksum += ( u_int ) ( u_char ) c - ( u_int ) ( u_char ) mbp -> msg_ptr [ pos ] ; mbp -> msg_ptr [ pos ] = c ; * seq = MSGBUF_SEQNORM ( mbp , * seq + 1 ) ; }
Add a character into the message buffer, and update the checksum and
 sequence number.
Add a character into the message buffer and update the checksum and sequence number .
/* Make sure we properly wrap the sequence number. */