Allocate PCBs with malloc(), not MGET().

This commit is contained in:
mycroft 1995-08-16 00:38:53 +00:00
parent af8b19a276
commit 26c674e349
5 changed files with 14 additions and 42 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: argo_debug.h,v 1.5 1994/06/29 06:39:02 cgd Exp $ */
/* $NetBSD: argo_debug.h,v 1.6 1995/08/16 00:38:53 mycroft Exp $ */
/*-
* Copyright (c) 1991, 1993
@ -266,28 +266,20 @@ void dump_mbuf();
#ifdef notdef
#define TPMT_DATA 0x21
#define TPMT_RCVRTC 0x42
#define TPMT_SNDRTC 0x41
#define TPMT_TPHDR 0x22
#define TPMT_IPHDR 0x32
#define TPMT_SONAME 0x28
#define TPMT_EOT 0x40
#define TPMT_XPD 0x44
#define TPMT_PCB 0x23
#define TPMT_PERF 0x45
#else /* ARGO_DEBUG */
#define TPMT_DATA MT_DATA
#define TPMT_RCVRTC MT_DATA
#define TPMT_SNDRTC MT_DATA
#define TPMT_IPHDR MT_HEADER
#define TPMT_TPHDR MT_HEADER
#define TPMT_SONAME MT_SONAME
/* MT_EOT and MT_XPD are defined in tp_param.h */
#define TPMT_XPD MT_OOBDATA
#define TPMT_PCB MT_PCB
#define TPMT_PERF MT_PCB
#endif /* ARGO_DEBUG */

View File

@ -1,4 +1,4 @@
/* $NetBSD: tp_output.c,v 1.8 1995/08/12 23:59:50 mycroft Exp $ */
/* $NetBSD: tp_output.c,v 1.9 1995/08/16 00:38:54 mycroft Exp $ */
/*-
* Copyright (c) 1991, 1993
@ -592,14 +592,12 @@ tp_ctloutput(cmd, so, level, optname, mp)
error = EINVAL; goto done;
}
IFPERF(tpcb)
if (*mp) {
struct mbuf * n;
do {
MFREE(*mp, n);
*mp = n;
} while (n);
MCLGET(*mp, M_WAITOK);
if (((*mp)->m_flags & M_EXT) == 0) {
error = ENOBUFS; goto done;
}
*mp = m_copym(tpcb->tp_p_mbuf, (int)M_COPYALL, M_WAITOK);
(*mp)->m_len = sizeof(struct tp_pmeas);
bcopy(tpcb->tp_p_meas, mtod(*mp), sizeof(struct tp_pmeas));
ENDPERF
else {
error = EINVAL; goto done;

View File

@ -1,4 +1,4 @@
/* $NetBSD: tp_pcb.c,v 1.8 1995/06/13 07:58:22 mycroft Exp $ */
/* $NetBSD: tp_pcb.c,v 1.9 1995/08/16 00:38:56 mycroft Exp $ */
/*-
* Copyright (c) 1991, 1993
@ -853,18 +853,12 @@ tp_detach(tpcb)
* to one (that is, we need the TP_PERF_MEASs around the following section
* of code, not the IFPERFs)
*/
if (tpcb->tp_p_mbuf) {
register struct mbuf *m = tpcb->tp_p_mbuf;
struct mbuf *n;
if (tpcb->tp_p_meas) {
IFDEBUG(D_PERF_MEAS)
printf("freeing tp_p_meas 0x%x ", tpcb->tp_p_meas);
ENDDEBUG
do {
MFREE(m, n);
m = n;
} while (n);
free(tpcb->tp_p_meas, M_PCB);
tpcb->tp_p_meas = 0;
tpcb->tp_p_mbuf = 0;
}
#endif /* TP_PERF_MEAS */

View File

@ -1,4 +1,4 @@
/* $NetBSD: tp_pcb.h,v 1.7 1995/03/26 20:35:31 jtc Exp $ */
/* $NetBSD: tp_pcb.h,v 1.8 1995/08/16 00:38:57 mycroft Exp $ */
/*-
* Copyright (c) 1991, 1993
@ -269,7 +269,6 @@ struct tp_pcb {
#ifdef TP_PERF_MEAS
/* performance stats - see tp_stat.h */
struct tp_pmeas *tp_p_meas;
struct mbuf *tp_p_mbuf;
#endif /* TP_PERF_MEAS */
/* addressing */

View File

@ -1,4 +1,4 @@
/* $NetBSD: tp_subr2.c,v 1.7 1995/06/13 07:13:47 mycroft Exp $ */
/* $NetBSD: tp_subr2.c,v 1.8 1995/08/16 00:38:58 mycroft Exp $ */
/*-
* Copyright (c) 1991, 1993
@ -792,21 +792,10 @@ int
tp_setup_perf(tpcb)
register struct tp_pcb *tpcb;
{
register struct mbuf *q;
if( tpcb->tp_p_meas == 0 ) {
MGET(q, M_WAITOK, MT_PCB);
if (q == 0)
return ENOBUFS;
MCLGET(q, M_WAITOK);
if ((q->m_flags & M_EXT) == 0) {
(void) m_free(q);
return ENOBUFS;
}
q->m_len = sizeof (struct tp_pmeas);
tpcb->tp_p_mbuf = q;
tpcb->tp_p_meas = mtod(q, struct tp_pmeas *);
bzero( (caddr_t)tpcb->tp_p_meas, sizeof (struct tp_pmeas) );
tpcb->tp_p_meas = malloc(sizeof(struct tp_pmeas), M_PCB, M_WAITOK);
bzero((caddr_t)tpcb->tp_p_meas, sizeof(struct tp_pmeas));
IFDEBUG(D_PERF_MEAS)
printf(
"tpcb 0x%x so 0x%x ref 0x%x tp_p_meas 0x%x tp_perf_on 0x%x\n",