svr4_stream.c (109153) | svr4_stream.c (109623) |
---|---|
1/* 2 * Copyright (c) 1998 Mark Newton. All rights reserved. 3 * Copyright (c) 1994, 1996 Christos Zoulas. 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 --- 13 unchanged lines hidden (view full) --- 22 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 23 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 24 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 28 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 * | 1/* 2 * Copyright (c) 1998 Mark Newton. All rights reserved. 3 * Copyright (c) 1994, 1996 Christos Zoulas. 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 --- 13 unchanged lines hidden (view full) --- 22 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 23 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 24 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 28 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 * |
30 * $FreeBSD: head/sys/compat/svr4/svr4_stream.c 109153 2003-01-13 00:33:17Z dillon $ | 30 * $FreeBSD: head/sys/compat/svr4/svr4_stream.c 109623 2003-01-21 08:56:16Z alfred $ |
31 */ 32 33/* 34 * Pretend that we have streams... 35 * Yes, this is gross. 36 * 37 * ToDo: The state machine for getmsg needs re-thinking 38 */ --- 168 unchanged lines hidden (view full) --- 207 goto bad; 208 } else { 209 control = 0; 210 } 211#ifdef KTRACE 212 if (KTRPOINT(td, KTR_GENIO)) { 213 int iovlen = auio.uio_iovcnt * sizeof (struct iovec); 214 | 31 */ 32 33/* 34 * Pretend that we have streams... 35 * Yes, this is gross. 36 * 37 * ToDo: The state machine for getmsg needs re-thinking 38 */ --- 168 unchanged lines hidden (view full) --- 207 goto bad; 208 } else { 209 control = 0; 210 } 211#ifdef KTRACE 212 if (KTRPOINT(td, KTR_GENIO)) { 213 int iovlen = auio.uio_iovcnt * sizeof (struct iovec); 214 |
215 MALLOC(ktriov, struct iovec *, iovlen, M_TEMP, M_WAITOK); | 215 MALLOC(ktriov, struct iovec *, iovlen, M_TEMP, 0); |
216 bcopy((caddr_t)auio.uio_iov, (caddr_t)ktriov, iovlen); 217 ktruio = auio; 218 } 219#endif 220 len = auio.uio_resid; 221 error = so->so_proto->pr_usrreqs->pru_sosend(so, to, &auio, 0, control, 222 flags, td); 223 if (error) { --- 68 unchanged lines hidden (view full) --- 292 error = EINVAL; 293 goto done1; 294 } 295 } 296#ifdef KTRACE 297 if (KTRPOINT(td, KTR_GENIO)) { 298 int iovlen = auio.uio_iovcnt * sizeof (struct iovec); 299 | 216 bcopy((caddr_t)auio.uio_iov, (caddr_t)ktriov, iovlen); 217 ktruio = auio; 218 } 219#endif 220 len = auio.uio_resid; 221 error = so->so_proto->pr_usrreqs->pru_sosend(so, to, &auio, 0, control, 222 flags, td); 223 if (error) { --- 68 unchanged lines hidden (view full) --- 292 error = EINVAL; 293 goto done1; 294 } 295 } 296#ifdef KTRACE 297 if (KTRPOINT(td, KTR_GENIO)) { 298 int iovlen = auio.uio_iovcnt * sizeof (struct iovec); 299 |
300 MALLOC(ktriov, struct iovec *, iovlen, M_TEMP, M_WAITOK); | 300 MALLOC(ktriov, struct iovec *, iovlen, M_TEMP, 0); |
301 bcopy((caddr_t)auio.uio_iov, (caddr_t)ktriov, iovlen); 302 ktruio = auio; 303 } 304#endif 305 len = auio.uio_resid; 306 error = so->so_proto->pr_usrreqs->pru_soreceive(so, &fromsa, &auio, 307 (struct mbuf **)0, mp->msg_control ? &control : (struct mbuf **)0, 308 &mp->msg_flags); --- 94 unchanged lines hidden (view full) --- 403 } 404} 405 406static int 407show_ioc(str, ioc) 408 const char *str; 409 struct svr4_strioctl *ioc; 410{ | 301 bcopy((caddr_t)auio.uio_iov, (caddr_t)ktriov, iovlen); 302 ktruio = auio; 303 } 304#endif 305 len = auio.uio_resid; 306 error = so->so_proto->pr_usrreqs->pru_soreceive(so, &fromsa, &auio, 307 (struct mbuf **)0, mp->msg_control ? &control : (struct mbuf **)0, 308 &mp->msg_flags); --- 94 unchanged lines hidden (view full) --- 403 } 404} 405 406static int 407show_ioc(str, ioc) 408 const char *str; 409 struct svr4_strioctl *ioc; 410{ |
411 u_char *ptr = (u_char *) malloc(ioc->len, M_TEMP, M_WAITOK); | 411 u_char *ptr = (u_char *) malloc(ioc->len, M_TEMP, 0); |
412 int error; 413 414 uprintf("%s cmd = %ld, timeout = %d, len = %d, buf = %p { ", 415 str, ioc->cmd, ioc->timeout, ioc->len, ioc->buf); 416 417 if ((error = copyin(ioc->buf, ptr, ioc->len)) != 0) { 418 free((char *) ptr, M_TEMP); 419 return error; --- 19 unchanged lines hidden (view full) --- 439 440 if (maxlen < 0) 441 maxlen = 0; 442 443 if (len >= maxlen) 444 len = maxlen; 445 446 if (len > 0) { | 412 int error; 413 414 uprintf("%s cmd = %ld, timeout = %d, len = %d, buf = %p { ", 415 str, ioc->cmd, ioc->timeout, ioc->len, ioc->buf); 416 417 if ((error = copyin(ioc->buf, ptr, ioc->len)) != 0) { 418 free((char *) ptr, M_TEMP); 419 return error; --- 19 unchanged lines hidden (view full) --- 439 440 if (maxlen < 0) 441 maxlen = 0; 442 443 if (len >= maxlen) 444 len = maxlen; 445 446 if (len > 0) { |
447 ptr = (u_char *) malloc(len, M_TEMP, M_WAITOK); | 447 ptr = (u_char *) malloc(len, M_TEMP, 0); |
448 449 if ((error = copyin(str->buf, ptr, len)) != 0) { 450 free((char *) ptr, M_TEMP); 451 return error; 452 } 453 } 454 455 uprintf(", { %d, %d, %p=[ ", str->maxlen, str->len, str->buf); --- 1858 unchanged lines hidden --- | 448 449 if ((error = copyin(str->buf, ptr, len)) != 0) { 450 free((char *) ptr, M_TEMP); 451 return error; 452 } 453 } 454 455 uprintf(", { %d, %d, %p=[ ", str->maxlen, str->len, str->buf); --- 1858 unchanged lines hidden --- |