This is an upgrade so that the kernel supports the AIO calls from

POSIX.4.  Additionally, there is some initial code that supports LIO.
This code supports AIO/LIO for all types of file descriptors, with
few if any restrictions.  There will be a followup very soon that
will support significantly more efficient operation for VCHR type
files (raw.)  This code is also dependent on some kernel features
that don't work under SMP yet.  After I commit the changes to the
kernel to support proper address space sharing on SMP, this code
will also work under SMP.
This commit is contained in:
John Dyson 1997-07-06 02:40:43 +00:00
parent ee589d62ba
commit 2244ea07dc
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=27221
6 changed files with 1016 additions and 89 deletions

View File

@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* @(#)kern_exit.c 8.7 (Berkeley) 2/12/94
* $Id: kern_exit.c,v 1.48 1997/05/22 07:25:20 phk Exp $
* $Id: kern_exit.c,v 1.49 1997/06/16 00:29:30 dyson Exp $
*/
#include "opt_ktrace.h"
@ -126,6 +126,8 @@ exit1(p, rv)
panic("Going nowhere without my init!");
}
aio_proc_rundown(p);
/* are we a task leader? */
if(p == p->p_leader) {
struct kill_args killArgs;

View File

@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* @(#)kern_fork.c 8.6 (Berkeley) 4/8/94
* $Id: kern_fork.c,v 1.43 1997/06/16 00:29:30 dyson Exp $
* $Id: kern_fork.c,v 1.44 1997/06/22 16:04:13 peter Exp $
*/
#include "opt_ktrace.h"
@ -307,6 +307,8 @@ fork1(p1, flags, retval)
bcopy(&p1->p_startcopy, &p2->p_startcopy,
(unsigned) ((caddr_t)&p2->p_endcopy - (caddr_t)&p2->p_startcopy));
p2->p_aioinfo = NULL;
/*
* Duplicate sub-structures as needed.
* Increase reference counts on shared objects.

View File

@ -46,7 +46,7 @@
* in Germany will I accept domestic beer. This code may or may not work
* and I certainly make no claims as to its fitness for *any* purpose.
*
* $Id$
* $Id: kern_threads.c,v 1.1 1997/06/16 00:27:26 dyson Exp $
*/
#include <sys/param.h>
@ -80,13 +80,12 @@
*/
int
thr_sleep(struct proc *p, struct thr_sleep_args *uap, int *retval) {
int sleepStart;
long long sleeptime;
int sleepclocks;
int sleepstart;
struct timespec ts;
int error;
struct timeval atv, utv;
int error, s, timo;
sleepclocks = 0;
timo = 0;
if (uap->timeout != 0) {
/*
* Get timespec struct
@ -95,24 +94,33 @@ thr_sleep(struct proc *p, struct thr_sleep_args *uap, int *retval) {
p->p_wakeup = 0;
return error;
}
sleeptime = (long long) (hz * ts.tv_nsec);
sleeptime /= 1000000000LL;
sleeptime += ts.tv_sec * hz;
sleepclocks = sleeptime;
if (sleepclocks != sleeptime) {
if (ts.tv_nsec < 0 || ts.tv_nsec >= 1000000000) {
p->p_wakeup = 0;
retval[0] = EINVAL;
return 0;
return (EINVAL);
}
if (sleepclocks == 0)
sleepclocks = 1;
TIMESPEC_TO_TIMEVAL(&atv, &ts)
if (itimerfix(&atv)) {
p->p_wakeup = 0;
return (EINVAL);
}
/*
* XXX this is not as careful as settimeofday() about minimising
* interrupt latency. The hzto() interface is inconvenient as usual.
*/
s = splclock();
timevaladd(&atv, &time);
timo = hzto(&atv);
splx(s);
if (timo == 0)
timo = 1;
}
retval[0] = 0;
if (p->p_wakeup == 0) {
sleepStart = ticks;
sleepstart = ticks;
p->p_flag |= P_SINTR;
error = tsleep(p, PUSER, "thrslp", sleepclocks);
error = tsleep(p, PUSER, "thrslp", timo);
p->p_flag &= ~P_SINTR;
if (error == EWOULDBLOCK) {
p->p_wakeup = 0;
@ -120,7 +128,7 @@ thr_sleep(struct proc *p, struct thr_sleep_args *uap, int *retval) {
return 0;
}
if (uap->timeout == 0)
retval[0] = ticks - sleepStart;
retval[0] = ticks - sleepstart;
}
p->p_wakeup = 0;
return (0);

File diff suppressed because it is too large Load Diff

View File

@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)malloc.h 8.5 (Berkeley) 5/3/95
* $Id$
* $Id: malloc.h,v 1.20 1997/02/22 09:45:32 peter Exp $
*/
#ifndef _SYS_MALLOC_H_
@ -134,7 +134,8 @@
#define M_GEOM_REQ 87 /* geometry request */
#define M_GEOM_MISC 88 /* geometry misc */
#define M_VFSCONF 89 /* vfsconf structure */
#define M_LAST 90 /* Must be last type + 1 */
#define M_AIO 90 /* AIO structure(s) */
#define M_LAST 91 /* Must be last type + 1 */
#define INITKMEMNAMES { \
"free", /* 0 M_FREE */ \
@ -224,6 +225,7 @@
"GEOM req", /* 87 M_GEOM_REQ */ \
"GEOM misc", /* 88 M_GEOM_MISC */ \
"VFS conf", /* 89 M_VFSCONF */ \
"AIO", /* 90 M_AIO */ \
}
struct kmemstats {

View File

@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* @(#)proc.h 8.15 (Berkeley) 5/19/95
* $Id: proc.h,v 1.40 1997/06/16 00:29:25 dyson Exp $
* $Id: proc.h,v 1.41 1997/06/22 16:04:22 peter Exp $
*/
#ifndef _SYS_PROC_H_
@ -177,7 +177,7 @@ struct proc {
struct rusage *p_ru; /* Exit information. XXX */
int p_nthreads; /* number of threads (only in leader) */
int p_npeers; /* number of kernel threads (only in leader) */
void *p_aioinfo; /* ASYNC I/O info */
int p_wakeup; /* thread id */
struct proc *p_peers;
struct proc *p_leader;