Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
I
ioping
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
ioping
Commits
0ae4ee0c
Commit
0ae4ee0c
authored
Sep 06, 2015
by
Konstantin Khlebnikov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ioping: add windows "overlapped" aio
just for fun Signed-off-by:
Konstantin Khlebnikov
<
koct9i@gmail.com
>
parent
204f31ef
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
1 deletion
+16
-1
ioping.c
ioping.c
+16
-1
No files found.
ioping.c
View file @
0ae4ee0c
...
...
@@ -153,6 +153,8 @@ void warnx(const char *fmt, ...)
#endif
/* HAVE_ERR_INCLUDE */
int
async
=
0
;
#ifdef __MINGW32__
ssize_t
pread
(
int
fd
,
void
*
buf
,
size_t
count
,
off_t
offset
)
...
...
@@ -167,6 +169,11 @@ ssize_t pread(int fd, void *buf, size_t count, off_t offset)
if
(
ReadFile
(
h
,
buf
,
count
,
&
r
,
&
o
))
return
r
;
if
(
async
&&
GetLastError
()
==
ERROR_IO_PENDING
&&
GetOverlappedResult
(
h
,
&
o
,
&
r
,
TRUE
))
return
r
;
return
-
1
;
}
...
...
@@ -182,6 +189,11 @@ ssize_t pwrite(int fd, void *buf, size_t count, off_t offset)
if
(
WriteFile
(
h
,
buf
,
count
,
&
r
,
&
o
))
return
r
;
if
(
async
&&
GetLastError
()
==
ERROR_IO_PENDING
&&
GetOverlappedResult
(
h
,
&
o
,
&
r
,
TRUE
))
return
r
;
return
-
1
;
}
...
...
@@ -423,7 +435,6 @@ void *buf;
int
quiet
=
0
;
int
batch_mode
=
0
;
int
direct
=
0
;
int
async
=
0
;
int
cached
=
0
;
int
randomize
=
1
;
int
write_test
=
0
;
...
...
@@ -785,7 +796,9 @@ static void aio_setup(void)
static
void
aio_setup
(
void
)
{
#ifndef __MINGW32__
errx
(
1
,
"asynchronous I/O not supported by this platform"
);
#endif
}
#endif
...
...
@@ -822,6 +835,8 @@ int open_file(const char *path, const char *temp)
attr
|=
FILE_FLAG_RANDOM_ACCESS
;
else
attr
|=
FILE_FLAG_SEQUENTIAL_SCAN
;
if
(
async
)
attr
|=
FILE_FLAG_OVERLAPPED
;
h
=
CreateFile
(
file_path
,
GENERIC_READ
|
GENERIC_WRITE
,
FILE_SHARE_READ
|
FILE_SHARE_WRITE
|
FILE_SHARE_DELETE
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment