From c8b3626a77370899b9fc62294a0136f85e7c9373 Mon Sep 17 00:00:00 2001 From: Sascha Wildner Date: Mon, 16 Feb 2009 01:12:07 +0100 Subject: [PATCH] uio.h: Move definition of struct iovec to . * Make iov_base a void * and fix a resulting warning in lpr(1). * Include in . Taken-from: FreeBSD --- sys/sys/_iovec.h | 48 ++++++++++++++++++++++++++++++ sys/sys/socket.h | 2 ++ sys/sys/uio.h | 11 ++----- usr.sbin/lpr/common_source/rmjob.c | 2 +- 4 files changed, 53 insertions(+), 10 deletions(-) create mode 100644 sys/sys/_iovec.h diff --git a/sys/sys/_iovec.h b/sys/sys/_iovec.h new file mode 100644 index 0000000000..1fafc2318c --- /dev/null +++ b/sys/sys/_iovec.h @@ -0,0 +1,48 @@ +/*- + * Copyright (c) 1982, 1986, 1993, 1994 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)uio.h 8.5 (Berkeley) 2/22/94 + * $FreeBSD: src/sys/sys/_iovec.h,v 1.4 2005/01/07 02:29:23 imp Exp $ + */ + +#ifndef _SYS__IOVEC_H_ +#define _SYS__IOVEC_H_ + +#include + +#ifndef _SIZE_T_DECLARED +typedef __size_t size_t; +#define _SIZE_T_DECLARED +#endif + +struct iovec { + void *iov_base; /* Base address. */ + size_t iov_len; /* Length. */ +}; + +#endif /* !_SYS__IOVEC_H_ */ diff --git a/sys/sys/socket.h b/sys/sys/socket.h index 2430e048b6..8515b14995 100644 --- a/sys/sys/socket.h +++ b/sys/sys/socket.h @@ -38,6 +38,8 @@ #ifndef _SYS_SOCKET_H_ #define _SYS_SOCKET_H_ +#include + #ifndef _SYS_TYPES_H_ #include #endif diff --git a/sys/sys/uio.h b/sys/sys/uio.h index e325bebd43..dd26f89885 100644 --- a/sys/sys/uio.h +++ b/sys/sys/uio.h @@ -38,6 +38,8 @@ #ifndef _SYS_UIO_H_ #define _SYS_UIO_H_ +#include + #ifndef _SYS_TYPES_H_ #include #endif @@ -48,15 +50,6 @@ #include /* Needed to inline iovec_free(). */ #endif -/* - * XXX - * iov_base should be a void *. - */ -struct iovec { - char *iov_base; /* Base address. */ - size_t iov_len; /* Length. */ -}; - enum uio_rw { UIO_READ, UIO_WRITE }; /* Segment flag values. */ diff --git a/usr.sbin/lpr/common_source/rmjob.c b/usr.sbin/lpr/common_source/rmjob.c index 964066e1b9..72ed5d28ac 100644 --- a/usr.sbin/lpr/common_source/rmjob.c +++ b/usr.sbin/lpr/common_source/rmjob.c @@ -345,7 +345,7 @@ rmremote(const struct printer *pp) } firstreq = elem; for (i = 0; i < requests; i++) { - asprintf(&iov[elem].iov_base, " %d", requ[i]); + asprintf((char **)&iov[elem].iov_base, " %d", requ[i]); if (iov[elem].iov_base == 0) fatal(pp, "out of memory in rmremote()"); elem++; -- 2.41.0