subr_msgbuf.c (222537) | subr_msgbuf.c (222550) |
---|---|
1/*- 2 * Copyright (c) 2003 Ian Dowse. All rights reserved. 3 * 4 * Redistribution and use in source and binary forms, with or without 5 * modification, are permitted provided that the following conditions 6 * are met: 7 * 1. Redistributions of source code must retain the above copyright 8 * notice, this list of conditions and the following disclaimer. --- 8 unchanged lines hidden (view full) --- 17 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 18 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 19 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 20 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 21 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 22 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 23 * SUCH DAMAGE. 24 * | 1/*- 2 * Copyright (c) 2003 Ian Dowse. All rights reserved. 3 * 4 * Redistribution and use in source and binary forms, with or without 5 * modification, are permitted provided that the following conditions 6 * are met: 7 * 1. Redistributions of source code must retain the above copyright 8 * notice, this list of conditions and the following disclaimer. --- 8 unchanged lines hidden (view full) --- 17 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 18 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 19 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 20 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 21 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 22 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 23 * SUCH DAMAGE. 24 * |
25 * $FreeBSD: head/sys/kern/subr_msgbuf.c 222537 2011-05-31 17:29:58Z ken $ | 25 * $FreeBSD: head/sys/kern/subr_msgbuf.c 222550 2011-05-31 22:39:32Z ken $ |
26 */ 27 28/* 29 * Generic message buffer support routines. 30 */ 31 32#include <sys/param.h> 33#include <sys/systm.h> --- 22 unchanged lines hidden (view full) --- 56 57 mbp->msg_ptr = ptr; 58 mbp->msg_size = size; 59 mbp->msg_seqmod = SEQMOD(size); 60 msgbuf_clear(mbp); 61 mbp->msg_magic = MSG_MAGIC; 62 mbp->msg_lastpri = -1; 63 mbp->msg_needsnl = 0; | 26 */ 27 28/* 29 * Generic message buffer support routines. 30 */ 31 32#include <sys/param.h> 33#include <sys/systm.h> --- 22 unchanged lines hidden (view full) --- 56 57 mbp->msg_ptr = ptr; 58 mbp->msg_size = size; 59 mbp->msg_seqmod = SEQMOD(size); 60 msgbuf_clear(mbp); 61 mbp->msg_magic = MSG_MAGIC; 62 mbp->msg_lastpri = -1; 63 mbp->msg_needsnl = 0; |
64 bzero(&mbp->msg_lock, sizeof(mbp->msg_lock)); |
|
64 mtx_init(&mbp->msg_lock, "msgbuf", NULL, MTX_SPIN); 65} 66 67/* 68 * Reinitialize a message buffer, retaining its previous contents if 69 * the size and checksum are correct. If the old contents cannot be 70 * recovered, the message buffer is cleared. 71 */ --- 18 unchanged lines hidden (view full) --- 90 printf("Old msgbuf not recovered\n"); 91 } 92 msgbuf_clear(mbp); 93 } 94 95 mbp->msg_lastpri = -1; 96 /* Assume that the old message buffer didn't end in a newline. */ 97 mbp->msg_needsnl = 1; | 65 mtx_init(&mbp->msg_lock, "msgbuf", NULL, MTX_SPIN); 66} 67 68/* 69 * Reinitialize a message buffer, retaining its previous contents if 70 * the size and checksum are correct. If the old contents cannot be 71 * recovered, the message buffer is cleared. 72 */ --- 18 unchanged lines hidden (view full) --- 91 printf("Old msgbuf not recovered\n"); 92 } 93 msgbuf_clear(mbp); 94 } 95 96 mbp->msg_lastpri = -1; 97 /* Assume that the old message buffer didn't end in a newline. */ 98 mbp->msg_needsnl = 1; |
99 bzero(&mbp->msg_lock, sizeof(mbp->msg_lock)); |
|
98 mtx_init(&mbp->msg_lock, "msgbuf", NULL, MTX_SPIN); 99} 100 101/* 102 * Clear the message buffer. 103 */ 104void 105msgbuf_clear(struct msgbuf *mbp) --- 290 unchanged lines hidden --- | 100 mtx_init(&mbp->msg_lock, "msgbuf", NULL, MTX_SPIN); 101} 102 103/* 104 * Clear the message buffer. 105 */ 106void 107msgbuf_clear(struct msgbuf *mbp) --- 290 unchanged lines hidden --- |