uipc_sockbuf.c (c2696aaf51e9d0da2b28c201bdc4ecf32a02c9eb) uipc_sockbuf.c (099a0e588cbe1bbc56a565bf57d722621b47a866)
1/*
2 * Copyright (c) 1982, 1986, 1988, 1990, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

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

954 register int size;
955 int type, level;
956{
957 register struct cmsghdr *cp;
958 struct mbuf *m;
959
960 if (CMSG_SPACE((u_int)size) > MCLBYTES)
961 return ((struct mbuf *) NULL);
1/*
2 * Copyright (c) 1982, 1986, 1988, 1990, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

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

954 register int size;
955 int type, level;
956{
957 register struct cmsghdr *cp;
958 struct mbuf *m;
959
960 if (CMSG_SPACE((u_int)size) > MCLBYTES)
961 return ((struct mbuf *) NULL);
962 if ((m = m_get(M_DONTWAIT, MT_CONTROL)) == NULL)
962 if (CMSG_SPACE((u_int)size > MLEN))
963 m = m_getcl(M_DONTWAIT, MT_CONTROL, 0);
964 else
965 m = m_get(M_DONTWAIT, MT_CONTROL);
966 if (m == NULL)
963 return ((struct mbuf *) NULL);
967 return ((struct mbuf *) NULL);
964 if (CMSG_SPACE((u_int)size) > MLEN) {
965 MCLGET(m, M_DONTWAIT);
966 if ((m->m_flags & M_EXT) == 0) {
967 m_free(m);
968 return ((struct mbuf *) NULL);
969 }
970 }
971 cp = mtod(m, struct cmsghdr *);
972 m->m_len = 0;
973 KASSERT(CMSG_SPACE((u_int)size) <= M_TRAILINGSPACE(m),
974 ("sbcreatecontrol: short mbuf"));
975 if (p != NULL)
976 (void)memcpy(CMSG_DATA(cp), p, size);
977 m->m_len = CMSG_SPACE(size);
978 cp->cmsg_len = CMSG_LEN(size);

--- 162 unchanged lines hidden ---
968 cp = mtod(m, struct cmsghdr *);
969 m->m_len = 0;
970 KASSERT(CMSG_SPACE((u_int)size) <= M_TRAILINGSPACE(m),
971 ("sbcreatecontrol: short mbuf"));
972 if (p != NULL)
973 (void)memcpy(CMSG_DATA(cp), p, size);
974 m->m_len = CMSG_SPACE(size);
975 cp->cmsg_len = CMSG_LEN(size);

--- 162 unchanged lines hidden ---