aio.c (156194) | aio.c (156267) |
---|---|
1/* 2 * Copyright (c) 2005 David Xu <davidxu@freebsd.org> 3 * 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 --- 9 unchanged lines hidden (view full) --- 18 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 19 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 20 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 21 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 * | 1/* 2 * Copyright (c) 2005 David Xu <davidxu@freebsd.org> 3 * 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 --- 9 unchanged lines hidden (view full) --- 18 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 19 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 20 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 21 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 * |
26 * $FreeBSD: head/lib/librt/aio.c 156194 2006-03-01 23:41:47Z davidxu $ | 26 * $FreeBSD: head/lib/librt/aio.c 156267 2006-03-04 00:18:19Z davidxu $ |
27 * 28 */ 29 30#include <sys/cdefs.h> 31#include <sys/types.h> 32#include <sys/syscall.h> 33#include <sys/aio.h> 34 --- 19 unchanged lines hidden (view full) --- 54 55extern int __sys_aio_read(struct aiocb *iocb); 56extern int __sys_aio_write(struct aiocb *iocb); 57extern int __sys_aio_waitcomplete(struct aiocb **iocbp, struct timespec *timeout); 58extern int __sys_aio_return(struct aiocb *iocb); 59extern int __sys_aio_error(struct aiocb *iocb); 60 61static void | 27 * 28 */ 29 30#include <sys/cdefs.h> 31#include <sys/types.h> 32#include <sys/syscall.h> 33#include <sys/aio.h> 34 --- 19 unchanged lines hidden (view full) --- 54 55extern int __sys_aio_read(struct aiocb *iocb); 56extern int __sys_aio_write(struct aiocb *iocb); 57extern int __sys_aio_waitcomplete(struct aiocb **iocbp, struct timespec *timeout); 58extern int __sys_aio_return(struct aiocb *iocb); 59extern int __sys_aio_error(struct aiocb *iocb); 60 61static void |
62aio_dispatch(struct sigev_node *sn, siginfo_t *si) | 62aio_dispatch(struct sigev_node *sn) |
63{ 64 aio_func f = sn->sn_func; 65 66 f(sn->sn_value, (struct aiocb *)sn->sn_id); 67} 68 69static int 70aio_io(struct aiocb *iocb, int (*sysfunc)(struct aiocb *iocb)) --- 8 unchanged lines hidden (view full) --- 79 } 80 81 if (__sigev_check_init()) { 82 /* This might be that thread library is not enabled. */ 83 errno = EINVAL; 84 return (-1); 85 } 86 | 63{ 64 aio_func f = sn->sn_func; 65 66 f(sn->sn_value, (struct aiocb *)sn->sn_id); 67} 68 69static int 70aio_io(struct aiocb *iocb, int (*sysfunc)(struct aiocb *iocb)) --- 8 unchanged lines hidden (view full) --- 79 } 80 81 if (__sigev_check_init()) { 82 /* This might be that thread library is not enabled. */ 83 errno = EINVAL; 84 return (-1); 85 } 86 |
87 sn = __sigev_alloc(SI_ASYNCIO, &iocb->aio_sigevent); | 87 sn = __sigev_alloc(SI_ASYNCIO, &iocb->aio_sigevent, NULL, 1); |
88 if (sn == NULL) { 89 errno = EAGAIN; 90 return (-1); 91 } 92 93 saved_ev = iocb->aio_sigevent; 94 sn->sn_id = (sigev_id_t)iocb; 95 sn->sn_flags |= SNF_ONESHOT; --- 67 unchanged lines hidden --- | 88 if (sn == NULL) { 89 errno = EAGAIN; 90 return (-1); 91 } 92 93 saved_ev = iocb->aio_sigevent; 94 sn->sn_id = (sigev_id_t)iocb; 95 sn->sn_flags |= SNF_ONESHOT; --- 67 unchanged lines hidden --- |