diff options
author | Douglas Gilbert <dgilbert@interlog.com> | 2013-10-14 19:29:37 +0000 |
---|---|---|
committer | Douglas Gilbert <dgilbert@interlog.com> | 2013-10-14 19:29:37 +0000 |
commit | 189211afbafc77fdc22b7ec2cfe75fa313f12049 (patch) | |
tree | 0075f06941a30a4296d51dd443e92a9e139dce1b /src/sgp_dd.c | |
parent | e8a28a4bffdb40f9d19faae694b3cea794bb2dbb (diff) | |
download | sg3_utils-189211afbafc77fdc22b7ec2cfe75fa313f12049.tar.gz |
avoid getpagesize() with sysconf() and use posix_memalign()
git-svn-id: https://svn.bingwo.ca/repos/sg3_utils/trunk@521 6180dd3e-e324-4e3e-922d-17de1ae2f315
Diffstat (limited to 'src/sgp_dd.c')
-rw-r--r-- | src/sgp_dd.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/sgp_dd.c b/src/sgp_dd.c index 47d60686..d87eb298 100644 --- a/src/sgp_dd.c +++ b/src/sgp_dd.c @@ -57,7 +57,7 @@ #include "sg_io_linux.h" -static const char * version_str = "5.44 20130603"; +static const char * version_str = "5.45 20131011"; #define DEF_BLOCK_SIZE 512 #define DEF_BLOCKS_PER_TRANSFER 128 @@ -534,7 +534,11 @@ read_write_thread(void * v_clp) sz = clp->bpt * clp->bs; seek_skip = clp->seek - clp->skip; memset(rep, 0, sizeof(Rq_elem)); - psz = getpagesize(); +#if defined(HAVE_SYSCONF) && defined(_SC_PAGESIZE) + psz = sysconf(_SC_PAGESIZE); /* POSIX.1 (was getpagesize()) */ +#else + psz = 4096; /* give up, pick likely figure */ +#endif if (NULL == (rep->alloc_bp = (unsigned char *)malloc(sz + psz))) err_exit(ENOMEM, "out of memory creating user buffers\n"); rep->buffp = (unsigned char *)(((unsigned long)rep->alloc_bp + psz - 1) & |