Deleted Added
full compact
26c26
< * $FreeBSD: head/lib/librt/aio.c 156383 2006-03-07 08:28:07Z davidxu $
---
> * $FreeBSD: head/lib/librt/aio.c 157078 2006-03-24 03:24:27Z davidxu $
49a50,51
> __weak_reference(__aio_fsync, _aio_fsync);
> __weak_reference(__aio_fsync, aio_fsync);
57a60
> extern int __sys_aio_fsync(int op, struct aiocb *iocb);
68c71,72
< aio_io(struct aiocb *iocb, int (*sysfunc)(struct aiocb *iocb))
---
> aio_sigev_alloc(struct aiocb *iocb, struct sigev_node **sn,
> struct sigevent *saved_ev)
70,78d73
< struct sigev_node *sn;
< struct sigevent saved_ev;
< int ret, err;
<
< if (iocb->aio_sigevent.sigev_notify != SIGEV_THREAD) {
< ret = sysfunc(iocb);
< return (ret);
< }
<
85,86c80,81
< sn = __sigev_alloc(SI_ASYNCIO, &iocb->aio_sigevent, NULL, 1);
< if (sn == NULL) {
---
> *sn = __sigev_alloc(SI_ASYNCIO, &iocb->aio_sigevent, NULL, 1);
> if (*sn == NULL) {
91,93c86,89
< saved_ev = iocb->aio_sigevent;
< sn->sn_id = (sigev_id_t)iocb;
< __sigev_get_sigevent(sn, &iocb->aio_sigevent, sn->sn_id);
---
> *saved_ev = iocb->aio_sigevent;
> (*sn)->sn_id = (sigev_id_t)iocb;
> __sigev_get_sigevent(*sn, &iocb->aio_sigevent, (*sn)->sn_id);
> (*sn)->sn_dispatch = aio_dispatch;
96c92
< __sigev_register(sn);
---
> __sigev_register(*sn);
99c95,112
< sn->sn_dispatch = aio_dispatch;
---
> return (0);
> }
>
> static int
> aio_io(struct aiocb *iocb, int (*sysfunc)(struct aiocb *iocb))
> {
> struct sigev_node *sn;
> struct sigevent saved_ev;
> int ret, err;
>
> if (iocb->aio_sigevent.sigev_notify != SIGEV_THREAD) {
> ret = sysfunc(iocb);
> return (ret);
> }
>
> ret = aio_sigev_alloc(iocb, &sn, &saved_ev);
> if (ret)
> return (ret);
102d114
<
159a172,196
>
> int
> __aio_fsync(int op, struct aiocb *iocb)
> {
> struct sigev_node *sn;
> struct sigevent saved_ev;
> int ret, err;
>
> if (iocb->aio_sigevent.sigev_notify != SIGEV_THREAD)
> return __sys_aio_fsync(op, iocb);
>
> ret = aio_sigev_alloc(iocb, &sn, &saved_ev);
> if (ret)
> return (ret);
> ret = __sys_aio_fsync(op, iocb);
> iocb->aio_sigevent = saved_ev;
> if (ret != 0) {
> err = errno;
> __sigev_list_lock();
> __sigev_delete_node(sn);
> __sigev_list_unlock();
> errno = err;
> }
> return (ret);
> }