Deleted Added
full compact
subr_prf.c (106855) subr_prf.c (106917)
1/*-
2 * Copyright (c) 1986, 1988, 1991, 1993
3 * The Regents of the University of California. All rights reserved.
4 * (c) UNIX System Laboratories, Inc.
5 * All or some portions of this file are derived from material licensed
6 * to the University of California by American Telephone and Telegraph
7 * Co. or Unix System Laboratories, Inc. and are reproduced herein with
8 * the permission of UNIX System Laboratories, Inc.

--- 22 unchanged lines hidden (view full) ---

31 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
32 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
33 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
34 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
35 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
36 * SUCH DAMAGE.
37 *
38 * @(#)subr_prf.c 8.3 (Berkeley) 1/21/94
1/*-
2 * Copyright (c) 1986, 1988, 1991, 1993
3 * The Regents of the University of California. All rights reserved.
4 * (c) UNIX System Laboratories, Inc.
5 * All or some portions of this file are derived from material licensed
6 * to the University of California by American Telephone and Telegraph
7 * Co. or Unix System Laboratories, Inc. and are reproduced herein with
8 * the permission of UNIX System Laboratories, Inc.

--- 22 unchanged lines hidden (view full) ---

31 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
32 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
33 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
34 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
35 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
36 * SUCH DAMAGE.
37 *
38 * @(#)subr_prf.c 8.3 (Berkeley) 1/21/94
39 * $FreeBSD: head/sys/kern/subr_prf.c 106855 2002-11-13 15:15:59Z mux $
39 * $FreeBSD: head/sys/kern/subr_prf.c 106917 2002-11-14 16:11:12Z tmm $
40 */
41
42#include <sys/param.h>
43#include <sys/systm.h>
44#include <sys/lock.h>
45#include <sys/mutex.h>
46#include <sys/sx.h>
47#include <sys/kernel.h>

--- 767 unchanged lines hidden (view full) ---

815 while (pos != oldp->msg_bufx) {
816 msglogchar(oldp->msg_ptr[pos], -1);
817 if (++pos >= oldp->msg_size)
818 pos = 0;
819 }
820}
821
822void
40 */
41
42#include <sys/param.h>
43#include <sys/systm.h>
44#include <sys/lock.h>
45#include <sys/mutex.h>
46#include <sys/sx.h>
47#include <sys/kernel.h>

--- 767 unchanged lines hidden (view full) ---

815 while (pos != oldp->msg_bufx) {
816 msglogchar(oldp->msg_ptr[pos], -1);
817 if (++pos >= oldp->msg_size)
818 pos = 0;
819 }
820}
821
822void
823msgbufinit(void *ptr, size_t size)
823msgbufinit(void *ptr, int size)
824{
825 char *cp;
826 static struct msgbuf *oldp = NULL;
827
828 size -= sizeof(*msgbufp);
829 cp = (char *)ptr;
830 msgbufp = (struct msgbuf *) (cp + size);
831 if (msgbufp->msg_magic != MSG_MAGIC || msgbufp->msg_size != size ||
824{
825 char *cp;
826 static struct msgbuf *oldp = NULL;
827
828 size -= sizeof(*msgbufp);
829 cp = (char *)ptr;
830 msgbufp = (struct msgbuf *) (cp + size);
831 if (msgbufp->msg_magic != MSG_MAGIC || msgbufp->msg_size != size ||
832 msgbufp->msg_bufx >= size || msgbufp->msg_bufr >= size) {
832 msgbufp->msg_bufx >= size || msgbufp->msg_bufx < 0 ||
833 msgbufp->msg_bufr >= size || msgbufp->msg_bufr < 0) {
833 bzero(cp, size);
834 bzero(msgbufp, sizeof(*msgbufp));
835 msgbufp->msg_magic = MSG_MAGIC;
836 msgbufp->msg_size = (char *)msgbufp - cp;
837 }
838 msgbufp->msg_ptr = cp;
839 if (msgbufmapped && oldp != msgbufp)
840 msgbufcopy(oldp);

--- 85 unchanged lines hidden ---
834 bzero(cp, size);
835 bzero(msgbufp, sizeof(*msgbufp));
836 msgbufp->msg_magic = MSG_MAGIC;
837 msgbufp->msg_size = (char *)msgbufp - cp;
838 }
839 msgbufp->msg_ptr = cp;
840 if (msgbufmapped && oldp != msgbufp)
841 msgbufcopy(oldp);

--- 85 unchanged lines hidden ---