Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F143113369
D43448.id132737.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
D43448.id132737.diff
View Options
diff --git a/lib/libc/sys/lio_listio.2 b/lib/libc/sys/lio_listio.2
--- a/lib/libc/sys/lio_listio.2
+++ b/lib/libc/sys/lio_listio.2
@@ -78,6 +78,18 @@
.El
.Pp
If the
+.Dv LIO_READ
+or
+.Dv LIO_WRITE
+opcodes are or-ed with the
+.Dv LIO_FOFFSET
+flag, the correspoing read or write operation uses the current file
+descriptor offset, instead of the
+.Va aio_offset
+from
+.Vt aiocb .
+.Pp
+If the
.Fa mode
argument is
.Dv LIO_WAIT ,
diff --git a/sys/kern/vfs_aio.c b/sys/kern/vfs_aio.c
--- a/sys/kern/vfs_aio.c
+++ b/sys/kern/vfs_aio.c
@@ -229,6 +229,9 @@
#define KAIOCB_CLEARED 0x10
#define KAIOCB_FINISHED 0x20
+/* ioflags */
+#define KAIOCB_IO_FOFFSET 0x01
+
/*
* AIO process info
*/
@@ -789,12 +792,14 @@
if (job->uiop->uio_resid == 0)
error = 0;
else
- error = fo_read(fp, job->uiop, fp->f_cred, FOF_OFFSET,
- td);
+ error = fo_read(fp, job->uiop, fp->f_cred,
+ (job->ioflags & KAIOCB_IO_FOFFSET) != 0 ? 0 :
+ FOF_OFFSET, td);
} else {
if (fp->f_type == DTYPE_VNODE)
bwillwrite();
- error = fo_write(fp, job->uiop, fp->f_cred, FOF_OFFSET, td);
+ error = fo_write(fp, job->uiop, fp->f_cred, (job->ioflags &
+ KAIOCB_IO_FOFFSET) != 0 ? 0 : FOF_OFFSET, td);
}
msgrcv_end = td->td_ru.ru_msgrcv;
msgsnd_end = td->td_ru.ru_msgsnd;
@@ -1549,13 +1554,15 @@
/* Get the opcode. */
if (type == LIO_NOP) {
- switch (job->uaiocb.aio_lio_opcode) {
+ switch (job->uaiocb.aio_lio_opcode & ~LIO_FOFFSET) {
case LIO_WRITE:
case LIO_WRITEV:
case LIO_NOP:
case LIO_READ:
case LIO_READV:
- opcode = job->uaiocb.aio_lio_opcode;
+ opcode = job->uaiocb.aio_lio_opcode & ~LIO_FOFFSET;
+ if ((job->uaiocb.aio_lio_opcode & LIO_FOFFSET) != 0)
+ job->ioflags |= KAIOCB_IO_FOFFSET;
break;
default:
error = EINVAL;
diff --git a/sys/sys/aio.h b/sys/sys/aio.h
--- a/sys/sys/aio.h
+++ b/sys/sys/aio.h
@@ -51,6 +51,9 @@
#define LIO_DSYNC (0x10 | LIO_SYNC)
#define LIO_MLOCK 0x20
#endif
+#if __BSD_VISIBLE
+#define LIO_FOFFSET 0x40
+#endif
/*
* LIO modes
@@ -129,6 +132,7 @@
TAILQ_ENTRY(kaiocb) plist; /* (a) lists of pending / done jobs */
TAILQ_ENTRY(kaiocb) allist; /* (a) list of all jobs in proc */
int jobflags; /* (a) job flags */
+ int ioflags; /* (*) io flags */
int inblock; /* (*) input blocks */
int outblock; /* (*) output blocks */
int msgsnd; /* (*) messages sent */
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Jan 27, 3:31 AM (2 h, 22 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
28049745
Default Alt Text
D43448.id132737.diff (2 KB)
Attached To
Mode
D43448: lio_listio(2): add LIO_FOFFSET flag to ignore aiocb aio_offset
Attached
Detach File
Event Timeline
Log In to Comment