vfs_aio.c (30994) | vfs_aio.c (31016) |
---|---|
1/* 2 * Copyright (c) 1997 John S. Dyson. All rights reserved. 3 * 4 * Redistribution and use in source and binary forms, with or without 5 * modification, are permitted provided that the following conditions 6 * are met: 7 * 1. Redistributions of source code must retain the above copyright 8 * notice, this list of conditions and the following disclaimer. 9 * 2. John S. Dyson's name may not be used to endorse or promote products 10 * derived from this software without specific prior written permission. 11 * 12 * DISCLAIMER: This code isn't warranted to do anything useful. Anything 13 * bad that happens because of using this software isn't the responsibility 14 * of the author. This software is distributed AS-IS. 15 * | 1/* 2 * Copyright (c) 1997 John S. Dyson. All rights reserved. 3 * 4 * Redistribution and use in source and binary forms, with or without 5 * modification, are permitted provided that the following conditions 6 * are met: 7 * 1. Redistributions of source code must retain the above copyright 8 * notice, this list of conditions and the following disclaimer. 9 * 2. John S. Dyson's name may not be used to endorse or promote products 10 * derived from this software without specific prior written permission. 11 * 12 * DISCLAIMER: This code isn't warranted to do anything useful. Anything 13 * bad that happens because of using this software isn't the responsibility 14 * of the author. This software is distributed AS-IS. 15 * |
16 * $Id: vfs_aio.c,v 1.8 1997/10/12 20:24:19 phk Exp $ | 16 * $Id: vfs_aio.c,v 1.9 1997/11/06 19:29:27 phk Exp $ |
17 */ 18 19/* 20 * This file contains support for the POSIX.4 AIO facility. 21 * 22 * The initial version provides only the (bogus) synchronous semantics 23 * but will support async in the future. Note that a bit 24 * in a private field allows the user mode subroutine to adapt --- 439 unchanged lines hidden (view full) --- 464 if (debugaio > 2) 465 printf("Started new process: %d\n", curproc->p_pid); 466#endif 467 wakeup(&aio_freeproc); 468 469 while(1) { 470 struct vmspace *myvm, *tmpvm; 471 struct proc *cp = curproc; | 17 */ 18 19/* 20 * This file contains support for the POSIX.4 AIO facility. 21 * 22 * The initial version provides only the (bogus) synchronous semantics 23 * but will support async in the future. Note that a bit 24 * in a private field allows the user mode subroutine to adapt --- 439 unchanged lines hidden (view full) --- 464 if (debugaio > 2) 465 printf("Started new process: %d\n", curproc->p_pid); 466#endif 467 wakeup(&aio_freeproc); 468 469 while(1) { 470 struct vmspace *myvm, *tmpvm; 471 struct proc *cp = curproc; |
472 struct proc *up = NULL; | |
473 struct aiocblist *aiocbe; 474 475 if ((aiop->aioprocflags & AIOP_FREE) == 0) { 476 TAILQ_INSERT_HEAD(&aio_freeproc, aiop, list); 477 aiop->aioprocflags |= AIOP_FREE; 478 } 479 if (tsleep(cp, PRIBIO, "aiordy", hz*30)) { 480 if ((num_aio_procs > target_aio_procs) && --- 344 unchanged lines hidden (view full) --- 825/* 826 * Support the aio_return system call 827 */ 828int 829aio_return(struct proc *p, struct aio_return_args *uap) { 830 int jobref, status; 831 struct aiocblist *cb; 832 struct kaioinfo *ki; | 472 struct aiocblist *aiocbe; 473 474 if ((aiop->aioprocflags & AIOP_FREE) == 0) { 475 TAILQ_INSERT_HEAD(&aio_freeproc, aiop, list); 476 aiop->aioprocflags |= AIOP_FREE; 477 } 478 if (tsleep(cp, PRIBIO, "aiordy", hz*30)) { 479 if ((num_aio_procs > target_aio_procs) && --- 344 unchanged lines hidden (view full) --- 824/* 825 * Support the aio_return system call 826 */ 827int 828aio_return(struct proc *p, struct aio_return_args *uap) { 829 int jobref, status; 830 struct aiocblist *cb; 831 struct kaioinfo *ki; |
833 struct proc *userp; | |
834 835 ki = p->p_aioinfo; 836 if (ki == NULL) { 837 return EINVAL; 838 } 839 840 jobref = fuword(&uap->aiocbp->_aiocb_private.kernelinfo); 841 if (jobref == -1) --- 59 unchanged lines hidden (view full) --- 901} 902 903/* 904 * Allow a process to wakeup when any of the I/O requests are 905 * completed. 906 */ 907int 908aio_suspend(struct proc *p, struct aio_suspend_args *uap) { | 832 833 ki = p->p_aioinfo; 834 if (ki == NULL) { 835 return EINVAL; 836 } 837 838 jobref = fuword(&uap->aiocbp->_aiocb_private.kernelinfo); 839 if (jobref == -1) --- 59 unchanged lines hidden (view full) --- 899} 900 901/* 902 * Allow a process to wakeup when any of the I/O requests are 903 * completed. 904 */ 905int 906aio_suspend(struct proc *p, struct aio_suspend_args *uap) { |
909 struct timeval atv, utv; | 907 struct timeval atv; |
910 struct timespec ts; 911 struct aiocb *const *cbptr, *cbp; 912 struct kaioinfo *ki; 913 struct aiocblist *cb; 914 int i; 915 int error, s, timo; 916 int *joblist; 917 --- 113 unchanged lines hidden (view full) --- 1031 1032/* 1033 * aio_error is implemented in the kernel level for compatibility 1034 * purposes only. For a user mode async implementation, it would be 1035 * best to do it in a userland subroutine. 1036 */ 1037int 1038aio_error(struct proc *p, struct aio_error_args *uap) { | 908 struct timespec ts; 909 struct aiocb *const *cbptr, *cbp; 910 struct kaioinfo *ki; 911 struct aiocblist *cb; 912 int i; 913 int error, s, timo; 914 int *joblist; 915 --- 113 unchanged lines hidden (view full) --- 1029 1030/* 1031 * aio_error is implemented in the kernel level for compatibility 1032 * purposes only. For a user mode async implementation, it would be 1033 * best to do it in a userland subroutine. 1034 */ 1035int 1036aio_error(struct proc *p, struct aio_error_args *uap) { |
1039 int activeflag, errorcode; | |
1040 struct aiocblist *cb; 1041 struct kaioinfo *ki; 1042 int jobref; | 1037 struct aiocblist *cb; 1038 struct kaioinfo *ki; 1039 int jobref; |
1043 int error, status; | 1040 int status; |
1044 1045 ki = p->p_aioinfo; 1046 if (ki == NULL) 1047 return EINVAL; 1048 1049 jobref = fuword(&uap->aiocbp->_aiocb_private.kernelinfo); 1050 if (jobref == -1) 1051 return EFAULT; --- 173 unchanged lines hidden (view full) --- 1225 } 1226 cnt -= auio.uio_resid; 1227 p->p_retval[0] = cnt; 1228 return error; 1229} 1230 1231int 1232lio_listio(struct proc *p, struct lio_listio_args *uap) { | 1041 1042 ki = p->p_aioinfo; 1043 if (ki == NULL) 1044 return EINVAL; 1045 1046 jobref = fuword(&uap->aiocbp->_aiocb_private.kernelinfo); 1047 if (jobref == -1) 1048 return EFAULT; --- 173 unchanged lines hidden (view full) --- 1222 } 1223 cnt -= auio.uio_resid; 1224 p->p_retval[0] = cnt; 1225 return error; 1226} 1227 1228int 1229lio_listio(struct proc *p, struct lio_listio_args *uap) { |
1233 int cnt, nent, nentqueued; | 1230 int nent, nentqueued; |
1234 struct aiocb *iocb, * const *cbptr; 1235 struct aiocblist *cb; 1236 struct kaioinfo *ki; 1237 int error, runningcode; 1238 int i; 1239 1240 if ((uap->mode != LIO_NOWAIT) && (uap->mode != LIO_WAIT)) { 1241#if DEBUGAIO > 0 --- 140 unchanged lines hidden --- | 1231 struct aiocb *iocb, * const *cbptr; 1232 struct aiocblist *cb; 1233 struct kaioinfo *ki; 1234 int error, runningcode; 1235 int i; 1236 1237 if ((uap->mode != LIO_NOWAIT) && (uap->mode != LIO_WAIT)) { 1238#if DEBUGAIO > 0 --- 140 unchanged lines hidden --- |