Add aio_waitcomplete(). Make aio work correctly for socket descriptors.
Make gratuitous style(9) fixes (me, not the submitter) to make the aio code more readable. PR: kern/12053 Submitted by: Chris Sedore <cmsedore@maxwell.syr.edu>
This commit is contained in:
parent
5955c7b344
commit
241bd93929
@ -3,7 +3,7 @@
|
||||
*
|
||||
* DO NOT EDIT-- this file is automatically generated.
|
||||
* $FreeBSD$
|
||||
* created from FreeBSD: src/sys/kern/syscalls.master,v 1.68 1999/12/19 05:54:46 rwatson Exp
|
||||
* created from FreeBSD: src/sys/kern/syscalls.master,v 1.69 1999/12/21 20:21:11 alfred Exp
|
||||
*/
|
||||
|
||||
#include "opt_compat.h"
|
||||
@ -379,4 +379,5 @@ struct sysent sysent[] = {
|
||||
{ 4, (sy_call_t *)extattr_set_file }, /* 356 = extattr_set_file */
|
||||
{ 4, (sy_call_t *)extattr_get_file }, /* 357 = extattr_get_file */
|
||||
{ 2, (sy_call_t *)extattr_delete_file }, /* 358 = extattr_delete_file */
|
||||
{ 2, (sy_call_t *)aio_waitcomplete }, /* 359 = aio_waitcomplete */
|
||||
};
|
||||
|
@ -695,7 +695,9 @@ select(p, uap)
|
||||
goto retry;
|
||||
}
|
||||
p->p_flag &= ~P_SELECT;
|
||||
|
||||
error = tsleep((caddr_t)&selwait, PSOCK | PCATCH, "select", timo);
|
||||
|
||||
splx(s);
|
||||
if (error == 0)
|
||||
goto retry;
|
||||
|
@ -3,7 +3,7 @@
|
||||
*
|
||||
* DO NOT EDIT-- this file is automatically generated.
|
||||
* $FreeBSD$
|
||||
* created from FreeBSD: src/sys/kern/syscalls.master,v 1.68 1999/12/19 05:54:46 rwatson Exp
|
||||
* created from FreeBSD: src/sys/kern/syscalls.master,v 1.69 1999/12/21 20:21:11 alfred Exp
|
||||
*/
|
||||
|
||||
char *syscallnames[] = {
|
||||
@ -366,4 +366,5 @@ char *syscallnames[] = {
|
||||
"extattr_set_file", /* 356 = extattr_set_file */
|
||||
"extattr_get_file", /* 357 = extattr_get_file */
|
||||
"extattr_delete_file", /* 358 = extattr_delete_file */
|
||||
"aio_waitcomplete", /* 359 = aio_waitcomplete */
|
||||
};
|
||||
|
@ -497,3 +497,4 @@
|
||||
356 STD BSD { int extattr_set_file(char *path, char *attrname, struct iovec *iovp, u_int iovcnt); }
|
||||
357 STD BSD { int extattr_get_file(char *path, char *attrname, struct iovec *iovp, u_int iovcnt); }
|
||||
358 STD BSD { int extattr_delete_file(char *path, char *attrname); }
|
||||
359 STD BSD { int aio_waitcomplete(struct aiocb **aiocbp, struct timespec *timeout); }
|
||||
|
@ -50,6 +50,7 @@
|
||||
#include <sys/socketvar.h>
|
||||
#include <sys/signalvar.h>
|
||||
#include <sys/sysctl.h>
|
||||
#include <sys/aio.h> /* for aio_swake proto */
|
||||
|
||||
int maxsockets;
|
||||
|
||||
@ -337,6 +338,8 @@ sowakeup(so, sb)
|
||||
pgsigio(so->so_sigio, SIGIO, 0);
|
||||
if (sb->sb_flags & SB_UPCALL)
|
||||
(*so->so_upcall)(so, so->so_upcallarg, M_DONTWAIT);
|
||||
if (sb->sb_flags & SB_AIO)
|
||||
aio_swake(so, sb);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -94,6 +94,7 @@ soalloc(waitok)
|
||||
bzero(so, sizeof *so);
|
||||
so->so_gencnt = ++so_gencnt;
|
||||
so->so_zone = socket_zone;
|
||||
TAILQ_INIT(&so->so_aiojobq);
|
||||
}
|
||||
return so;
|
||||
}
|
||||
|
@ -50,6 +50,7 @@
|
||||
#include <sys/socketvar.h>
|
||||
#include <sys/signalvar.h>
|
||||
#include <sys/sysctl.h>
|
||||
#include <sys/aio.h> /* for aio_swake proto */
|
||||
|
||||
int maxsockets;
|
||||
|
||||
@ -337,6 +338,8 @@ sowakeup(so, sb)
|
||||
pgsigio(so->so_sigio, SIGIO, 0);
|
||||
if (sb->sb_flags & SB_UPCALL)
|
||||
(*so->so_upcall)(so, so->so_upcallarg, M_DONTWAIT);
|
||||
if (sb->sb_flags & SB_AIO)
|
||||
aio_swake(so, sb);
|
||||
}
|
||||
|
||||
/*
|
||||
|
1165
sys/kern/vfs_aio.c
1165
sys/kern/vfs_aio.c
File diff suppressed because it is too large
Load Diff
@ -22,6 +22,7 @@
|
||||
#include <sys/time.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/signal.h>
|
||||
#include <sys/socketvar.h>
|
||||
|
||||
/*
|
||||
* Returned by aio_cancel:
|
||||
@ -95,12 +96,12 @@ __BEGIN_DECLS
|
||||
/*
|
||||
* Asynchronously read from a file
|
||||
*/
|
||||
int aio_read(struct aiocb *);
|
||||
int aio_read(struct aiocb *);
|
||||
|
||||
/*
|
||||
* Asynchronously write to file
|
||||
*/
|
||||
int aio_write(struct aiocb *);
|
||||
int aio_write(struct aiocb *);
|
||||
|
||||
/*
|
||||
* List I/O Asynchronously/synchronously read/write to/from file
|
||||
@ -108,14 +109,14 @@ int aio_write(struct aiocb *);
|
||||
* "acb_list" is an array of "nacb_listent" I/O control blocks.
|
||||
* when all I/Os are complete, the optional signal "sig" is sent.
|
||||
*/
|
||||
int lio_listio(int, struct aiocb * const [], int, struct sigevent *);
|
||||
int lio_listio(int, struct aiocb * const [], int, struct sigevent *);
|
||||
|
||||
/*
|
||||
* Get completion status
|
||||
* returns EINPROGRESS until I/O is complete.
|
||||
* this routine does not block.
|
||||
*/
|
||||
int aio_error(const struct aiocb *);
|
||||
int aio_error(const struct aiocb *);
|
||||
|
||||
/*
|
||||
* Finish up I/O, releasing I/O resources and returns the value
|
||||
@ -123,31 +124,57 @@ int aio_error(const struct aiocb *);
|
||||
* This routine must be called once and only once for each
|
||||
* I/O control block who has had I/O associated with it.
|
||||
*/
|
||||
ssize_t aio_return(struct aiocb *);
|
||||
ssize_t aio_return(struct aiocb *);
|
||||
|
||||
/*
|
||||
* Cancel I/O -- implemented only to return AIO_NOTCANCELLED or
|
||||
* AIO_ALLDONE. No cancellation operation will occur.
|
||||
*/
|
||||
int aio_cancel(int, struct aiocb *);
|
||||
int aio_cancel(int, struct aiocb *);
|
||||
|
||||
/*
|
||||
* Suspend until all specified I/O or timeout is complete.
|
||||
*/
|
||||
int aio_suspend(const struct aiocb * const[], int, const struct timespec *);
|
||||
int aio_suspend(const struct aiocb * const[], int, const struct timespec *);
|
||||
|
||||
/*
|
||||
* Retrieve the status of the specified I/O request.
|
||||
*/
|
||||
int aio_error(const struct aiocb *);
|
||||
int aio_error(const struct aiocb *);
|
||||
|
||||
int aio_waitcomplete(struct aiocb **, struct timespec *);
|
||||
|
||||
__END_DECLS
|
||||
|
||||
#else
|
||||
/*
|
||||
* Job queue item
|
||||
*/
|
||||
|
||||
#define AIOCBLIST_CANCELLED 0x1
|
||||
#define AIOCBLIST_RUNDOWN 0x4
|
||||
#define AIOCBLIST_ASYNCFREE 0x8
|
||||
#define AIOCBLIST_DONE 0x10
|
||||
|
||||
struct aiocblist {
|
||||
TAILQ_ENTRY (aiocblist) list; /* List of jobs */
|
||||
TAILQ_ENTRY (aiocblist) plist; /* List of jobs for proc */
|
||||
int jobflags;
|
||||
int jobstate;
|
||||
int inputcharge, outputcharge;
|
||||
struct buf *bp; /* Buffer pointer */
|
||||
struct proc *userproc; /* User process */
|
||||
struct file *fd_file; /* Pointer to file structure */
|
||||
struct aioproclist *jobaioproc;/* AIO process descriptor */
|
||||
struct aio_liojob *lio; /* Optional lio job */
|
||||
struct aiocb *uuaiocb; /* Pointer in userspace of aiocb */
|
||||
struct aiocb uaiocb; /* Kernel I/O control block */
|
||||
};
|
||||
|
||||
void aio_proc_rundown(struct proc *p);
|
||||
|
||||
#endif
|
||||
void aio_swake(struct socket *, struct sockbuf *);
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
@ -80,6 +80,7 @@ struct socket {
|
||||
struct sigio *so_sigio; /* information for async I/O or
|
||||
out of band data (SIGURG) */
|
||||
u_long so_oobmark; /* chars to oob mark */
|
||||
TAILQ_HEAD(, aiocblist) so_aiojobq; /* AIO ops waiting on socket */
|
||||
/*
|
||||
* Variables for socket buffering.
|
||||
*/
|
||||
@ -102,6 +103,7 @@ struct socket {
|
||||
#define SB_ASYNC 0x10 /* ASYNC I/O, need signals */
|
||||
#define SB_UPCALL 0x20 /* someone wants an upcall */
|
||||
#define SB_NOINTR 0x40 /* operations not interruptible */
|
||||
#define SB_AIO 0x80 /* AIO operations queued */
|
||||
|
||||
void (*so_upcall) __P((struct socket *, void *, int));
|
||||
void *so_upcallarg;
|
||||
@ -169,7 +171,8 @@ struct xsocket {
|
||||
/*
|
||||
* Do we need to notify the other side when I/O is possible?
|
||||
*/
|
||||
#define sb_notify(sb) (((sb)->sb_flags & (SB_WAIT|SB_SEL|SB_ASYNC|SB_UPCALL)) != 0)
|
||||
#define sb_notify(sb) (((sb)->sb_flags & (SB_WAIT | SB_SEL | SB_ASYNC | \
|
||||
SB_UPCALL | SB_AIO)) != 0)
|
||||
|
||||
/*
|
||||
* How much space is there in a socket buffer (so->so_snd or so->so_rcv)?
|
||||
|
@ -3,7 +3,7 @@
|
||||
*
|
||||
* DO NOT EDIT-- this file is automatically generated.
|
||||
* $FreeBSD$
|
||||
* created from FreeBSD: src/sys/kern/syscalls.master,v 1.68 1999/12/19 05:54:46 rwatson Exp
|
||||
* created from FreeBSD: src/sys/kern/syscalls.master,v 1.69 1999/12/21 20:21:11 alfred Exp
|
||||
*/
|
||||
|
||||
HIDE_POSIX(fork)
|
||||
@ -274,3 +274,4 @@ HIDE_BSD(extattrctl)
|
||||
HIDE_BSD(extattr_set_file)
|
||||
HIDE_BSD(extattr_get_file)
|
||||
HIDE_BSD(extattr_delete_file)
|
||||
HIDE_BSD(aio_waitcomplete)
|
||||
|
@ -3,7 +3,7 @@
|
||||
*
|
||||
* DO NOT EDIT-- this file is automatically generated.
|
||||
* $FreeBSD$
|
||||
* created from FreeBSD: src/sys/kern/syscalls.master,v 1.68 1999/12/19 05:54:46 rwatson Exp
|
||||
* created from FreeBSD: src/sys/kern/syscalls.master,v 1.69 1999/12/21 20:21:11 alfred Exp
|
||||
*/
|
||||
|
||||
#define SYS_syscall 0
|
||||
@ -279,4 +279,5 @@
|
||||
#define SYS_extattr_set_file 356
|
||||
#define SYS_extattr_get_file 357
|
||||
#define SYS_extattr_delete_file 358
|
||||
#define SYS_MAXSYSCALL 359
|
||||
#define SYS_aio_waitcomplete 359
|
||||
#define SYS_MAXSYSCALL 360
|
||||
|
@ -1,7 +1,7 @@
|
||||
# FreeBSD system call names.
|
||||
# DO NOT EDIT-- this file is automatically generated.
|
||||
# $FreeBSD$
|
||||
# created from FreeBSD: src/sys/kern/syscalls.master,v 1.68 1999/12/19 05:54:46 rwatson Exp
|
||||
# created from FreeBSD: src/sys/kern/syscalls.master,v 1.69 1999/12/21 20:21:11 alfred Exp
|
||||
MIASM = \
|
||||
syscall.o \
|
||||
exit.o \
|
||||
@ -229,4 +229,5 @@ MIASM = \
|
||||
extattrctl.o \
|
||||
extattr_set_file.o \
|
||||
extattr_get_file.o \
|
||||
extattr_delete_file.o
|
||||
extattr_delete_file.o \
|
||||
aio_waitcomplete.o
|
||||
|
@ -3,7 +3,7 @@
|
||||
*
|
||||
* DO NOT EDIT-- this file is automatically generated.
|
||||
* $FreeBSD$
|
||||
* created from FreeBSD: src/sys/kern/syscalls.master,v 1.68 1999/12/19 05:54:46 rwatson Exp
|
||||
* created from FreeBSD: src/sys/kern/syscalls.master,v 1.69 1999/12/21 20:21:11 alfred Exp
|
||||
*/
|
||||
|
||||
#ifndef _SYS_SYSPROTO_H_
|
||||
@ -989,6 +989,10 @@ struct extattr_delete_file_args {
|
||||
char * path; char path_[PAD_(char *)];
|
||||
char * attrname; char attrname_[PAD_(char *)];
|
||||
};
|
||||
struct aio_waitcomplete_args {
|
||||
struct aiocb ** aiocbp; char aiocbp_[PAD_(struct aiocb **)];
|
||||
struct timespec * timeout; char timeout_[PAD_(struct timespec *)];
|
||||
};
|
||||
int nosys __P((struct proc *, struct nosys_args *));
|
||||
void exit __P((struct proc *, struct rexit_args *)) __dead2;
|
||||
int fork __P((struct proc *, struct fork_args *));
|
||||
@ -1214,6 +1218,7 @@ int extattrctl __P((struct proc *, struct extattrctl_args *));
|
||||
int extattr_set_file __P((struct proc *, struct extattr_set_file_args *));
|
||||
int extattr_get_file __P((struct proc *, struct extattr_get_file_args *));
|
||||
int extattr_delete_file __P((struct proc *, struct extattr_delete_file_args *));
|
||||
int aio_waitcomplete __P((struct proc *, struct aio_waitcomplete_args *));
|
||||
|
||||
#ifdef COMPAT_43
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user