2 * Copyright (c) 2013 Adrian Chadd <adrian@FreeBSD.org>
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
14 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29 #ifndef _SYS_SF_SYNC_H_
30 #define _SYS_SF_SYNC_H_
38 } sendfile_sync_state_t;
40 struct sendfile_sync {
46 int32_t xerrno; /* Completion errno, if retval < 0 */
47 off_t retval; /* Completion retval (eg written bytes) */
48 sendfile_sync_state_t state;
54 extern struct sendfile_sync * sf_sync_alloc(uint32_t flags);
55 extern void sf_sync_syscall_wait(struct sendfile_sync *);
56 extern void sf_sync_free(struct sendfile_sync *);
57 extern void sf_sync_try_free(struct sendfile_sync *);
58 extern void sf_sync_ref(struct sendfile_sync *);
59 extern void sf_sync_deref(struct sendfile_sync *);
60 extern int sf_sync_kqueue_setup(struct sendfile_sync *, struct sf_hdtr_kq *);
61 extern void sf_sync_set_state(struct sendfile_sync *, sendfile_sync_state_t, int);
62 extern void sf_sync_set_retval(struct sendfile_sync *, off_t, int);
64 #endif /* !_SYS_SF_BUF_H_ */