summaryrefslogtreecommitdiffstats
path: root/sys/sys
diff options
context:
space:
mode:
authorjasone <jasone@FreeBSD.org>2000-01-14 02:53:29 +0000
committerjasone <jasone@FreeBSD.org>2000-01-14 02:53:29 +0000
commit241bd93929c50045d997159647c990ce30a09b38 (patch)
treee533e938e06d1bbf52b15ac617cd9ac2788c42ed /sys/sys
parent5955c7b34496a4da6142bb7a85bdab015975afce (diff)
downloadFreeBSD-src-241bd93929c50045d997159647c990ce30a09b38.zip
FreeBSD-src-241bd93929c50045d997159647c990ce30a09b38.tar.gz
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>
Diffstat (limited to 'sys/sys')
-rw-r--r--sys/sys/aio.h45
-rw-r--r--sys/sys/socketvar.h5
-rw-r--r--sys/sys/syscall-hide.h3
-rw-r--r--sys/sys/syscall.h5
-rw-r--r--sys/sys/syscall.mk5
-rw-r--r--sys/sys/sysproto.h7
6 files changed, 54 insertions, 16 deletions
diff --git a/sys/sys/aio.h b/sys/sys/aio.h
index b74eadd..e905c89 100644
--- a/sys/sys/aio.h
+++ b/sys/sys/aio.h
@@ -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
diff --git a/sys/sys/socketvar.h b/sys/sys/socketvar.h
index aedd690..1b6d94c 100644
--- a/sys/sys/socketvar.h
+++ b/sys/sys/socketvar.h
@@ -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)?
diff --git a/sys/sys/syscall-hide.h b/sys/sys/syscall-hide.h
index 5c563f4..c08c937 100644
--- a/sys/sys/syscall-hide.h
+++ b/sys/sys/syscall-hide.h
@@ -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)
diff --git a/sys/sys/syscall.h b/sys/sys/syscall.h
index d438e57..c3dcd0c 100644
--- a/sys/sys/syscall.h
+++ b/sys/sys/syscall.h
@@ -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
diff --git a/sys/sys/syscall.mk b/sys/sys/syscall.mk
index 08c9f4c..ee2737e 100644
--- a/sys/sys/syscall.mk
+++ b/sys/sys/syscall.mk
@@ -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
diff --git a/sys/sys/sysproto.h b/sys/sys/sysproto.h
index 0689a9a..14bb02f 100644
--- a/sys/sys/sysproto.h
+++ b/sys/sys/sysproto.h
@@ -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
OpenPOWER on IntegriCloud