aio.c (156267) | aio.c (156383) |
---|---|
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 156267 2006-03-04 00:18:19Z davidxu $ | 26 * $FreeBSD: head/lib/librt/aio.c 156383 2006-03-07 08:28:07Z 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 35#include "namespace.h" 36#include <errno.h> | 27 * 28 */ 29 30#include <sys/cdefs.h> 31#include <sys/types.h> 32#include <sys/syscall.h> 33#include <sys/aio.h> 34 35#include "namespace.h" 36#include <errno.h> |
37#include <pthread.h> | |
38#include <stddef.h> 39#include <signal.h> | 37#include <stddef.h> 38#include <signal.h> |
40#include <unistd.h> | |
41#include "sigev_thread.h" 42#include "un-namespace.h" 43 44__weak_reference(__aio_read, _aio_read); 45__weak_reference(__aio_read, aio_read); 46__weak_reference(__aio_write, _aio_write); 47__weak_reference(__aio_write, aio_write); 48__weak_reference(__aio_return, _aio_return); --- 38 unchanged lines hidden (view full) --- 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; | 39#include "sigev_thread.h" 40#include "un-namespace.h" 41 42__weak_reference(__aio_read, _aio_read); 43__weak_reference(__aio_read, aio_read); 44__weak_reference(__aio_write, _aio_write); 45__weak_reference(__aio_write, aio_write); 46__weak_reference(__aio_return, _aio_return); --- 38 unchanged lines hidden (view full) --- 85 sn = __sigev_alloc(SI_ASYNCIO, &iocb->aio_sigevent, NULL, 1); 86 if (sn == NULL) { 87 errno = EAGAIN; 88 return (-1); 89 } 90 91 saved_ev = iocb->aio_sigevent; 92 sn->sn_id = (sigev_id_t)iocb; |
95 sn->sn_flags |= SNF_ONESHOT; | |
96 __sigev_get_sigevent(sn, &iocb->aio_sigevent, sn->sn_id); 97 98 __sigev_list_lock(); 99 __sigev_register(sn); 100 __sigev_list_unlock(); 101 102 sn->sn_dispatch = aio_dispatch; 103 ret = sysfunc(iocb); --- 59 unchanged lines hidden --- | 93 __sigev_get_sigevent(sn, &iocb->aio_sigevent, sn->sn_id); 94 95 __sigev_list_lock(); 96 __sigev_register(sn); 97 __sigev_list_unlock(); 98 99 sn->sn_dispatch = aio_dispatch; 100 ret = sysfunc(iocb); --- 59 unchanged lines hidden --- |