uipc_syscalls.c (e1419c08e2520d267e0a14e1bb10ae3bebbb12ae) uipc_syscalls.c (e45db9b837dc530b86149374e2baeaa775061107)
1/*
2 * Copyright (c) 1982, 1986, 1989, 1990, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * sendfile(2) and related extensions:
6 * Copyright (c) 1998, David Greenman. All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without

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

55#include <sys/event.h>
56#include <sys/proc.h>
57#include <sys/fcntl.h>
58#include <sys/file.h>
59#include <sys/filio.h>
60#include <sys/mount.h>
61#include <sys/mbuf.h>
62#include <sys/protosw.h>
1/*
2 * Copyright (c) 1982, 1986, 1989, 1990, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * sendfile(2) and related extensions:
6 * Copyright (c) 1998, David Greenman. All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without

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

55#include <sys/event.h>
56#include <sys/proc.h>
57#include <sys/fcntl.h>
58#include <sys/file.h>
59#include <sys/filio.h>
60#include <sys/mount.h>
61#include <sys/mbuf.h>
62#include <sys/protosw.h>
63#include <sys/sf_buf.h>
63#include <sys/socket.h>
64#include <sys/socketvar.h>
65#include <sys/signalvar.h>
66#include <sys/syscallsubr.h>
67#include <sys/uio.h>
68#include <sys/vnode.h>
69#ifdef KTRACE
70#include <sys/ktrace.h>

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

1880 }
1881
1882 /*
1883 * Get an mbuf header and set it up as having external storage.
1884 */
1885 MGETHDR(m, M_TRYWAIT, MT_DATA);
1886 if (m == NULL) {
1887 error = ENOBUFS;
64#include <sys/socket.h>
65#include <sys/socketvar.h>
66#include <sys/signalvar.h>
67#include <sys/syscallsubr.h>
68#include <sys/uio.h>
69#include <sys/vnode.h>
70#ifdef KTRACE
71#include <sys/ktrace.h>

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

1881 }
1882
1883 /*
1884 * Get an mbuf header and set it up as having external storage.
1885 */
1886 MGETHDR(m, M_TRYWAIT, MT_DATA);
1887 if (m == NULL) {
1888 error = ENOBUFS;
1888 sf_buf_free((void *)sf->kva, sf);
1889 sf_buf_free((void *)sf_buf_kva(sf), sf);
1889 sbunlock(&so->so_snd);
1890 goto done;
1891 }
1892 /*
1893 * Setup external storage for mbuf.
1894 */
1890 sbunlock(&so->so_snd);
1891 goto done;
1892 }
1893 /*
1894 * Setup external storage for mbuf.
1895 */
1895 MEXTADD(m, sf->kva, PAGE_SIZE, sf_buf_free, sf, M_RDONLY,
1896 MEXTADD(m, sf_buf_kva(sf), PAGE_SIZE, sf_buf_free, sf, M_RDONLY,
1896 EXT_SFBUF);
1897 EXT_SFBUF);
1897 m->m_data = (char *) sf->kva + pgoff;
1898 m->m_data = (char *)sf_buf_kva(sf) + pgoff;
1898 m->m_pkthdr.len = m->m_len = xfsize;
1899 /*
1900 * Add the buffer to the socket buffer chain.
1901 */
1902 s = splnet();
1903retry_space:
1904 /*
1905 * Make sure that the socket is still able to take more data.

--- 93 unchanged lines hidden ---
1899 m->m_pkthdr.len = m->m_len = xfsize;
1900 /*
1901 * Add the buffer to the socket buffer chain.
1902 */
1903 s = splnet();
1904retry_space:
1905 /*
1906 * Make sure that the socket is still able to take more data.

--- 93 unchanged lines hidden ---