MCPcopy Create free account
hub / github.com/F-Stack/f-stack / m_dup1

Function m_dup1

freebsd/kern/uipc_mbuf2.c:269–302  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

267}
268
269static struct mbuf *
270m_dup1(struct mbuf *m, int off, int len, int wait)
271{
272 struct mbuf *n;
273 int copyhdr;
274
275 if (len > MCLBYTES)
276 return NULL;
277 if (off == 0 && (m->m_flags & M_PKTHDR) != 0)
278 copyhdr = 1;
279 else
280 copyhdr = 0;
281 if (len >= MINCLSIZE) {
282 if (copyhdr == 1)
283 n = m_getcl(wait, m->m_type, M_PKTHDR);
284 else
285 n = m_getcl(wait, m->m_type, 0);
286 } else {
287 if (copyhdr == 1)
288 n = m_gethdr(wait, m->m_type);
289 else
290 n = m_get(wait, m->m_type);
291 }
292 if (!n)
293 return NULL; /* ENOBUFS */
294
295 if (copyhdr && !m_dup_pkthdr(n, m, wait)) {
296 m_free(n);
297 return NULL;
298 }
299 m_copydata(m, off, len, mtod(n, caddr_t));
300 n->m_len = len;
301 return n;
302}
303
304/* Free a packet tag. */
305void

Callers 1

m_pulldownFunction · 0.85

Calls 6

m_dup_pkthdrFunction · 0.85
m_copydataFunction · 0.85
m_getclFunction · 0.50
m_gethdrFunction · 0.50
m_getFunction · 0.50
m_freeFunction · 0.50

Tested by

no test coverage detected