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
3485b25b
Commit
3485b25b
authored
Jun 09, 2011
by
Konstantin Khlebnikov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
more disk size ioctls
parent
cbc4e1e0
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
2 deletions
+21
-2
ioping.c
ioping.c
+21
-2
No files found.
ioping.c
View file @
3485b25b
...
@@ -42,6 +42,10 @@
...
@@ -42,6 +42,10 @@
# define HAVE_POSIX_MEMALLIGN
# define HAVE_POSIX_MEMALLIGN
#endif
#endif
#ifdef __APPLE__
# include <sys/disk.h>
#endif
#ifndef HAVE_POSIX_FADVICE
#ifndef HAVE_POSIX_FADVICE
# define POSIX_FADV_RANDOM 0
# define POSIX_FADV_RANDOM 0
# define POSIX_FADV_DONTNEED 0
# define POSIX_FADV_DONTNEED 0
...
@@ -331,9 +335,24 @@ out:
...
@@ -331,9 +335,24 @@ out:
off_t
get_device_size
(
int
fd
)
off_t
get_device_size
(
int
fd
)
{
{
unsigned
long
long
blksize
;
unsigned
long
long
blksize
=
0
;
int
ret
;
#if defined(BLKGETSIZE64)
/* linux */
ret
=
ioctl
(
fd
,
BLKGETSIZE64
,
&
blksize
);
#elif defined(DIOCGMEDIASIZE)
/* freebsd */
ret
=
ioctl
(
fd
,
DIOCGMEDIASIZE
,
&
blksize
);
#elif defined(DKIOCGETBLOCKCOUNT)
/* macos */
ret
=
ioctl
(
fd
,
DKIOCGETBLOCKCOUNT
,
&
blksize
);
blksize
<<=
9
;
#else
# error no get disk size method
#endif
if
(
ioctl
(
fd
,
BLKGETSIZE64
,
&
blksize
)
)
if
(
ret
)
err
(
2
,
"block get size ioctl failed"
);
err
(
2
,
"block get size ioctl failed"
);
return
blksize
;
return
blksize
;
...
...
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