xref: /freebsd/include/ssp/uio.h (revision 1ace24b30cad59c8ae509d0c690aa55b8df73136)
1*1ace24b3SKyle Evans /*-
2*1ace24b3SKyle Evans  * SPDX-License-Identifier: BSD-2-Clause
3*1ace24b3SKyle Evans  *
4*1ace24b3SKyle Evans  * Copyright (c) 2024, Klara, Inc.
5*1ace24b3SKyle Evans  *
6*1ace24b3SKyle Evans  * Redistribution and use in source and binary forms, with or without
7*1ace24b3SKyle Evans  * modification, are permitted provided that the following conditions
8*1ace24b3SKyle Evans  * are met:
9*1ace24b3SKyle Evans  * 1. Redistributions of source code must retain the above copyright
10*1ace24b3SKyle Evans  *    notice, this list of conditions and the following disclaimer.
11*1ace24b3SKyle Evans  * 2. Redistributions in binary form must reproduce the above copyright
12*1ace24b3SKyle Evans  *    notice, this list of conditions and the following disclaimer in the
13*1ace24b3SKyle Evans  *    documentation and/or other materials provided with the distribution.
14*1ace24b3SKyle Evans  *
15*1ace24b3SKyle Evans  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
16*1ace24b3SKyle Evans  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
17*1ace24b3SKyle Evans  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
18*1ace24b3SKyle Evans  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
19*1ace24b3SKyle Evans  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
20*1ace24b3SKyle Evans  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
21*1ace24b3SKyle Evans  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
22*1ace24b3SKyle Evans  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
23*1ace24b3SKyle Evans  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
24*1ace24b3SKyle Evans  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
25*1ace24b3SKyle Evans  * POSSIBILITY OF SUCH DAMAGE.
26*1ace24b3SKyle Evans  */
27*1ace24b3SKyle Evans #ifndef _SSP_UIO_H_
28*1ace24b3SKyle Evans #define _SSP_UIO_H_
29*1ace24b3SKyle Evans 
30*1ace24b3SKyle Evans #include <ssp/ssp.h>
31*1ace24b3SKyle Evans 
32*1ace24b3SKyle Evans #if __SSP_FORTIFY_LEVEL > 0
33*1ace24b3SKyle Evans 
34*1ace24b3SKyle Evans __BEGIN_DECLS
35*1ace24b3SKyle Evans 
36*1ace24b3SKyle Evans __ssp_redirect_raw_impl(ssize_t, readv, readv,
37*1ace24b3SKyle Evans     (int fd, const struct iovec *iov, int iovcnt))
38*1ace24b3SKyle Evans {
39*1ace24b3SKyle Evans 	__ssp_check_iovec(iov, iovcnt);
40*1ace24b3SKyle Evans 	return (__ssp_real(readv)(fd, iov, iovcnt));
41*1ace24b3SKyle Evans }
42*1ace24b3SKyle Evans 
43*1ace24b3SKyle Evans __ssp_redirect_raw_impl(ssize_t, preadv, preadv,
44*1ace24b3SKyle Evans     (int fd, const struct iovec *iov, int iovcnt, off_t offset))
45*1ace24b3SKyle Evans {
46*1ace24b3SKyle Evans 	__ssp_check_iovec(iov, iovcnt);
47*1ace24b3SKyle Evans 	return (__ssp_real(preadv)(fd, iov, iovcnt, offset));
48*1ace24b3SKyle Evans }
49*1ace24b3SKyle Evans 
50*1ace24b3SKyle Evans __END_DECLS
51*1ace24b3SKyle Evans 
52*1ace24b3SKyle Evans #endif /* __SSP_FORTIFY_LEVEL > 0 */
53*1ace24b3SKyle Evans #endif /* _SSP_UIO_H_ */
54