|
DataMuseum.dkPresents historical artifacts from the history of: Regnecentalen RC-900 |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about Regnecentalen RC-900 Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - metrics - download
Length: 3941 (0xf65) Types: TextFile Notes: UNIX file Names: »mbuf.h«
└─⟦8c4f54e61⟧ Bits:30004068/disk2.imd Interactive TCP/IP v.1.2 └─⟦8c4f54e61⟧ UNIX Filesystem └─⟦this⟧ »hb/new/usr/include/sys/mbuf.h«
/* * Copyright (c) 1982, 1986 Regents of the University of California. * All rights reserved. The Berkeley software License Agreement * specifies the terms and conditions for redistribution. * * @(#)mbuf.h 7.1 (Berkeley) 6/4/86 */ #ident "@(#)mbuf.h 1.2 - 89/02/24" /* * Constants related to memory allocator. */ #define MSIZE 128 /* size of an mbuf */ #define MMINOFF 0 /* mbuf header length */ #define MTAIL 4 #define MMAXOFF (MSIZE-MTAIL) /* offset where data ends */ #define MLEN (MSIZE-MMINOFF-MTAIL) /* mbuf data length */ #define NMBCLUSTERS 256 #define NMBPCL (CLBYTES/MSIZE) /* # mbufs per cluster */ /* * Macros for type conversion */ /* address in mbuf to mbuf head */ #define dtom(x) $_dtom x$ /* mbuf head, to typed data */ #define mtod(x,t) ((t)((x)->b_rptr)) /* macro to get length of this buffer */ #define m_len(m) ((m)->b_wptr - (m)->b_rptr) /* macro to compute space between b_rptr and beginning of buffer */ /* used for m_off value */ #define m_off(m) ((m)->b_rptr - (m)->b_datap->db_base) /* get base of buffer for reset of b_rptr */ #define m_base(m) (m)->b_datap->db_base /* maximum amount of data (MAXOFF) in this buffer */ #define m_maxoff(m) ((m)->b_datap->db_lim - (m)->b_datap->db_base) /* mbuf types */ #define MT_FREE 0 /* should be on free list */ #define MT_DATA 1 /* dynamic (data) allocation */ #define MT_HEADER 2 /* packet header */ #define MT_SOCKET 3 /* socket structure */ #define MT_PCB 4 /* protocol control block */ #define MT_RTABLE 5 /* routing tables */ #define MT_HTABLE 6 /* IMP host tables */ #define MT_ATABLE 7 /* address resolution tables */ #define MT_SONAME 8 /* socket name */ #define MT_ZOMBIE 9 /* zombie proc status */ #define MT_SOOPTS 10 /* socket options */ #define MT_FTABLE 11 /* fragment reassembly header */ #define MT_RIGHTS 12 /* access rights */ #define MT_IFADDR 13 /* interface address */ /* flags to m_get */ #define M_DONTWAIT 0 #define M_WAIT 1 /* flags to m_pgalloc */ /* #define MPG_MBUFS 0 /* put new mbufs on free list */ /* #define MPG_CLUSTERS 1 /* put new clusters on free list */ /* #define MPG_SPACE 2 /* don't free; caller wants space */ /* length to m_copy to copy all */ #define M_COPYALL 1000000000 /* * m_pullup will pull up additional length if convenient; * should be enough to hold headers of second-level and higher protocols. */ #define MPULL_EXTRA 32 #define MGET(m, i, t) (m = allocb(MSIZE, BPRI_MED)) /* * Mbuf page cluster macros. * MCLALLOC allocates mbuf page clusters. * Note that it works only with a count of 1 at the moment. * MCLGET adds such clusters to a normal mbuf. * m->m_len is set to CLBYTES upon success. * MCLFREE frees clusters allocated by MCLALLOC. */ #define CLBYTES 1024 #define MCLBYTES CLBYTES #define MCLALLOC(m, i) (m = allocb(CLBYTES, BPRI_MED)) /* #define M_HASCL(m) ((m)->m_off >= MSIZE) */ /* #define MTOCL(m) ((struct mbuf *)(mtod((m), int)&~CLOFSET)) */ #define MCLGET(m) MCLALLOC(m, M_DONTWAIT, MT_DATA) #define MCLFREE(m) $MCLFREE m$ #define MFREE(m, n) {n = m->b_cont; freeb(m);} /* * additional macros to map functions as needed */ #define m_freem(m) freemsg(m) /* 1-1 mapping */ #define m_free(m) freeb(m) #define m_adj(m,diff) (adjmsg(m, diff)==1 ||panic("m_adj")) /* adjmsg can fail, m_adj doesn't ??? */ #define m_cat(m1, m2) linkb(m1, m2) /* m_cat does compaction, linkb does not */ /* equivalent. VAX converts ovbcopy into inline code */ #define ovbcopy bcopy /* * Mbuf statistics. */ /* struct mbstat { /* short m_mbufs; /* mbufs obtained from page pool */ /* short m_clusters; /* clusters obtained from page pool */ /* short m_clfree; /* free clusters */ /* short m_drops; /* times failed to find space */ /* short m_mtypes[256]; /* type specific mbuf allocations */ /* }; */ #ifdef KERNEL /* need to map this to a valid function */ #define splnet splstr mblk_t *m_get(), *m_getclr(), *m_copy(), *m_pullup(); #endif