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
00361768
Commit
00361768
authored
Jul 25, 2011
by
Konstantin Khlebnikov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ioping: port to Debian GNU/Hurd
Signed-off-by:
Konstantin Khlebnikov
<
koct9i@gmail.com
>
parent
e95689f0
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
4 deletions
+15
-4
ioping.c
ioping.c
+15
-4
No files found.
ioping.c
View file @
00361768
...
@@ -34,21 +34,27 @@
...
@@ -34,21 +34,27 @@
#include <sys/types.h>
#include <sys/types.h>
#include <sys/time.h>
#include <sys/time.h>
#include <sys/stat.h>
#include <sys/stat.h>
#include <sys/mount.h>
#include <sys/ioctl.h>
#include <sys/ioctl.h>
#ifdef __linux__
#ifdef __linux__
# include <sys/mount.h>
# define HAVE_POSIX_FADVICE
# define HAVE_POSIX_FADVICE
# define HAVE_POSIX_MEMALIGN
# define HAVE_POSIX_MEMALIGN
# define HAVE_DIRECT_IO
# define HAVE_DIRECT_IO
#endif
#endif
#ifdef __gnu_hurd__
# define HAVE_POSIX_MEMALIGN
#endif
#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
# include <sys/mount.h>
# include <sys/disk.h>
# include <sys/disk.h>
# define HAVE_NOCACHE_IO
# define HAVE_NOCACHE_IO
#endif
#endif
#ifdef __APPLE__
#ifdef __APPLE__
# include <sys/mount.h>
# include <sys/disk.h>
# include <sys/disk.h>
# include <sys/uio.h>
# include <sys/uio.h>
# define HAVE_NOCACHE_IO
# define HAVE_NOCACHE_IO
...
@@ -364,10 +370,12 @@ void parse_device(dev_t dev)
...
@@ -364,10 +370,12 @@ void parse_device(dev_t dev)
#endif
#endif
off_t
get_device_size
(
int
fd
)
off_t
get_device_size
(
int
fd
,
struct
stat
*
st
)
{
{
unsigned
long
long
blksize
=
0
;
unsigned
long
long
blksize
=
0
;
int
ret
;
int
ret
=
0
;
(
void
)
fd
;
(
void
)
st
;
#if defined(BLKGETSIZE64)
#if defined(BLKGETSIZE64)
/* linux */
/* linux */
...
@@ -379,6 +387,9 @@ off_t get_device_size(int fd)
...
@@ -379,6 +387,9 @@ off_t get_device_size(int fd)
/* macos */
/* macos */
ret
=
ioctl
(
fd
,
DKIOCGETBLOCKCOUNT
,
&
blksize
);
ret
=
ioctl
(
fd
,
DKIOCGETBLOCKCOUNT
,
&
blksize
);
blksize
<<=
9
;
blksize
<<=
9
;
#elif defined(__gnu_hurd__)
/* hurd */
blksize
=
st
->
st_size
;
#else
#else
# error no get disk size method
# error no get disk size method
#endif
#endif
...
@@ -446,7 +457,7 @@ int main (int argc, char **argv)
...
@@ -446,7 +457,7 @@ int main (int argc, char **argv)
if
(
fd
<
0
)
if
(
fd
<
0
)
err
(
2
,
"failed to open
\"
%s
\"
"
,
path
);
err
(
2
,
"failed to open
\"
%s
\"
"
,
path
);
st
.
st_size
=
get_device_size
(
fd
);
st
.
st_size
=
get_device_size
(
fd
,
&
st
);
fstype
=
"block device"
;
fstype
=
"block device"
;
device
=
malloc
(
32
);
device
=
malloc
(
32
);
...
...
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